blob: 339e89e9dd35454c38c18c3756abff199823ac30 [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 Veillardb5839c32005-02-19 18:27:14 +00001069#ifdef LIBXML_SCHEMAS_ENABLED
1070#define gen_nb_xmlSchemaWhitespaceValueType 4
1071static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
1072 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1073 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1074 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1075 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1076 return(0);
1077}
1078
1079static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1080}
1081
1082#endif
1083
Daniel Veillard34099b42004-11-04 17:34:35 +00001084#include <libxml/HTMLparser.h>
1085#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001086#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001087#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001088#include <libxml/catalog.h>
1089#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001090#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001091#include <libxml/dict.h>
1092#include <libxml/encoding.h>
1093#include <libxml/entities.h>
1094#include <libxml/hash.h>
1095#include <libxml/list.h>
1096#include <libxml/nanoftp.h>
1097#include <libxml/nanohttp.h>
1098#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001099#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001100#include <libxml/pattern.h>
1101#include <libxml/relaxng.h>
1102#include <libxml/schemasInternals.h>
1103#include <libxml/tree.h>
1104#include <libxml/uri.h>
1105#include <libxml/valid.h>
1106#include <libxml/xinclude.h>
1107#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001108#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001109#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001110#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001111#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001112#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001113#include <libxml/xmlsave.h>
1114#include <libxml/xmlschemas.h>
1115#include <libxml/xmlschemastypes.h>
1116#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001117#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001118#include <libxml/xmlwriter.h>
1119#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001120#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001121#include <libxml/xpointer.h>
1122static int test_HTMLparser(void);
1123static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001124static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001125static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001126static int test_catalog(void);
1127static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001128static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001129static int test_dict(void);
1130static int test_encoding(void);
1131static int test_entities(void);
1132static int test_hash(void);
1133static int test_list(void);
1134static int test_nanoftp(void);
1135static int test_nanohttp(void);
1136static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001137static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001138static int test_pattern(void);
1139static int test_relaxng(void);
1140static int test_schemasInternals(void);
1141static int test_tree(void);
1142static int test_uri(void);
1143static int test_valid(void);
1144static int test_xinclude(void);
1145static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001146static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001147static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001148static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001149static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001150static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001151static int test_xmlsave(void);
1152static int test_xmlschemas(void);
1153static int test_xmlschemastypes(void);
1154static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001155static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001156static int test_xmlwriter(void);
1157static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001158static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001159static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001160
1161/**
1162 * testlibxml2:
1163 *
1164 * Main entry point of the tester for the full libxml2 module,
1165 * it calls all the tester entry point for each module.
1166 *
1167 * Returns the number of error found
1168 */
1169static int
1170testlibxml2(void)
1171{
Daniel Veillard42595322004-11-08 10:52:06 +00001172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001173
Daniel Veillard42595322004-11-08 10:52:06 +00001174 test_ret += test_HTMLparser();
1175 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001176 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001177 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001178 test_ret += test_catalog();
1179 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001180 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001181 test_ret += test_dict();
1182 test_ret += test_encoding();
1183 test_ret += test_entities();
1184 test_ret += test_hash();
1185 test_ret += test_list();
1186 test_ret += test_nanoftp();
1187 test_ret += test_nanohttp();
1188 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001189 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001190 test_ret += test_pattern();
1191 test_ret += test_relaxng();
1192 test_ret += test_schemasInternals();
1193 test_ret += test_tree();
1194 test_ret += test_uri();
1195 test_ret += test_valid();
1196 test_ret += test_xinclude();
1197 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001198 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001199 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001200 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001201 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001202 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001203 test_ret += test_xmlsave();
1204 test_ret += test_xmlschemas();
1205 test_ret += test_xmlschemastypes();
1206 test_ret += test_xmlstring();
1207 test_ret += test_xmlunicode();
1208 test_ret += test_xmlwriter();
1209 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001210 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001211 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001212
Daniel Veillard3d97e662004-11-04 10:49:00 +00001213 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001214 function_tests, call_tests, test_ret);
1215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001216}
1217
1218
1219static int
1220test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001222
William M. Brack21e4ef22005-01-02 09:53:13 +00001223#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001224 int mem_base;
1225 int ret_val;
1226 unsigned char * out; /* a pointer to an array of bytes to store the result */
1227 int n_out;
1228 int * outlen; /* the length of @out */
1229 int n_outlen;
1230 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1231 int n_in;
1232 int * inlen; /* the length of @in */
1233 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001234
Daniel Veillardce682bc2004-11-05 17:22:25 +00001235 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1236 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1237 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1238 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1239 mem_base = xmlMemBlocks();
1240 out = gen_unsigned_char_ptr(n_out, 0);
1241 outlen = gen_int_ptr(n_outlen, 1);
1242 in = gen_const_unsigned_char_ptr(n_in, 2);
1243 inlen = gen_int_ptr(n_inlen, 3);
1244
William M. Brackf13f77f2004-11-12 16:03:48 +00001245 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001246 desret_int(ret_val);
1247 call_tests++;
1248 des_unsigned_char_ptr(n_out, out, 0);
1249 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001250 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001251 des_int_ptr(n_inlen, inlen, 3);
1252 xmlResetLastError();
1253 if (mem_base != xmlMemBlocks()) {
1254 printf("Leak of %d blocks found in UTF8ToHtml",
1255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001256 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001257 printf(" %d", n_out);
1258 printf(" %d", n_outlen);
1259 printf(" %d", n_in);
1260 printf(" %d", n_inlen);
1261 printf("\n");
1262 }
1263 }
1264 }
1265 }
1266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001267 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001268#endif
1269
Daniel Veillard42595322004-11-08 10:52:06 +00001270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001271}
1272
Daniel Veillarda521d282004-11-09 14:59:59 +00001273#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001274
Daniel Veillardce682bc2004-11-05 17:22:25 +00001275#define gen_nb_const_htmlElemDesc_ptr 1
1276static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1277 return(NULL);
1278}
1279static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1280}
Daniel Veillarda521d282004-11-09 14:59:59 +00001281#endif
1282
Daniel Veillardce682bc2004-11-05 17:22:25 +00001283
Daniel Veillardd93f6252004-11-02 15:53:51 +00001284static int
1285test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001287
William M. Brack21e4ef22005-01-02 09:53:13 +00001288#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001289 int mem_base;
1290 htmlStatus ret_val;
1291 htmlElemDesc * elt; /* HTML element */
1292 int n_elt;
1293 xmlChar * attr; /* HTML attribute */
1294 int n_attr;
1295 int legacy; /* whether to allow deprecated attributes */
1296 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001297
Daniel Veillard57b25162004-11-06 14:50:18 +00001298 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1299 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1300 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1301 mem_base = xmlMemBlocks();
1302 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1303 attr = gen_const_xmlChar_ptr(n_attr, 1);
1304 legacy = gen_int(n_legacy, 2);
1305
William M. Brackf13f77f2004-11-12 16:03:48 +00001306 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001307 desret_htmlStatus(ret_val);
1308 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001309 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1310 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001311 des_int(n_legacy, legacy, 2);
1312 xmlResetLastError();
1313 if (mem_base != xmlMemBlocks()) {
1314 printf("Leak of %d blocks found in htmlAttrAllowed",
1315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001316 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001317 printf(" %d", n_elt);
1318 printf(" %d", n_attr);
1319 printf(" %d", n_legacy);
1320 printf("\n");
1321 }
1322 }
1323 }
1324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001325 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001326#endif
1327
Daniel Veillard42595322004-11-08 10:52:06 +00001328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001329}
1330
Daniel Veillarda521d282004-11-09 14:59:59 +00001331#ifdef LIBXML_HTML_ENABLED
1332
1333#define gen_nb_htmlNodePtr 1
1334static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1335 return(NULL);
1336}
1337static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1338}
1339#endif
1340
Daniel Veillardd93f6252004-11-02 15:53:51 +00001341
1342static int
1343test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001345
William M. Brack21e4ef22005-01-02 09:53:13 +00001346#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001347 int mem_base;
1348 int ret_val;
1349 htmlDocPtr doc; /* the HTML document */
1350 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001351 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001352 int n_name;
1353 htmlNodePtr elem; /* the HTML element */
1354 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001355
Daniel Veillarda521d282004-11-09 14:59:59 +00001356 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001358 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001359 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001360 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001361 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001362 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001363
William M. Brackf13f77f2004-11-12 16:03:48 +00001364 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001365 desret_int(ret_val);
1366 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001367 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001368 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001369 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001370 xmlResetLastError();
1371 if (mem_base != xmlMemBlocks()) {
1372 printf("Leak of %d blocks found in htmlAutoCloseTag",
1373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001374 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001375 printf(" %d", n_doc);
1376 printf(" %d", n_name);
1377 printf(" %d", n_elem);
1378 printf("\n");
1379 }
1380 }
1381 }
1382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001383 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001384#endif
1385
Daniel Veillard42595322004-11-08 10:52:06 +00001386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001387}
1388
1389
1390static int
1391test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001393
William M. Brack21e4ef22005-01-02 09:53:13 +00001394#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001395 int mem_base;
1396 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001397 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001398 int n_buffer;
1399 int size; /* the size of the array */
1400 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001401
Daniel Veillard34099b42004-11-04 17:34:35 +00001402 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1403 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1404 mem_base = xmlMemBlocks();
1405 buffer = gen_const_char_ptr(n_buffer, 0);
1406 size = gen_int(n_size, 1);
1407
William M. Brackf13f77f2004-11-12 16:03:48 +00001408 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001409 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001410 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001411 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001412 des_int(n_size, size, 1);
1413 xmlResetLastError();
1414 if (mem_base != xmlMemBlocks()) {
1415 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001417 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001418 printf(" %d", n_buffer);
1419 printf(" %d", n_size);
1420 printf("\n");
1421 }
1422 }
1423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001424 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001425#endif
1426
Daniel Veillard42595322004-11-08 10:52:06 +00001427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001428}
1429
Daniel Veillarda521d282004-11-09 14:59:59 +00001430#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001431
Daniel Veillardce682bc2004-11-05 17:22:25 +00001432#define gen_nb_htmlSAXHandlerPtr 1
1433static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1434 return(NULL);
1435}
1436static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1437}
Daniel Veillarda521d282004-11-09 14:59:59 +00001438#endif
1439
Daniel Veillardce682bc2004-11-05 17:22:25 +00001440
Daniel Veillardd93f6252004-11-02 15:53:51 +00001441static int
1442test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001444
William M. Brack21e4ef22005-01-02 09:53:13 +00001445#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001446 int mem_base;
1447 htmlParserCtxtPtr ret_val;
1448 htmlSAXHandlerPtr sax; /* a SAX handler */
1449 int n_sax;
1450 void * user_data; /* The user data returned on SAX callbacks */
1451 int n_user_data;
1452 char * chunk; /* a pointer to an array of chars */
1453 int n_chunk;
1454 int size; /* number of chars in the array */
1455 int n_size;
1456 const char * filename; /* an optional file name or URI */
1457 int n_filename;
1458 xmlCharEncoding enc; /* an optional encoding */
1459 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001460
Daniel Veillardce682bc2004-11-05 17:22:25 +00001461 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1462 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1463 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1464 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001465 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1467 mem_base = xmlMemBlocks();
1468 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1469 user_data = gen_userdata(n_user_data, 1);
1470 chunk = gen_const_char_ptr(n_chunk, 2);
1471 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001472 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001473 enc = gen_xmlCharEncoding(n_enc, 5);
1474
William M. Brackf13f77f2004-11-12 16:03:48 +00001475 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001476 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001477 call_tests++;
1478 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1479 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001480 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001481 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001482 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001483 des_xmlCharEncoding(n_enc, enc, 5);
1484 xmlResetLastError();
1485 if (mem_base != xmlMemBlocks()) {
1486 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001488 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001489 printf(" %d", n_sax);
1490 printf(" %d", n_user_data);
1491 printf(" %d", n_chunk);
1492 printf(" %d", n_size);
1493 printf(" %d", n_filename);
1494 printf(" %d", n_enc);
1495 printf("\n");
1496 }
1497 }
1498 }
1499 }
1500 }
1501 }
1502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001503 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001504#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001505
Daniel Veillard42595322004-11-08 10:52:06 +00001506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001507}
1508
1509
1510static int
1511test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001513
William M. Brack21e4ef22005-01-02 09:53:13 +00001514#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001515 int mem_base;
1516 htmlDocPtr ret_val;
1517 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1518 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001519 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001520 int n_cur;
1521 const char * URL; /* the base URL to use for the document */
1522 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001523 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001524 int n_encoding;
1525 int options; /* a combination of htmlParserOption(s) */
1526 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001527
Daniel Veillarda521d282004-11-09 14:59:59 +00001528 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001529 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1530 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1531 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1532 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1533 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001534 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001535 cur = gen_const_xmlChar_ptr(n_cur, 1);
1536 URL = gen_filepath(n_URL, 2);
1537 encoding = gen_const_char_ptr(n_encoding, 3);
1538 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001539
William M. Brackf13f77f2004-11-12 16:03:48 +00001540 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001541 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001542 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001543 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001544 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001545 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001546 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001547 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001548 xmlResetLastError();
1549 if (mem_base != xmlMemBlocks()) {
1550 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001552 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001553 printf(" %d", n_ctxt);
1554 printf(" %d", n_cur);
1555 printf(" %d", n_URL);
1556 printf(" %d", n_encoding);
1557 printf(" %d", n_options);
1558 printf("\n");
1559 }
1560 }
1561 }
1562 }
1563 }
1564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001565 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001566#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001567
Daniel Veillard42595322004-11-08 10:52:06 +00001568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001569}
1570
1571
1572static int
1573test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001575
William M. Brack21e4ef22005-01-02 09:53:13 +00001576#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001577 htmlDocPtr ret_val;
1578 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1579 int n_ctxt;
1580 const char * filename; /* a file or URL */
1581 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001582 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001583 int n_encoding;
1584 int options; /* a combination of htmlParserOption(s) */
1585 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001586
Daniel Veillarda521d282004-11-09 14:59:59 +00001587 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001588 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1589 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1590 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001591 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001592 filename = gen_filepath(n_filename, 1);
1593 encoding = gen_const_char_ptr(n_encoding, 2);
1594 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001595
William M. Brackf13f77f2004-11-12 16:03:48 +00001596 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001597 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001598 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001599 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001600 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001601 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001602 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001603 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001604 }
1605 }
1606 }
1607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001608 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001609#endif
1610
Daniel Veillard42595322004-11-08 10:52:06 +00001611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001612}
1613
1614
1615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001616test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001618
William M. Brack21e4ef22005-01-02 09:53:13 +00001619#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001620 int mem_base;
1621 htmlDocPtr ret_val;
1622 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1623 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001624 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001625 int n_buffer;
1626 int size; /* the size of the array */
1627 int n_size;
1628 const char * URL; /* the base URL to use for the document */
1629 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001630 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001631 int n_encoding;
1632 int options; /* a combination of htmlParserOption(s) */
1633 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001634
Daniel Veillarda521d282004-11-09 14:59:59 +00001635 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001636 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1637 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1638 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1639 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1640 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1641 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001642 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001643 buffer = gen_const_char_ptr(n_buffer, 1);
1644 size = gen_int(n_size, 2);
1645 URL = gen_filepath(n_URL, 3);
1646 encoding = gen_const_char_ptr(n_encoding, 4);
1647 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001648
William M. Brackf13f77f2004-11-12 16:03:48 +00001649 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001650 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001651 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001652 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001653 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001654 des_int(n_size, size, 2);
1655 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001656 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001657 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001658 xmlResetLastError();
1659 if (mem_base != xmlMemBlocks()) {
1660 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001663 printf(" %d", n_ctxt);
1664 printf(" %d", n_buffer);
1665 printf(" %d", n_size);
1666 printf(" %d", n_URL);
1667 printf(" %d", n_encoding);
1668 printf(" %d", n_options);
1669 printf("\n");
1670 }
1671 }
1672 }
1673 }
1674 }
1675 }
1676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001677 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001678#endif
1679
Daniel Veillard42595322004-11-08 10:52:06 +00001680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001681}
1682
1683
1684static int
1685test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001687
William M. Brack21e4ef22005-01-02 09:53:13 +00001688#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001689 int mem_base;
1690 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1691 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001692
Daniel Veillarda521d282004-11-09 14:59:59 +00001693 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001694 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001695 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001696
1697 htmlCtxtReset(ctxt);
1698 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001699 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001700 xmlResetLastError();
1701 if (mem_base != xmlMemBlocks()) {
1702 printf("Leak of %d blocks found in htmlCtxtReset",
1703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001705 printf(" %d", n_ctxt);
1706 printf("\n");
1707 }
1708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001709 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001710#endif
1711
Daniel Veillard42595322004-11-08 10:52:06 +00001712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001713}
1714
1715
1716static int
1717test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001719
William M. Brack21e4ef22005-01-02 09:53:13 +00001720#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001721 int mem_base;
1722 int ret_val;
1723 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1724 int n_ctxt;
1725 int options; /* a combination of htmlParserOption(s) */
1726 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001727
Daniel Veillarda521d282004-11-09 14:59:59 +00001728 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001729 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1730 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001731 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001732 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001733
1734 ret_val = htmlCtxtUseOptions(ctxt, options);
1735 desret_int(ret_val);
1736 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001737 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001738 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001739 xmlResetLastError();
1740 if (mem_base != xmlMemBlocks()) {
1741 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001743 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001744 printf(" %d", n_ctxt);
1745 printf(" %d", n_options);
1746 printf("\n");
1747 }
1748 }
1749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001750 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001751#endif
1752
Daniel Veillard42595322004-11-08 10:52:06 +00001753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001754}
1755
1756
1757static int
1758test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001760
William M. Brack21e4ef22005-01-02 09:53:13 +00001761#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001762 int mem_base;
1763 int ret_val;
1764 htmlElemDesc * parent; /* HTML parent element */
1765 int n_parent;
1766 xmlChar * elt; /* HTML element */
1767 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001768
Daniel Veillardce682bc2004-11-05 17:22:25 +00001769 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1770 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1771 mem_base = xmlMemBlocks();
1772 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1773 elt = gen_const_xmlChar_ptr(n_elt, 1);
1774
William M. Brackf13f77f2004-11-12 16:03:48 +00001775 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001776 desret_int(ret_val);
1777 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001778 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1779 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001780 xmlResetLastError();
1781 if (mem_base != xmlMemBlocks()) {
1782 printf("Leak of %d blocks found in htmlElementAllowedHere",
1783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001784 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001785 printf(" %d", n_parent);
1786 printf(" %d", n_elt);
1787 printf("\n");
1788 }
1789 }
1790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001791 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001792#endif
1793
Daniel Veillard42595322004-11-08 10:52:06 +00001794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001795}
1796
1797
1798static int
1799test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001801
William M. Brack21e4ef22005-01-02 09:53:13 +00001802#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001803 int mem_base;
1804 htmlStatus ret_val;
1805 htmlElemDesc * parent; /* HTML parent element */
1806 int n_parent;
1807 htmlElemDesc * elt; /* HTML element */
1808 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001809
Daniel Veillard57b25162004-11-06 14:50:18 +00001810 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1811 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1812 mem_base = xmlMemBlocks();
1813 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1814 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1815
William M. Brackf13f77f2004-11-12 16:03:48 +00001816 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001817 desret_htmlStatus(ret_val);
1818 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001819 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1820 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001821 xmlResetLastError();
1822 if (mem_base != xmlMemBlocks()) {
1823 printf("Leak of %d blocks found in htmlElementStatusHere",
1824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001825 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001826 printf(" %d", n_parent);
1827 printf(" %d", n_elt);
1828 printf("\n");
1829 }
1830 }
1831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001832 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001833#endif
1834
Daniel Veillard42595322004-11-08 10:52:06 +00001835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001836}
1837
1838
1839static int
1840test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001842
William M. Brack21e4ef22005-01-02 09:53:13 +00001843#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001844 int mem_base;
1845 int ret_val;
1846 unsigned char * out; /* a pointer to an array of bytes to store the result */
1847 int n_out;
1848 int * outlen; /* the length of @out */
1849 int n_outlen;
1850 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1851 int n_in;
1852 int * inlen; /* the length of @in */
1853 int n_inlen;
1854 int quoteChar; /* the quote character to escape (' or ") or zero. */
1855 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001856
Daniel Veillardce682bc2004-11-05 17:22:25 +00001857 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1858 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1859 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1860 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1861 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1862 mem_base = xmlMemBlocks();
1863 out = gen_unsigned_char_ptr(n_out, 0);
1864 outlen = gen_int_ptr(n_outlen, 1);
1865 in = gen_const_unsigned_char_ptr(n_in, 2);
1866 inlen = gen_int_ptr(n_inlen, 3);
1867 quoteChar = gen_int(n_quoteChar, 4);
1868
William M. Brackf13f77f2004-11-12 16:03:48 +00001869 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001870 desret_int(ret_val);
1871 call_tests++;
1872 des_unsigned_char_ptr(n_out, out, 0);
1873 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001874 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001875 des_int_ptr(n_inlen, inlen, 3);
1876 des_int(n_quoteChar, quoteChar, 4);
1877 xmlResetLastError();
1878 if (mem_base != xmlMemBlocks()) {
1879 printf("Leak of %d blocks found in htmlEncodeEntities",
1880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001881 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001882 printf(" %d", n_out);
1883 printf(" %d", n_outlen);
1884 printf(" %d", n_in);
1885 printf(" %d", n_inlen);
1886 printf(" %d", n_quoteChar);
1887 printf("\n");
1888 }
1889 }
1890 }
1891 }
1892 }
1893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001894 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001895#endif
1896
Daniel Veillard42595322004-11-08 10:52:06 +00001897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001898}
1899
1900
1901static int
1902test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001904
William M. Brack21e4ef22005-01-02 09:53:13 +00001905#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001906 int mem_base;
1907 const htmlEntityDesc * ret_val;
1908 xmlChar * name; /* the entity name */
1909 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001910
Daniel Veillard42595322004-11-08 10:52:06 +00001911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1912 mem_base = xmlMemBlocks();
1913 name = gen_const_xmlChar_ptr(n_name, 0);
1914
William M. Brackf13f77f2004-11-12 16:03:48 +00001915 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001916 desret_const_htmlEntityDesc_ptr(ret_val);
1917 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001918 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001919 xmlResetLastError();
1920 if (mem_base != xmlMemBlocks()) {
1921 printf("Leak of %d blocks found in htmlEntityLookup",
1922 xmlMemBlocks() - mem_base);
1923 test_ret++;
1924 printf(" %d", n_name);
1925 printf("\n");
1926 }
1927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001929#endif
1930
Daniel Veillard42595322004-11-08 10:52:06 +00001931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001932}
1933
1934
1935static int
1936test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001938
William M. Brack21e4ef22005-01-02 09:53:13 +00001939#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001940 int mem_base;
1941 const htmlEntityDesc * ret_val;
1942 unsigned int value; /* the entity's unicode value */
1943 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001944
Daniel Veillard42595322004-11-08 10:52:06 +00001945 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1946 mem_base = xmlMemBlocks();
1947 value = gen_unsigned_int(n_value, 0);
1948
1949 ret_val = htmlEntityValueLookup(value);
1950 desret_const_htmlEntityDesc_ptr(ret_val);
1951 call_tests++;
1952 des_unsigned_int(n_value, value, 0);
1953 xmlResetLastError();
1954 if (mem_base != xmlMemBlocks()) {
1955 printf("Leak of %d blocks found in htmlEntityValueLookup",
1956 xmlMemBlocks() - mem_base);
1957 test_ret++;
1958 printf(" %d", n_value);
1959 printf("\n");
1960 }
1961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001962 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001963#endif
1964
Daniel Veillard42595322004-11-08 10:52:06 +00001965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001966}
1967
1968
1969static int
1970test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001972
William M. Brack21e4ef22005-01-02 09:53:13 +00001973#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001974 int mem_base;
1975 int ret_val;
1976 int val; /* int 0 or 1 */
1977 int n_val;
1978
1979 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001981 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001982
1983 ret_val = htmlHandleOmittedElem(val);
1984 desret_int(ret_val);
1985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001986 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001987 xmlResetLastError();
1988 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001989 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001991 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001992 printf(" %d", n_val);
1993 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001994 }
1995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001996 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001997#endif
1998
Daniel Veillard42595322004-11-08 10:52:06 +00001999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002000}
2001
2002
2003static int
2004test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002006
William M. Brack21e4ef22005-01-02 09:53:13 +00002007#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002008 int mem_base;
2009 int ret_val;
2010 htmlDocPtr doc; /* the HTML document */
2011 int n_doc;
2012 htmlNodePtr elem; /* the HTML element */
2013 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002014
Daniel Veillarda521d282004-11-09 14:59:59 +00002015 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2016 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002017 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002018 doc = gen_htmlDocPtr(n_doc, 0);
2019 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002020
2021 ret_val = htmlIsAutoClosed(doc, elem);
2022 desret_int(ret_val);
2023 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002024 des_htmlDocPtr(n_doc, doc, 0);
2025 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002026 xmlResetLastError();
2027 if (mem_base != xmlMemBlocks()) {
2028 printf("Leak of %d blocks found in htmlIsAutoClosed",
2029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031 printf(" %d", n_doc);
2032 printf(" %d", n_elem);
2033 printf("\n");
2034 }
2035 }
2036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002037 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002038#endif
2039
Daniel Veillard42595322004-11-08 10:52:06 +00002040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002041}
2042
2043
2044static int
2045test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002047
William M. Brack21e4ef22005-01-02 09:53:13 +00002048#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002049 int mem_base;
2050 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002051 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002052 int n_name;
2053
2054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002056 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002057
William M. Brackf13f77f2004-11-12 16:03:48 +00002058 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002059 desret_int(ret_val);
2060 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002061 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002062 xmlResetLastError();
2063 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002064 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002066 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002067 printf(" %d", n_name);
2068 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002069 }
2070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002071 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002072#endif
2073
Daniel Veillard42595322004-11-08 10:52:06 +00002074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002075}
2076
2077
2078static int
2079test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002081
William M. Brack21e4ef22005-01-02 09:53:13 +00002082#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002083 int mem_base;
2084 htmlStatus ret_val;
2085 htmlNodePtr node; /* an htmlNodePtr in a tree */
2086 int n_node;
2087 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2088 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002089
Daniel Veillarda521d282004-11-09 14:59:59 +00002090 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002091 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2092 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002093 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002094 legacy = gen_int(n_legacy, 1);
2095
William M. Brackf13f77f2004-11-12 16:03:48 +00002096 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002097 desret_htmlStatus(ret_val);
2098 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002099 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002100 des_int(n_legacy, legacy, 1);
2101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlNodeStatus",
2104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002105 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002106 printf(" %d", n_node);
2107 printf(" %d", n_legacy);
2108 printf("\n");
2109 }
2110 }
2111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002112 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002113#endif
2114
Daniel Veillard42595322004-11-08 10:52:06 +00002115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002116}
2117
2118
2119static int
2120test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002122
William M. Brack21e4ef22005-01-02 09:53:13 +00002123#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002124 int mem_base;
2125 int ret_val;
2126 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2127 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002128
Daniel Veillarda521d282004-11-09 14:59:59 +00002129 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002130 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002131 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002132
2133 ret_val = htmlParseCharRef(ctxt);
2134 desret_int(ret_val);
2135 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002136 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002137 xmlResetLastError();
2138 if (mem_base != xmlMemBlocks()) {
2139 printf("Leak of %d blocks found in htmlParseCharRef",
2140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002141 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142 printf(" %d", n_ctxt);
2143 printf("\n");
2144 }
2145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002146 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002147#endif
2148
Daniel Veillard42595322004-11-08 10:52:06 +00002149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002150}
2151
2152
2153static int
2154test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002156
William M. Brack21e4ef22005-01-02 09:53:13 +00002157#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002158 int mem_base;
2159 int ret_val;
2160 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2161 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002162 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163 int n_chunk;
2164 int size; /* the size in byte of the chunk */
2165 int n_size;
2166 int terminate; /* last chunk indicator */
2167 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002168
Daniel Veillarda521d282004-11-09 14:59:59 +00002169 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002170 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2171 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2172 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2173 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002174 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002175 chunk = gen_const_char_ptr(n_chunk, 1);
2176 size = gen_int(n_size, 2);
2177 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002178
William M. Brackf13f77f2004-11-12 16:03:48 +00002179 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002180 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002181 desret_int(ret_val);
2182 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002183 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002184 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002185 des_int(n_size, size, 2);
2186 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002187 xmlResetLastError();
2188 if (mem_base != xmlMemBlocks()) {
2189 printf("Leak of %d blocks found in htmlParseChunk",
2190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002192 printf(" %d", n_ctxt);
2193 printf(" %d", n_chunk);
2194 printf(" %d", n_size);
2195 printf(" %d", n_terminate);
2196 printf("\n");
2197 }
2198 }
2199 }
2200 }
2201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002202 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002203#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002204
Daniel Veillard42595322004-11-08 10:52:06 +00002205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002206}
2207
2208
2209static int
2210test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002212
William M. Brack21e4ef22005-01-02 09:53:13 +00002213#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002214 int mem_base;
2215 htmlDocPtr ret_val;
2216 xmlChar * cur; /* a pointer to an array of xmlChar */
2217 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002218 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002219 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002221 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2222 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002224 cur = gen_xmlChar_ptr(n_cur, 0);
2225 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002226
William M. Brackf13f77f2004-11-12 16:03:48 +00002227 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002228 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002230 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002231 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002232 xmlResetLastError();
2233 if (mem_base != xmlMemBlocks()) {
2234 printf("Leak of %d blocks found in htmlParseDoc",
2235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002236 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002237 printf(" %d", n_cur);
2238 printf(" %d", n_encoding);
2239 printf("\n");
2240 }
2241 }
2242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002243 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002244#endif
2245
Daniel Veillard42595322004-11-08 10:52:06 +00002246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002247}
2248
2249
2250static int
2251test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002253
William M. Brack21e4ef22005-01-02 09:53:13 +00002254#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002255 int mem_base;
2256 int ret_val;
2257 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2258 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002259
Daniel Veillarda521d282004-11-09 14:59:59 +00002260 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002261 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002262 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002263
2264 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002265 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002266 desret_int(ret_val);
2267 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002268 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002269 xmlResetLastError();
2270 if (mem_base != xmlMemBlocks()) {
2271 printf("Leak of %d blocks found in htmlParseDocument",
2272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002274 printf(" %d", n_ctxt);
2275 printf("\n");
2276 }
2277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002278 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002279#endif
2280
Daniel Veillard42595322004-11-08 10:52:06 +00002281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002282}
2283
2284
2285static int
2286test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002288
William M. Brack21e4ef22005-01-02 09:53:13 +00002289#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002290 int mem_base;
2291 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2292 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002293
Daniel Veillarda521d282004-11-09 14:59:59 +00002294 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002295 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002296 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002297
2298 htmlParseElement(ctxt);
2299 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002300 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002301 xmlResetLastError();
2302 if (mem_base != xmlMemBlocks()) {
2303 printf("Leak of %d blocks found in htmlParseElement",
2304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002305 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002306 printf(" %d", n_ctxt);
2307 printf("\n");
2308 }
2309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002310 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002311#endif
2312
Daniel Veillard42595322004-11-08 10:52:06 +00002313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002314}
2315
2316
2317static int
2318test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002320
William M. Brack21e4ef22005-01-02 09:53:13 +00002321#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002322 int mem_base;
2323 const htmlEntityDesc * ret_val;
2324 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2325 int n_ctxt;
2326 xmlChar ** str; /* location to store the entity name */
2327 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002328
Daniel Veillarda521d282004-11-09 14:59:59 +00002329 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002330 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2331 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002332 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002333 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2334
William M. Brackf13f77f2004-11-12 16:03:48 +00002335 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002336 desret_const_htmlEntityDesc_ptr(ret_val);
2337 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002338 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002339 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002340 xmlResetLastError();
2341 if (mem_base != xmlMemBlocks()) {
2342 printf("Leak of %d blocks found in htmlParseEntityRef",
2343 xmlMemBlocks() - mem_base);
2344 test_ret++;
2345 printf(" %d", n_ctxt);
2346 printf(" %d", n_str);
2347 printf("\n");
2348 }
2349 }
2350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002351 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002352#endif
2353
Daniel Veillard42595322004-11-08 10:52:06 +00002354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002355}
2356
2357
2358static int
2359test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002361
William M. Brack21e4ef22005-01-02 09:53:13 +00002362#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002363 htmlDocPtr ret_val;
2364 const char * filename; /* the filename */
2365 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002366 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002367 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillarda03e3652004-11-02 18:45:30 +00002369 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2370 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 filename = gen_filepath(n_filename, 0);
2372 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002373
William M. Brackf13f77f2004-11-12 16:03:48 +00002374 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002375 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002377 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002378 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002379 xmlResetLastError();
2380 }
2381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002382 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002383#endif
2384
Daniel Veillard42595322004-11-08 10:52:06 +00002385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002386}
2387
2388
2389static int
2390test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002392
William M. Brack21e4ef22005-01-02 09:53:13 +00002393#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002394 int mem_base;
2395 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002396 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002397 int n_cur;
2398 const char * URL; /* the base URL to use for the document */
2399 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002400 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002401 int n_encoding;
2402 int options; /* a combination of htmlParserOption(s) */
2403 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002404
Daniel Veillarda03e3652004-11-02 18:45:30 +00002405 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2406 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2407 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2408 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002410 cur = gen_const_xmlChar_ptr(n_cur, 0);
2411 URL = gen_filepath(n_URL, 1);
2412 encoding = gen_const_char_ptr(n_encoding, 2);
2413 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002414
William M. Brackf13f77f2004-11-12 16:03:48 +00002415 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002416 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002417 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002418 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002419 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002420 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002421 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 xmlResetLastError();
2423 if (mem_base != xmlMemBlocks()) {
2424 printf("Leak of %d blocks found in htmlReadDoc",
2425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002426 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002427 printf(" %d", n_cur);
2428 printf(" %d", n_URL);
2429 printf(" %d", n_encoding);
2430 printf(" %d", n_options);
2431 printf("\n");
2432 }
2433 }
2434 }
2435 }
2436 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002437 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002438#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002439
Daniel Veillard42595322004-11-08 10:52:06 +00002440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002441}
2442
2443
2444static int
2445test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002447
William M. Brack21e4ef22005-01-02 09:53:13 +00002448#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002449 int mem_base;
2450 htmlDocPtr ret_val;
2451 const char * filename; /* a file or URL */
2452 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002453 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002454 int n_encoding;
2455 int options; /* a combination of htmlParserOption(s) */
2456 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457
Daniel Veillarda03e3652004-11-02 18:45:30 +00002458 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2459 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2460 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2461 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002462 filename = gen_filepath(n_filename, 0);
2463 encoding = gen_const_char_ptr(n_encoding, 1);
2464 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002465
William M. Brackf13f77f2004-11-12 16:03:48 +00002466 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002467 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002469 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002470 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002471 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002472 xmlResetLastError();
2473 if (mem_base != xmlMemBlocks()) {
2474 printf("Leak of %d blocks found in htmlReadFile",
2475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002477 printf(" %d", n_filename);
2478 printf(" %d", n_encoding);
2479 printf(" %d", n_options);
2480 printf("\n");
2481 }
2482 }
2483 }
2484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002485 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486#endif
2487
Daniel Veillard42595322004-11-08 10:52:06 +00002488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002489}
2490
2491
2492static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002493test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002495
William M. Brack21e4ef22005-01-02 09:53:13 +00002496#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002497 int mem_base;
2498 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002499 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002500 int n_buffer;
2501 int size; /* the size of the array */
2502 int n_size;
2503 const char * URL; /* the base URL to use for the document */
2504 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002505 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002506 int n_encoding;
2507 int options; /* a combination of htmlParserOption(s) */
2508 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002509
Daniel Veillarda03e3652004-11-02 18:45:30 +00002510 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2511 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2512 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2513 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2514 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002516 buffer = gen_const_char_ptr(n_buffer, 0);
2517 size = gen_int(n_size, 1);
2518 URL = gen_filepath(n_URL, 2);
2519 encoding = gen_const_char_ptr(n_encoding, 3);
2520 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002521
William M. Brackf13f77f2004-11-12 16:03:48 +00002522 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002523 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002524 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002525 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002526 des_int(n_size, size, 1);
2527 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002528 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002529 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002530 xmlResetLastError();
2531 if (mem_base != xmlMemBlocks()) {
2532 printf("Leak of %d blocks found in htmlReadMemory",
2533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002534 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002535 printf(" %d", n_buffer);
2536 printf(" %d", n_size);
2537 printf(" %d", n_URL);
2538 printf(" %d", n_encoding);
2539 printf(" %d", n_options);
2540 printf("\n");
2541 }
2542 }
2543 }
2544 }
2545 }
2546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002547 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002548#endif
2549
Daniel Veillard42595322004-11-08 10:52:06 +00002550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002551}
2552
2553
2554static int
2555test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002557
William M. Brack21e4ef22005-01-02 09:53:13 +00002558#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002559 int mem_base;
2560 htmlDocPtr ret_val;
2561 xmlChar * cur; /* a pointer to an array of xmlChar */
2562 int n_cur;
2563 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2564 int n_encoding;
2565 htmlSAXHandlerPtr sax; /* the SAX handler block */
2566 int n_sax;
2567 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2568 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002569
Daniel Veillardce682bc2004-11-05 17:22:25 +00002570 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2571 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2572 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2573 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2574 mem_base = xmlMemBlocks();
2575 cur = gen_xmlChar_ptr(n_cur, 0);
2576 encoding = gen_const_char_ptr(n_encoding, 1);
2577 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2578 userData = gen_userdata(n_userData, 3);
2579
William M. Brackf13f77f2004-11-12 16:03:48 +00002580 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002581 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002582 call_tests++;
2583 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002584 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002585 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2586 des_userdata(n_userData, userData, 3);
2587 xmlResetLastError();
2588 if (mem_base != xmlMemBlocks()) {
2589 printf("Leak of %d blocks found in htmlSAXParseDoc",
2590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002591 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002592 printf(" %d", n_cur);
2593 printf(" %d", n_encoding);
2594 printf(" %d", n_sax);
2595 printf(" %d", n_userData);
2596 printf("\n");
2597 }
2598 }
2599 }
2600 }
2601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002602 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002603#endif
2604
Daniel Veillard42595322004-11-08 10:52:06 +00002605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002606}
2607
2608
2609static int
2610test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002612
William M. Brack21e4ef22005-01-02 09:53:13 +00002613#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002614 int mem_base;
2615 htmlDocPtr ret_val;
2616 const char * filename; /* the filename */
2617 int n_filename;
2618 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2619 int n_encoding;
2620 htmlSAXHandlerPtr sax; /* the SAX handler block */
2621 int n_sax;
2622 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2623 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002624
Daniel Veillardce682bc2004-11-05 17:22:25 +00002625 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2626 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2627 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2628 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2629 mem_base = xmlMemBlocks();
2630 filename = gen_filepath(n_filename, 0);
2631 encoding = gen_const_char_ptr(n_encoding, 1);
2632 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2633 userData = gen_userdata(n_userData, 3);
2634
William M. Brackf13f77f2004-11-12 16:03:48 +00002635 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002636 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002637 call_tests++;
2638 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002639 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002640 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2641 des_userdata(n_userData, userData, 3);
2642 xmlResetLastError();
2643 if (mem_base != xmlMemBlocks()) {
2644 printf("Leak of %d blocks found in htmlSAXParseFile",
2645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002646 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002647 printf(" %d", n_filename);
2648 printf(" %d", n_encoding);
2649 printf(" %d", n_sax);
2650 printf(" %d", n_userData);
2651 printf("\n");
2652 }
2653 }
2654 }
2655 }
2656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002657 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002658#endif
2659
Daniel Veillard42595322004-11-08 10:52:06 +00002660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002661}
2662
2663
2664static int
2665test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002667
2668
2669 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002671}
2672
2673static int
2674test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002676
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002677 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002678 test_ret += test_UTF8ToHtml();
2679 test_ret += test_htmlAttrAllowed();
2680 test_ret += test_htmlAutoCloseTag();
2681 test_ret += test_htmlCreateMemoryParserCtxt();
2682 test_ret += test_htmlCreatePushParserCtxt();
2683 test_ret += test_htmlCtxtReadDoc();
2684 test_ret += test_htmlCtxtReadFile();
2685 test_ret += test_htmlCtxtReadMemory();
2686 test_ret += test_htmlCtxtReset();
2687 test_ret += test_htmlCtxtUseOptions();
2688 test_ret += test_htmlElementAllowedHere();
2689 test_ret += test_htmlElementStatusHere();
2690 test_ret += test_htmlEncodeEntities();
2691 test_ret += test_htmlEntityLookup();
2692 test_ret += test_htmlEntityValueLookup();
2693 test_ret += test_htmlHandleOmittedElem();
2694 test_ret += test_htmlIsAutoClosed();
2695 test_ret += test_htmlIsScriptAttribute();
2696 test_ret += test_htmlNodeStatus();
2697 test_ret += test_htmlParseCharRef();
2698 test_ret += test_htmlParseChunk();
2699 test_ret += test_htmlParseDoc();
2700 test_ret += test_htmlParseDocument();
2701 test_ret += test_htmlParseElement();
2702 test_ret += test_htmlParseEntityRef();
2703 test_ret += test_htmlParseFile();
2704 test_ret += test_htmlReadDoc();
2705 test_ret += test_htmlReadFile();
2706 test_ret += test_htmlReadMemory();
2707 test_ret += test_htmlSAXParseDoc();
2708 test_ret += test_htmlSAXParseFile();
2709 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002710
Daniel Veillard42595322004-11-08 10:52:06 +00002711 if (test_ret != 0)
2712 printf("Module HTMLparser: %d errors\n", test_ret);
2713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002714}
2715
2716static int
2717test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002719
William M. Brack21e4ef22005-01-02 09:53:13 +00002720#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002721 int mem_base;
2722 xmlOutputBufferPtr buf; /* the HTML buffer output */
2723 int n_buf;
2724 xmlDocPtr cur; /* the document */
2725 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002726 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727 int n_encoding;
2728 int format; /* should formatting spaces been added */
2729 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730
Daniel Veillard3d97e662004-11-04 10:49:00 +00002731 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2732 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2733 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2734 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2735 mem_base = xmlMemBlocks();
2736 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2737 cur = gen_xmlDocPtr(n_cur, 1);
2738 encoding = gen_const_char_ptr(n_encoding, 2);
2739 format = gen_int(n_format, 3);
2740
William M. Brackf13f77f2004-11-12 16:03:48 +00002741 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002742 call_tests++;
2743 des_xmlOutputBufferPtr(n_buf, buf, 0);
2744 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002745 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002746 des_int(n_format, format, 3);
2747 xmlResetLastError();
2748 if (mem_base != xmlMemBlocks()) {
2749 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002751 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002752 printf(" %d", n_buf);
2753 printf(" %d", n_cur);
2754 printf(" %d", n_encoding);
2755 printf(" %d", n_format);
2756 printf("\n");
2757 }
2758 }
2759 }
2760 }
2761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002762 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002763#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002764
Daniel Veillard42595322004-11-08 10:52:06 +00002765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002766}
2767
2768
2769static int
2770test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002772
William M. Brack21e4ef22005-01-02 09:53:13 +00002773#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774 int mem_base;
2775 xmlOutputBufferPtr buf; /* the HTML buffer output */
2776 int n_buf;
2777 xmlDocPtr cur; /* the document */
2778 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002779 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002780 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002781
Daniel Veillard3d97e662004-11-04 10:49:00 +00002782 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2783 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2784 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2785 mem_base = xmlMemBlocks();
2786 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2787 cur = gen_xmlDocPtr(n_cur, 1);
2788 encoding = gen_const_char_ptr(n_encoding, 2);
2789
William M. Brackf13f77f2004-11-12 16:03:48 +00002790 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002791 call_tests++;
2792 des_xmlOutputBufferPtr(n_buf, buf, 0);
2793 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002794 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002795 xmlResetLastError();
2796 if (mem_base != xmlMemBlocks()) {
2797 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002799 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002800 printf(" %d", n_buf);
2801 printf(" %d", n_cur);
2802 printf(" %d", n_encoding);
2803 printf("\n");
2804 }
2805 }
2806 }
2807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002808 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002809#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002810
Daniel Veillard42595322004-11-08 10:52:06 +00002811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002812}
2813
2814
2815static int
2816test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002818
William M. Brack21e4ef22005-01-02 09:53:13 +00002819#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002820 int mem_base;
2821 int ret_val;
2822 FILE * f; /* the FILE* */
2823 int n_f;
2824 xmlDocPtr cur; /* the document */
2825 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002826
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002827 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2828 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2829 mem_base = xmlMemBlocks();
2830 f = gen_FILE_ptr(n_f, 0);
2831 cur = gen_xmlDocPtr(n_cur, 1);
2832
2833 ret_val = htmlDocDump(f, cur);
2834 desret_int(ret_val);
2835 call_tests++;
2836 des_FILE_ptr(n_f, f, 0);
2837 des_xmlDocPtr(n_cur, cur, 1);
2838 xmlResetLastError();
2839 if (mem_base != xmlMemBlocks()) {
2840 printf("Leak of %d blocks found in htmlDocDump",
2841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002842 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002843 printf(" %d", n_f);
2844 printf(" %d", n_cur);
2845 printf("\n");
2846 }
2847 }
2848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002849 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002850#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002851
Daniel Veillard42595322004-11-08 10:52:06 +00002852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002853}
2854
2855
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002856#define gen_nb_xmlChar_ptr_ptr 1
2857static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2858 return(NULL);
2859}
2860static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2861}
2862
Daniel Veillardd93f6252004-11-02 15:53:51 +00002863static int
2864test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002866
William M. Brack21e4ef22005-01-02 09:53:13 +00002867#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002868 int mem_base;
2869 xmlDocPtr cur; /* the document */
2870 int n_cur;
2871 xmlChar ** mem; /* OUT: the memory pointer */
2872 int n_mem;
2873 int * size; /* OUT: the memory length */
2874 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002875
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002876 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2877 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2878 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2879 mem_base = xmlMemBlocks();
2880 cur = gen_xmlDocPtr(n_cur, 0);
2881 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2882 size = gen_int_ptr(n_size, 2);
2883
2884 htmlDocDumpMemory(cur, mem, size);
2885 call_tests++;
2886 des_xmlDocPtr(n_cur, cur, 0);
2887 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2888 des_int_ptr(n_size, size, 2);
2889 xmlResetLastError();
2890 if (mem_base != xmlMemBlocks()) {
2891 printf("Leak of %d blocks found in htmlDocDumpMemory",
2892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002893 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002894 printf(" %d", n_cur);
2895 printf(" %d", n_mem);
2896 printf(" %d", n_size);
2897 printf("\n");
2898 }
2899 }
2900 }
2901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002902 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002903#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002904
Daniel Veillard42595322004-11-08 10:52:06 +00002905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002906}
2907
2908
2909static int
2910test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912
William M. Brack21e4ef22005-01-02 09:53:13 +00002913#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002914 int mem_base;
2915 const xmlChar * ret_val;
2916 htmlDocPtr doc; /* the document */
2917 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002918
Daniel Veillarda521d282004-11-09 14:59:59 +00002919 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002920 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002921 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002922
2923 ret_val = htmlGetMetaEncoding(doc);
2924 desret_const_xmlChar_ptr(ret_val);
2925 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002926 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002927 xmlResetLastError();
2928 if (mem_base != xmlMemBlocks()) {
2929 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002931 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002932 printf(" %d", n_doc);
2933 printf("\n");
2934 }
2935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002936 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002937#endif
2938
Daniel Veillard42595322004-11-08 10:52:06 +00002939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002940}
2941
2942
2943static int
2944test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002946
William M. Brack21e4ef22005-01-02 09:53:13 +00002947#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002948 int mem_base;
2949 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002950 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002951 int n_name;
2952
2953 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002955 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002956
William M. Brackf13f77f2004-11-12 16:03:48 +00002957 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002958 desret_int(ret_val);
2959 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002960 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002961 xmlResetLastError();
2962 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002963 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002965 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002966 printf(" %d", n_name);
2967 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002968 }
2969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002970 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002971#endif
2972
Daniel Veillard42595322004-11-08 10:52:06 +00002973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002974}
2975
2976
2977static int
2978test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002980
William M. Brack21e4ef22005-01-02 09:53:13 +00002981#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002982 int mem_base;
2983 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002984 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002985 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002986 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002988
Daniel Veillarda03e3652004-11-02 18:45:30 +00002989 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2990 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002992 URI = gen_const_xmlChar_ptr(n_URI, 0);
2993 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002994
William M. Brackf13f77f2004-11-12 16:03:48 +00002995 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002996 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002997 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002998 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2999 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003000 xmlResetLastError();
3001 if (mem_base != xmlMemBlocks()) {
3002 printf("Leak of %d blocks found in htmlNewDoc",
3003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003004 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 printf(" %d", n_URI);
3006 printf(" %d", n_ExternalID);
3007 printf("\n");
3008 }
3009 }
3010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003011 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003012#endif
3013
Daniel Veillard42595322004-11-08 10:52:06 +00003014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003015}
3016
3017
3018static int
3019test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003021
William M. Brack21e4ef22005-01-02 09:53:13 +00003022#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003023 int mem_base;
3024 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003025 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003027 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003028 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003029
Daniel Veillarda03e3652004-11-02 18:45:30 +00003030 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3031 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003033 URI = gen_const_xmlChar_ptr(n_URI, 0);
3034 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003035
William M. Brackf13f77f2004-11-12 16:03:48 +00003036 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003037 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003038 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003039 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3040 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003041 xmlResetLastError();
3042 if (mem_base != xmlMemBlocks()) {
3043 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003045 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003046 printf(" %d", n_URI);
3047 printf(" %d", n_ExternalID);
3048 printf("\n");
3049 }
3050 }
3051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003052 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003053#endif
3054
Daniel Veillard42595322004-11-08 10:52:06 +00003055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003056}
3057
3058
3059static int
3060test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003062
William M. Brack21e4ef22005-01-02 09:53:13 +00003063#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003064 int mem_base;
3065 int ret_val;
3066 xmlBufferPtr buf; /* the HTML buffer output */
3067 int n_buf;
3068 xmlDocPtr doc; /* the document */
3069 int n_doc;
3070 xmlNodePtr cur; /* the current node */
3071 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003072
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003073 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3074 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3075 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003077 buf = gen_xmlBufferPtr(n_buf, 0);
3078 doc = gen_xmlDocPtr(n_doc, 1);
3079 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003080
3081 ret_val = htmlNodeDump(buf, doc, cur);
3082 desret_int(ret_val);
3083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003084 des_xmlBufferPtr(n_buf, buf, 0);
3085 des_xmlDocPtr(n_doc, doc, 1);
3086 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003087 xmlResetLastError();
3088 if (mem_base != xmlMemBlocks()) {
3089 printf("Leak of %d blocks found in htmlNodeDump",
3090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003091 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003092 printf(" %d", n_buf);
3093 printf(" %d", n_doc);
3094 printf(" %d", n_cur);
3095 printf("\n");
3096 }
3097 }
3098 }
3099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003100 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003101#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003102
Daniel Veillard42595322004-11-08 10:52:06 +00003103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003104}
3105
3106
3107static int
3108test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003110
William M. Brack21e4ef22005-01-02 09:53:13 +00003111#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003112 int mem_base;
3113 FILE * out; /* the FILE pointer */
3114 int n_out;
3115 xmlDocPtr doc; /* the document */
3116 int n_doc;
3117 xmlNodePtr cur; /* the current node */
3118 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003119
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003120 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3121 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3122 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3123 mem_base = xmlMemBlocks();
3124 out = gen_FILE_ptr(n_out, 0);
3125 doc = gen_xmlDocPtr(n_doc, 1);
3126 cur = gen_xmlNodePtr(n_cur, 2);
3127
3128 htmlNodeDumpFile(out, doc, cur);
3129 call_tests++;
3130 des_FILE_ptr(n_out, out, 0);
3131 des_xmlDocPtr(n_doc, doc, 1);
3132 des_xmlNodePtr(n_cur, cur, 2);
3133 xmlResetLastError();
3134 if (mem_base != xmlMemBlocks()) {
3135 printf("Leak of %d blocks found in htmlNodeDumpFile",
3136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003137 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003138 printf(" %d", n_out);
3139 printf(" %d", n_doc);
3140 printf(" %d", n_cur);
3141 printf("\n");
3142 }
3143 }
3144 }
3145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003146 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003147#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148
Daniel Veillard42595322004-11-08 10:52:06 +00003149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003150}
3151
3152
3153static int
3154test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003156
William M. Brack21e4ef22005-01-02 09:53:13 +00003157#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003158 int mem_base;
3159 int ret_val;
3160 FILE * out; /* the FILE pointer */
3161 int n_out;
3162 xmlDocPtr doc; /* the document */
3163 int n_doc;
3164 xmlNodePtr cur; /* the current node */
3165 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003166 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003167 int n_encoding;
3168 int format; /* should formatting spaces been added */
3169 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003170
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003171 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3173 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3174 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3175 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3176 mem_base = xmlMemBlocks();
3177 out = gen_FILE_ptr(n_out, 0);
3178 doc = gen_xmlDocPtr(n_doc, 1);
3179 cur = gen_xmlNodePtr(n_cur, 2);
3180 encoding = gen_const_char_ptr(n_encoding, 3);
3181 format = gen_int(n_format, 4);
3182
William M. Brackf13f77f2004-11-12 16:03:48 +00003183 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003184 desret_int(ret_val);
3185 call_tests++;
3186 des_FILE_ptr(n_out, out, 0);
3187 des_xmlDocPtr(n_doc, doc, 1);
3188 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003189 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003190 des_int(n_format, format, 4);
3191 xmlResetLastError();
3192 if (mem_base != xmlMemBlocks()) {
3193 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003195 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003196 printf(" %d", n_out);
3197 printf(" %d", n_doc);
3198 printf(" %d", n_cur);
3199 printf(" %d", n_encoding);
3200 printf(" %d", n_format);
3201 printf("\n");
3202 }
3203 }
3204 }
3205 }
3206 }
3207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003208 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003209#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003210
Daniel Veillard42595322004-11-08 10:52:06 +00003211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003212}
3213
3214
3215static int
3216test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003218
William M. Brack21e4ef22005-01-02 09:53:13 +00003219#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 int mem_base;
3221 xmlOutputBufferPtr buf; /* the HTML buffer output */
3222 int n_buf;
3223 xmlDocPtr doc; /* the document */
3224 int n_doc;
3225 xmlNodePtr cur; /* the current node */
3226 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003227 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003228 int n_encoding;
3229 int format; /* should formatting spaces been added */
3230 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003231
Daniel Veillard3d97e662004-11-04 10:49:00 +00003232 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3234 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3235 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3236 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3237 mem_base = xmlMemBlocks();
3238 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3239 doc = gen_xmlDocPtr(n_doc, 1);
3240 cur = gen_xmlNodePtr(n_cur, 2);
3241 encoding = gen_const_char_ptr(n_encoding, 3);
3242 format = gen_int(n_format, 4);
3243
William M. Brackf13f77f2004-11-12 16:03:48 +00003244 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003245 call_tests++;
3246 des_xmlOutputBufferPtr(n_buf, buf, 0);
3247 des_xmlDocPtr(n_doc, doc, 1);
3248 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003249 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003250 des_int(n_format, format, 4);
3251 xmlResetLastError();
3252 if (mem_base != xmlMemBlocks()) {
3253 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003255 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003256 printf(" %d", n_buf);
3257 printf(" %d", n_doc);
3258 printf(" %d", n_cur);
3259 printf(" %d", n_encoding);
3260 printf(" %d", n_format);
3261 printf("\n");
3262 }
3263 }
3264 }
3265 }
3266 }
3267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003268 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003269#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270
Daniel Veillard42595322004-11-08 10:52:06 +00003271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003272}
3273
3274
3275static int
3276test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003278
William M. Brack21e4ef22005-01-02 09:53:13 +00003279#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003280 int mem_base;
3281 xmlOutputBufferPtr buf; /* the HTML buffer output */
3282 int n_buf;
3283 xmlDocPtr doc; /* the document */
3284 int n_doc;
3285 xmlNodePtr cur; /* the current node */
3286 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003287 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003288 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003289
Daniel Veillard3d97e662004-11-04 10:49:00 +00003290 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3291 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3292 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3293 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3294 mem_base = xmlMemBlocks();
3295 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3296 doc = gen_xmlDocPtr(n_doc, 1);
3297 cur = gen_xmlNodePtr(n_cur, 2);
3298 encoding = gen_const_char_ptr(n_encoding, 3);
3299
William M. Brackf13f77f2004-11-12 16:03:48 +00003300 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003301 call_tests++;
3302 des_xmlOutputBufferPtr(n_buf, buf, 0);
3303 des_xmlDocPtr(n_doc, doc, 1);
3304 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003305 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003306 xmlResetLastError();
3307 if (mem_base != xmlMemBlocks()) {
3308 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003310 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003311 printf(" %d", n_buf);
3312 printf(" %d", n_doc);
3313 printf(" %d", n_cur);
3314 printf(" %d", n_encoding);
3315 printf("\n");
3316 }
3317 }
3318 }
3319 }
3320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003321 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003322#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003323
Daniel Veillard42595322004-11-08 10:52:06 +00003324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003325}
3326
3327
3328static int
3329test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003331
William M. Brack21e4ef22005-01-02 09:53:13 +00003332#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003333 int mem_base;
3334 int ret_val;
3335 const char * filename; /* the filename (or URL) */
3336 int n_filename;
3337 xmlDocPtr cur; /* the document */
3338 int n_cur;
3339
3340 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3341 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003343 filename = gen_fileoutput(n_filename, 0);
3344 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345
3346 ret_val = htmlSaveFile(filename, cur);
3347 desret_int(ret_val);
3348 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003349 des_fileoutput(n_filename, filename, 0);
3350 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351 xmlResetLastError();
3352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003353 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003356 printf(" %d", n_filename);
3357 printf(" %d", n_cur);
3358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003359 }
3360 }
3361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003362 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003363#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364
Daniel Veillard42595322004-11-08 10:52:06 +00003365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003366}
3367
3368
3369static int
3370test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003372
William M. Brack21e4ef22005-01-02 09:53:13 +00003373#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003374 int mem_base;
3375 int ret_val;
3376 const char * filename; /* the filename */
3377 int n_filename;
3378 xmlDocPtr cur; /* the document */
3379 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003380 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003381 int n_encoding;
3382
3383 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3384 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3385 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003387 filename = gen_fileoutput(n_filename, 0);
3388 cur = gen_xmlDocPtr(n_cur, 1);
3389 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003390
William M. Brackf13f77f2004-11-12 16:03:48 +00003391 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003392 desret_int(ret_val);
3393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003394 des_fileoutput(n_filename, filename, 0);
3395 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003396 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003397 xmlResetLastError();
3398 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003399 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003401 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003402 printf(" %d", n_filename);
3403 printf(" %d", n_cur);
3404 printf(" %d", n_encoding);
3405 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003406 }
3407 }
3408 }
3409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003410 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003411#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003412
Daniel Veillard42595322004-11-08 10:52:06 +00003413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414}
3415
3416
3417static int
3418test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420
William M. Brack21e4ef22005-01-02 09:53:13 +00003421#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003422 int mem_base;
3423 int ret_val;
3424 const char * filename; /* the filename */
3425 int n_filename;
3426 xmlDocPtr cur; /* the document */
3427 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003428 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003429 int n_encoding;
3430 int format; /* should formatting spaces been added */
3431 int n_format;
3432
3433 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3434 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3435 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3436 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003438 filename = gen_fileoutput(n_filename, 0);
3439 cur = gen_xmlDocPtr(n_cur, 1);
3440 encoding = gen_const_char_ptr(n_encoding, 2);
3441 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003442
William M. Brackf13f77f2004-11-12 16:03:48 +00003443 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003444 desret_int(ret_val);
3445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003446 des_fileoutput(n_filename, filename, 0);
3447 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003448 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003449 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003450 xmlResetLastError();
3451 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003452 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003454 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 printf(" %d", n_filename);
3456 printf(" %d", n_cur);
3457 printf(" %d", n_encoding);
3458 printf(" %d", n_format);
3459 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003460 }
3461 }
3462 }
3463 }
3464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003465 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003466#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003467
Daniel Veillard42595322004-11-08 10:52:06 +00003468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003469}
3470
3471
3472static int
3473test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003475
William M. Brack21e4ef22005-01-02 09:53:13 +00003476#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003477 int mem_base;
3478 int ret_val;
3479 htmlDocPtr doc; /* the document */
3480 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003481 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003482 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003483
Daniel Veillarda521d282004-11-09 14:59:59 +00003484 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003485 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3486 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003487 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003488 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003489
William M. Brackf13f77f2004-11-12 16:03:48 +00003490 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003491 desret_int(ret_val);
3492 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003493 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003494 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003495 xmlResetLastError();
3496 if (mem_base != xmlMemBlocks()) {
3497 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003500 printf(" %d", n_doc);
3501 printf(" %d", n_encoding);
3502 printf("\n");
3503 }
3504 }
3505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003506 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003507#endif
3508
Daniel Veillard42595322004-11-08 10:52:06 +00003509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003510}
3511
3512static int
3513test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003515
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003516 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003517 test_ret += test_htmlDocContentDumpFormatOutput();
3518 test_ret += test_htmlDocContentDumpOutput();
3519 test_ret += test_htmlDocDump();
3520 test_ret += test_htmlDocDumpMemory();
3521 test_ret += test_htmlGetMetaEncoding();
3522 test_ret += test_htmlIsBooleanAttr();
3523 test_ret += test_htmlNewDoc();
3524 test_ret += test_htmlNewDocNoDtD();
3525 test_ret += test_htmlNodeDump();
3526 test_ret += test_htmlNodeDumpFile();
3527 test_ret += test_htmlNodeDumpFileFormat();
3528 test_ret += test_htmlNodeDumpFormatOutput();
3529 test_ret += test_htmlNodeDumpOutput();
3530 test_ret += test_htmlSaveFile();
3531 test_ret += test_htmlSaveFileEnc();
3532 test_ret += test_htmlSaveFileFormat();
3533 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003534
Daniel Veillard42595322004-11-08 10:52:06 +00003535 if (test_ret != 0)
3536 printf("Module HTMLtree: %d errors\n", test_ret);
3537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003538}
3539
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003540static int
3541test_docbDefaultSAXHandlerInit(void) {
3542 int test_ret = 0;
3543
William M. Brack21e4ef22005-01-02 09:53:13 +00003544#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003545#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003546 int mem_base;
3547
3548 mem_base = xmlMemBlocks();
3549
3550 docbDefaultSAXHandlerInit();
3551 call_tests++;
3552 xmlResetLastError();
3553 if (mem_base != xmlMemBlocks()) {
3554 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3555 xmlMemBlocks() - mem_base);
3556 test_ret++;
3557 printf("\n");
3558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003559 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003560#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003561#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003562
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003563 return(test_ret);
3564}
3565
3566
3567static int
3568test_htmlDefaultSAXHandlerInit(void) {
3569 int test_ret = 0;
3570
William M. Brack21e4ef22005-01-02 09:53:13 +00003571#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003572#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003573 int mem_base;
3574
3575 mem_base = xmlMemBlocks();
3576
3577 htmlDefaultSAXHandlerInit();
3578 call_tests++;
3579 xmlResetLastError();
3580 if (mem_base != xmlMemBlocks()) {
3581 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3582 xmlMemBlocks() - mem_base);
3583 test_ret++;
3584 printf("\n");
3585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003586 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003587#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003588#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003589
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003590 return(test_ret);
3591}
3592
3593
3594static int
3595test_xmlDefaultSAXHandlerInit(void) {
3596 int test_ret = 0;
3597
3598 int mem_base;
3599
3600 mem_base = xmlMemBlocks();
3601
3602 xmlDefaultSAXHandlerInit();
3603 call_tests++;
3604 xmlResetLastError();
3605 if (mem_base != xmlMemBlocks()) {
3606 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3607 xmlMemBlocks() - mem_base);
3608 test_ret++;
3609 printf("\n");
3610 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003612
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003613 return(test_ret);
3614}
3615
3616
3617#define gen_nb_xmlEnumerationPtr 1
3618static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3619 return(NULL);
3620}
3621static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3622}
3623
3624static int
3625test_xmlSAX2AttributeDecl(void) {
3626 int test_ret = 0;
3627
3628 int mem_base;
3629 void * ctx; /* the user data (XML parser context) */
3630 int n_ctx;
3631 xmlChar * elem; /* the name of the element */
3632 int n_elem;
3633 xmlChar * fullname; /* the attribute name */
3634 int n_fullname;
3635 int type; /* the attribute type */
3636 int n_type;
3637 int def; /* the type of default value */
3638 int n_def;
3639 xmlChar * defaultValue; /* the attribute default value */
3640 int n_defaultValue;
3641 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3642 int n_tree;
3643
3644 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3645 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3646 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3647 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3648 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3649 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3650 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3651 mem_base = xmlMemBlocks();
3652 ctx = gen_void_ptr(n_ctx, 0);
3653 elem = gen_const_xmlChar_ptr(n_elem, 1);
3654 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3655 type = gen_int(n_type, 3);
3656 def = gen_int(n_def, 4);
3657 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3658 tree = gen_xmlEnumerationPtr(n_tree, 6);
3659
William M. Brackf13f77f2004-11-12 16:03:48 +00003660 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003661 call_tests++;
3662 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003663 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3664 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003665 des_int(n_type, type, 3);
3666 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003667 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003668 des_xmlEnumerationPtr(n_tree, tree, 6);
3669 xmlResetLastError();
3670 if (mem_base != xmlMemBlocks()) {
3671 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3672 xmlMemBlocks() - mem_base);
3673 test_ret++;
3674 printf(" %d", n_ctx);
3675 printf(" %d", n_elem);
3676 printf(" %d", n_fullname);
3677 printf(" %d", n_type);
3678 printf(" %d", n_def);
3679 printf(" %d", n_defaultValue);
3680 printf(" %d", n_tree);
3681 printf("\n");
3682 }
3683 }
3684 }
3685 }
3686 }
3687 }
3688 }
3689 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003691
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003692 return(test_ret);
3693}
3694
3695
3696static int
3697test_xmlSAX2CDataBlock(void) {
3698 int test_ret = 0;
3699
3700 int mem_base;
3701 void * ctx; /* the user data (XML parser context) */
3702 int n_ctx;
3703 xmlChar * value; /* The pcdata content */
3704 int n_value;
3705 int len; /* the block length */
3706 int n_len;
3707
3708 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3709 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3710 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3711 mem_base = xmlMemBlocks();
3712 ctx = gen_void_ptr(n_ctx, 0);
3713 value = gen_const_xmlChar_ptr(n_value, 1);
3714 len = gen_int(n_len, 2);
3715
William M. Brackf13f77f2004-11-12 16:03:48 +00003716 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003717 call_tests++;
3718 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003719 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003720 des_int(n_len, len, 2);
3721 xmlResetLastError();
3722 if (mem_base != xmlMemBlocks()) {
3723 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3724 xmlMemBlocks() - mem_base);
3725 test_ret++;
3726 printf(" %d", n_ctx);
3727 printf(" %d", n_value);
3728 printf(" %d", n_len);
3729 printf("\n");
3730 }
3731 }
3732 }
3733 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003735
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003736 return(test_ret);
3737}
3738
3739
3740static int
3741test_xmlSAX2Characters(void) {
3742 int test_ret = 0;
3743
3744 int mem_base;
3745 void * ctx; /* the user data (XML parser context) */
3746 int n_ctx;
3747 xmlChar * ch; /* a xmlChar string */
3748 int n_ch;
3749 int len; /* the number of xmlChar */
3750 int n_len;
3751
3752 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3753 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3754 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3755 mem_base = xmlMemBlocks();
3756 ctx = gen_void_ptr(n_ctx, 0);
3757 ch = gen_const_xmlChar_ptr(n_ch, 1);
3758 len = gen_int(n_len, 2);
3759
William M. Brackf13f77f2004-11-12 16:03:48 +00003760 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003761 call_tests++;
3762 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003763 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003764 des_int(n_len, len, 2);
3765 xmlResetLastError();
3766 if (mem_base != xmlMemBlocks()) {
3767 printf("Leak of %d blocks found in xmlSAX2Characters",
3768 xmlMemBlocks() - mem_base);
3769 test_ret++;
3770 printf(" %d", n_ctx);
3771 printf(" %d", n_ch);
3772 printf(" %d", n_len);
3773 printf("\n");
3774 }
3775 }
3776 }
3777 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003778 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003779
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003780 return(test_ret);
3781}
3782
3783
3784static int
3785test_xmlSAX2Comment(void) {
3786 int test_ret = 0;
3787
3788 int mem_base;
3789 void * ctx; /* the user data (XML parser context) */
3790 int n_ctx;
3791 xmlChar * value; /* the xmlSAX2Comment content */
3792 int n_value;
3793
3794 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3795 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3796 mem_base = xmlMemBlocks();
3797 ctx = gen_void_ptr(n_ctx, 0);
3798 value = gen_const_xmlChar_ptr(n_value, 1);
3799
William M. Brackf13f77f2004-11-12 16:03:48 +00003800 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003801 call_tests++;
3802 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003803 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003804 xmlResetLastError();
3805 if (mem_base != xmlMemBlocks()) {
3806 printf("Leak of %d blocks found in xmlSAX2Comment",
3807 xmlMemBlocks() - mem_base);
3808 test_ret++;
3809 printf(" %d", n_ctx);
3810 printf(" %d", n_value);
3811 printf("\n");
3812 }
3813 }
3814 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003815 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003816
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003817 return(test_ret);
3818}
3819
3820
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003821static int
3822test_xmlSAX2ElementDecl(void) {
3823 int test_ret = 0;
3824
3825 int mem_base;
3826 void * ctx; /* the user data (XML parser context) */
3827 int n_ctx;
3828 xmlChar * name; /* the element name */
3829 int n_name;
3830 int type; /* the element type */
3831 int n_type;
3832 xmlElementContentPtr content; /* the element value tree */
3833 int n_content;
3834
3835 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3836 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3837 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3838 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3839 mem_base = xmlMemBlocks();
3840 ctx = gen_void_ptr(n_ctx, 0);
3841 name = gen_const_xmlChar_ptr(n_name, 1);
3842 type = gen_int(n_type, 2);
3843 content = gen_xmlElementContentPtr(n_content, 3);
3844
William M. Brackf13f77f2004-11-12 16:03:48 +00003845 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003846 call_tests++;
3847 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003848 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003849 des_int(n_type, type, 2);
3850 des_xmlElementContentPtr(n_content, content, 3);
3851 xmlResetLastError();
3852 if (mem_base != xmlMemBlocks()) {
3853 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3854 xmlMemBlocks() - mem_base);
3855 test_ret++;
3856 printf(" %d", n_ctx);
3857 printf(" %d", n_name);
3858 printf(" %d", n_type);
3859 printf(" %d", n_content);
3860 printf("\n");
3861 }
3862 }
3863 }
3864 }
3865 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003867
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003868 return(test_ret);
3869}
3870
3871
3872static int
3873test_xmlSAX2EndDocument(void) {
3874 int test_ret = 0;
3875
3876 int mem_base;
3877 void * ctx; /* the user data (XML parser context) */
3878 int n_ctx;
3879
3880 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3881 mem_base = xmlMemBlocks();
3882 ctx = gen_void_ptr(n_ctx, 0);
3883
3884 xmlSAX2EndDocument(ctx);
3885 call_tests++;
3886 des_void_ptr(n_ctx, ctx, 0);
3887 xmlResetLastError();
3888 if (mem_base != xmlMemBlocks()) {
3889 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3890 xmlMemBlocks() - mem_base);
3891 test_ret++;
3892 printf(" %d", n_ctx);
3893 printf("\n");
3894 }
3895 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003897
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003898 return(test_ret);
3899}
3900
3901
3902static int
3903test_xmlSAX2EndElement(void) {
3904 int test_ret = 0;
3905
William M. Brack21e4ef22005-01-02 09:53:13 +00003906#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003907#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003908 int mem_base;
3909 void * ctx; /* the user data (XML parser context) */
3910 int n_ctx;
3911 xmlChar * name; /* The element name */
3912 int n_name;
3913
3914 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3915 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3916 mem_base = xmlMemBlocks();
3917 ctx = gen_void_ptr(n_ctx, 0);
3918 name = gen_const_xmlChar_ptr(n_name, 1);
3919
William M. Brackf13f77f2004-11-12 16:03:48 +00003920 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003921 call_tests++;
3922 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003923 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003924 xmlResetLastError();
3925 if (mem_base != xmlMemBlocks()) {
3926 printf("Leak of %d blocks found in xmlSAX2EndElement",
3927 xmlMemBlocks() - mem_base);
3928 test_ret++;
3929 printf(" %d", n_ctx);
3930 printf(" %d", n_name);
3931 printf("\n");
3932 }
3933 }
3934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003935 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003936#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003937#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003938
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003939 return(test_ret);
3940}
3941
3942
3943static int
3944test_xmlSAX2EndElementNs(void) {
3945 int test_ret = 0;
3946
3947 int mem_base;
3948 void * ctx; /* the user data (XML parser context) */
3949 int n_ctx;
3950 xmlChar * localname; /* the local name of the element */
3951 int n_localname;
3952 xmlChar * prefix; /* the element namespace prefix if available */
3953 int n_prefix;
3954 xmlChar * URI; /* the element namespace name if available */
3955 int n_URI;
3956
3957 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3958 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3959 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3960 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3961 mem_base = xmlMemBlocks();
3962 ctx = gen_void_ptr(n_ctx, 0);
3963 localname = gen_const_xmlChar_ptr(n_localname, 1);
3964 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3965 URI = gen_const_xmlChar_ptr(n_URI, 3);
3966
William M. Brackf13f77f2004-11-12 16:03:48 +00003967 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003968 call_tests++;
3969 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003970 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3971 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3972 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003973 xmlResetLastError();
3974 if (mem_base != xmlMemBlocks()) {
3975 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3976 xmlMemBlocks() - mem_base);
3977 test_ret++;
3978 printf(" %d", n_ctx);
3979 printf(" %d", n_localname);
3980 printf(" %d", n_prefix);
3981 printf(" %d", n_URI);
3982 printf("\n");
3983 }
3984 }
3985 }
3986 }
3987 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003989
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003990 return(test_ret);
3991}
3992
3993
3994static int
3995test_xmlSAX2EntityDecl(void) {
3996 int test_ret = 0;
3997
3998 int mem_base;
3999 void * ctx; /* the user data (XML parser context) */
4000 int n_ctx;
4001 xmlChar * name; /* the entity name */
4002 int n_name;
4003 int type; /* the entity type */
4004 int n_type;
4005 xmlChar * publicId; /* The public ID of the entity */
4006 int n_publicId;
4007 xmlChar * systemId; /* The system ID of the entity */
4008 int n_systemId;
4009 xmlChar * content; /* the entity value (without processing). */
4010 int n_content;
4011
4012 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4013 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4014 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4015 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4016 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4017 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4018 mem_base = xmlMemBlocks();
4019 ctx = gen_void_ptr(n_ctx, 0);
4020 name = gen_const_xmlChar_ptr(n_name, 1);
4021 type = gen_int(n_type, 2);
4022 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4023 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4024 content = gen_xmlChar_ptr(n_content, 5);
4025
William M. Brackf13f77f2004-11-12 16:03:48 +00004026 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004027 call_tests++;
4028 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004029 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004030 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004031 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4032 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004033 des_xmlChar_ptr(n_content, content, 5);
4034 xmlResetLastError();
4035 if (mem_base != xmlMemBlocks()) {
4036 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4037 xmlMemBlocks() - mem_base);
4038 test_ret++;
4039 printf(" %d", n_ctx);
4040 printf(" %d", n_name);
4041 printf(" %d", n_type);
4042 printf(" %d", n_publicId);
4043 printf(" %d", n_systemId);
4044 printf(" %d", n_content);
4045 printf("\n");
4046 }
4047 }
4048 }
4049 }
4050 }
4051 }
4052 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004055 return(test_ret);
4056}
4057
4058
4059static int
4060test_xmlSAX2ExternalSubset(void) {
4061 int test_ret = 0;
4062
4063 int mem_base;
4064 void * ctx; /* the user data (XML parser context) */
4065 int n_ctx;
4066 xmlChar * name; /* the root element name */
4067 int n_name;
4068 xmlChar * ExternalID; /* the external ID */
4069 int n_ExternalID;
4070 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4071 int n_SystemID;
4072
4073 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4074 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4075 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4076 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4077 mem_base = xmlMemBlocks();
4078 ctx = gen_void_ptr(n_ctx, 0);
4079 name = gen_const_xmlChar_ptr(n_name, 1);
4080 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4081 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4082
William M. Brackf13f77f2004-11-12 16:03:48 +00004083 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004084 call_tests++;
4085 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004086 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4087 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4088 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004089 xmlResetLastError();
4090 if (mem_base != xmlMemBlocks()) {
4091 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4092 xmlMemBlocks() - mem_base);
4093 test_ret++;
4094 printf(" %d", n_ctx);
4095 printf(" %d", n_name);
4096 printf(" %d", n_ExternalID);
4097 printf(" %d", n_SystemID);
4098 printf("\n");
4099 }
4100 }
4101 }
4102 }
4103 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004104 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004105
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004106 return(test_ret);
4107}
4108
4109
4110static int
4111test_xmlSAX2GetColumnNumber(void) {
4112 int test_ret = 0;
4113
4114 int mem_base;
4115 int ret_val;
4116 void * ctx; /* the user data (XML parser context) */
4117 int n_ctx;
4118
4119 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4120 mem_base = xmlMemBlocks();
4121 ctx = gen_void_ptr(n_ctx, 0);
4122
4123 ret_val = xmlSAX2GetColumnNumber(ctx);
4124 desret_int(ret_val);
4125 call_tests++;
4126 des_void_ptr(n_ctx, ctx, 0);
4127 xmlResetLastError();
4128 if (mem_base != xmlMemBlocks()) {
4129 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4130 xmlMemBlocks() - mem_base);
4131 test_ret++;
4132 printf(" %d", n_ctx);
4133 printf("\n");
4134 }
4135 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004136 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004137
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004138 return(test_ret);
4139}
4140
4141
4142static int
4143test_xmlSAX2GetEntity(void) {
4144 int test_ret = 0;
4145
4146 int mem_base;
4147 xmlEntityPtr ret_val;
4148 void * ctx; /* the user data (XML parser context) */
4149 int n_ctx;
4150 xmlChar * name; /* The entity name */
4151 int n_name;
4152
4153 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4154 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4155 mem_base = xmlMemBlocks();
4156 ctx = gen_void_ptr(n_ctx, 0);
4157 name = gen_const_xmlChar_ptr(n_name, 1);
4158
William M. Brackf13f77f2004-11-12 16:03:48 +00004159 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004160 desret_xmlEntityPtr(ret_val);
4161 call_tests++;
4162 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004163 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004164 xmlResetLastError();
4165 if (mem_base != xmlMemBlocks()) {
4166 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4167 xmlMemBlocks() - mem_base);
4168 test_ret++;
4169 printf(" %d", n_ctx);
4170 printf(" %d", n_name);
4171 printf("\n");
4172 }
4173 }
4174 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004176
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004177 return(test_ret);
4178}
4179
4180
4181static int
4182test_xmlSAX2GetLineNumber(void) {
4183 int test_ret = 0;
4184
4185 int mem_base;
4186 int ret_val;
4187 void * ctx; /* the user data (XML parser context) */
4188 int n_ctx;
4189
4190 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4191 mem_base = xmlMemBlocks();
4192 ctx = gen_void_ptr(n_ctx, 0);
4193
4194 ret_val = xmlSAX2GetLineNumber(ctx);
4195 desret_int(ret_val);
4196 call_tests++;
4197 des_void_ptr(n_ctx, ctx, 0);
4198 xmlResetLastError();
4199 if (mem_base != xmlMemBlocks()) {
4200 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4201 xmlMemBlocks() - mem_base);
4202 test_ret++;
4203 printf(" %d", n_ctx);
4204 printf("\n");
4205 }
4206 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004208
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004209 return(test_ret);
4210}
4211
4212
4213static int
4214test_xmlSAX2GetParameterEntity(void) {
4215 int test_ret = 0;
4216
4217 int mem_base;
4218 xmlEntityPtr ret_val;
4219 void * ctx; /* the user data (XML parser context) */
4220 int n_ctx;
4221 xmlChar * name; /* The entity name */
4222 int n_name;
4223
4224 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4225 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4226 mem_base = xmlMemBlocks();
4227 ctx = gen_void_ptr(n_ctx, 0);
4228 name = gen_const_xmlChar_ptr(n_name, 1);
4229
William M. Brackf13f77f2004-11-12 16:03:48 +00004230 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004231 desret_xmlEntityPtr(ret_val);
4232 call_tests++;
4233 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004234 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004235 xmlResetLastError();
4236 if (mem_base != xmlMemBlocks()) {
4237 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4238 xmlMemBlocks() - mem_base);
4239 test_ret++;
4240 printf(" %d", n_ctx);
4241 printf(" %d", n_name);
4242 printf("\n");
4243 }
4244 }
4245 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004247
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004248 return(test_ret);
4249}
4250
4251
4252static int
4253test_xmlSAX2GetPublicId(void) {
4254 int test_ret = 0;
4255
4256 int mem_base;
4257 const xmlChar * ret_val;
4258 void * ctx; /* the user data (XML parser context) */
4259 int n_ctx;
4260
4261 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4262 mem_base = xmlMemBlocks();
4263 ctx = gen_void_ptr(n_ctx, 0);
4264
4265 ret_val = xmlSAX2GetPublicId(ctx);
4266 desret_const_xmlChar_ptr(ret_val);
4267 call_tests++;
4268 des_void_ptr(n_ctx, ctx, 0);
4269 xmlResetLastError();
4270 if (mem_base != xmlMemBlocks()) {
4271 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4272 xmlMemBlocks() - mem_base);
4273 test_ret++;
4274 printf(" %d", n_ctx);
4275 printf("\n");
4276 }
4277 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004279
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004280 return(test_ret);
4281}
4282
4283
4284static int
4285test_xmlSAX2GetSystemId(void) {
4286 int test_ret = 0;
4287
4288 int mem_base;
4289 const xmlChar * ret_val;
4290 void * ctx; /* the user data (XML parser context) */
4291 int n_ctx;
4292
4293 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4294 mem_base = xmlMemBlocks();
4295 ctx = gen_void_ptr(n_ctx, 0);
4296
4297 ret_val = xmlSAX2GetSystemId(ctx);
4298 desret_const_xmlChar_ptr(ret_val);
4299 call_tests++;
4300 des_void_ptr(n_ctx, ctx, 0);
4301 xmlResetLastError();
4302 if (mem_base != xmlMemBlocks()) {
4303 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4304 xmlMemBlocks() - mem_base);
4305 test_ret++;
4306 printf(" %d", n_ctx);
4307 printf("\n");
4308 }
4309 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004311
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004312 return(test_ret);
4313}
4314
4315
4316static int
4317test_xmlSAX2HasExternalSubset(void) {
4318 int test_ret = 0;
4319
4320 int mem_base;
4321 int ret_val;
4322 void * ctx; /* the user data (XML parser context) */
4323 int n_ctx;
4324
4325 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4326 mem_base = xmlMemBlocks();
4327 ctx = gen_void_ptr(n_ctx, 0);
4328
4329 ret_val = xmlSAX2HasExternalSubset(ctx);
4330 desret_int(ret_val);
4331 call_tests++;
4332 des_void_ptr(n_ctx, ctx, 0);
4333 xmlResetLastError();
4334 if (mem_base != xmlMemBlocks()) {
4335 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4336 xmlMemBlocks() - mem_base);
4337 test_ret++;
4338 printf(" %d", n_ctx);
4339 printf("\n");
4340 }
4341 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004343
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004344 return(test_ret);
4345}
4346
4347
4348static int
4349test_xmlSAX2HasInternalSubset(void) {
4350 int test_ret = 0;
4351
4352 int mem_base;
4353 int ret_val;
4354 void * ctx; /* the user data (XML parser context) */
4355 int n_ctx;
4356
4357 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4358 mem_base = xmlMemBlocks();
4359 ctx = gen_void_ptr(n_ctx, 0);
4360
4361 ret_val = xmlSAX2HasInternalSubset(ctx);
4362 desret_int(ret_val);
4363 call_tests++;
4364 des_void_ptr(n_ctx, ctx, 0);
4365 xmlResetLastError();
4366 if (mem_base != xmlMemBlocks()) {
4367 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4368 xmlMemBlocks() - mem_base);
4369 test_ret++;
4370 printf(" %d", n_ctx);
4371 printf("\n");
4372 }
4373 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004375
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004376 return(test_ret);
4377}
4378
4379
4380static int
4381test_xmlSAX2IgnorableWhitespace(void) {
4382 int test_ret = 0;
4383
4384 int mem_base;
4385 void * ctx; /* the user data (XML parser context) */
4386 int n_ctx;
4387 xmlChar * ch; /* a xmlChar string */
4388 int n_ch;
4389 int len; /* the number of xmlChar */
4390 int n_len;
4391
4392 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4393 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4394 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4395 mem_base = xmlMemBlocks();
4396 ctx = gen_void_ptr(n_ctx, 0);
4397 ch = gen_const_xmlChar_ptr(n_ch, 1);
4398 len = gen_int(n_len, 2);
4399
William M. Brackf13f77f2004-11-12 16:03:48 +00004400 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004401 call_tests++;
4402 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004403 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004404 des_int(n_len, len, 2);
4405 xmlResetLastError();
4406 if (mem_base != xmlMemBlocks()) {
4407 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4408 xmlMemBlocks() - mem_base);
4409 test_ret++;
4410 printf(" %d", n_ctx);
4411 printf(" %d", n_ch);
4412 printf(" %d", n_len);
4413 printf("\n");
4414 }
4415 }
4416 }
4417 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004418 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004419
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004420 return(test_ret);
4421}
4422
4423
4424#define gen_nb_xmlSAXHandler_ptr 1
4425static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4426 return(NULL);
4427}
4428static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4429}
4430
4431static int
4432test_xmlSAX2InitDefaultSAXHandler(void) {
4433 int test_ret = 0;
4434
4435 int mem_base;
4436 xmlSAXHandler * hdlr; /* the SAX handler */
4437 int n_hdlr;
4438 int warning; /* flag if non-zero sets the handler warning procedure */
4439 int n_warning;
4440
4441 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4442 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4443 mem_base = xmlMemBlocks();
4444 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4445 warning = gen_int(n_warning, 1);
4446
4447 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4448 call_tests++;
4449 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4450 des_int(n_warning, warning, 1);
4451 xmlResetLastError();
4452 if (mem_base != xmlMemBlocks()) {
4453 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4454 xmlMemBlocks() - mem_base);
4455 test_ret++;
4456 printf(" %d", n_hdlr);
4457 printf(" %d", n_warning);
4458 printf("\n");
4459 }
4460 }
4461 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004463
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004464 return(test_ret);
4465}
4466
4467
4468static int
4469test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4470 int test_ret = 0;
4471
William M. Brack21e4ef22005-01-02 09:53:13 +00004472#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004473 int mem_base;
4474 xmlSAXHandler * hdlr; /* the SAX handler */
4475 int n_hdlr;
4476
4477 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4478 mem_base = xmlMemBlocks();
4479 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4480
4481 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4482 call_tests++;
4483 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4484 xmlResetLastError();
4485 if (mem_base != xmlMemBlocks()) {
4486 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4487 xmlMemBlocks() - mem_base);
4488 test_ret++;
4489 printf(" %d", n_hdlr);
4490 printf("\n");
4491 }
4492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004493 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004494#endif
4495
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004496 return(test_ret);
4497}
4498
4499
4500static int
4501test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4502 int test_ret = 0;
4503
William M. Brack21e4ef22005-01-02 09:53:13 +00004504#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004505 int mem_base;
4506 xmlSAXHandler * hdlr; /* the SAX handler */
4507 int n_hdlr;
4508
4509 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4510 mem_base = xmlMemBlocks();
4511 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4512
4513 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4514 call_tests++;
4515 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4516 xmlResetLastError();
4517 if (mem_base != xmlMemBlocks()) {
4518 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4519 xmlMemBlocks() - mem_base);
4520 test_ret++;
4521 printf(" %d", n_hdlr);
4522 printf("\n");
4523 }
4524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004525 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526#endif
4527
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004528 return(test_ret);
4529}
4530
4531
4532static int
4533test_xmlSAX2InternalSubset(void) {
4534 int test_ret = 0;
4535
4536 int mem_base;
4537 void * ctx; /* the user data (XML parser context) */
4538 int n_ctx;
4539 xmlChar * name; /* the root element name */
4540 int n_name;
4541 xmlChar * ExternalID; /* the external ID */
4542 int n_ExternalID;
4543 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4544 int n_SystemID;
4545
4546 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4548 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4549 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4550 mem_base = xmlMemBlocks();
4551 ctx = gen_void_ptr(n_ctx, 0);
4552 name = gen_const_xmlChar_ptr(n_name, 1);
4553 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4554 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4555
William M. Brackf13f77f2004-11-12 16:03:48 +00004556 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004557 call_tests++;
4558 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004559 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4560 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4561 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004562 xmlResetLastError();
4563 if (mem_base != xmlMemBlocks()) {
4564 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4565 xmlMemBlocks() - mem_base);
4566 test_ret++;
4567 printf(" %d", n_ctx);
4568 printf(" %d", n_name);
4569 printf(" %d", n_ExternalID);
4570 printf(" %d", n_SystemID);
4571 printf("\n");
4572 }
4573 }
4574 }
4575 }
4576 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004577 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004578
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004579 return(test_ret);
4580}
4581
4582
4583static int
4584test_xmlSAX2IsStandalone(void) {
4585 int test_ret = 0;
4586
4587 int mem_base;
4588 int ret_val;
4589 void * ctx; /* the user data (XML parser context) */
4590 int n_ctx;
4591
4592 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4593 mem_base = xmlMemBlocks();
4594 ctx = gen_void_ptr(n_ctx, 0);
4595
4596 ret_val = xmlSAX2IsStandalone(ctx);
4597 desret_int(ret_val);
4598 call_tests++;
4599 des_void_ptr(n_ctx, ctx, 0);
4600 xmlResetLastError();
4601 if (mem_base != xmlMemBlocks()) {
4602 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4603 xmlMemBlocks() - mem_base);
4604 test_ret++;
4605 printf(" %d", n_ctx);
4606 printf("\n");
4607 }
4608 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004610
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004611 return(test_ret);
4612}
4613
4614
4615static int
4616test_xmlSAX2NotationDecl(void) {
4617 int test_ret = 0;
4618
4619 int mem_base;
4620 void * ctx; /* the user data (XML parser context) */
4621 int n_ctx;
4622 xmlChar * name; /* The name of the notation */
4623 int n_name;
4624 xmlChar * publicId; /* The public ID of the entity */
4625 int n_publicId;
4626 xmlChar * systemId; /* The system ID of the entity */
4627 int n_systemId;
4628
4629 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4630 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4631 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4632 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4633 mem_base = xmlMemBlocks();
4634 ctx = gen_void_ptr(n_ctx, 0);
4635 name = gen_const_xmlChar_ptr(n_name, 1);
4636 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4637 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4638
William M. Brackf13f77f2004-11-12 16:03:48 +00004639 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004640 call_tests++;
4641 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004642 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4643 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4644 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004645 xmlResetLastError();
4646 if (mem_base != xmlMemBlocks()) {
4647 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4648 xmlMemBlocks() - mem_base);
4649 test_ret++;
4650 printf(" %d", n_ctx);
4651 printf(" %d", n_name);
4652 printf(" %d", n_publicId);
4653 printf(" %d", n_systemId);
4654 printf("\n");
4655 }
4656 }
4657 }
4658 }
4659 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004660 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004661
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004662 return(test_ret);
4663}
4664
4665
4666static int
4667test_xmlSAX2ProcessingInstruction(void) {
4668 int test_ret = 0;
4669
4670 int mem_base;
4671 void * ctx; /* the user data (XML parser context) */
4672 int n_ctx;
4673 xmlChar * target; /* the target name */
4674 int n_target;
4675 xmlChar * data; /* the PI data's */
4676 int n_data;
4677
4678 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4679 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4680 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4681 mem_base = xmlMemBlocks();
4682 ctx = gen_void_ptr(n_ctx, 0);
4683 target = gen_const_xmlChar_ptr(n_target, 1);
4684 data = gen_const_xmlChar_ptr(n_data, 2);
4685
William M. Brackf13f77f2004-11-12 16:03:48 +00004686 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004687 call_tests++;
4688 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004689 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4690 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 xmlResetLastError();
4692 if (mem_base != xmlMemBlocks()) {
4693 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4694 xmlMemBlocks() - mem_base);
4695 test_ret++;
4696 printf(" %d", n_ctx);
4697 printf(" %d", n_target);
4698 printf(" %d", n_data);
4699 printf("\n");
4700 }
4701 }
4702 }
4703 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004704 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004705
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004706 return(test_ret);
4707}
4708
4709
4710static int
4711test_xmlSAX2Reference(void) {
4712 int test_ret = 0;
4713
4714 int mem_base;
4715 void * ctx; /* the user data (XML parser context) */
4716 int n_ctx;
4717 xmlChar * name; /* The entity name */
4718 int n_name;
4719
4720 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4721 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4722 mem_base = xmlMemBlocks();
4723 ctx = gen_void_ptr(n_ctx, 0);
4724 name = gen_const_xmlChar_ptr(n_name, 1);
4725
William M. Brackf13f77f2004-11-12 16:03:48 +00004726 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004727 call_tests++;
4728 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004729 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004730 xmlResetLastError();
4731 if (mem_base != xmlMemBlocks()) {
4732 printf("Leak of %d blocks found in xmlSAX2Reference",
4733 xmlMemBlocks() - mem_base);
4734 test_ret++;
4735 printf(" %d", n_ctx);
4736 printf(" %d", n_name);
4737 printf("\n");
4738 }
4739 }
4740 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004742
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004743 return(test_ret);
4744}
4745
4746
4747static int
4748test_xmlSAX2ResolveEntity(void) {
4749 int test_ret = 0;
4750
4751 int mem_base;
4752 xmlParserInputPtr ret_val;
4753 void * ctx; /* the user data (XML parser context) */
4754 int n_ctx;
4755 xmlChar * publicId; /* The public ID of the entity */
4756 int n_publicId;
4757 xmlChar * systemId; /* The system ID of the entity */
4758 int n_systemId;
4759
4760 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4761 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4762 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4763 mem_base = xmlMemBlocks();
4764 ctx = gen_void_ptr(n_ctx, 0);
4765 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4766 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4767
William M. Brackf13f77f2004-11-12 16:03:48 +00004768 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004769 desret_xmlParserInputPtr(ret_val);
4770 call_tests++;
4771 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004772 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4773 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004774 xmlResetLastError();
4775 if (mem_base != xmlMemBlocks()) {
4776 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4777 xmlMemBlocks() - mem_base);
4778 test_ret++;
4779 printf(" %d", n_ctx);
4780 printf(" %d", n_publicId);
4781 printf(" %d", n_systemId);
4782 printf("\n");
4783 }
4784 }
4785 }
4786 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004787 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004788
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004789 return(test_ret);
4790}
4791
4792
4793#define gen_nb_xmlSAXLocatorPtr 1
4794static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4795 return(NULL);
4796}
4797static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4798}
4799
4800static int
4801test_xmlSAX2SetDocumentLocator(void) {
4802 int test_ret = 0;
4803
4804 int mem_base;
4805 void * ctx; /* the user data (XML parser context) */
4806 int n_ctx;
4807 xmlSAXLocatorPtr loc; /* A SAX Locator */
4808 int n_loc;
4809
4810 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4811 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4812 mem_base = xmlMemBlocks();
4813 ctx = gen_void_ptr(n_ctx, 0);
4814 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4815
4816 xmlSAX2SetDocumentLocator(ctx, loc);
4817 call_tests++;
4818 des_void_ptr(n_ctx, ctx, 0);
4819 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4820 xmlResetLastError();
4821 if (mem_base != xmlMemBlocks()) {
4822 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4823 xmlMemBlocks() - mem_base);
4824 test_ret++;
4825 printf(" %d", n_ctx);
4826 printf(" %d", n_loc);
4827 printf("\n");
4828 }
4829 }
4830 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004832
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004833 return(test_ret);
4834}
4835
4836
4837static int
4838test_xmlSAX2StartDocument(void) {
4839 int test_ret = 0;
4840
4841 int mem_base;
4842 void * ctx; /* the user data (XML parser context) */
4843 int n_ctx;
4844
4845 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4846 mem_base = xmlMemBlocks();
4847 ctx = gen_void_ptr(n_ctx, 0);
4848
4849 xmlSAX2StartDocument(ctx);
4850 call_tests++;
4851 des_void_ptr(n_ctx, ctx, 0);
4852 xmlResetLastError();
4853 if (mem_base != xmlMemBlocks()) {
4854 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4855 xmlMemBlocks() - mem_base);
4856 test_ret++;
4857 printf(" %d", n_ctx);
4858 printf("\n");
4859 }
4860 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004861 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004862
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004863 return(test_ret);
4864}
4865
4866
4867static int
4868test_xmlSAX2StartElement(void) {
4869 int test_ret = 0;
4870
William M. Brack21e4ef22005-01-02 09:53:13 +00004871#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004872#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004873 int mem_base;
4874 void * ctx; /* the user data (XML parser context) */
4875 int n_ctx;
4876 xmlChar * fullname; /* The element name, including namespace prefix */
4877 int n_fullname;
4878 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4879 int n_atts;
4880
4881 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4882 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4883 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4884 mem_base = xmlMemBlocks();
4885 ctx = gen_void_ptr(n_ctx, 0);
4886 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4887 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4888
William M. Brackf13f77f2004-11-12 16:03:48 +00004889 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004890 call_tests++;
4891 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004892 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4893 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004894 xmlResetLastError();
4895 if (mem_base != xmlMemBlocks()) {
4896 printf("Leak of %d blocks found in xmlSAX2StartElement",
4897 xmlMemBlocks() - mem_base);
4898 test_ret++;
4899 printf(" %d", n_ctx);
4900 printf(" %d", n_fullname);
4901 printf(" %d", n_atts);
4902 printf("\n");
4903 }
4904 }
4905 }
4906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004907 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004908#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004909#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004910
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004911 return(test_ret);
4912}
4913
4914
4915static int
4916test_xmlSAX2StartElementNs(void) {
4917 int test_ret = 0;
4918
4919 int mem_base;
4920 void * ctx; /* the user data (XML parser context) */
4921 int n_ctx;
4922 xmlChar * localname; /* the local name of the element */
4923 int n_localname;
4924 xmlChar * prefix; /* the element namespace prefix if available */
4925 int n_prefix;
4926 xmlChar * URI; /* the element namespace name if available */
4927 int n_URI;
4928 int nb_namespaces; /* number of namespace definitions on that node */
4929 int n_nb_namespaces;
4930 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4931 int n_namespaces;
4932 int nb_attributes; /* the number of attributes on that node */
4933 int n_nb_attributes;
4934 int nb_defaulted; /* the number of defaulted attributes. */
4935 int n_nb_defaulted;
4936 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4937 int n_attributes;
4938
4939 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4940 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4941 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4942 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4943 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4944 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4945 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4946 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4947 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4948 mem_base = xmlMemBlocks();
4949 ctx = gen_void_ptr(n_ctx, 0);
4950 localname = gen_const_xmlChar_ptr(n_localname, 1);
4951 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4952 URI = gen_const_xmlChar_ptr(n_URI, 3);
4953 nb_namespaces = gen_int(n_nb_namespaces, 4);
4954 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4955 nb_attributes = gen_int(n_nb_attributes, 6);
4956 nb_defaulted = gen_int(n_nb_defaulted, 7);
4957 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4958
William M. Brackf13f77f2004-11-12 16:03:48 +00004959 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 +00004960 call_tests++;
4961 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004962 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4963 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4964 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004965 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004966 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004967 des_int(n_nb_attributes, nb_attributes, 6);
4968 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004969 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004970 xmlResetLastError();
4971 if (mem_base != xmlMemBlocks()) {
4972 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4973 xmlMemBlocks() - mem_base);
4974 test_ret++;
4975 printf(" %d", n_ctx);
4976 printf(" %d", n_localname);
4977 printf(" %d", n_prefix);
4978 printf(" %d", n_URI);
4979 printf(" %d", n_nb_namespaces);
4980 printf(" %d", n_namespaces);
4981 printf(" %d", n_nb_attributes);
4982 printf(" %d", n_nb_defaulted);
4983 printf(" %d", n_attributes);
4984 printf("\n");
4985 }
4986 }
4987 }
4988 }
4989 }
4990 }
4991 }
4992 }
4993 }
4994 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004996
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004997 return(test_ret);
4998}
4999
5000
5001static int
5002test_xmlSAX2UnparsedEntityDecl(void) {
5003 int test_ret = 0;
5004
5005 int mem_base;
5006 void * ctx; /* the user data (XML parser context) */
5007 int n_ctx;
5008 xmlChar * name; /* The name of the entity */
5009 int n_name;
5010 xmlChar * publicId; /* The public ID of the entity */
5011 int n_publicId;
5012 xmlChar * systemId; /* The system ID of the entity */
5013 int n_systemId;
5014 xmlChar * notationName; /* the name of the notation */
5015 int n_notationName;
5016
5017 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5019 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5020 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5021 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5022 mem_base = xmlMemBlocks();
5023 ctx = gen_void_ptr(n_ctx, 0);
5024 name = gen_const_xmlChar_ptr(n_name, 1);
5025 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5026 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5027 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5028
William M. Brackf13f77f2004-11-12 16:03:48 +00005029 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005030 call_tests++;
5031 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5033 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5034 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5035 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005036 xmlResetLastError();
5037 if (mem_base != xmlMemBlocks()) {
5038 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5039 xmlMemBlocks() - mem_base);
5040 test_ret++;
5041 printf(" %d", n_ctx);
5042 printf(" %d", n_name);
5043 printf(" %d", n_publicId);
5044 printf(" %d", n_systemId);
5045 printf(" %d", n_notationName);
5046 printf("\n");
5047 }
5048 }
5049 }
5050 }
5051 }
5052 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005055 return(test_ret);
5056}
5057
5058
5059static int
5060test_xmlSAXDefaultVersion(void) {
5061 int test_ret = 0;
5062
William M. Brack21e4ef22005-01-02 09:53:13 +00005063#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005064#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005065 int mem_base;
5066 int ret_val;
5067 int version; /* the version, 1 or 2 */
5068 int n_version;
5069
5070 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5071 mem_base = xmlMemBlocks();
5072 version = gen_int(n_version, 0);
5073
5074 ret_val = xmlSAXDefaultVersion(version);
5075 desret_int(ret_val);
5076 call_tests++;
5077 des_int(n_version, version, 0);
5078 xmlResetLastError();
5079 if (mem_base != xmlMemBlocks()) {
5080 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5081 xmlMemBlocks() - mem_base);
5082 test_ret++;
5083 printf(" %d", n_version);
5084 printf("\n");
5085 }
5086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005087 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005088#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005089#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005090
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005091 return(test_ret);
5092}
5093
5094
5095static int
5096test_xmlSAXVersion(void) {
5097 int test_ret = 0;
5098
5099 int mem_base;
5100 int ret_val;
5101 xmlSAXHandler * hdlr; /* the SAX handler */
5102 int n_hdlr;
5103 int version; /* the version, 1 or 2 */
5104 int n_version;
5105
5106 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5107 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5108 mem_base = xmlMemBlocks();
5109 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5110 version = gen_int(n_version, 1);
5111
5112 ret_val = xmlSAXVersion(hdlr, version);
5113 desret_int(ret_val);
5114 call_tests++;
5115 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5116 des_int(n_version, version, 1);
5117 xmlResetLastError();
5118 if (mem_base != xmlMemBlocks()) {
5119 printf("Leak of %d blocks found in xmlSAXVersion",
5120 xmlMemBlocks() - mem_base);
5121 test_ret++;
5122 printf(" %d", n_hdlr);
5123 printf(" %d", n_version);
5124 printf("\n");
5125 }
5126 }
5127 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005129
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005130 return(test_ret);
5131}
5132
5133static int
5134test_SAX2(void) {
5135 int test_ret = 0;
5136
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005137 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005138 test_ret += test_docbDefaultSAXHandlerInit();
5139 test_ret += test_htmlDefaultSAXHandlerInit();
5140 test_ret += test_xmlDefaultSAXHandlerInit();
5141 test_ret += test_xmlSAX2AttributeDecl();
5142 test_ret += test_xmlSAX2CDataBlock();
5143 test_ret += test_xmlSAX2Characters();
5144 test_ret += test_xmlSAX2Comment();
5145 test_ret += test_xmlSAX2ElementDecl();
5146 test_ret += test_xmlSAX2EndDocument();
5147 test_ret += test_xmlSAX2EndElement();
5148 test_ret += test_xmlSAX2EndElementNs();
5149 test_ret += test_xmlSAX2EntityDecl();
5150 test_ret += test_xmlSAX2ExternalSubset();
5151 test_ret += test_xmlSAX2GetColumnNumber();
5152 test_ret += test_xmlSAX2GetEntity();
5153 test_ret += test_xmlSAX2GetLineNumber();
5154 test_ret += test_xmlSAX2GetParameterEntity();
5155 test_ret += test_xmlSAX2GetPublicId();
5156 test_ret += test_xmlSAX2GetSystemId();
5157 test_ret += test_xmlSAX2HasExternalSubset();
5158 test_ret += test_xmlSAX2HasInternalSubset();
5159 test_ret += test_xmlSAX2IgnorableWhitespace();
5160 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5161 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5162 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5163 test_ret += test_xmlSAX2InternalSubset();
5164 test_ret += test_xmlSAX2IsStandalone();
5165 test_ret += test_xmlSAX2NotationDecl();
5166 test_ret += test_xmlSAX2ProcessingInstruction();
5167 test_ret += test_xmlSAX2Reference();
5168 test_ret += test_xmlSAX2ResolveEntity();
5169 test_ret += test_xmlSAX2SetDocumentLocator();
5170 test_ret += test_xmlSAX2StartDocument();
5171 test_ret += test_xmlSAX2StartElement();
5172 test_ret += test_xmlSAX2StartElementNs();
5173 test_ret += test_xmlSAX2UnparsedEntityDecl();
5174 test_ret += test_xmlSAXDefaultVersion();
5175 test_ret += test_xmlSAXVersion();
5176
5177 if (test_ret != 0)
5178 printf("Module SAX2: %d errors\n", test_ret);
5179 return(test_ret);
5180}
5181
Daniel Veillarda82b1822004-11-08 16:24:57 +00005182static int
5183test_xmlC14NDocDumpMemory(void) {
5184 int test_ret = 0;
5185
William M. Brack21e4ef22005-01-02 09:53:13 +00005186#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005187 int mem_base;
5188 int ret_val;
5189 xmlDocPtr doc; /* the XML document for canonization */
5190 int n_doc;
5191 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5192 int n_nodes;
5193 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5194 int n_exclusive;
5195 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) */
5196 int n_inclusive_ns_prefixes;
5197 int with_comments; /* include comments in the result (!=0) or not (==0) */
5198 int n_with_comments;
5199 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 */
5200 int n_doc_txt_ptr;
5201
5202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5203 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5204 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5205 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5206 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5207 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5208 mem_base = xmlMemBlocks();
5209 doc = gen_xmlDocPtr(n_doc, 0);
5210 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5211 exclusive = gen_int(n_exclusive, 2);
5212 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5213 with_comments = gen_int(n_with_comments, 4);
5214 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5215
5216 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5217 desret_int(ret_val);
5218 call_tests++;
5219 des_xmlDocPtr(n_doc, doc, 0);
5220 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5221 des_int(n_exclusive, exclusive, 2);
5222 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5223 des_int(n_with_comments, with_comments, 4);
5224 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5225 xmlResetLastError();
5226 if (mem_base != xmlMemBlocks()) {
5227 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5228 xmlMemBlocks() - mem_base);
5229 test_ret++;
5230 printf(" %d", n_doc);
5231 printf(" %d", n_nodes);
5232 printf(" %d", n_exclusive);
5233 printf(" %d", n_inclusive_ns_prefixes);
5234 printf(" %d", n_with_comments);
5235 printf(" %d", n_doc_txt_ptr);
5236 printf("\n");
5237 }
5238 }
5239 }
5240 }
5241 }
5242 }
5243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005244 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005245#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005246
Daniel Veillarda82b1822004-11-08 16:24:57 +00005247 return(test_ret);
5248}
5249
5250
5251static int
5252test_xmlC14NDocSave(void) {
5253 int test_ret = 0;
5254
William M. Brack21e4ef22005-01-02 09:53:13 +00005255#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005256 int mem_base;
5257 int ret_val;
5258 xmlDocPtr doc; /* the XML document for canonization */
5259 int n_doc;
5260 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5261 int n_nodes;
5262 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5263 int n_exclusive;
5264 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) */
5265 int n_inclusive_ns_prefixes;
5266 int with_comments; /* include comments in the result (!=0) or not (==0) */
5267 int n_with_comments;
5268 const char * filename; /* the filename to store canonical XML image */
5269 int n_filename;
5270 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5271 int n_compression;
5272
5273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5274 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5275 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5276 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5277 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5278 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5279 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5280 mem_base = xmlMemBlocks();
5281 doc = gen_xmlDocPtr(n_doc, 0);
5282 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5283 exclusive = gen_int(n_exclusive, 2);
5284 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5285 with_comments = gen_int(n_with_comments, 4);
5286 filename = gen_fileoutput(n_filename, 5);
5287 compression = gen_int(n_compression, 6);
5288
5289 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5290 desret_int(ret_val);
5291 call_tests++;
5292 des_xmlDocPtr(n_doc, doc, 0);
5293 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5294 des_int(n_exclusive, exclusive, 2);
5295 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5296 des_int(n_with_comments, with_comments, 4);
5297 des_fileoutput(n_filename, filename, 5);
5298 des_int(n_compression, compression, 6);
5299 xmlResetLastError();
5300 if (mem_base != xmlMemBlocks()) {
5301 printf("Leak of %d blocks found in xmlC14NDocSave",
5302 xmlMemBlocks() - mem_base);
5303 test_ret++;
5304 printf(" %d", n_doc);
5305 printf(" %d", n_nodes);
5306 printf(" %d", n_exclusive);
5307 printf(" %d", n_inclusive_ns_prefixes);
5308 printf(" %d", n_with_comments);
5309 printf(" %d", n_filename);
5310 printf(" %d", n_compression);
5311 printf("\n");
5312 }
5313 }
5314 }
5315 }
5316 }
5317 }
5318 }
5319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005320 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005321#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005322
Daniel Veillarda82b1822004-11-08 16:24:57 +00005323 return(test_ret);
5324}
5325
5326
5327static int
5328test_xmlC14NDocSaveTo(void) {
5329 int test_ret = 0;
5330
William M. Brack21e4ef22005-01-02 09:53:13 +00005331#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005332 int mem_base;
5333 int ret_val;
5334 xmlDocPtr doc; /* the XML document for canonization */
5335 int n_doc;
5336 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5337 int n_nodes;
5338 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5339 int n_exclusive;
5340 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) */
5341 int n_inclusive_ns_prefixes;
5342 int with_comments; /* include comments in the result (!=0) or not (==0) */
5343 int n_with_comments;
5344 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5345 int n_buf;
5346
5347 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5348 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5349 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5350 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5351 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5352 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5353 mem_base = xmlMemBlocks();
5354 doc = gen_xmlDocPtr(n_doc, 0);
5355 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5356 exclusive = gen_int(n_exclusive, 2);
5357 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5358 with_comments = gen_int(n_with_comments, 4);
5359 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5360
5361 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5362 desret_int(ret_val);
5363 call_tests++;
5364 des_xmlDocPtr(n_doc, doc, 0);
5365 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5366 des_int(n_exclusive, exclusive, 2);
5367 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5368 des_int(n_with_comments, with_comments, 4);
5369 des_xmlOutputBufferPtr(n_buf, buf, 5);
5370 xmlResetLastError();
5371 if (mem_base != xmlMemBlocks()) {
5372 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5373 xmlMemBlocks() - mem_base);
5374 test_ret++;
5375 printf(" %d", n_doc);
5376 printf(" %d", n_nodes);
5377 printf(" %d", n_exclusive);
5378 printf(" %d", n_inclusive_ns_prefixes);
5379 printf(" %d", n_with_comments);
5380 printf(" %d", n_buf);
5381 printf("\n");
5382 }
5383 }
5384 }
5385 }
5386 }
5387 }
5388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005389 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005390#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005391
Daniel Veillarda82b1822004-11-08 16:24:57 +00005392 return(test_ret);
5393}
5394
5395
5396static int
5397test_xmlC14NExecute(void) {
5398 int test_ret = 0;
5399
5400
5401 /* missing type support */
5402 return(test_ret);
5403}
5404
5405static int
5406test_c14n(void) {
5407 int test_ret = 0;
5408
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005409 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005410 test_ret += test_xmlC14NDocDumpMemory();
5411 test_ret += test_xmlC14NDocSave();
5412 test_ret += test_xmlC14NDocSaveTo();
5413 test_ret += test_xmlC14NExecute();
5414
5415 if (test_ret != 0)
5416 printf("Module c14n: %d errors\n", test_ret);
5417 return(test_ret);
5418}
Daniel Veillarda521d282004-11-09 14:59:59 +00005419#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005420
Daniel Veillardce682bc2004-11-05 17:22:25 +00005421#define gen_nb_xmlCatalogPtr 1
5422static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5423 return(NULL);
5424}
5425static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5426}
Daniel Veillarda521d282004-11-09 14:59:59 +00005427#endif
5428
Daniel Veillardce682bc2004-11-05 17:22:25 +00005429
Daniel Veillardd93f6252004-11-02 15:53:51 +00005430static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005431test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005433
William M. Brack21e4ef22005-01-02 09:53:13 +00005434#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005435 int mem_base;
5436 int ret_val;
5437 xmlCatalogPtr catal; /* a Catalog */
5438 int n_catal;
5439 xmlChar * type; /* the type of record to add to the catalog */
5440 int n_type;
5441 xmlChar * orig; /* the system, public or prefix to match */
5442 int n_orig;
5443 xmlChar * replace; /* the replacement value for the match */
5444 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005445
Daniel Veillardce682bc2004-11-05 17:22:25 +00005446 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5447 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5448 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5449 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5450 mem_base = xmlMemBlocks();
5451 catal = gen_xmlCatalogPtr(n_catal, 0);
5452 type = gen_const_xmlChar_ptr(n_type, 1);
5453 orig = gen_const_xmlChar_ptr(n_orig, 2);
5454 replace = gen_const_xmlChar_ptr(n_replace, 3);
5455
William M. Brackf13f77f2004-11-12 16:03:48 +00005456 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005457 desret_int(ret_val);
5458 call_tests++;
5459 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005460 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5461 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5462 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005463 xmlResetLastError();
5464 if (mem_base != xmlMemBlocks()) {
5465 printf("Leak of %d blocks found in xmlACatalogAdd",
5466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005467 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005468 printf(" %d", n_catal);
5469 printf(" %d", n_type);
5470 printf(" %d", n_orig);
5471 printf(" %d", n_replace);
5472 printf("\n");
5473 }
5474 }
5475 }
5476 }
5477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005478 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005479#endif
5480
Daniel Veillard42595322004-11-08 10:52:06 +00005481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005482}
5483
5484
5485static int
5486test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005488
William M. Brack21e4ef22005-01-02 09:53:13 +00005489#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005490 int mem_base;
5491 xmlCatalogPtr catal; /* a Catalog */
5492 int n_catal;
5493 FILE * out; /* the file. */
5494 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005495
Daniel Veillardce682bc2004-11-05 17:22:25 +00005496 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5497 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5498 mem_base = xmlMemBlocks();
5499 catal = gen_xmlCatalogPtr(n_catal, 0);
5500 out = gen_FILE_ptr(n_out, 1);
5501
5502 xmlACatalogDump(catal, out);
5503 call_tests++;
5504 des_xmlCatalogPtr(n_catal, catal, 0);
5505 des_FILE_ptr(n_out, out, 1);
5506 xmlResetLastError();
5507 if (mem_base != xmlMemBlocks()) {
5508 printf("Leak of %d blocks found in xmlACatalogDump",
5509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 printf(" %d", n_catal);
5512 printf(" %d", n_out);
5513 printf("\n");
5514 }
5515 }
5516 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005517 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005518#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005519
Daniel Veillard42595322004-11-08 10:52:06 +00005520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005521}
5522
5523
5524static int
5525test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005527
William M. Brack21e4ef22005-01-02 09:53:13 +00005528#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005529 int mem_base;
5530 int ret_val;
5531 xmlCatalogPtr catal; /* a Catalog */
5532 int n_catal;
5533 xmlChar * value; /* the value to remove */
5534 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005535
Daniel Veillardce682bc2004-11-05 17:22:25 +00005536 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5537 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5538 mem_base = xmlMemBlocks();
5539 catal = gen_xmlCatalogPtr(n_catal, 0);
5540 value = gen_const_xmlChar_ptr(n_value, 1);
5541
William M. Brackf13f77f2004-11-12 16:03:48 +00005542 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005543 desret_int(ret_val);
5544 call_tests++;
5545 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005546 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005547 xmlResetLastError();
5548 if (mem_base != xmlMemBlocks()) {
5549 printf("Leak of %d blocks found in xmlACatalogRemove",
5550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 printf(" %d", n_catal);
5553 printf(" %d", n_value);
5554 printf("\n");
5555 }
5556 }
5557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005558 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005559#endif
5560
Daniel Veillard42595322004-11-08 10:52:06 +00005561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005562}
5563
5564
5565static int
5566test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005568
William M. Brack21e4ef22005-01-02 09:53:13 +00005569#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005570 int mem_base;
5571 xmlChar * ret_val;
5572 xmlCatalogPtr catal; /* a Catalog */
5573 int n_catal;
5574 xmlChar * pubID; /* the public ID string */
5575 int n_pubID;
5576 xmlChar * sysID; /* the system ID string */
5577 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005578
Daniel Veillardce682bc2004-11-05 17:22:25 +00005579 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5580 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5581 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5582 mem_base = xmlMemBlocks();
5583 catal = gen_xmlCatalogPtr(n_catal, 0);
5584 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5585 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5586
William M. Brackf13f77f2004-11-12 16:03:48 +00005587 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005588 desret_xmlChar_ptr(ret_val);
5589 call_tests++;
5590 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005591 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5592 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005593 xmlResetLastError();
5594 if (mem_base != xmlMemBlocks()) {
5595 printf("Leak of %d blocks found in xmlACatalogResolve",
5596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005597 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005598 printf(" %d", n_catal);
5599 printf(" %d", n_pubID);
5600 printf(" %d", n_sysID);
5601 printf("\n");
5602 }
5603 }
5604 }
5605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005606 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005607#endif
5608
Daniel Veillard42595322004-11-08 10:52:06 +00005609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005610}
5611
5612
5613static int
5614test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005616
William M. Brack21e4ef22005-01-02 09:53:13 +00005617#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005618 int mem_base;
5619 xmlChar * ret_val;
5620 xmlCatalogPtr catal; /* a Catalog */
5621 int n_catal;
5622 xmlChar * pubID; /* the public ID string */
5623 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005624
Daniel Veillardce682bc2004-11-05 17:22:25 +00005625 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5626 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5627 mem_base = xmlMemBlocks();
5628 catal = gen_xmlCatalogPtr(n_catal, 0);
5629 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5630
William M. Brackf13f77f2004-11-12 16:03:48 +00005631 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005632 desret_xmlChar_ptr(ret_val);
5633 call_tests++;
5634 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005635 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005636 xmlResetLastError();
5637 if (mem_base != xmlMemBlocks()) {
5638 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005640 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005641 printf(" %d", n_catal);
5642 printf(" %d", n_pubID);
5643 printf("\n");
5644 }
5645 }
5646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005647 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005648#endif
5649
Daniel Veillard42595322004-11-08 10:52:06 +00005650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005651}
5652
5653
5654static int
5655test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005657
William M. Brack21e4ef22005-01-02 09:53:13 +00005658#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005659 int mem_base;
5660 xmlChar * ret_val;
5661 xmlCatalogPtr catal; /* a Catalog */
5662 int n_catal;
5663 xmlChar * sysID; /* the system ID string */
5664 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005665
Daniel Veillardce682bc2004-11-05 17:22:25 +00005666 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5667 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5668 mem_base = xmlMemBlocks();
5669 catal = gen_xmlCatalogPtr(n_catal, 0);
5670 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5671
William M. Brackf13f77f2004-11-12 16:03:48 +00005672 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005673 desret_xmlChar_ptr(ret_val);
5674 call_tests++;
5675 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005676 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005677 xmlResetLastError();
5678 if (mem_base != xmlMemBlocks()) {
5679 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005681 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005682 printf(" %d", n_catal);
5683 printf(" %d", n_sysID);
5684 printf("\n");
5685 }
5686 }
5687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005688 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005689#endif
5690
Daniel Veillard42595322004-11-08 10:52:06 +00005691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005692}
5693
5694
5695static int
5696test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005698
William M. Brack21e4ef22005-01-02 09:53:13 +00005699#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005700 int mem_base;
5701 xmlChar * ret_val;
5702 xmlCatalogPtr catal; /* a Catalog */
5703 int n_catal;
5704 xmlChar * URI; /* the URI */
5705 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005706
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5708 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5709 mem_base = xmlMemBlocks();
5710 catal = gen_xmlCatalogPtr(n_catal, 0);
5711 URI = gen_const_xmlChar_ptr(n_URI, 1);
5712
William M. Brackf13f77f2004-11-12 16:03:48 +00005713 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005714 desret_xmlChar_ptr(ret_val);
5715 call_tests++;
5716 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005717 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005718 xmlResetLastError();
5719 if (mem_base != xmlMemBlocks()) {
5720 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005722 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005723 printf(" %d", n_catal);
5724 printf(" %d", n_URI);
5725 printf("\n");
5726 }
5727 }
5728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005729 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005730#endif
5731
Daniel Veillard42595322004-11-08 10:52:06 +00005732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005733}
5734
5735
5736static int
5737test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005739
William M. Brack21e4ef22005-01-02 09:53:13 +00005740#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005741 int mem_base;
5742 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005743 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005744 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005745 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005746 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005747 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005748 int n_replace;
5749
5750 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5751 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5752 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005754 type = gen_const_xmlChar_ptr(n_type, 0);
5755 orig = gen_const_xmlChar_ptr(n_orig, 1);
5756 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005757
William M. Brackf13f77f2004-11-12 16:03:48 +00005758 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759 desret_int(ret_val);
5760 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005761 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5762 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5763 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005764 xmlResetLastError();
5765 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005766 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005768 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005769 printf(" %d", n_type);
5770 printf(" %d", n_orig);
5771 printf(" %d", n_replace);
5772 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005773 }
5774 }
5775 }
5776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005777 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778#endif
5779
Daniel Veillard42595322004-11-08 10:52:06 +00005780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005781}
5782
5783
5784static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005785test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787
William M. Brack21e4ef22005-01-02 09:53:13 +00005788#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005789
Daniel Veillardd93f6252004-11-02 15:53:51 +00005790
5791 xmlCatalogCleanup();
5792 call_tests++;
5793 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005794 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005795#endif
5796
Daniel Veillard42595322004-11-08 10:52:06 +00005797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005798}
5799
5800
5801static int
5802test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005804
William M. Brack21e4ef22005-01-02 09:53:13 +00005805#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005806 int ret_val;
5807
5808
5809 ret_val = xmlCatalogConvert();
5810 desret_int(ret_val);
5811 call_tests++;
5812 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005813 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005814#endif
5815
Daniel Veillard42595322004-11-08 10:52:06 +00005816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005817}
5818
5819
5820static int
5821test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
William M. Brack21e4ef22005-01-02 09:53:13 +00005824#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005825 int mem_base;
5826 FILE * out; /* the file. */
5827 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005828
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005829 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5830 mem_base = xmlMemBlocks();
5831 out = gen_FILE_ptr(n_out, 0);
5832
5833 xmlCatalogDump(out);
5834 call_tests++;
5835 des_FILE_ptr(n_out, out, 0);
5836 xmlResetLastError();
5837 if (mem_base != xmlMemBlocks()) {
5838 printf("Leak of %d blocks found in xmlCatalogDump",
5839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005840 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005841 printf(" %d", n_out);
5842 printf("\n");
5843 }
5844 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005845 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005846#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005847
Daniel Veillard42595322004-11-08 10:52:06 +00005848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005849}
5850
5851
5852static int
5853test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005855
William M. Brack21e4ef22005-01-02 09:53:13 +00005856#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005857 int mem_base;
5858 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005859
Daniel Veillard57b25162004-11-06 14:50:18 +00005860 mem_base = xmlMemBlocks();
5861
5862 ret_val = xmlCatalogGetDefaults();
5863 desret_xmlCatalogAllow(ret_val);
5864 call_tests++;
5865 xmlResetLastError();
5866 if (mem_base != xmlMemBlocks()) {
5867 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005869 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005870 printf("\n");
5871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005872 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005873#endif
5874
Daniel Veillard42595322004-11-08 10:52:06 +00005875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005876}
5877
5878
5879static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005882
William M. Brack21e4ef22005-01-02 09:53:13 +00005883#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005884 int mem_base;
5885 int ret_val;
5886 xmlCatalogPtr catal; /* should this create an SGML catalog */
5887 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005888
Daniel Veillardce682bc2004-11-05 17:22:25 +00005889 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5890 mem_base = xmlMemBlocks();
5891 catal = gen_xmlCatalogPtr(n_catal, 0);
5892
5893 ret_val = xmlCatalogIsEmpty(catal);
5894 desret_int(ret_val);
5895 call_tests++;
5896 des_xmlCatalogPtr(n_catal, catal, 0);
5897 xmlResetLastError();
5898 if (mem_base != xmlMemBlocks()) {
5899 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005901 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005902 printf(" %d", n_catal);
5903 printf("\n");
5904 }
5905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005906 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005907#endif
5908
Daniel Veillard42595322004-11-08 10:52:06 +00005909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005910}
5911
5912
5913static int
5914test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005916
William M. Brack21e4ef22005-01-02 09:53:13 +00005917#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005918 int mem_base;
5919 xmlChar * ret_val;
5920 void * catalogs; /* a document's list of catalogs */
5921 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005922 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005923 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005924 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005925 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005926
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005927 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5928 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5929 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005931 catalogs = gen_void_ptr(n_catalogs, 0);
5932 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5933 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005934
William M. Brackf13f77f2004-11-12 16:03:48 +00005935 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005936 desret_xmlChar_ptr(ret_val);
5937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005938 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005939 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5940 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005941 xmlResetLastError();
5942 if (mem_base != xmlMemBlocks()) {
5943 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005945 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005946 printf(" %d", n_catalogs);
5947 printf(" %d", n_pubID);
5948 printf(" %d", n_sysID);
5949 printf("\n");
5950 }
5951 }
5952 }
5953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005954 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005955#endif
5956
Daniel Veillard42595322004-11-08 10:52:06 +00005957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005958}
5959
5960
5961static int
5962test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005964
William M. Brack21e4ef22005-01-02 09:53:13 +00005965#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005966 int mem_base;
5967 xmlChar * ret_val;
5968 void * catalogs; /* a document's list of catalogs */
5969 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005970 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005971 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005972
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005973 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5974 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005976 catalogs = gen_void_ptr(n_catalogs, 0);
5977 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005978
William M. Brackf13f77f2004-11-12 16:03:48 +00005979 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005980 desret_xmlChar_ptr(ret_val);
5981 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005982 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005983 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005984 xmlResetLastError();
5985 if (mem_base != xmlMemBlocks()) {
5986 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005988 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005989 printf(" %d", n_catalogs);
5990 printf(" %d", n_URI);
5991 printf("\n");
5992 }
5993 }
5994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005995 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005996#endif
5997
Daniel Veillard42595322004-11-08 10:52:06 +00005998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005999}
6000
6001
6002static int
6003test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006005
William M. Brack21e4ef22005-01-02 09:53:13 +00006006#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006007 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006008 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006009 int n_value;
6010
6011 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006012 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006013
William M. Brackf13f77f2004-11-12 16:03:48 +00006014 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006015 desret_int(ret_val);
6016 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006017 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006018 xmlResetLastError();
6019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006020 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006021#endif
6022
Daniel Veillard42595322004-11-08 10:52:06 +00006023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006024}
6025
6026
6027static int
6028test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006030
William M. Brack21e4ef22005-01-02 09:53:13 +00006031#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006032 int mem_base;
6033 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006034 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006035 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006036 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006038
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006039 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6040 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006042 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6043 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006044
William M. Brackf13f77f2004-11-12 16:03:48 +00006045 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006046 desret_xmlChar_ptr(ret_val);
6047 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006048 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6049 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006050 xmlResetLastError();
6051 if (mem_base != xmlMemBlocks()) {
6052 printf("Leak of %d blocks found in xmlCatalogResolve",
6053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006054 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006055 printf(" %d", n_pubID);
6056 printf(" %d", n_sysID);
6057 printf("\n");
6058 }
6059 }
6060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006061 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006062#endif
6063
Daniel Veillard42595322004-11-08 10:52:06 +00006064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006065}
6066
6067
6068static int
6069test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006071
William M. Brack21e4ef22005-01-02 09:53:13 +00006072#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006073 int mem_base;
6074 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006075 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006077
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006078 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006080 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081
William M. Brackf13f77f2004-11-12 16:03:48 +00006082 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006083 desret_xmlChar_ptr(ret_val);
6084 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006085 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006086 xmlResetLastError();
6087 if (mem_base != xmlMemBlocks()) {
6088 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006090 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006091 printf(" %d", n_pubID);
6092 printf("\n");
6093 }
6094 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006095 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006096#endif
6097
Daniel Veillard42595322004-11-08 10:52:06 +00006098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006099}
6100
6101
6102static int
6103test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006105
William M. Brack21e4ef22005-01-02 09:53:13 +00006106#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006107 int mem_base;
6108 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006109 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006111
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006112 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006114 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115
William M. Brackf13f77f2004-11-12 16:03:48 +00006116 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006117 desret_xmlChar_ptr(ret_val);
6118 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006119 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006120 xmlResetLastError();
6121 if (mem_base != xmlMemBlocks()) {
6122 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006124 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006125 printf(" %d", n_sysID);
6126 printf("\n");
6127 }
6128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006129 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006130#endif
6131
Daniel Veillard42595322004-11-08 10:52:06 +00006132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006133}
6134
6135
6136static int
6137test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006139
William M. Brack21e4ef22005-01-02 09:53:13 +00006140#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006141 int mem_base;
6142 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006143 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006144 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006145
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006146 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006148 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006149
William M. Brackf13f77f2004-11-12 16:03:48 +00006150 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006151 desret_xmlChar_ptr(ret_val);
6152 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006153 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006154 xmlResetLastError();
6155 if (mem_base != xmlMemBlocks()) {
6156 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006158 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006159 printf(" %d", n_URI);
6160 printf("\n");
6161 }
6162 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006163 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006164#endif
6165
Daniel Veillard42595322004-11-08 10:52:06 +00006166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006167}
6168
6169
6170static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006171test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006173
William M. Brack21e4ef22005-01-02 09:53:13 +00006174#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006175 int mem_base;
6176 xmlCatalogPrefer ret_val;
6177 xmlCatalogPrefer prefer; /* the default preference for delegation */
6178 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006179
Daniel Veillard57b25162004-11-06 14:50:18 +00006180 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6181 mem_base = xmlMemBlocks();
6182 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6183
6184 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6185 desret_xmlCatalogPrefer(ret_val);
6186 call_tests++;
6187 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6188 xmlResetLastError();
6189 if (mem_base != xmlMemBlocks()) {
6190 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006192 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006193 printf(" %d", n_prefer);
6194 printf("\n");
6195 }
6196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006197 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006198#endif
6199
Daniel Veillard42595322004-11-08 10:52:06 +00006200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006201}
6202
6203
6204static int
6205test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006207
William M. Brack21e4ef22005-01-02 09:53:13 +00006208#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006209 int mem_base;
6210 xmlCatalogAllow allow; /* what catalogs should be accepted */
6211 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006212
Daniel Veillard57b25162004-11-06 14:50:18 +00006213 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6214 mem_base = xmlMemBlocks();
6215 allow = gen_xmlCatalogAllow(n_allow, 0);
6216
6217 xmlCatalogSetDefaults(allow);
6218 call_tests++;
6219 des_xmlCatalogAllow(n_allow, allow, 0);
6220 xmlResetLastError();
6221 if (mem_base != xmlMemBlocks()) {
6222 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006224 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006225 printf(" %d", n_allow);
6226 printf("\n");
6227 }
6228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006229 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006230#endif
6231
Daniel Veillard42595322004-11-08 10:52:06 +00006232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006233}
6234
6235
6236static int
6237test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239
William M. Brack21e4ef22005-01-02 09:53:13 +00006240#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006241 int mem_base;
6242 int ret_val;
6243 xmlCatalogPtr catal; /* the catalog */
6244 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006245
Daniel Veillardce682bc2004-11-05 17:22:25 +00006246 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6247 mem_base = xmlMemBlocks();
6248 catal = gen_xmlCatalogPtr(n_catal, 0);
6249
6250 ret_val = xmlConvertSGMLCatalog(catal);
6251 desret_int(ret_val);
6252 call_tests++;
6253 des_xmlCatalogPtr(n_catal, catal, 0);
6254 xmlResetLastError();
6255 if (mem_base != xmlMemBlocks()) {
6256 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006258 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006259 printf(" %d", n_catal);
6260 printf("\n");
6261 }
6262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006263 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006264#endif
6265
Daniel Veillard42595322004-11-08 10:52:06 +00006266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006267}
6268
6269
6270static int
6271test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006273
William M. Brack21e4ef22005-01-02 09:53:13 +00006274#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006275 int mem_base;
6276
6277 mem_base = xmlMemBlocks();
6278
6279 xmlInitializeCatalog();
6280 call_tests++;
6281 xmlResetLastError();
6282 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006283 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006285 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006286 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006288 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006289#endif
6290
Daniel Veillard42595322004-11-08 10:52:06 +00006291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006292}
6293
6294
6295static int
6296test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006298
6299
6300 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006302}
6303
6304
6305static int
6306test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308
William M. Brack21e4ef22005-01-02 09:53:13 +00006309#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006310 int ret_val;
6311 const char * filename; /* a file path */
6312 int n_filename;
6313
6314 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006315 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006316
6317 ret_val = xmlLoadCatalog(filename);
6318 desret_int(ret_val);
6319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006320 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006321 xmlResetLastError();
6322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006323 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324#endif
6325
Daniel Veillard42595322004-11-08 10:52:06 +00006326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006327}
6328
6329
6330static int
6331test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006333
William M. Brack21e4ef22005-01-02 09:53:13 +00006334#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006335 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336 int n_pathss;
6337
6338 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006339 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340
William M. Brackf13f77f2004-11-12 16:03:48 +00006341 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006343 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006344 xmlResetLastError();
6345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006346 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006347#endif
6348
Daniel Veillard42595322004-11-08 10:52:06 +00006349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006350}
6351
6352
6353static int
6354test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006356
6357
6358 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006360}
6361
6362
6363static int
6364test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006366
6367
6368 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006370}
6371
6372
6373static int
6374test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006376
William M. Brack21e4ef22005-01-02 09:53:13 +00006377#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006378 int mem_base;
6379 xmlDocPtr ret_val;
6380 const char * filename; /* the filename */
6381 int n_filename;
6382
6383 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6384 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006385 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006386
6387 ret_val = xmlParseCatalogFile(filename);
6388 desret_xmlDocPtr(ret_val);
6389 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006390 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006391 xmlResetLastError();
6392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006393 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006396 printf(" %d", n_filename);
6397 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006398 }
6399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006400 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006401#endif
6402
Daniel Veillard42595322004-11-08 10:52:06 +00006403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006404}
6405
6406static int
6407test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006409
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006410 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006411 test_ret += test_xmlACatalogAdd();
6412 test_ret += test_xmlACatalogDump();
6413 test_ret += test_xmlACatalogRemove();
6414 test_ret += test_xmlACatalogResolve();
6415 test_ret += test_xmlACatalogResolvePublic();
6416 test_ret += test_xmlACatalogResolveSystem();
6417 test_ret += test_xmlACatalogResolveURI();
6418 test_ret += test_xmlCatalogAdd();
6419 test_ret += test_xmlCatalogCleanup();
6420 test_ret += test_xmlCatalogConvert();
6421 test_ret += test_xmlCatalogDump();
6422 test_ret += test_xmlCatalogGetDefaults();
6423 test_ret += test_xmlCatalogIsEmpty();
6424 test_ret += test_xmlCatalogLocalResolve();
6425 test_ret += test_xmlCatalogLocalResolveURI();
6426 test_ret += test_xmlCatalogRemove();
6427 test_ret += test_xmlCatalogResolve();
6428 test_ret += test_xmlCatalogResolvePublic();
6429 test_ret += test_xmlCatalogResolveSystem();
6430 test_ret += test_xmlCatalogResolveURI();
6431 test_ret += test_xmlCatalogSetDefaultPrefer();
6432 test_ret += test_xmlCatalogSetDefaults();
6433 test_ret += test_xmlConvertSGMLCatalog();
6434 test_ret += test_xmlInitializeCatalog();
6435 test_ret += test_xmlLoadACatalog();
6436 test_ret += test_xmlLoadCatalog();
6437 test_ret += test_xmlLoadCatalogs();
6438 test_ret += test_xmlLoadSGMLSuperCatalog();
6439 test_ret += test_xmlNewCatalog();
6440 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006441
Daniel Veillard42595322004-11-08 10:52:06 +00006442 if (test_ret != 0)
6443 printf("Module catalog: %d errors\n", test_ret);
6444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006445}
6446
Daniel Veillardce682bc2004-11-05 17:22:25 +00006447#define gen_nb_const_xmlChRangeGroupPtr 1
6448static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6449 return(NULL);
6450}
6451static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6452}
6453
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454static int
6455test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006457
Daniel Veillardce682bc2004-11-05 17:22:25 +00006458 int mem_base;
6459 int ret_val;
6460 unsigned int val; /* character to be validated */
6461 int n_val;
6462 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6463 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006464
Daniel Veillardce682bc2004-11-05 17:22:25 +00006465 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6466 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6467 mem_base = xmlMemBlocks();
6468 val = gen_unsigned_int(n_val, 0);
6469 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6470
William M. Brackf13f77f2004-11-12 16:03:48 +00006471 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006472 desret_int(ret_val);
6473 call_tests++;
6474 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006475 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006476 xmlResetLastError();
6477 if (mem_base != xmlMemBlocks()) {
6478 printf("Leak of %d blocks found in xmlCharInRange",
6479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006481 printf(" %d", n_val);
6482 printf(" %d", n_rptr);
6483 printf("\n");
6484 }
6485 }
6486 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006488
Daniel Veillard42595322004-11-08 10:52:06 +00006489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006490}
6491
6492
6493static int
6494test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006496
Daniel Veillard3d97e662004-11-04 10:49:00 +00006497 int mem_base;
6498 int ret_val;
6499 unsigned int ch; /* character to validate */
6500 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006501
Daniel Veillard3d97e662004-11-04 10:49:00 +00006502 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6503 mem_base = xmlMemBlocks();
6504 ch = gen_unsigned_int(n_ch, 0);
6505
6506 ret_val = xmlIsBaseChar(ch);
6507 desret_int(ret_val);
6508 call_tests++;
6509 des_unsigned_int(n_ch, ch, 0);
6510 xmlResetLastError();
6511 if (mem_base != xmlMemBlocks()) {
6512 printf("Leak of %d blocks found in xmlIsBaseChar",
6513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006514 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006515 printf(" %d", n_ch);
6516 printf("\n");
6517 }
6518 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006520
Daniel Veillard42595322004-11-08 10:52:06 +00006521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522}
6523
6524
6525static int
6526test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006528
Daniel Veillard3d97e662004-11-04 10:49:00 +00006529 int mem_base;
6530 int ret_val;
6531 unsigned int ch; /* character to validate */
6532 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006533
Daniel Veillard3d97e662004-11-04 10:49:00 +00006534 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6535 mem_base = xmlMemBlocks();
6536 ch = gen_unsigned_int(n_ch, 0);
6537
6538 ret_val = xmlIsBlank(ch);
6539 desret_int(ret_val);
6540 call_tests++;
6541 des_unsigned_int(n_ch, ch, 0);
6542 xmlResetLastError();
6543 if (mem_base != xmlMemBlocks()) {
6544 printf("Leak of %d blocks found in xmlIsBlank",
6545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006546 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 printf(" %d", n_ch);
6548 printf("\n");
6549 }
6550 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006551 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006552
Daniel Veillard42595322004-11-08 10:52:06 +00006553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006554}
6555
6556
6557static int
6558test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006560
Daniel Veillard3d97e662004-11-04 10:49:00 +00006561 int mem_base;
6562 int ret_val;
6563 unsigned int ch; /* character to validate */
6564 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006565
Daniel Veillard3d97e662004-11-04 10:49:00 +00006566 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6567 mem_base = xmlMemBlocks();
6568 ch = gen_unsigned_int(n_ch, 0);
6569
6570 ret_val = xmlIsChar(ch);
6571 desret_int(ret_val);
6572 call_tests++;
6573 des_unsigned_int(n_ch, ch, 0);
6574 xmlResetLastError();
6575 if (mem_base != xmlMemBlocks()) {
6576 printf("Leak of %d blocks found in xmlIsChar",
6577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006578 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 printf(" %d", n_ch);
6580 printf("\n");
6581 }
6582 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006584
Daniel Veillard42595322004-11-08 10:52:06 +00006585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006586}
6587
6588
6589static int
6590test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006592
Daniel Veillard3d97e662004-11-04 10:49:00 +00006593 int mem_base;
6594 int ret_val;
6595 unsigned int ch; /* character to validate */
6596 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006597
Daniel Veillard3d97e662004-11-04 10:49:00 +00006598 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6599 mem_base = xmlMemBlocks();
6600 ch = gen_unsigned_int(n_ch, 0);
6601
6602 ret_val = xmlIsCombining(ch);
6603 desret_int(ret_val);
6604 call_tests++;
6605 des_unsigned_int(n_ch, ch, 0);
6606 xmlResetLastError();
6607 if (mem_base != xmlMemBlocks()) {
6608 printf("Leak of %d blocks found in xmlIsCombining",
6609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006610 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006611 printf(" %d", n_ch);
6612 printf("\n");
6613 }
6614 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006616
Daniel Veillard42595322004-11-08 10:52:06 +00006617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006618}
6619
6620
6621static int
6622test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006624
Daniel Veillard3d97e662004-11-04 10:49:00 +00006625 int mem_base;
6626 int ret_val;
6627 unsigned int ch; /* character to validate */
6628 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006629
Daniel Veillard3d97e662004-11-04 10:49:00 +00006630 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6631 mem_base = xmlMemBlocks();
6632 ch = gen_unsigned_int(n_ch, 0);
6633
6634 ret_val = xmlIsDigit(ch);
6635 desret_int(ret_val);
6636 call_tests++;
6637 des_unsigned_int(n_ch, ch, 0);
6638 xmlResetLastError();
6639 if (mem_base != xmlMemBlocks()) {
6640 printf("Leak of %d blocks found in xmlIsDigit",
6641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006642 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006643 printf(" %d", n_ch);
6644 printf("\n");
6645 }
6646 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006648
Daniel Veillard42595322004-11-08 10:52:06 +00006649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006650}
6651
6652
6653static int
6654test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006656
Daniel Veillard3d97e662004-11-04 10:49:00 +00006657 int mem_base;
6658 int ret_val;
6659 unsigned int ch; /* character to validate */
6660 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006661
Daniel Veillard3d97e662004-11-04 10:49:00 +00006662 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6663 mem_base = xmlMemBlocks();
6664 ch = gen_unsigned_int(n_ch, 0);
6665
6666 ret_val = xmlIsExtender(ch);
6667 desret_int(ret_val);
6668 call_tests++;
6669 des_unsigned_int(n_ch, ch, 0);
6670 xmlResetLastError();
6671 if (mem_base != xmlMemBlocks()) {
6672 printf("Leak of %d blocks found in xmlIsExtender",
6673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006674 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006675 printf(" %d", n_ch);
6676 printf("\n");
6677 }
6678 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006680
Daniel Veillard42595322004-11-08 10:52:06 +00006681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006682}
6683
6684
6685static int
6686test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006688
Daniel Veillard3d97e662004-11-04 10:49:00 +00006689 int mem_base;
6690 int ret_val;
6691 unsigned int ch; /* character to validate */
6692 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006693
Daniel Veillard3d97e662004-11-04 10:49:00 +00006694 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6695 mem_base = xmlMemBlocks();
6696 ch = gen_unsigned_int(n_ch, 0);
6697
6698 ret_val = xmlIsIdeographic(ch);
6699 desret_int(ret_val);
6700 call_tests++;
6701 des_unsigned_int(n_ch, ch, 0);
6702 xmlResetLastError();
6703 if (mem_base != xmlMemBlocks()) {
6704 printf("Leak of %d blocks found in xmlIsIdeographic",
6705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006706 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006707 printf(" %d", n_ch);
6708 printf("\n");
6709 }
6710 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006712
Daniel Veillard42595322004-11-08 10:52:06 +00006713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006714}
6715
6716
6717static int
6718test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006720
Daniel Veillard3d97e662004-11-04 10:49:00 +00006721 int mem_base;
6722 int ret_val;
6723 unsigned int ch; /* character to validate */
6724 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006725
Daniel Veillard3d97e662004-11-04 10:49:00 +00006726 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6727 mem_base = xmlMemBlocks();
6728 ch = gen_unsigned_int(n_ch, 0);
6729
6730 ret_val = xmlIsPubidChar(ch);
6731 desret_int(ret_val);
6732 call_tests++;
6733 des_unsigned_int(n_ch, ch, 0);
6734 xmlResetLastError();
6735 if (mem_base != xmlMemBlocks()) {
6736 printf("Leak of %d blocks found in xmlIsPubidChar",
6737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006738 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006739 printf(" %d", n_ch);
6740 printf("\n");
6741 }
6742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006744
Daniel Veillard42595322004-11-08 10:52:06 +00006745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006746}
6747
6748static int
6749test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006751
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006752 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006753 test_ret += test_xmlCharInRange();
6754 test_ret += test_xmlIsBaseChar();
6755 test_ret += test_xmlIsBlank();
6756 test_ret += test_xmlIsChar();
6757 test_ret += test_xmlIsCombining();
6758 test_ret += test_xmlIsDigit();
6759 test_ret += test_xmlIsExtender();
6760 test_ret += test_xmlIsIdeographic();
6761 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006762
Daniel Veillard42595322004-11-08 10:52:06 +00006763 if (test_ret != 0)
6764 printf("Module chvalid: %d errors\n", test_ret);
6765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006766}
6767
6768static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006769test_xmlBoolToText(void) {
6770 int test_ret = 0;
6771
William M. Brack21e4ef22005-01-02 09:53:13 +00006772#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006773 int mem_base;
6774 const char * ret_val;
6775 int boolval; /* a bool to turn into text */
6776 int n_boolval;
6777
6778 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6779 mem_base = xmlMemBlocks();
6780 boolval = gen_int(n_boolval, 0);
6781
6782 ret_val = xmlBoolToText(boolval);
6783 desret_const_char_ptr(ret_val);
6784 call_tests++;
6785 des_int(n_boolval, boolval, 0);
6786 xmlResetLastError();
6787 if (mem_base != xmlMemBlocks()) {
6788 printf("Leak of %d blocks found in xmlBoolToText",
6789 xmlMemBlocks() - mem_base);
6790 test_ret++;
6791 printf(" %d", n_boolval);
6792 printf("\n");
6793 }
6794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006795 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006796#endif
6797
Daniel Veillarda82b1822004-11-08 16:24:57 +00006798 return(test_ret);
6799}
6800
6801
6802static int
6803test_xmlDebugCheckDocument(void) {
6804 int test_ret = 0;
6805
William M. Brack21e4ef22005-01-02 09:53:13 +00006806#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006807 int mem_base;
6808 int ret_val;
6809 FILE * output; /* the FILE * for the output */
6810 int n_output;
6811 xmlDocPtr doc; /* the document */
6812 int n_doc;
6813
6814 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6815 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6816 mem_base = xmlMemBlocks();
6817 output = gen_debug_FILE_ptr(n_output, 0);
6818 doc = gen_xmlDocPtr(n_doc, 1);
6819
6820 ret_val = xmlDebugCheckDocument(output, doc);
6821 desret_int(ret_val);
6822 call_tests++;
6823 des_debug_FILE_ptr(n_output, output, 0);
6824 des_xmlDocPtr(n_doc, doc, 1);
6825 xmlResetLastError();
6826 if (mem_base != xmlMemBlocks()) {
6827 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6828 xmlMemBlocks() - mem_base);
6829 test_ret++;
6830 printf(" %d", n_output);
6831 printf(" %d", n_doc);
6832 printf("\n");
6833 }
6834 }
6835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006836 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006837#endif
6838
Daniel Veillarda82b1822004-11-08 16:24:57 +00006839 return(test_ret);
6840}
6841
6842
6843static int
6844test_xmlDebugDumpAttr(void) {
6845 int test_ret = 0;
6846
William M. Brack21e4ef22005-01-02 09:53:13 +00006847#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006848 int mem_base;
6849 FILE * output; /* the FILE * for the output */
6850 int n_output;
6851 xmlAttrPtr attr; /* the attribute */
6852 int n_attr;
6853 int depth; /* the indentation level. */
6854 int n_depth;
6855
6856 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6857 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6858 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6859 mem_base = xmlMemBlocks();
6860 output = gen_debug_FILE_ptr(n_output, 0);
6861 attr = gen_xmlAttrPtr(n_attr, 1);
6862 depth = gen_int(n_depth, 2);
6863
6864 xmlDebugDumpAttr(output, attr, depth);
6865 call_tests++;
6866 des_debug_FILE_ptr(n_output, output, 0);
6867 des_xmlAttrPtr(n_attr, attr, 1);
6868 des_int(n_depth, depth, 2);
6869 xmlResetLastError();
6870 if (mem_base != xmlMemBlocks()) {
6871 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6872 xmlMemBlocks() - mem_base);
6873 test_ret++;
6874 printf(" %d", n_output);
6875 printf(" %d", n_attr);
6876 printf(" %d", n_depth);
6877 printf("\n");
6878 }
6879 }
6880 }
6881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006882 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006883#endif
6884
Daniel Veillarda82b1822004-11-08 16:24:57 +00006885 return(test_ret);
6886}
6887
6888
6889static int
6890test_xmlDebugDumpAttrList(void) {
6891 int test_ret = 0;
6892
William M. Brack21e4ef22005-01-02 09:53:13 +00006893#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006894 int mem_base;
6895 FILE * output; /* the FILE * for the output */
6896 int n_output;
6897 xmlAttrPtr attr; /* the attribute list */
6898 int n_attr;
6899 int depth; /* the indentation level. */
6900 int n_depth;
6901
6902 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6903 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6904 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6905 mem_base = xmlMemBlocks();
6906 output = gen_debug_FILE_ptr(n_output, 0);
6907 attr = gen_xmlAttrPtr(n_attr, 1);
6908 depth = gen_int(n_depth, 2);
6909
6910 xmlDebugDumpAttrList(output, attr, depth);
6911 call_tests++;
6912 des_debug_FILE_ptr(n_output, output, 0);
6913 des_xmlAttrPtr(n_attr, attr, 1);
6914 des_int(n_depth, depth, 2);
6915 xmlResetLastError();
6916 if (mem_base != xmlMemBlocks()) {
6917 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6918 xmlMemBlocks() - mem_base);
6919 test_ret++;
6920 printf(" %d", n_output);
6921 printf(" %d", n_attr);
6922 printf(" %d", n_depth);
6923 printf("\n");
6924 }
6925 }
6926 }
6927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006928 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006929#endif
6930
Daniel Veillarda82b1822004-11-08 16:24:57 +00006931 return(test_ret);
6932}
6933
6934
6935static int
6936test_xmlDebugDumpDTD(void) {
6937 int test_ret = 0;
6938
William M. Brack21e4ef22005-01-02 09:53:13 +00006939#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006940 int mem_base;
6941 FILE * output; /* the FILE * for the output */
6942 int n_output;
6943 xmlDtdPtr dtd; /* the DTD */
6944 int n_dtd;
6945
6946 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6947 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6948 mem_base = xmlMemBlocks();
6949 output = gen_debug_FILE_ptr(n_output, 0);
6950 dtd = gen_xmlDtdPtr(n_dtd, 1);
6951
6952 xmlDebugDumpDTD(output, dtd);
6953 call_tests++;
6954 des_debug_FILE_ptr(n_output, output, 0);
6955 des_xmlDtdPtr(n_dtd, dtd, 1);
6956 xmlResetLastError();
6957 if (mem_base != xmlMemBlocks()) {
6958 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6959 xmlMemBlocks() - mem_base);
6960 test_ret++;
6961 printf(" %d", n_output);
6962 printf(" %d", n_dtd);
6963 printf("\n");
6964 }
6965 }
6966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006967 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006968#endif
6969
Daniel Veillarda82b1822004-11-08 16:24:57 +00006970 return(test_ret);
6971}
6972
6973
6974static int
6975test_xmlDebugDumpDocument(void) {
6976 int test_ret = 0;
6977
William M. Brack21e4ef22005-01-02 09:53:13 +00006978#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006979 int mem_base;
6980 FILE * output; /* the FILE * for the output */
6981 int n_output;
6982 xmlDocPtr doc; /* the document */
6983 int n_doc;
6984
6985 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6986 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6987 mem_base = xmlMemBlocks();
6988 output = gen_debug_FILE_ptr(n_output, 0);
6989 doc = gen_xmlDocPtr(n_doc, 1);
6990
6991 xmlDebugDumpDocument(output, doc);
6992 call_tests++;
6993 des_debug_FILE_ptr(n_output, output, 0);
6994 des_xmlDocPtr(n_doc, doc, 1);
6995 xmlResetLastError();
6996 if (mem_base != xmlMemBlocks()) {
6997 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6998 xmlMemBlocks() - mem_base);
6999 test_ret++;
7000 printf(" %d", n_output);
7001 printf(" %d", n_doc);
7002 printf("\n");
7003 }
7004 }
7005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007006 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007007#endif
7008
Daniel Veillarda82b1822004-11-08 16:24:57 +00007009 return(test_ret);
7010}
7011
7012
7013static int
7014test_xmlDebugDumpDocumentHead(void) {
7015 int test_ret = 0;
7016
William M. Brack21e4ef22005-01-02 09:53:13 +00007017#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007018 int mem_base;
7019 FILE * output; /* the FILE * for the output */
7020 int n_output;
7021 xmlDocPtr doc; /* the document */
7022 int n_doc;
7023
7024 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7025 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7026 mem_base = xmlMemBlocks();
7027 output = gen_debug_FILE_ptr(n_output, 0);
7028 doc = gen_xmlDocPtr(n_doc, 1);
7029
7030 xmlDebugDumpDocumentHead(output, doc);
7031 call_tests++;
7032 des_debug_FILE_ptr(n_output, output, 0);
7033 des_xmlDocPtr(n_doc, doc, 1);
7034 xmlResetLastError();
7035 if (mem_base != xmlMemBlocks()) {
7036 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7037 xmlMemBlocks() - mem_base);
7038 test_ret++;
7039 printf(" %d", n_output);
7040 printf(" %d", n_doc);
7041 printf("\n");
7042 }
7043 }
7044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007045 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007046#endif
7047
Daniel Veillarda82b1822004-11-08 16:24:57 +00007048 return(test_ret);
7049}
7050
7051
7052static int
7053test_xmlDebugDumpEntities(void) {
7054 int test_ret = 0;
7055
William M. Brack21e4ef22005-01-02 09:53:13 +00007056#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007057 int mem_base;
7058 FILE * output; /* the FILE * for the output */
7059 int n_output;
7060 xmlDocPtr doc; /* the document */
7061 int n_doc;
7062
7063 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7064 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7065 mem_base = xmlMemBlocks();
7066 output = gen_debug_FILE_ptr(n_output, 0);
7067 doc = gen_xmlDocPtr(n_doc, 1);
7068
7069 xmlDebugDumpEntities(output, doc);
7070 call_tests++;
7071 des_debug_FILE_ptr(n_output, output, 0);
7072 des_xmlDocPtr(n_doc, doc, 1);
7073 xmlResetLastError();
7074 if (mem_base != xmlMemBlocks()) {
7075 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7076 xmlMemBlocks() - mem_base);
7077 test_ret++;
7078 printf(" %d", n_output);
7079 printf(" %d", n_doc);
7080 printf("\n");
7081 }
7082 }
7083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007084 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007085#endif
7086
Daniel Veillarda82b1822004-11-08 16:24:57 +00007087 return(test_ret);
7088}
7089
7090
7091static int
7092test_xmlDebugDumpNode(void) {
7093 int test_ret = 0;
7094
William M. Brack21e4ef22005-01-02 09:53:13 +00007095#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007096 int mem_base;
7097 FILE * output; /* the FILE * for the output */
7098 int n_output;
7099 xmlNodePtr node; /* the node */
7100 int n_node;
7101 int depth; /* the indentation level. */
7102 int n_depth;
7103
7104 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7105 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7106 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7107 mem_base = xmlMemBlocks();
7108 output = gen_debug_FILE_ptr(n_output, 0);
7109 node = gen_xmlNodePtr(n_node, 1);
7110 depth = gen_int(n_depth, 2);
7111
7112 xmlDebugDumpNode(output, node, depth);
7113 call_tests++;
7114 des_debug_FILE_ptr(n_output, output, 0);
7115 des_xmlNodePtr(n_node, node, 1);
7116 des_int(n_depth, depth, 2);
7117 xmlResetLastError();
7118 if (mem_base != xmlMemBlocks()) {
7119 printf("Leak of %d blocks found in xmlDebugDumpNode",
7120 xmlMemBlocks() - mem_base);
7121 test_ret++;
7122 printf(" %d", n_output);
7123 printf(" %d", n_node);
7124 printf(" %d", n_depth);
7125 printf("\n");
7126 }
7127 }
7128 }
7129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007130 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007131#endif
7132
Daniel Veillarda82b1822004-11-08 16:24:57 +00007133 return(test_ret);
7134}
7135
7136
7137static int
7138test_xmlDebugDumpNodeList(void) {
7139 int test_ret = 0;
7140
William M. Brack21e4ef22005-01-02 09:53:13 +00007141#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007142 int mem_base;
7143 FILE * output; /* the FILE * for the output */
7144 int n_output;
7145 xmlNodePtr node; /* the node list */
7146 int n_node;
7147 int depth; /* the indentation level. */
7148 int n_depth;
7149
7150 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7151 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7152 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7153 mem_base = xmlMemBlocks();
7154 output = gen_debug_FILE_ptr(n_output, 0);
7155 node = gen_xmlNodePtr(n_node, 1);
7156 depth = gen_int(n_depth, 2);
7157
7158 xmlDebugDumpNodeList(output, node, depth);
7159 call_tests++;
7160 des_debug_FILE_ptr(n_output, output, 0);
7161 des_xmlNodePtr(n_node, node, 1);
7162 des_int(n_depth, depth, 2);
7163 xmlResetLastError();
7164 if (mem_base != xmlMemBlocks()) {
7165 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7166 xmlMemBlocks() - mem_base);
7167 test_ret++;
7168 printf(" %d", n_output);
7169 printf(" %d", n_node);
7170 printf(" %d", n_depth);
7171 printf("\n");
7172 }
7173 }
7174 }
7175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007176 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007177#endif
7178
Daniel Veillarda82b1822004-11-08 16:24:57 +00007179 return(test_ret);
7180}
7181
7182
7183static int
7184test_xmlDebugDumpOneNode(void) {
7185 int test_ret = 0;
7186
William M. Brack21e4ef22005-01-02 09:53:13 +00007187#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007188 int mem_base;
7189 FILE * output; /* the FILE * for the output */
7190 int n_output;
7191 xmlNodePtr node; /* the node */
7192 int n_node;
7193 int depth; /* the indentation level. */
7194 int n_depth;
7195
7196 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7197 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7198 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7199 mem_base = xmlMemBlocks();
7200 output = gen_debug_FILE_ptr(n_output, 0);
7201 node = gen_xmlNodePtr(n_node, 1);
7202 depth = gen_int(n_depth, 2);
7203
7204 xmlDebugDumpOneNode(output, node, depth);
7205 call_tests++;
7206 des_debug_FILE_ptr(n_output, output, 0);
7207 des_xmlNodePtr(n_node, node, 1);
7208 des_int(n_depth, depth, 2);
7209 xmlResetLastError();
7210 if (mem_base != xmlMemBlocks()) {
7211 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7212 xmlMemBlocks() - mem_base);
7213 test_ret++;
7214 printf(" %d", n_output);
7215 printf(" %d", n_node);
7216 printf(" %d", n_depth);
7217 printf("\n");
7218 }
7219 }
7220 }
7221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007222 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007223#endif
7224
Daniel Veillarda82b1822004-11-08 16:24:57 +00007225 return(test_ret);
7226}
7227
7228
7229static int
7230test_xmlDebugDumpString(void) {
7231 int test_ret = 0;
7232
William M. Brack21e4ef22005-01-02 09:53:13 +00007233#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007234 int mem_base;
7235 FILE * output; /* the FILE * for the output */
7236 int n_output;
7237 xmlChar * str; /* the string */
7238 int n_str;
7239
7240 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7241 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7242 mem_base = xmlMemBlocks();
7243 output = gen_debug_FILE_ptr(n_output, 0);
7244 str = gen_const_xmlChar_ptr(n_str, 1);
7245
William M. Brackf13f77f2004-11-12 16:03:48 +00007246 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007247 call_tests++;
7248 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007249 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007250 xmlResetLastError();
7251 if (mem_base != xmlMemBlocks()) {
7252 printf("Leak of %d blocks found in xmlDebugDumpString",
7253 xmlMemBlocks() - mem_base);
7254 test_ret++;
7255 printf(" %d", n_output);
7256 printf(" %d", n_str);
7257 printf("\n");
7258 }
7259 }
7260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007261 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007262#endif
7263
Daniel Veillarda82b1822004-11-08 16:24:57 +00007264 return(test_ret);
7265}
7266
7267
7268static int
7269test_xmlLsCountNode(void) {
7270 int test_ret = 0;
7271
William M. Brack21e4ef22005-01-02 09:53:13 +00007272#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007273 int mem_base;
7274 int ret_val;
7275 xmlNodePtr node; /* the node to count */
7276 int n_node;
7277
7278 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7279 mem_base = xmlMemBlocks();
7280 node = gen_xmlNodePtr(n_node, 0);
7281
7282 ret_val = xmlLsCountNode(node);
7283 desret_int(ret_val);
7284 call_tests++;
7285 des_xmlNodePtr(n_node, node, 0);
7286 xmlResetLastError();
7287 if (mem_base != xmlMemBlocks()) {
7288 printf("Leak of %d blocks found in xmlLsCountNode",
7289 xmlMemBlocks() - mem_base);
7290 test_ret++;
7291 printf(" %d", n_node);
7292 printf("\n");
7293 }
7294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007295 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007296#endif
7297
Daniel Veillarda82b1822004-11-08 16:24:57 +00007298 return(test_ret);
7299}
7300
7301
7302static int
7303test_xmlLsOneNode(void) {
7304 int test_ret = 0;
7305
William M. Brack21e4ef22005-01-02 09:53:13 +00007306#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007307 int mem_base;
7308 FILE * output; /* the FILE * for the output */
7309 int n_output;
7310 xmlNodePtr node; /* the node to dump */
7311 int n_node;
7312
7313 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7314 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7315 mem_base = xmlMemBlocks();
7316 output = gen_debug_FILE_ptr(n_output, 0);
7317 node = gen_xmlNodePtr(n_node, 1);
7318
7319 xmlLsOneNode(output, node);
7320 call_tests++;
7321 des_debug_FILE_ptr(n_output, output, 0);
7322 des_xmlNodePtr(n_node, node, 1);
7323 xmlResetLastError();
7324 if (mem_base != xmlMemBlocks()) {
7325 printf("Leak of %d blocks found in xmlLsOneNode",
7326 xmlMemBlocks() - mem_base);
7327 test_ret++;
7328 printf(" %d", n_output);
7329 printf(" %d", n_node);
7330 printf("\n");
7331 }
7332 }
7333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007335#endif
7336
Daniel Veillarda82b1822004-11-08 16:24:57 +00007337 return(test_ret);
7338}
7339
7340
7341#define gen_nb_char_ptr 1
7342static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7343 return(NULL);
7344}
7345static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7346}
7347
7348static int
7349test_xmlShell(void) {
7350 int test_ret = 0;
7351
7352
7353 /* missing type support */
7354 return(test_ret);
7355}
7356
7357
Daniel Veillarda82b1822004-11-08 16:24:57 +00007358static int
7359test_xmlShellBase(void) {
7360 int test_ret = 0;
7361
William M. Brack21e4ef22005-01-02 09:53:13 +00007362#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007363 int mem_base;
7364 int ret_val;
7365 xmlShellCtxtPtr ctxt; /* the shell context */
7366 int n_ctxt;
7367 char * arg; /* unused */
7368 int n_arg;
7369 xmlNodePtr node; /* a node */
7370 int n_node;
7371 xmlNodePtr node2; /* unused */
7372 int n_node2;
7373
7374 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7375 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7376 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7377 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7378 mem_base = xmlMemBlocks();
7379 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7380 arg = gen_char_ptr(n_arg, 1);
7381 node = gen_xmlNodePtr(n_node, 2);
7382 node2 = gen_xmlNodePtr(n_node2, 3);
7383
7384 ret_val = xmlShellBase(ctxt, arg, node, node2);
7385 desret_int(ret_val);
7386 call_tests++;
7387 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7388 des_char_ptr(n_arg, arg, 1);
7389 des_xmlNodePtr(n_node, node, 2);
7390 des_xmlNodePtr(n_node2, node2, 3);
7391 xmlResetLastError();
7392 if (mem_base != xmlMemBlocks()) {
7393 printf("Leak of %d blocks found in xmlShellBase",
7394 xmlMemBlocks() - mem_base);
7395 test_ret++;
7396 printf(" %d", n_ctxt);
7397 printf(" %d", n_arg);
7398 printf(" %d", n_node);
7399 printf(" %d", n_node2);
7400 printf("\n");
7401 }
7402 }
7403 }
7404 }
7405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007406 function_tests++;
7407#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007408
Daniel Veillarda82b1822004-11-08 16:24:57 +00007409 return(test_ret);
7410}
7411
7412
7413static int
7414test_xmlShellCat(void) {
7415 int test_ret = 0;
7416
William M. Brack21e4ef22005-01-02 09:53:13 +00007417#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007418 int mem_base;
7419 int ret_val;
7420 xmlShellCtxtPtr ctxt; /* the shell context */
7421 int n_ctxt;
7422 char * arg; /* unused */
7423 int n_arg;
7424 xmlNodePtr node; /* a node */
7425 int n_node;
7426 xmlNodePtr node2; /* unused */
7427 int n_node2;
7428
7429 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7430 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7431 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7432 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7433 mem_base = xmlMemBlocks();
7434 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7435 arg = gen_char_ptr(n_arg, 1);
7436 node = gen_xmlNodePtr(n_node, 2);
7437 node2 = gen_xmlNodePtr(n_node2, 3);
7438
7439 ret_val = xmlShellCat(ctxt, arg, node, node2);
7440 desret_int(ret_val);
7441 call_tests++;
7442 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7443 des_char_ptr(n_arg, arg, 1);
7444 des_xmlNodePtr(n_node, node, 2);
7445 des_xmlNodePtr(n_node2, node2, 3);
7446 xmlResetLastError();
7447 if (mem_base != xmlMemBlocks()) {
7448 printf("Leak of %d blocks found in xmlShellCat",
7449 xmlMemBlocks() - mem_base);
7450 test_ret++;
7451 printf(" %d", n_ctxt);
7452 printf(" %d", n_arg);
7453 printf(" %d", n_node);
7454 printf(" %d", n_node2);
7455 printf("\n");
7456 }
7457 }
7458 }
7459 }
7460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007461 function_tests++;
7462#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007463
Daniel Veillarda82b1822004-11-08 16:24:57 +00007464 return(test_ret);
7465}
7466
7467
7468static int
7469test_xmlShellDir(void) {
7470 int test_ret = 0;
7471
William M. Brack21e4ef22005-01-02 09:53:13 +00007472#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007473 int mem_base;
7474 int ret_val;
7475 xmlShellCtxtPtr ctxt; /* the shell context */
7476 int n_ctxt;
7477 char * arg; /* unused */
7478 int n_arg;
7479 xmlNodePtr node; /* a node */
7480 int n_node;
7481 xmlNodePtr node2; /* unused */
7482 int n_node2;
7483
7484 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7485 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7486 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7487 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7488 mem_base = xmlMemBlocks();
7489 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7490 arg = gen_char_ptr(n_arg, 1);
7491 node = gen_xmlNodePtr(n_node, 2);
7492 node2 = gen_xmlNodePtr(n_node2, 3);
7493
7494 ret_val = xmlShellDir(ctxt, arg, node, node2);
7495 desret_int(ret_val);
7496 call_tests++;
7497 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7498 des_char_ptr(n_arg, arg, 1);
7499 des_xmlNodePtr(n_node, node, 2);
7500 des_xmlNodePtr(n_node2, node2, 3);
7501 xmlResetLastError();
7502 if (mem_base != xmlMemBlocks()) {
7503 printf("Leak of %d blocks found in xmlShellDir",
7504 xmlMemBlocks() - mem_base);
7505 test_ret++;
7506 printf(" %d", n_ctxt);
7507 printf(" %d", n_arg);
7508 printf(" %d", n_node);
7509 printf(" %d", n_node2);
7510 printf("\n");
7511 }
7512 }
7513 }
7514 }
7515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007516 function_tests++;
7517#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007518
Daniel Veillarda82b1822004-11-08 16:24:57 +00007519 return(test_ret);
7520}
7521
7522
7523static int
7524test_xmlShellDu(void) {
7525 int test_ret = 0;
7526
William M. Brack21e4ef22005-01-02 09:53:13 +00007527#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007528 int mem_base;
7529 int ret_val;
7530 xmlShellCtxtPtr ctxt; /* the shell context */
7531 int n_ctxt;
7532 char * arg; /* unused */
7533 int n_arg;
7534 xmlNodePtr tree; /* a node defining a subtree */
7535 int n_tree;
7536 xmlNodePtr node2; /* unused */
7537 int n_node2;
7538
7539 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7540 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7541 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7542 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7543 mem_base = xmlMemBlocks();
7544 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7545 arg = gen_char_ptr(n_arg, 1);
7546 tree = gen_xmlNodePtr(n_tree, 2);
7547 node2 = gen_xmlNodePtr(n_node2, 3);
7548
7549 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7550 desret_int(ret_val);
7551 call_tests++;
7552 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7553 des_char_ptr(n_arg, arg, 1);
7554 des_xmlNodePtr(n_tree, tree, 2);
7555 des_xmlNodePtr(n_node2, node2, 3);
7556 xmlResetLastError();
7557 if (mem_base != xmlMemBlocks()) {
7558 printf("Leak of %d blocks found in xmlShellDu",
7559 xmlMemBlocks() - mem_base);
7560 test_ret++;
7561 printf(" %d", n_ctxt);
7562 printf(" %d", n_arg);
7563 printf(" %d", n_tree);
7564 printf(" %d", n_node2);
7565 printf("\n");
7566 }
7567 }
7568 }
7569 }
7570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007571 function_tests++;
7572#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007573
Daniel Veillarda82b1822004-11-08 16:24:57 +00007574 return(test_ret);
7575}
7576
7577
7578static int
7579test_xmlShellList(void) {
7580 int test_ret = 0;
7581
William M. Brack21e4ef22005-01-02 09:53:13 +00007582#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007583 int mem_base;
7584 int ret_val;
7585 xmlShellCtxtPtr ctxt; /* the shell context */
7586 int n_ctxt;
7587 char * arg; /* unused */
7588 int n_arg;
7589 xmlNodePtr node; /* a node */
7590 int n_node;
7591 xmlNodePtr node2; /* unused */
7592 int n_node2;
7593
7594 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7595 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7596 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7597 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7598 mem_base = xmlMemBlocks();
7599 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7600 arg = gen_char_ptr(n_arg, 1);
7601 node = gen_xmlNodePtr(n_node, 2);
7602 node2 = gen_xmlNodePtr(n_node2, 3);
7603
7604 ret_val = xmlShellList(ctxt, arg, node, node2);
7605 desret_int(ret_val);
7606 call_tests++;
7607 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7608 des_char_ptr(n_arg, arg, 1);
7609 des_xmlNodePtr(n_node, node, 2);
7610 des_xmlNodePtr(n_node2, node2, 3);
7611 xmlResetLastError();
7612 if (mem_base != xmlMemBlocks()) {
7613 printf("Leak of %d blocks found in xmlShellList",
7614 xmlMemBlocks() - mem_base);
7615 test_ret++;
7616 printf(" %d", n_ctxt);
7617 printf(" %d", n_arg);
7618 printf(" %d", n_node);
7619 printf(" %d", n_node2);
7620 printf("\n");
7621 }
7622 }
7623 }
7624 }
7625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007626 function_tests++;
7627#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007628
Daniel Veillarda82b1822004-11-08 16:24:57 +00007629 return(test_ret);
7630}
7631
7632
7633static int
7634test_xmlShellLoad(void) {
7635 int test_ret = 0;
7636
William M. Brack21e4ef22005-01-02 09:53:13 +00007637#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007638 int mem_base;
7639 int ret_val;
7640 xmlShellCtxtPtr ctxt; /* the shell context */
7641 int n_ctxt;
7642 char * filename; /* the file name */
7643 int n_filename;
7644 xmlNodePtr node; /* unused */
7645 int n_node;
7646 xmlNodePtr node2; /* unused */
7647 int n_node2;
7648
7649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7650 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7651 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7652 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7653 mem_base = xmlMemBlocks();
7654 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7655 filename = gen_char_ptr(n_filename, 1);
7656 node = gen_xmlNodePtr(n_node, 2);
7657 node2 = gen_xmlNodePtr(n_node2, 3);
7658
7659 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7660 desret_int(ret_val);
7661 call_tests++;
7662 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7663 des_char_ptr(n_filename, filename, 1);
7664 des_xmlNodePtr(n_node, node, 2);
7665 des_xmlNodePtr(n_node2, node2, 3);
7666 xmlResetLastError();
7667 if (mem_base != xmlMemBlocks()) {
7668 printf("Leak of %d blocks found in xmlShellLoad",
7669 xmlMemBlocks() - mem_base);
7670 test_ret++;
7671 printf(" %d", n_ctxt);
7672 printf(" %d", n_filename);
7673 printf(" %d", n_node);
7674 printf(" %d", n_node2);
7675 printf("\n");
7676 }
7677 }
7678 }
7679 }
7680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007681 function_tests++;
7682#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007683
Daniel Veillarda82b1822004-11-08 16:24:57 +00007684 return(test_ret);
7685}
7686
7687
7688static int
7689test_xmlShellPrintXPathResult(void) {
7690 int test_ret = 0;
7691
William M. Brack21e4ef22005-01-02 09:53:13 +00007692#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007693 int mem_base;
7694 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7695 int n_list;
7696
7697 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7698 mem_base = xmlMemBlocks();
7699 list = gen_xmlXPathObjectPtr(n_list, 0);
7700
7701 xmlShellPrintXPathResult(list);
7702 call_tests++;
7703 des_xmlXPathObjectPtr(n_list, list, 0);
7704 xmlResetLastError();
7705 if (mem_base != xmlMemBlocks()) {
7706 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7707 xmlMemBlocks() - mem_base);
7708 test_ret++;
7709 printf(" %d", n_list);
7710 printf("\n");
7711 }
7712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007713 function_tests++;
7714#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007715
Daniel Veillarda82b1822004-11-08 16:24:57 +00007716 return(test_ret);
7717}
7718
7719
7720static int
7721test_xmlShellPwd(void) {
7722 int test_ret = 0;
7723
William M. Brack21e4ef22005-01-02 09:53:13 +00007724#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007725 int mem_base;
7726 int ret_val;
7727 xmlShellCtxtPtr ctxt; /* the shell context */
7728 int n_ctxt;
7729 char * buffer; /* the output buffer */
7730 int n_buffer;
7731 xmlNodePtr node; /* a node */
7732 int n_node;
7733 xmlNodePtr node2; /* unused */
7734 int n_node2;
7735
7736 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7737 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7738 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7739 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7740 mem_base = xmlMemBlocks();
7741 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7742 buffer = gen_char_ptr(n_buffer, 1);
7743 node = gen_xmlNodePtr(n_node, 2);
7744 node2 = gen_xmlNodePtr(n_node2, 3);
7745
7746 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7747 desret_int(ret_val);
7748 call_tests++;
7749 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7750 des_char_ptr(n_buffer, buffer, 1);
7751 des_xmlNodePtr(n_node, node, 2);
7752 des_xmlNodePtr(n_node2, node2, 3);
7753 xmlResetLastError();
7754 if (mem_base != xmlMemBlocks()) {
7755 printf("Leak of %d blocks found in xmlShellPwd",
7756 xmlMemBlocks() - mem_base);
7757 test_ret++;
7758 printf(" %d", n_ctxt);
7759 printf(" %d", n_buffer);
7760 printf(" %d", n_node);
7761 printf(" %d", n_node2);
7762 printf("\n");
7763 }
7764 }
7765 }
7766 }
7767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007768 function_tests++;
7769#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007770
Daniel Veillarda82b1822004-11-08 16:24:57 +00007771 return(test_ret);
7772}
7773
7774
7775static int
7776test_xmlShellSave(void) {
7777 int test_ret = 0;
7778
William M. Brack21e4ef22005-01-02 09:53:13 +00007779#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007780 int mem_base;
7781 int ret_val;
7782 xmlShellCtxtPtr ctxt; /* the shell context */
7783 int n_ctxt;
7784 char * filename; /* the file name (optional) */
7785 int n_filename;
7786 xmlNodePtr node; /* unused */
7787 int n_node;
7788 xmlNodePtr node2; /* unused */
7789 int n_node2;
7790
7791 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7792 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7793 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7794 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7795 mem_base = xmlMemBlocks();
7796 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7797 filename = gen_char_ptr(n_filename, 1);
7798 node = gen_xmlNodePtr(n_node, 2);
7799 node2 = gen_xmlNodePtr(n_node2, 3);
7800
7801 ret_val = xmlShellSave(ctxt, filename, node, node2);
7802 desret_int(ret_val);
7803 call_tests++;
7804 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7805 des_char_ptr(n_filename, filename, 1);
7806 des_xmlNodePtr(n_node, node, 2);
7807 des_xmlNodePtr(n_node2, node2, 3);
7808 xmlResetLastError();
7809 if (mem_base != xmlMemBlocks()) {
7810 printf("Leak of %d blocks found in xmlShellSave",
7811 xmlMemBlocks() - mem_base);
7812 test_ret++;
7813 printf(" %d", n_ctxt);
7814 printf(" %d", n_filename);
7815 printf(" %d", n_node);
7816 printf(" %d", n_node2);
7817 printf("\n");
7818 }
7819 }
7820 }
7821 }
7822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007823 function_tests++;
7824#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007825
Daniel Veillarda82b1822004-11-08 16:24:57 +00007826 return(test_ret);
7827}
7828
7829
7830static int
7831test_xmlShellValidate(void) {
7832 int test_ret = 0;
7833
William M. Brack21e4ef22005-01-02 09:53:13 +00007834#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007835 int mem_base;
7836 int ret_val;
7837 xmlShellCtxtPtr ctxt; /* the shell context */
7838 int n_ctxt;
7839 char * dtd; /* the DTD URI (optional) */
7840 int n_dtd;
7841 xmlNodePtr node; /* unused */
7842 int n_node;
7843 xmlNodePtr node2; /* unused */
7844 int n_node2;
7845
7846 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7847 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7848 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7849 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7850 mem_base = xmlMemBlocks();
7851 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7852 dtd = gen_char_ptr(n_dtd, 1);
7853 node = gen_xmlNodePtr(n_node, 2);
7854 node2 = gen_xmlNodePtr(n_node2, 3);
7855
7856 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7857 desret_int(ret_val);
7858 call_tests++;
7859 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7860 des_char_ptr(n_dtd, dtd, 1);
7861 des_xmlNodePtr(n_node, node, 2);
7862 des_xmlNodePtr(n_node2, node2, 3);
7863 xmlResetLastError();
7864 if (mem_base != xmlMemBlocks()) {
7865 printf("Leak of %d blocks found in xmlShellValidate",
7866 xmlMemBlocks() - mem_base);
7867 test_ret++;
7868 printf(" %d", n_ctxt);
7869 printf(" %d", n_dtd);
7870 printf(" %d", n_node);
7871 printf(" %d", n_node2);
7872 printf("\n");
7873 }
7874 }
7875 }
7876 }
7877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007878 function_tests++;
7879#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007880
Daniel Veillarda82b1822004-11-08 16:24:57 +00007881 return(test_ret);
7882}
7883
7884
7885static int
7886test_xmlShellWrite(void) {
7887 int test_ret = 0;
7888
William M. Brack21e4ef22005-01-02 09:53:13 +00007889#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007890 int mem_base;
7891 int ret_val;
7892 xmlShellCtxtPtr ctxt; /* the shell context */
7893 int n_ctxt;
7894 char * filename; /* the file name */
7895 int n_filename;
7896 xmlNodePtr node; /* a node in the tree */
7897 int n_node;
7898 xmlNodePtr node2; /* unused */
7899 int n_node2;
7900
7901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7902 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7903 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7904 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7905 mem_base = xmlMemBlocks();
7906 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7907 filename = gen_char_ptr(n_filename, 1);
7908 node = gen_xmlNodePtr(n_node, 2);
7909 node2 = gen_xmlNodePtr(n_node2, 3);
7910
7911 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7912 desret_int(ret_val);
7913 call_tests++;
7914 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7915 des_char_ptr(n_filename, filename, 1);
7916 des_xmlNodePtr(n_node, node, 2);
7917 des_xmlNodePtr(n_node2, node2, 3);
7918 xmlResetLastError();
7919 if (mem_base != xmlMemBlocks()) {
7920 printf("Leak of %d blocks found in xmlShellWrite",
7921 xmlMemBlocks() - mem_base);
7922 test_ret++;
7923 printf(" %d", n_ctxt);
7924 printf(" %d", n_filename);
7925 printf(" %d", n_node);
7926 printf(" %d", n_node2);
7927 printf("\n");
7928 }
7929 }
7930 }
7931 }
7932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007933 function_tests++;
7934#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007935
Daniel Veillarda82b1822004-11-08 16:24:57 +00007936 return(test_ret);
7937}
7938
7939static int
7940test_debugXML(void) {
7941 int test_ret = 0;
7942
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007943 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007944 test_ret += test_xmlBoolToText();
7945 test_ret += test_xmlDebugCheckDocument();
7946 test_ret += test_xmlDebugDumpAttr();
7947 test_ret += test_xmlDebugDumpAttrList();
7948 test_ret += test_xmlDebugDumpDTD();
7949 test_ret += test_xmlDebugDumpDocument();
7950 test_ret += test_xmlDebugDumpDocumentHead();
7951 test_ret += test_xmlDebugDumpEntities();
7952 test_ret += test_xmlDebugDumpNode();
7953 test_ret += test_xmlDebugDumpNodeList();
7954 test_ret += test_xmlDebugDumpOneNode();
7955 test_ret += test_xmlDebugDumpString();
7956 test_ret += test_xmlLsCountNode();
7957 test_ret += test_xmlLsOneNode();
7958 test_ret += test_xmlShell();
7959 test_ret += test_xmlShellBase();
7960 test_ret += test_xmlShellCat();
7961 test_ret += test_xmlShellDir();
7962 test_ret += test_xmlShellDu();
7963 test_ret += test_xmlShellList();
7964 test_ret += test_xmlShellLoad();
7965 test_ret += test_xmlShellPrintXPathResult();
7966 test_ret += test_xmlShellPwd();
7967 test_ret += test_xmlShellSave();
7968 test_ret += test_xmlShellValidate();
7969 test_ret += test_xmlShellWrite();
7970
7971 if (test_ret != 0)
7972 printf("Module debugXML: %d errors\n", test_ret);
7973 return(test_ret);
7974}
7975
7976static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007977test_xmlDictCleanup(void) {
7978 int test_ret = 0;
7979
7980 int mem_base;
7981
7982 mem_base = xmlMemBlocks();
7983
7984 xmlDictCleanup();
7985 call_tests++;
7986 xmlResetLastError();
7987 if (mem_base != xmlMemBlocks()) {
7988 printf("Leak of %d blocks found in xmlDictCleanup",
7989 xmlMemBlocks() - mem_base);
7990 test_ret++;
7991 printf("\n");
7992 }
7993 function_tests++;
7994
7995 return(test_ret);
7996}
7997
7998
7999static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008000test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008002
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008003 int mem_base;
8004 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008005
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008006 mem_base = xmlMemBlocks();
8007
8008 ret_val = xmlDictCreate();
8009 desret_xmlDictPtr(ret_val);
8010 call_tests++;
8011 xmlResetLastError();
8012 if (mem_base != xmlMemBlocks()) {
8013 printf("Leak of %d blocks found in xmlDictCreate",
8014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008015 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008016 printf("\n");
8017 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008018 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008019
Daniel Veillard42595322004-11-08 10:52:06 +00008020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008021}
8022
8023
8024static int
8025test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008027
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008028 int mem_base;
8029 xmlDictPtr ret_val;
8030 xmlDictPtr sub; /* an existing dictionnary */
8031 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008032
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008033 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8034 mem_base = xmlMemBlocks();
8035 sub = gen_xmlDictPtr(n_sub, 0);
8036
8037 ret_val = xmlDictCreateSub(sub);
8038 desret_xmlDictPtr(ret_val);
8039 call_tests++;
8040 des_xmlDictPtr(n_sub, sub, 0);
8041 xmlResetLastError();
8042 if (mem_base != xmlMemBlocks()) {
8043 printf("Leak of %d blocks found in xmlDictCreateSub",
8044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008045 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008046 printf(" %d", n_sub);
8047 printf("\n");
8048 }
8049 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008050 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008051
Daniel Veillard42595322004-11-08 10:52:06 +00008052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008053}
8054
8055
8056static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008057test_xmlDictExists(void) {
8058 int test_ret = 0;
8059
8060 int mem_base;
8061 const xmlChar * ret_val;
8062 xmlDictPtr dict; /* the dictionnary */
8063 int n_dict;
8064 xmlChar * name; /* the name of the userdata */
8065 int n_name;
8066 int len; /* the length of the name, if -1 it is recomputed */
8067 int n_len;
8068
8069 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8070 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8071 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8072 mem_base = xmlMemBlocks();
8073 dict = gen_xmlDictPtr(n_dict, 0);
8074 name = gen_const_xmlChar_ptr(n_name, 1);
8075 len = gen_int(n_len, 2);
8076
8077 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8078 desret_const_xmlChar_ptr(ret_val);
8079 call_tests++;
8080 des_xmlDictPtr(n_dict, dict, 0);
8081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8082 des_int(n_len, len, 2);
8083 xmlResetLastError();
8084 if (mem_base != xmlMemBlocks()) {
8085 printf("Leak of %d blocks found in xmlDictExists",
8086 xmlMemBlocks() - mem_base);
8087 test_ret++;
8088 printf(" %d", n_dict);
8089 printf(" %d", n_name);
8090 printf(" %d", n_len);
8091 printf("\n");
8092 }
8093 }
8094 }
8095 }
8096 function_tests++;
8097
8098 return(test_ret);
8099}
8100
8101
8102static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008103test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008105
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008106 int mem_base;
8107 const xmlChar * ret_val;
8108 xmlDictPtr dict; /* the dictionnary */
8109 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008110 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008111 int n_name;
8112 int len; /* the length of the name, if -1 it is recomputed */
8113 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008114
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008115 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8116 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8117 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8118 mem_base = xmlMemBlocks();
8119 dict = gen_xmlDictPtr(n_dict, 0);
8120 name = gen_const_xmlChar_ptr(n_name, 1);
8121 len = gen_int(n_len, 2);
8122
William M. Brackf13f77f2004-11-12 16:03:48 +00008123 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008124 desret_const_xmlChar_ptr(ret_val);
8125 call_tests++;
8126 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008128 des_int(n_len, len, 2);
8129 xmlResetLastError();
8130 if (mem_base != xmlMemBlocks()) {
8131 printf("Leak of %d blocks found in xmlDictLookup",
8132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008133 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 printf(" %d", n_dict);
8135 printf(" %d", n_name);
8136 printf(" %d", n_len);
8137 printf("\n");
8138 }
8139 }
8140 }
8141 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008142 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008143
Daniel Veillard42595322004-11-08 10:52:06 +00008144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008145}
8146
8147
8148static int
8149test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008151
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008152 int mem_base;
8153 int ret_val;
8154 xmlDictPtr dict; /* the dictionnary */
8155 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008156 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008157 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008158
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008159 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8160 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8161 mem_base = xmlMemBlocks();
8162 dict = gen_xmlDictPtr(n_dict, 0);
8163 str = gen_const_xmlChar_ptr(n_str, 1);
8164
William M. Brackf13f77f2004-11-12 16:03:48 +00008165 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008166 desret_int(ret_val);
8167 call_tests++;
8168 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008169 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008170 xmlResetLastError();
8171 if (mem_base != xmlMemBlocks()) {
8172 printf("Leak of %d blocks found in xmlDictOwns",
8173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008174 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008175 printf(" %d", n_dict);
8176 printf(" %d", n_str);
8177 printf("\n");
8178 }
8179 }
8180 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008182
Daniel Veillard42595322004-11-08 10:52:06 +00008183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008184}
8185
8186
8187static int
8188test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008190
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 int mem_base;
8192 const xmlChar * ret_val;
8193 xmlDictPtr dict; /* the dictionnary */
8194 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008195 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008196 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008197 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008198 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008199
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008200 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8201 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8203 mem_base = xmlMemBlocks();
8204 dict = gen_xmlDictPtr(n_dict, 0);
8205 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8206 name = gen_const_xmlChar_ptr(n_name, 2);
8207
William M. Brackf13f77f2004-11-12 16:03:48 +00008208 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008209 desret_const_xmlChar_ptr(ret_val);
8210 call_tests++;
8211 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008212 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8213 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008214 xmlResetLastError();
8215 if (mem_base != xmlMemBlocks()) {
8216 printf("Leak of %d blocks found in xmlDictQLookup",
8217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008218 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008219 printf(" %d", n_dict);
8220 printf(" %d", n_prefix);
8221 printf(" %d", n_name);
8222 printf("\n");
8223 }
8224 }
8225 }
8226 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008228
Daniel Veillard42595322004-11-08 10:52:06 +00008229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008230}
8231
8232
8233static int
8234test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008236
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008237 int mem_base;
8238 int ret_val;
8239 xmlDictPtr dict; /* the dictionnary */
8240 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008241
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008242 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8243 mem_base = xmlMemBlocks();
8244 dict = gen_xmlDictPtr(n_dict, 0);
8245
8246 ret_val = xmlDictReference(dict);
8247 xmlDictFree(dict);
8248 desret_int(ret_val);
8249 call_tests++;
8250 des_xmlDictPtr(n_dict, dict, 0);
8251 xmlResetLastError();
8252 if (mem_base != xmlMemBlocks()) {
8253 printf("Leak of %d blocks found in xmlDictReference",
8254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008255 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008256 printf(" %d", n_dict);
8257 printf("\n");
8258 }
8259 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008261
Daniel Veillard42595322004-11-08 10:52:06 +00008262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008263}
8264
8265
8266static int
8267test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008269
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008270 int mem_base;
8271 int ret_val;
8272 xmlDictPtr dict; /* the dictionnary */
8273 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008274
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008275 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8276 mem_base = xmlMemBlocks();
8277 dict = gen_xmlDictPtr(n_dict, 0);
8278
8279 ret_val = xmlDictSize(dict);
8280 desret_int(ret_val);
8281 call_tests++;
8282 des_xmlDictPtr(n_dict, dict, 0);
8283 xmlResetLastError();
8284 if (mem_base != xmlMemBlocks()) {
8285 printf("Leak of %d blocks found in xmlDictSize",
8286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008287 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008288 printf(" %d", n_dict);
8289 printf("\n");
8290 }
8291 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008293
Daniel Veillard42595322004-11-08 10:52:06 +00008294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008295}
8296
8297static int
8298test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008300
Daniel Veillard2ae13382005-01-25 23:45:06 +00008301 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8302 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008303 test_ret += test_xmlDictCreate();
8304 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008305 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008306 test_ret += test_xmlDictLookup();
8307 test_ret += test_xmlDictOwns();
8308 test_ret += test_xmlDictQLookup();
8309 test_ret += test_xmlDictReference();
8310 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008311
Daniel Veillard42595322004-11-08 10:52:06 +00008312 if (test_ret != 0)
8313 printf("Module dict: %d errors\n", test_ret);
8314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008315}
8316
8317static int
8318test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008320
William M. Brack21e4ef22005-01-02 09:53:13 +00008321#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008322#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008323 int mem_base;
8324 int ret_val;
8325 unsigned char * out; /* a pointer to an array of bytes to store the result */
8326 int n_out;
8327 int * outlen; /* the length of @out */
8328 int n_outlen;
8329 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8330 int n_in;
8331 int * inlen; /* the length of @in */
8332 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008333
Daniel Veillardce682bc2004-11-05 17:22:25 +00008334 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8335 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8336 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8337 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8338 mem_base = xmlMemBlocks();
8339 out = gen_unsigned_char_ptr(n_out, 0);
8340 outlen = gen_int_ptr(n_outlen, 1);
8341 in = gen_const_unsigned_char_ptr(n_in, 2);
8342 inlen = gen_int_ptr(n_inlen, 3);
8343
William M. Brackf13f77f2004-11-12 16:03:48 +00008344 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008345 desret_int(ret_val);
8346 call_tests++;
8347 des_unsigned_char_ptr(n_out, out, 0);
8348 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008349 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008350 des_int_ptr(n_inlen, inlen, 3);
8351 xmlResetLastError();
8352 if (mem_base != xmlMemBlocks()) {
8353 printf("Leak of %d blocks found in UTF8Toisolat1",
8354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008355 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008356 printf(" %d", n_out);
8357 printf(" %d", n_outlen);
8358 printf(" %d", n_in);
8359 printf(" %d", n_inlen);
8360 printf("\n");
8361 }
8362 }
8363 }
8364 }
8365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008366 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008367#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008368#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008369
Daniel Veillard42595322004-11-08 10:52:06 +00008370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008371}
8372
8373
8374static int
8375test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008377
Daniel Veillardce682bc2004-11-05 17:22:25 +00008378 int mem_base;
8379 int ret_val;
8380 unsigned char * out; /* a pointer to an array of bytes to store the result */
8381 int n_out;
8382 int * outlen; /* the length of @out */
8383 int n_outlen;
8384 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8385 int n_in;
8386 int * inlen; /* the length of @in */
8387 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008388
Daniel Veillardce682bc2004-11-05 17:22:25 +00008389 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8390 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8391 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8392 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8393 mem_base = xmlMemBlocks();
8394 out = gen_unsigned_char_ptr(n_out, 0);
8395 outlen = gen_int_ptr(n_outlen, 1);
8396 in = gen_const_unsigned_char_ptr(n_in, 2);
8397 inlen = gen_int_ptr(n_inlen, 3);
8398
William M. Brackf13f77f2004-11-12 16:03:48 +00008399 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008400 desret_int(ret_val);
8401 call_tests++;
8402 des_unsigned_char_ptr(n_out, out, 0);
8403 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008404 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008405 des_int_ptr(n_inlen, inlen, 3);
8406 xmlResetLastError();
8407 if (mem_base != xmlMemBlocks()) {
8408 printf("Leak of %d blocks found in isolat1ToUTF8",
8409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008411 printf(" %d", n_out);
8412 printf(" %d", n_outlen);
8413 printf(" %d", n_in);
8414 printf(" %d", n_inlen);
8415 printf("\n");
8416 }
8417 }
8418 }
8419 }
8420 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008421 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008422
Daniel Veillard42595322004-11-08 10:52:06 +00008423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008424}
8425
8426
8427static int
8428test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008430
8431 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008432 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008433 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008434 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008435 int n_alias;
8436
8437 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8438 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008439 name = gen_const_char_ptr(n_name, 0);
8440 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008441
William M. Brackf13f77f2004-11-12 16:03:48 +00008442 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008443 desret_int(ret_val);
8444 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008445 des_const_char_ptr(n_name, (const char *)name, 0);
8446 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008447 xmlResetLastError();
8448 }
8449 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008451
Daniel Veillard42595322004-11-08 10:52:06 +00008452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008453}
8454
8455
Daniel Veillardce682bc2004-11-05 17:22:25 +00008456#define gen_nb_xmlCharEncodingHandler_ptr 1
8457static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8458 return(NULL);
8459}
8460static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8461}
8462
Daniel Veillardd93f6252004-11-02 15:53:51 +00008463static int
8464test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008466
Daniel Veillardce682bc2004-11-05 17:22:25 +00008467 int mem_base;
8468 int ret_val;
8469 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8470 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008471
Daniel Veillardce682bc2004-11-05 17:22:25 +00008472 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8473 mem_base = xmlMemBlocks();
8474 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8475
8476 ret_val = xmlCharEncCloseFunc(handler);
8477 desret_int(ret_val);
8478 call_tests++;
8479 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8480 xmlResetLastError();
8481 if (mem_base != xmlMemBlocks()) {
8482 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008484 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008485 printf(" %d", n_handler);
8486 printf("\n");
8487 }
8488 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008490
Daniel Veillard42595322004-11-08 10:52:06 +00008491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008492}
8493
8494
8495static int
8496test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008498
Daniel Veillardce682bc2004-11-05 17:22:25 +00008499 int mem_base;
8500 int ret_val;
8501 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8502 int n_handler;
8503 xmlBufferPtr out; /* an xmlBuffer for the output. */
8504 int n_out;
8505 xmlBufferPtr in; /* an xmlBuffer for the input */
8506 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008507
Daniel Veillardce682bc2004-11-05 17:22:25 +00008508 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8509 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8510 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8511 mem_base = xmlMemBlocks();
8512 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8513 out = gen_xmlBufferPtr(n_out, 1);
8514 in = gen_xmlBufferPtr(n_in, 2);
8515
8516 ret_val = xmlCharEncFirstLine(handler, out, in);
8517 desret_int(ret_val);
8518 call_tests++;
8519 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8520 des_xmlBufferPtr(n_out, out, 1);
8521 des_xmlBufferPtr(n_in, in, 2);
8522 xmlResetLastError();
8523 if (mem_base != xmlMemBlocks()) {
8524 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008526 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008527 printf(" %d", n_handler);
8528 printf(" %d", n_out);
8529 printf(" %d", n_in);
8530 printf("\n");
8531 }
8532 }
8533 }
8534 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008536
Daniel Veillard42595322004-11-08 10:52:06 +00008537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008538}
8539
8540
8541static int
8542test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008544
Daniel Veillardce682bc2004-11-05 17:22:25 +00008545 int mem_base;
8546 int ret_val;
8547 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8548 int n_handler;
8549 xmlBufferPtr out; /* an xmlBuffer for the output. */
8550 int n_out;
8551 xmlBufferPtr in; /* an xmlBuffer for the input */
8552 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008553
Daniel Veillardce682bc2004-11-05 17:22:25 +00008554 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8555 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8556 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8557 mem_base = xmlMemBlocks();
8558 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8559 out = gen_xmlBufferPtr(n_out, 1);
8560 in = gen_xmlBufferPtr(n_in, 2);
8561
8562 ret_val = xmlCharEncInFunc(handler, out, in);
8563 desret_int(ret_val);
8564 call_tests++;
8565 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8566 des_xmlBufferPtr(n_out, out, 1);
8567 des_xmlBufferPtr(n_in, in, 2);
8568 xmlResetLastError();
8569 if (mem_base != xmlMemBlocks()) {
8570 printf("Leak of %d blocks found in xmlCharEncInFunc",
8571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008572 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008573 printf(" %d", n_handler);
8574 printf(" %d", n_out);
8575 printf(" %d", n_in);
8576 printf("\n");
8577 }
8578 }
8579 }
8580 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008582
Daniel Veillard42595322004-11-08 10:52:06 +00008583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008584}
8585
8586
8587static int
8588test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008590
Daniel Veillardce682bc2004-11-05 17:22:25 +00008591 int mem_base;
8592 int ret_val;
8593 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8594 int n_handler;
8595 xmlBufferPtr out; /* an xmlBuffer for the output. */
8596 int n_out;
8597 xmlBufferPtr in; /* an xmlBuffer for the input */
8598 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008599
Daniel Veillardce682bc2004-11-05 17:22:25 +00008600 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8601 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8602 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8603 mem_base = xmlMemBlocks();
8604 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8605 out = gen_xmlBufferPtr(n_out, 1);
8606 in = gen_xmlBufferPtr(n_in, 2);
8607
8608 ret_val = xmlCharEncOutFunc(handler, out, in);
8609 desret_int(ret_val);
8610 call_tests++;
8611 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8612 des_xmlBufferPtr(n_out, out, 1);
8613 des_xmlBufferPtr(n_in, in, 2);
8614 xmlResetLastError();
8615 if (mem_base != xmlMemBlocks()) {
8616 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008619 printf(" %d", n_handler);
8620 printf(" %d", n_out);
8621 printf(" %d", n_in);
8622 printf("\n");
8623 }
8624 }
8625 }
8626 }
Daniel Veillardce682bc2004-11-05 17:22:25 +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_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008636
8637
8638
8639 xmlCleanupCharEncodingHandlers();
8640 call_tests++;
8641 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008643
Daniel Veillard42595322004-11-08 10:52:06 +00008644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008645}
8646
8647
8648static int
8649test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008651
8652 int mem_base;
8653
8654 mem_base = xmlMemBlocks();
8655
8656 xmlCleanupEncodingAliases();
8657 call_tests++;
8658 xmlResetLastError();
8659 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008660 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008663 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008666
Daniel Veillard42595322004-11-08 10:52:06 +00008667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008668}
8669
8670
8671static int
8672test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008674
8675 int mem_base;
8676 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008677 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008678 int n_alias;
8679
8680 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008682 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008683
William M. Brackf13f77f2004-11-12 16:03:48 +00008684 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685 desret_int(ret_val);
8686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008687 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008688 xmlResetLastError();
8689 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008690 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008692 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008693 printf(" %d", n_alias);
8694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695 }
8696 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008698
Daniel Veillard42595322004-11-08 10:52:06 +00008699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008700}
8701
8702
8703static int
8704test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008706
Daniel Veillardce682bc2004-11-05 17:22:25 +00008707 int mem_base;
8708 xmlCharEncoding ret_val;
8709 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). */
8710 int n_in;
8711 int len; /* pointer to the length of the buffer */
8712 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008713
Daniel Veillardce682bc2004-11-05 17:22:25 +00008714 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8715 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8716 mem_base = xmlMemBlocks();
8717 in = gen_const_unsigned_char_ptr(n_in, 0);
8718 len = gen_int(n_len, 1);
8719
William M. Brackf13f77f2004-11-12 16:03:48 +00008720 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008721 desret_xmlCharEncoding(ret_val);
8722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008723 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008724 des_int(n_len, len, 1);
8725 xmlResetLastError();
8726 if (mem_base != xmlMemBlocks()) {
8727 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008730 printf(" %d", n_in);
8731 printf(" %d", n_len);
8732 printf("\n");
8733 }
8734 }
8735 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008737
Daniel Veillard42595322004-11-08 10:52:06 +00008738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008739}
8740
8741
8742static int
8743test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008745
8746
8747 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008749}
8750
8751
8752static int
8753test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755
8756
8757 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759}
8760
8761
8762static int
8763test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765
Daniel Veillard3d97e662004-11-04 10:49:00 +00008766 int mem_base;
8767 const char * ret_val;
8768 xmlCharEncoding enc; /* the encoding */
8769 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008770
Daniel Veillard3d97e662004-11-04 10:49:00 +00008771 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8772 mem_base = xmlMemBlocks();
8773 enc = gen_xmlCharEncoding(n_enc, 0);
8774
8775 ret_val = xmlGetCharEncodingName(enc);
8776 desret_const_char_ptr(ret_val);
8777 call_tests++;
8778 des_xmlCharEncoding(n_enc, enc, 0);
8779 xmlResetLastError();
8780 if (mem_base != xmlMemBlocks()) {
8781 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008783 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008784 printf(" %d", n_enc);
8785 printf("\n");
8786 }
8787 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008788 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008789
Daniel Veillard42595322004-11-08 10:52:06 +00008790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791}
8792
8793
8794static int
8795test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008797
8798 int mem_base;
8799 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008800 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008801 int n_alias;
8802
8803 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008806
William M. Brackf13f77f2004-11-12 16:03:48 +00008807 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808 desret_const_char_ptr(ret_val);
8809 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008810 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008811 xmlResetLastError();
8812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008813 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008816 printf(" %d", n_alias);
8817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818 }
8819 }
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_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829
8830
8831
8832 xmlInitCharEncodingHandlers();
8833 call_tests++;
8834 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008836
Daniel Veillard42595322004-11-08 10:52:06 +00008837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008838}
8839
8840
8841static int
8842test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844
8845
8846 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008848}
8849
8850
8851static int
8852test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008854
Daniel Veillard3d97e662004-11-04 10:49:00 +00008855 int mem_base;
8856 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008857 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008858 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008859
Daniel Veillard3d97e662004-11-04 10:49:00 +00008860 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8861 mem_base = xmlMemBlocks();
8862 name = gen_const_char_ptr(n_name, 0);
8863
William M. Brackf13f77f2004-11-12 16:03:48 +00008864 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008865 desret_xmlCharEncoding(ret_val);
8866 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008867 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008868 xmlResetLastError();
8869 if (mem_base != xmlMemBlocks()) {
8870 printf("Leak of %d blocks found in xmlParseCharEncoding",
8871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008872 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008873 printf(" %d", n_name);
8874 printf("\n");
8875 }
8876 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008877 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008878
Daniel Veillard42595322004-11-08 10:52:06 +00008879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008880}
8881
8882
Daniel Veillardce682bc2004-11-05 17:22:25 +00008883#define gen_nb_xmlCharEncodingHandlerPtr 1
8884static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8885 return(NULL);
8886}
8887static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8888}
8889
Daniel Veillardd93f6252004-11-02 15:53:51 +00008890static int
8891test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008893
Daniel Veillardce682bc2004-11-05 17:22:25 +00008894 int mem_base;
8895 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8896 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008897
Daniel Veillardce682bc2004-11-05 17:22:25 +00008898 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8899 mem_base = xmlMemBlocks();
8900 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8901
8902 xmlRegisterCharEncodingHandler(handler);
8903 call_tests++;
8904 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8905 xmlResetLastError();
8906 if (mem_base != xmlMemBlocks()) {
8907 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008910 printf(" %d", n_handler);
8911 printf("\n");
8912 }
8913 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008914 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008915
Daniel Veillard42595322004-11-08 10:52:06 +00008916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008917}
8918
8919static int
8920test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008922
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008923 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008924 test_ret += test_UTF8Toisolat1();
8925 test_ret += test_isolat1ToUTF8();
8926 test_ret += test_xmlAddEncodingAlias();
8927 test_ret += test_xmlCharEncCloseFunc();
8928 test_ret += test_xmlCharEncFirstLine();
8929 test_ret += test_xmlCharEncInFunc();
8930 test_ret += test_xmlCharEncOutFunc();
8931 test_ret += test_xmlCleanupCharEncodingHandlers();
8932 test_ret += test_xmlCleanupEncodingAliases();
8933 test_ret += test_xmlDelEncodingAlias();
8934 test_ret += test_xmlDetectCharEncoding();
8935 test_ret += test_xmlFindCharEncodingHandler();
8936 test_ret += test_xmlGetCharEncodingHandler();
8937 test_ret += test_xmlGetCharEncodingName();
8938 test_ret += test_xmlGetEncodingAlias();
8939 test_ret += test_xmlInitCharEncodingHandlers();
8940 test_ret += test_xmlNewCharEncodingHandler();
8941 test_ret += test_xmlParseCharEncoding();
8942 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008943
Daniel Veillard42595322004-11-08 10:52:06 +00008944 if (test_ret != 0)
8945 printf("Module encoding: %d errors\n", test_ret);
8946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008947}
8948
8949static int
8950test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008953 int mem_base;
8954 xmlEntityPtr ret_val;
8955 xmlDocPtr doc; /* the document */
8956 int n_doc;
8957 xmlChar * name; /* the entity name */
8958 int n_name;
8959 int type; /* the entity type XML_xxx_yyy_ENTITY */
8960 int n_type;
8961 xmlChar * ExternalID; /* the entity external ID if available */
8962 int n_ExternalID;
8963 xmlChar * SystemID; /* the entity system ID if available */
8964 int n_SystemID;
8965 xmlChar * content; /* the entity content */
8966 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008967
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008968 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8969 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8970 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8971 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8972 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8973 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8974 mem_base = xmlMemBlocks();
8975 doc = gen_xmlDocPtr(n_doc, 0);
8976 name = gen_const_xmlChar_ptr(n_name, 1);
8977 type = gen_int(n_type, 2);
8978 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8979 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8980 content = gen_const_xmlChar_ptr(n_content, 5);
8981
William M. Brackf13f77f2004-11-12 16:03:48 +00008982 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008983 desret_xmlEntityPtr(ret_val);
8984 call_tests++;
8985 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008986 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008987 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008988 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8989 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8990 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008991 xmlResetLastError();
8992 if (mem_base != xmlMemBlocks()) {
8993 printf("Leak of %d blocks found in xmlAddDocEntity",
8994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008995 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008996 printf(" %d", n_doc);
8997 printf(" %d", n_name);
8998 printf(" %d", n_type);
8999 printf(" %d", n_ExternalID);
9000 printf(" %d", n_SystemID);
9001 printf(" %d", n_content);
9002 printf("\n");
9003 }
9004 }
9005 }
9006 }
9007 }
9008 }
9009 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009011
Daniel Veillard42595322004-11-08 10:52:06 +00009012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009013}
9014
9015
9016static int
9017test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009020 int mem_base;
9021 xmlEntityPtr ret_val;
9022 xmlDocPtr doc; /* the document */
9023 int n_doc;
9024 xmlChar * name; /* the entity name */
9025 int n_name;
9026 int type; /* the entity type XML_xxx_yyy_ENTITY */
9027 int n_type;
9028 xmlChar * ExternalID; /* the entity external ID if available */
9029 int n_ExternalID;
9030 xmlChar * SystemID; /* the entity system ID if available */
9031 int n_SystemID;
9032 xmlChar * content; /* the entity content */
9033 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009035 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9036 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9037 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9038 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9039 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9040 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9041 mem_base = xmlMemBlocks();
9042 doc = gen_xmlDocPtr(n_doc, 0);
9043 name = gen_const_xmlChar_ptr(n_name, 1);
9044 type = gen_int(n_type, 2);
9045 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9046 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9047 content = gen_const_xmlChar_ptr(n_content, 5);
9048
William M. Brackf13f77f2004-11-12 16:03:48 +00009049 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009050 desret_xmlEntityPtr(ret_val);
9051 call_tests++;
9052 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009053 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009054 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009055 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9056 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9057 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009058 xmlResetLastError();
9059 if (mem_base != xmlMemBlocks()) {
9060 printf("Leak of %d blocks found in xmlAddDtdEntity",
9061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009062 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009063 printf(" %d", n_doc);
9064 printf(" %d", n_name);
9065 printf(" %d", n_type);
9066 printf(" %d", n_ExternalID);
9067 printf(" %d", n_SystemID);
9068 printf(" %d", n_content);
9069 printf("\n");
9070 }
9071 }
9072 }
9073 }
9074 }
9075 }
9076 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009078
Daniel Veillard42595322004-11-08 10:52:06 +00009079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009080}
9081
9082
9083static int
9084test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009086
William M. Brack21e4ef22005-01-02 09:53:13 +00009087#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009088#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009089 int mem_base;
9090
9091 mem_base = xmlMemBlocks();
9092
9093 xmlCleanupPredefinedEntities();
9094 call_tests++;
9095 xmlResetLastError();
9096 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009097 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009099 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009102 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009103#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009104#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009105
Daniel Veillard42595322004-11-08 10:52:06 +00009106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009107}
9108
9109
Daniel Veillardce682bc2004-11-05 17:22:25 +00009110#define gen_nb_xmlEntitiesTablePtr 1
9111static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9112 return(NULL);
9113}
9114static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9115}
9116
Daniel Veillardd93f6252004-11-02 15:53:51 +00009117static int
9118test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009120
9121
9122 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009124}
9125
9126
9127static int
9128test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009130
9131
9132 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009134}
9135
9136
9137static int
9138test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009140
William M. Brack21e4ef22005-01-02 09:53:13 +00009141#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009142 int mem_base;
9143 xmlBufferPtr buf; /* An XML buffer. */
9144 int n_buf;
9145 xmlEntitiesTablePtr table; /* An entity table */
9146 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009147
Daniel Veillardce682bc2004-11-05 17:22:25 +00009148 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9149 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9150 mem_base = xmlMemBlocks();
9151 buf = gen_xmlBufferPtr(n_buf, 0);
9152 table = gen_xmlEntitiesTablePtr(n_table, 1);
9153
9154 xmlDumpEntitiesTable(buf, table);
9155 call_tests++;
9156 des_xmlBufferPtr(n_buf, buf, 0);
9157 des_xmlEntitiesTablePtr(n_table, table, 1);
9158 xmlResetLastError();
9159 if (mem_base != xmlMemBlocks()) {
9160 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009163 printf(" %d", n_buf);
9164 printf(" %d", n_table);
9165 printf("\n");
9166 }
9167 }
9168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009169 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009170#endif
9171
Daniel Veillard42595322004-11-08 10:52:06 +00009172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009173}
9174
9175
Daniel Veillardce682bc2004-11-05 17:22:25 +00009176#define gen_nb_xmlEntityPtr 1
9177static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9178 return(NULL);
9179}
9180static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9181}
9182
Daniel Veillardd93f6252004-11-02 15:53:51 +00009183static int
9184test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009186
William M. Brack21e4ef22005-01-02 09:53:13 +00009187#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009188 int mem_base;
9189 xmlBufferPtr buf; /* An XML buffer. */
9190 int n_buf;
9191 xmlEntityPtr ent; /* An entity table */
9192 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009193
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9195 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9196 mem_base = xmlMemBlocks();
9197 buf = gen_xmlBufferPtr(n_buf, 0);
9198 ent = gen_xmlEntityPtr(n_ent, 1);
9199
9200 xmlDumpEntityDecl(buf, ent);
9201 call_tests++;
9202 des_xmlBufferPtr(n_buf, buf, 0);
9203 des_xmlEntityPtr(n_ent, ent, 1);
9204 xmlResetLastError();
9205 if (mem_base != xmlMemBlocks()) {
9206 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009208 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009209 printf(" %d", n_buf);
9210 printf(" %d", n_ent);
9211 printf("\n");
9212 }
9213 }
9214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009215 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009216#endif
9217
Daniel Veillard42595322004-11-08 10:52:06 +00009218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219}
9220
9221
9222static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009223test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009225
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009226 int mem_base;
9227 xmlChar * ret_val;
9228 xmlDocPtr doc; /* the document containing the string */
9229 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009230 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009231 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009232
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9234 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9235 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009236 doc = gen_xmlDocPtr(n_doc, 0);
9237 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009238
William M. Brackf13f77f2004-11-12 16:03:48 +00009239 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009240 desret_xmlChar_ptr(ret_val);
9241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009242 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009243 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009244 xmlResetLastError();
9245 if (mem_base != xmlMemBlocks()) {
9246 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009248 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009249 printf(" %d", n_doc);
9250 printf(" %d", n_input);
9251 printf("\n");
9252 }
9253 }
9254 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009256
Daniel Veillard42595322004-11-08 10:52:06 +00009257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009258}
9259
9260
9261static int
9262test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009264
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009265 int mem_base;
9266 xmlChar * ret_val;
9267 xmlDocPtr doc; /* the document containing the string */
9268 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009269 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009270 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009271
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9273 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009275 doc = gen_xmlDocPtr(n_doc, 0);
9276 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009277
William M. Brackf13f77f2004-11-12 16:03:48 +00009278 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009279 desret_xmlChar_ptr(ret_val);
9280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009281 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009282 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009283 xmlResetLastError();
9284 if (mem_base != xmlMemBlocks()) {
9285 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009287 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009288 printf(" %d", n_doc);
9289 printf(" %d", n_input);
9290 printf("\n");
9291 }
9292 }
9293 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009294 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009295
Daniel Veillard42595322004-11-08 10:52:06 +00009296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009297}
9298
9299
9300static int
9301test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009303
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009304 int mem_base;
9305 xmlEntityPtr ret_val;
9306 xmlDocPtr doc; /* the document referencing the entity */
9307 int n_doc;
9308 xmlChar * name; /* the entity name */
9309 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009310
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9312 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9313 mem_base = xmlMemBlocks();
9314 doc = gen_xmlDocPtr(n_doc, 0);
9315 name = gen_const_xmlChar_ptr(n_name, 1);
9316
William M. Brackf13f77f2004-11-12 16:03:48 +00009317 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009318 desret_xmlEntityPtr(ret_val);
9319 call_tests++;
9320 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009321 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009322 xmlResetLastError();
9323 if (mem_base != xmlMemBlocks()) {
9324 printf("Leak of %d blocks found in xmlGetDocEntity",
9325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009326 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009327 printf(" %d", n_doc);
9328 printf(" %d", n_name);
9329 printf("\n");
9330 }
9331 }
9332 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009334
Daniel Veillard42595322004-11-08 10:52:06 +00009335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009336}
9337
9338
9339static int
9340test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009342
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009343 int mem_base;
9344 xmlEntityPtr ret_val;
9345 xmlDocPtr doc; /* the document referencing the entity */
9346 int n_doc;
9347 xmlChar * name; /* the entity name */
9348 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009349
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009350 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9351 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9352 mem_base = xmlMemBlocks();
9353 doc = gen_xmlDocPtr(n_doc, 0);
9354 name = gen_const_xmlChar_ptr(n_name, 1);
9355
William M. Brackf13f77f2004-11-12 16:03:48 +00009356 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009357 desret_xmlEntityPtr(ret_val);
9358 call_tests++;
9359 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009360 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009361 xmlResetLastError();
9362 if (mem_base != xmlMemBlocks()) {
9363 printf("Leak of %d blocks found in xmlGetDtdEntity",
9364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009365 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009366 printf(" %d", n_doc);
9367 printf(" %d", n_name);
9368 printf("\n");
9369 }
9370 }
9371 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009372 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009373
Daniel Veillard42595322004-11-08 10:52:06 +00009374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009375}
9376
9377
9378static int
9379test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009381
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009382 int mem_base;
9383 xmlEntityPtr ret_val;
9384 xmlDocPtr doc; /* the document referencing the entity */
9385 int n_doc;
9386 xmlChar * name; /* the entity name */
9387 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009388
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009389 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9391 mem_base = xmlMemBlocks();
9392 doc = gen_xmlDocPtr(n_doc, 0);
9393 name = gen_const_xmlChar_ptr(n_name, 1);
9394
William M. Brackf13f77f2004-11-12 16:03:48 +00009395 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009396 desret_xmlEntityPtr(ret_val);
9397 call_tests++;
9398 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009400 xmlResetLastError();
9401 if (mem_base != xmlMemBlocks()) {
9402 printf("Leak of %d blocks found in xmlGetParameterEntity",
9403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009404 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009405 printf(" %d", n_doc);
9406 printf(" %d", n_name);
9407 printf("\n");
9408 }
9409 }
9410 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009412
Daniel Veillard42595322004-11-08 10:52:06 +00009413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009414}
9415
9416
9417static int
9418test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009420
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009421 int mem_base;
9422 xmlEntityPtr ret_val;
9423 xmlChar * name; /* the entity name */
9424 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009425
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009426 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9427 mem_base = xmlMemBlocks();
9428 name = gen_const_xmlChar_ptr(n_name, 0);
9429
William M. Brackf13f77f2004-11-12 16:03:48 +00009430 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009431 desret_xmlEntityPtr(ret_val);
9432 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009433 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009434 xmlResetLastError();
9435 if (mem_base != xmlMemBlocks()) {
9436 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009438 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009439 printf(" %d", n_name);
9440 printf("\n");
9441 }
9442 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009444
Daniel Veillard42595322004-11-08 10:52:06 +00009445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009446}
9447
9448
9449static int
9450test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009452
William M. Brack21e4ef22005-01-02 09:53:13 +00009453#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009454#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009455 int mem_base;
9456
9457 mem_base = xmlMemBlocks();
9458
9459 xmlInitializePredefinedEntities();
9460 call_tests++;
9461 xmlResetLastError();
9462 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009463 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009465 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009466 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009468 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009469#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009470#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009471
Daniel Veillard42595322004-11-08 10:52:06 +00009472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009473}
9474
9475static int
9476test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009478
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009479 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009480 test_ret += test_xmlAddDocEntity();
9481 test_ret += test_xmlAddDtdEntity();
9482 test_ret += test_xmlCleanupPredefinedEntities();
9483 test_ret += test_xmlCopyEntitiesTable();
9484 test_ret += test_xmlCreateEntitiesTable();
9485 test_ret += test_xmlDumpEntitiesTable();
9486 test_ret += test_xmlDumpEntityDecl();
9487 test_ret += test_xmlEncodeEntitiesReentrant();
9488 test_ret += test_xmlEncodeSpecialChars();
9489 test_ret += test_xmlGetDocEntity();
9490 test_ret += test_xmlGetDtdEntity();
9491 test_ret += test_xmlGetParameterEntity();
9492 test_ret += test_xmlGetPredefinedEntity();
9493 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009494
Daniel Veillard42595322004-11-08 10:52:06 +00009495 if (test_ret != 0)
9496 printf("Module entities: %d errors\n", test_ret);
9497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009498}
9499
9500static int
9501test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009503
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009504 int mem_base;
9505 int ret_val;
9506 xmlHashTablePtr table; /* the hash table */
9507 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009508 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009509 int n_name;
9510 void * userdata; /* a pointer to the userdata */
9511 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009512
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009513 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9514 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9515 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009517 table = gen_xmlHashTablePtr(n_table, 0);
9518 name = gen_const_xmlChar_ptr(n_name, 1);
9519 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009520
William M. Brackf13f77f2004-11-12 16:03:48 +00009521 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009522 desret_int(ret_val);
9523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009524 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009525 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009526 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009527 xmlResetLastError();
9528 if (mem_base != xmlMemBlocks()) {
9529 printf("Leak of %d blocks found in xmlHashAddEntry",
9530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009531 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009532 printf(" %d", n_table);
9533 printf(" %d", n_name);
9534 printf(" %d", n_userdata);
9535 printf("\n");
9536 }
9537 }
9538 }
9539 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009541
Daniel Veillard42595322004-11-08 10:52:06 +00009542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009543}
9544
9545
9546static int
9547test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009549
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009550 int mem_base;
9551 int ret_val;
9552 xmlHashTablePtr table; /* the hash table */
9553 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009554 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009555 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009556 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009557 int n_name2;
9558 void * userdata; /* a pointer to the userdata */
9559 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009560
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009561 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9563 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9564 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009566 table = gen_xmlHashTablePtr(n_table, 0);
9567 name = gen_const_xmlChar_ptr(n_name, 1);
9568 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9569 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009570
William M. Brackf13f77f2004-11-12 16:03:48 +00009571 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009572 desret_int(ret_val);
9573 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009574 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009575 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9576 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009577 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009578 xmlResetLastError();
9579 if (mem_base != xmlMemBlocks()) {
9580 printf("Leak of %d blocks found in xmlHashAddEntry2",
9581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009582 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009583 printf(" %d", n_table);
9584 printf(" %d", n_name);
9585 printf(" %d", n_name2);
9586 printf(" %d", n_userdata);
9587 printf("\n");
9588 }
9589 }
9590 }
9591 }
9592 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009593 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009594
Daniel Veillard42595322004-11-08 10:52:06 +00009595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009596}
9597
9598
9599static int
9600test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009602
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009603 int mem_base;
9604 int ret_val;
9605 xmlHashTablePtr table; /* the hash table */
9606 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009607 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009608 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009609 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009610 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009611 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009612 int n_name3;
9613 void * userdata; /* a pointer to the userdata */
9614 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009615
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009616 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9617 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9618 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9619 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9620 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009622 table = gen_xmlHashTablePtr(n_table, 0);
9623 name = gen_const_xmlChar_ptr(n_name, 1);
9624 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9625 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9626 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009627
William M. Brackf13f77f2004-11-12 16:03:48 +00009628 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009629 desret_int(ret_val);
9630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009631 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009632 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9633 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9634 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009635 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009636 xmlResetLastError();
9637 if (mem_base != xmlMemBlocks()) {
9638 printf("Leak of %d blocks found in xmlHashAddEntry3",
9639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009640 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009641 printf(" %d", n_table);
9642 printf(" %d", n_name);
9643 printf(" %d", n_name2);
9644 printf(" %d", n_name3);
9645 printf(" %d", n_userdata);
9646 printf("\n");
9647 }
9648 }
9649 }
9650 }
9651 }
9652 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009653 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009654
Daniel Veillard42595322004-11-08 10:52:06 +00009655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009656}
9657
9658
9659static int
9660test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009662
9663
9664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009666}
9667
9668
9669static int
9670test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009672
9673
9674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009676}
9677
9678
9679static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009680test_xmlHashCreateDict(void) {
9681 int test_ret = 0;
9682
9683
9684 /* missing type support */
9685 return(test_ret);
9686}
9687
9688
9689static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009690test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009692
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009693 int mem_base;
9694 void * ret_val;
9695 xmlHashTablePtr table; /* the hash table */
9696 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009697 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009698 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009699
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009700 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9701 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009703 table = gen_xmlHashTablePtr(n_table, 0);
9704 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009705
William M. Brackf13f77f2004-11-12 16:03:48 +00009706 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009707 desret_void_ptr(ret_val);
9708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009709 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009710 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009711 xmlResetLastError();
9712 if (mem_base != xmlMemBlocks()) {
9713 printf("Leak of %d blocks found in xmlHashLookup",
9714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009715 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009716 printf(" %d", n_table);
9717 printf(" %d", n_name);
9718 printf("\n");
9719 }
9720 }
9721 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009722 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009723
Daniel Veillard42595322004-11-08 10:52:06 +00009724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009725}
9726
9727
9728static int
9729test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009731
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009732 int mem_base;
9733 void * ret_val;
9734 xmlHashTablePtr table; /* the hash table */
9735 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009736 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009737 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009738 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009739 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009740
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009741 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9742 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9743 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009745 table = gen_xmlHashTablePtr(n_table, 0);
9746 name = gen_const_xmlChar_ptr(n_name, 1);
9747 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009748
William M. Brackf13f77f2004-11-12 16:03:48 +00009749 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009750 desret_void_ptr(ret_val);
9751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009752 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009753 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9754 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009755 xmlResetLastError();
9756 if (mem_base != xmlMemBlocks()) {
9757 printf("Leak of %d blocks found in xmlHashLookup2",
9758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009759 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009760 printf(" %d", n_table);
9761 printf(" %d", n_name);
9762 printf(" %d", n_name2);
9763 printf("\n");
9764 }
9765 }
9766 }
9767 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009768 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009769
Daniel Veillard42595322004-11-08 10:52:06 +00009770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009771}
9772
9773
9774static int
9775test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009777
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009778 int mem_base;
9779 void * ret_val;
9780 xmlHashTablePtr table; /* the hash table */
9781 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009782 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009783 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009784 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009785 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009786 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009787 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009788
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009789 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9790 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9791 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9792 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009794 table = gen_xmlHashTablePtr(n_table, 0);
9795 name = gen_const_xmlChar_ptr(n_name, 1);
9796 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9797 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009798
William M. Brackf13f77f2004-11-12 16:03:48 +00009799 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009800 desret_void_ptr(ret_val);
9801 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009802 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009803 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9804 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9805 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009806 xmlResetLastError();
9807 if (mem_base != xmlMemBlocks()) {
9808 printf("Leak of %d blocks found in xmlHashLookup3",
9809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009810 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811 printf(" %d", n_table);
9812 printf(" %d", n_name);
9813 printf(" %d", n_name2);
9814 printf(" %d", n_name3);
9815 printf("\n");
9816 }
9817 }
9818 }
9819 }
9820 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009822
Daniel Veillard42595322004-11-08 10:52:06 +00009823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009824}
9825
9826
9827static int
9828test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009830
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009831 int mem_base;
9832 void * ret_val;
9833 xmlHashTablePtr table; /* the hash table */
9834 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009835 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009836 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009837 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009838 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009839
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009840 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9841 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9842 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009844 table = gen_xmlHashTablePtr(n_table, 0);
9845 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9846 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009847
William M. Brackf13f77f2004-11-12 16:03:48 +00009848 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009849 desret_void_ptr(ret_val);
9850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009851 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009852 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9853 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009854 xmlResetLastError();
9855 if (mem_base != xmlMemBlocks()) {
9856 printf("Leak of %d blocks found in xmlHashQLookup",
9857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009858 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009859 printf(" %d", n_table);
9860 printf(" %d", n_prefix);
9861 printf(" %d", n_name);
9862 printf("\n");
9863 }
9864 }
9865 }
9866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009868
Daniel Veillard42595322004-11-08 10:52:06 +00009869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009870}
9871
9872
9873static int
9874test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009876
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009877 int mem_base;
9878 void * ret_val;
9879 xmlHashTablePtr table; /* the hash table */
9880 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009881 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009882 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009883 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009884 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009885 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009886 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009887 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009888 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009889
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009890 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9891 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9892 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9893 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9894 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009896 table = gen_xmlHashTablePtr(n_table, 0);
9897 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9898 name = gen_const_xmlChar_ptr(n_name, 2);
9899 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9900 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009901
William M. Brackf13f77f2004-11-12 16:03:48 +00009902 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009903 desret_void_ptr(ret_val);
9904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009905 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009906 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9907 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9908 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9909 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 xmlResetLastError();
9911 if (mem_base != xmlMemBlocks()) {
9912 printf("Leak of %d blocks found in xmlHashQLookup2",
9913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009914 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009915 printf(" %d", n_table);
9916 printf(" %d", n_prefix);
9917 printf(" %d", n_name);
9918 printf(" %d", n_prefix2);
9919 printf(" %d", n_name2);
9920 printf("\n");
9921 }
9922 }
9923 }
9924 }
9925 }
9926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009928
Daniel Veillard42595322004-11-08 10:52:06 +00009929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009930}
9931
9932
9933static int
9934test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009937 int mem_base;
9938 void * ret_val;
9939 xmlHashTablePtr table; /* the hash table */
9940 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009941 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009942 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009943 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009944 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009945 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009946 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009947 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009948 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009949 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009950 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009951 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009952 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009953
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009954 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9955 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9956 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9957 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9958 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9959 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9960 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009962 table = gen_xmlHashTablePtr(n_table, 0);
9963 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9964 name = gen_const_xmlChar_ptr(n_name, 2);
9965 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9966 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9967 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9968 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009969
William M. Brackf13f77f2004-11-12 16:03:48 +00009970 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 +00009971 desret_void_ptr(ret_val);
9972 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009973 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009974 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9975 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9976 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9977 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9978 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9979 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009980 xmlResetLastError();
9981 if (mem_base != xmlMemBlocks()) {
9982 printf("Leak of %d blocks found in xmlHashQLookup3",
9983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009984 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009985 printf(" %d", n_table);
9986 printf(" %d", n_prefix);
9987 printf(" %d", n_name);
9988 printf(" %d", n_prefix2);
9989 printf(" %d", n_name2);
9990 printf(" %d", n_prefix3);
9991 printf(" %d", n_name3);
9992 printf("\n");
9993 }
9994 }
9995 }
9996 }
9997 }
9998 }
9999 }
10000 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010001 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010002
Daniel Veillard42595322004-11-08 10:52:06 +000010003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010004}
10005
10006
10007static int
10008test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010010
Daniel Veillard42595322004-11-08 10:52:06 +000010011 int mem_base;
10012 int ret_val;
10013 xmlHashTablePtr table; /* the hash table */
10014 int n_table;
10015 xmlChar * name; /* the name of the userdata */
10016 int n_name;
10017 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10018 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010019
Daniel Veillard42595322004-11-08 10:52:06 +000010020 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10021 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10022 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10023 mem_base = xmlMemBlocks();
10024 table = gen_xmlHashTablePtr(n_table, 0);
10025 name = gen_const_xmlChar_ptr(n_name, 1);
10026 f = gen_xmlHashDeallocator(n_f, 2);
10027
William M. Brackf13f77f2004-11-12 16:03:48 +000010028 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010029 desret_int(ret_val);
10030 call_tests++;
10031 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010033 des_xmlHashDeallocator(n_f, f, 2);
10034 xmlResetLastError();
10035 if (mem_base != xmlMemBlocks()) {
10036 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10037 xmlMemBlocks() - mem_base);
10038 test_ret++;
10039 printf(" %d", n_table);
10040 printf(" %d", n_name);
10041 printf(" %d", n_f);
10042 printf("\n");
10043 }
10044 }
10045 }
10046 }
Daniel Veillard42595322004-11-08 10:52:06 +000010047 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010048
Daniel Veillard42595322004-11-08 10:52:06 +000010049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010050}
10051
10052
10053static int
10054test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010056
Daniel Veillard42595322004-11-08 10:52:06 +000010057 int mem_base;
10058 int ret_val;
10059 xmlHashTablePtr table; /* the hash table */
10060 int n_table;
10061 xmlChar * name; /* the name of the userdata */
10062 int n_name;
10063 xmlChar * name2; /* a second name of the userdata */
10064 int n_name2;
10065 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10066 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010067
Daniel Veillard42595322004-11-08 10:52:06 +000010068 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10069 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10070 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10071 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10072 mem_base = xmlMemBlocks();
10073 table = gen_xmlHashTablePtr(n_table, 0);
10074 name = gen_const_xmlChar_ptr(n_name, 1);
10075 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10076 f = gen_xmlHashDeallocator(n_f, 3);
10077
William M. Brackf13f77f2004-11-12 16:03:48 +000010078 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010079 desret_int(ret_val);
10080 call_tests++;
10081 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010082 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10083 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010084 des_xmlHashDeallocator(n_f, f, 3);
10085 xmlResetLastError();
10086 if (mem_base != xmlMemBlocks()) {
10087 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10088 xmlMemBlocks() - mem_base);
10089 test_ret++;
10090 printf(" %d", n_table);
10091 printf(" %d", n_name);
10092 printf(" %d", n_name2);
10093 printf(" %d", n_f);
10094 printf("\n");
10095 }
10096 }
10097 }
10098 }
10099 }
Daniel Veillard42595322004-11-08 10:52:06 +000010100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010101
Daniel Veillard42595322004-11-08 10:52:06 +000010102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010103}
10104
10105
10106static int
10107test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109
Daniel Veillard42595322004-11-08 10:52:06 +000010110 int mem_base;
10111 int ret_val;
10112 xmlHashTablePtr table; /* the hash table */
10113 int n_table;
10114 xmlChar * name; /* the name of the userdata */
10115 int n_name;
10116 xmlChar * name2; /* a second name of the userdata */
10117 int n_name2;
10118 xmlChar * name3; /* a third name of the userdata */
10119 int n_name3;
10120 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10121 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010122
Daniel Veillard42595322004-11-08 10:52:06 +000010123 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10124 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10125 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10126 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10127 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10128 mem_base = xmlMemBlocks();
10129 table = gen_xmlHashTablePtr(n_table, 0);
10130 name = gen_const_xmlChar_ptr(n_name, 1);
10131 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10132 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10133 f = gen_xmlHashDeallocator(n_f, 4);
10134
William M. Brackf13f77f2004-11-12 16:03:48 +000010135 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010136 desret_int(ret_val);
10137 call_tests++;
10138 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010139 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10140 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10141 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010142 des_xmlHashDeallocator(n_f, f, 4);
10143 xmlResetLastError();
10144 if (mem_base != xmlMemBlocks()) {
10145 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10146 xmlMemBlocks() - mem_base);
10147 test_ret++;
10148 printf(" %d", n_table);
10149 printf(" %d", n_name);
10150 printf(" %d", n_name2);
10151 printf(" %d", n_name3);
10152 printf(" %d", n_f);
10153 printf("\n");
10154 }
10155 }
10156 }
10157 }
10158 }
10159 }
Daniel Veillard42595322004-11-08 10:52:06 +000010160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010161
Daniel Veillard42595322004-11-08 10:52:06 +000010162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010163}
10164
10165
10166static int
10167test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010169
10170
10171 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010173}
10174
10175
10176static int
10177test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010179
10180
10181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010183}
10184
10185
10186static int
10187test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010189
10190
10191 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010193}
10194
10195
10196static int
10197test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010199
10200
10201 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010203}
10204
10205
10206static int
10207test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010209
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010210 int mem_base;
10211 int ret_val;
10212 xmlHashTablePtr table; /* the hash table */
10213 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010214
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010215 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010217 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010218
10219 ret_val = xmlHashSize(table);
10220 desret_int(ret_val);
10221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010222 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010223 xmlResetLastError();
10224 if (mem_base != xmlMemBlocks()) {
10225 printf("Leak of %d blocks found in xmlHashSize",
10226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010227 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010228 printf(" %d", n_table);
10229 printf("\n");
10230 }
10231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010233
Daniel Veillard42595322004-11-08 10:52:06 +000010234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010235}
10236
10237
10238static int
10239test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010241
Daniel Veillard42595322004-11-08 10:52:06 +000010242 int mem_base;
10243 int ret_val;
10244 xmlHashTablePtr table; /* the hash table */
10245 int n_table;
10246 xmlChar * name; /* the name of the userdata */
10247 int n_name;
10248 void * userdata; /* a pointer to the userdata */
10249 int n_userdata;
10250 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10251 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010252
Daniel Veillard42595322004-11-08 10:52:06 +000010253 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10254 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10255 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10256 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10257 mem_base = xmlMemBlocks();
10258 table = gen_xmlHashTablePtr(n_table, 0);
10259 name = gen_const_xmlChar_ptr(n_name, 1);
10260 userdata = gen_userdata(n_userdata, 2);
10261 f = gen_xmlHashDeallocator(n_f, 3);
10262
William M. Brackf13f77f2004-11-12 16:03:48 +000010263 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010264 desret_int(ret_val);
10265 call_tests++;
10266 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010267 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010268 des_userdata(n_userdata, userdata, 2);
10269 des_xmlHashDeallocator(n_f, f, 3);
10270 xmlResetLastError();
10271 if (mem_base != xmlMemBlocks()) {
10272 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10273 xmlMemBlocks() - mem_base);
10274 test_ret++;
10275 printf(" %d", n_table);
10276 printf(" %d", n_name);
10277 printf(" %d", n_userdata);
10278 printf(" %d", n_f);
10279 printf("\n");
10280 }
10281 }
10282 }
10283 }
10284 }
Daniel Veillard42595322004-11-08 10:52:06 +000010285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010286
Daniel Veillard42595322004-11-08 10:52:06 +000010287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010288}
10289
10290
10291static int
10292test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010294
Daniel Veillard42595322004-11-08 10:52:06 +000010295 int mem_base;
10296 int ret_val;
10297 xmlHashTablePtr table; /* the hash table */
10298 int n_table;
10299 xmlChar * name; /* the name of the userdata */
10300 int n_name;
10301 xmlChar * name2; /* a second name of the userdata */
10302 int n_name2;
10303 void * userdata; /* a pointer to the userdata */
10304 int n_userdata;
10305 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10306 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010307
Daniel Veillard42595322004-11-08 10:52:06 +000010308 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10310 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10311 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10312 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10313 mem_base = xmlMemBlocks();
10314 table = gen_xmlHashTablePtr(n_table, 0);
10315 name = gen_const_xmlChar_ptr(n_name, 1);
10316 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10317 userdata = gen_userdata(n_userdata, 3);
10318 f = gen_xmlHashDeallocator(n_f, 4);
10319
William M. Brackf13f77f2004-11-12 16:03:48 +000010320 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010321 desret_int(ret_val);
10322 call_tests++;
10323 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010324 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10325 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010326 des_userdata(n_userdata, userdata, 3);
10327 des_xmlHashDeallocator(n_f, f, 4);
10328 xmlResetLastError();
10329 if (mem_base != xmlMemBlocks()) {
10330 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10331 xmlMemBlocks() - mem_base);
10332 test_ret++;
10333 printf(" %d", n_table);
10334 printf(" %d", n_name);
10335 printf(" %d", n_name2);
10336 printf(" %d", n_userdata);
10337 printf(" %d", n_f);
10338 printf("\n");
10339 }
10340 }
10341 }
10342 }
10343 }
10344 }
Daniel Veillard42595322004-11-08 10:52:06 +000010345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010346
Daniel Veillard42595322004-11-08 10:52:06 +000010347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010348}
10349
10350
10351static int
10352test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010354
Daniel Veillard42595322004-11-08 10:52:06 +000010355 int mem_base;
10356 int ret_val;
10357 xmlHashTablePtr table; /* the hash table */
10358 int n_table;
10359 xmlChar * name; /* the name of the userdata */
10360 int n_name;
10361 xmlChar * name2; /* a second name of the userdata */
10362 int n_name2;
10363 xmlChar * name3; /* a third name of the userdata */
10364 int n_name3;
10365 void * userdata; /* a pointer to the userdata */
10366 int n_userdata;
10367 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10368 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010369
Daniel Veillard42595322004-11-08 10:52:06 +000010370 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10372 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10373 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10374 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10375 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10376 mem_base = xmlMemBlocks();
10377 table = gen_xmlHashTablePtr(n_table, 0);
10378 name = gen_const_xmlChar_ptr(n_name, 1);
10379 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10380 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10381 userdata = gen_userdata(n_userdata, 4);
10382 f = gen_xmlHashDeallocator(n_f, 5);
10383
William M. Brackf13f77f2004-11-12 16:03:48 +000010384 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010385 desret_int(ret_val);
10386 call_tests++;
10387 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010388 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10389 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10390 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010391 des_userdata(n_userdata, userdata, 4);
10392 des_xmlHashDeallocator(n_f, f, 5);
10393 xmlResetLastError();
10394 if (mem_base != xmlMemBlocks()) {
10395 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10396 xmlMemBlocks() - mem_base);
10397 test_ret++;
10398 printf(" %d", n_table);
10399 printf(" %d", n_name);
10400 printf(" %d", n_name2);
10401 printf(" %d", n_name3);
10402 printf(" %d", n_userdata);
10403 printf(" %d", n_f);
10404 printf("\n");
10405 }
10406 }
10407 }
10408 }
10409 }
10410 }
10411 }
Daniel Veillard42595322004-11-08 10:52:06 +000010412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010413
Daniel Veillard42595322004-11-08 10:52:06 +000010414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010415}
10416
10417static int
10418test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010420
Daniel Veillard2ae13382005-01-25 23:45:06 +000010421 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010422 test_ret += test_xmlHashAddEntry();
10423 test_ret += test_xmlHashAddEntry2();
10424 test_ret += test_xmlHashAddEntry3();
10425 test_ret += test_xmlHashCopy();
10426 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010427 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010428 test_ret += test_xmlHashLookup();
10429 test_ret += test_xmlHashLookup2();
10430 test_ret += test_xmlHashLookup3();
10431 test_ret += test_xmlHashQLookup();
10432 test_ret += test_xmlHashQLookup2();
10433 test_ret += test_xmlHashQLookup3();
10434 test_ret += test_xmlHashRemoveEntry();
10435 test_ret += test_xmlHashRemoveEntry2();
10436 test_ret += test_xmlHashRemoveEntry3();
10437 test_ret += test_xmlHashScan();
10438 test_ret += test_xmlHashScan3();
10439 test_ret += test_xmlHashScanFull();
10440 test_ret += test_xmlHashScanFull3();
10441 test_ret += test_xmlHashSize();
10442 test_ret += test_xmlHashUpdateEntry();
10443 test_ret += test_xmlHashUpdateEntry2();
10444 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010445
Daniel Veillard42595322004-11-08 10:52:06 +000010446 if (test_ret != 0)
10447 printf("Module hash: %d errors\n", test_ret);
10448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010449}
10450
Daniel Veillardce682bc2004-11-05 17:22:25 +000010451#define gen_nb_xmlLinkPtr 1
10452static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10453 return(NULL);
10454}
10455static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10456}
10457
Daniel Veillardd93f6252004-11-02 15:53:51 +000010458static int
10459test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461
Daniel Veillardce682bc2004-11-05 17:22:25 +000010462 int mem_base;
10463 void * ret_val;
10464 xmlLinkPtr lk; /* a link */
10465 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010466
Daniel Veillardce682bc2004-11-05 17:22:25 +000010467 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10468 mem_base = xmlMemBlocks();
10469 lk = gen_xmlLinkPtr(n_lk, 0);
10470
10471 ret_val = xmlLinkGetData(lk);
10472 desret_void_ptr(ret_val);
10473 call_tests++;
10474 des_xmlLinkPtr(n_lk, lk, 0);
10475 xmlResetLastError();
10476 if (mem_base != xmlMemBlocks()) {
10477 printf("Leak of %d blocks found in xmlLinkGetData",
10478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010479 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010480 printf(" %d", n_lk);
10481 printf("\n");
10482 }
10483 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010485
Daniel Veillard42595322004-11-08 10:52:06 +000010486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010487}
10488
10489
10490static int
10491test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010493
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010494 int mem_base;
10495 int ret_val;
10496 xmlListPtr l; /* a list */
10497 int n_l;
10498 void * data; /* the data */
10499 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010500
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010501 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10502 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010504 l = gen_xmlListPtr(n_l, 0);
10505 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010506
10507 ret_val = xmlListAppend(l, data);
10508 desret_int(ret_val);
10509 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010510 des_xmlListPtr(n_l, l, 0);
10511 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010512 xmlResetLastError();
10513 if (mem_base != xmlMemBlocks()) {
10514 printf("Leak of %d blocks found in xmlListAppend",
10515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010516 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010517 printf(" %d", n_l);
10518 printf(" %d", n_data);
10519 printf("\n");
10520 }
10521 }
10522 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010524
Daniel Veillard42595322004-11-08 10:52:06 +000010525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010526}
10527
10528
10529static int
10530test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010532
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010533 int mem_base;
10534 xmlListPtr l; /* a list */
10535 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010536
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010537 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010539 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010540
10541 xmlListClear(l);
10542 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010543 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010544 xmlResetLastError();
10545 if (mem_base != xmlMemBlocks()) {
10546 printf("Leak of %d blocks found in xmlListClear",
10547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010548 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010549 printf(" %d", n_l);
10550 printf("\n");
10551 }
10552 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010554
Daniel Veillard42595322004-11-08 10:52:06 +000010555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010556}
10557
10558
Daniel Veillardce682bc2004-11-05 17:22:25 +000010559#define gen_nb_const_xmlListPtr 1
10560static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10561 return(NULL);
10562}
10563static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10564}
10565
Daniel Veillardd93f6252004-11-02 15:53:51 +000010566static int
10567test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010569
Daniel Veillardce682bc2004-11-05 17:22:25 +000010570 int mem_base;
10571 int ret_val;
10572 xmlListPtr cur; /* the new list */
10573 int n_cur;
10574 xmlListPtr old; /* the old list */
10575 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576
Daniel Veillardce682bc2004-11-05 17:22:25 +000010577 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10578 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10579 mem_base = xmlMemBlocks();
10580 cur = gen_xmlListPtr(n_cur, 0);
10581 old = gen_const_xmlListPtr(n_old, 1);
10582
William M. Brackf13f77f2004-11-12 16:03:48 +000010583 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010584 desret_int(ret_val);
10585 call_tests++;
10586 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010587 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010588 xmlResetLastError();
10589 if (mem_base != xmlMemBlocks()) {
10590 printf("Leak of %d blocks found in xmlListCopy",
10591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010592 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010593 printf(" %d", n_cur);
10594 printf(" %d", n_old);
10595 printf("\n");
10596 }
10597 }
10598 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010599 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010600
Daniel Veillard42595322004-11-08 10:52:06 +000010601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010602}
10603
10604
10605static int
10606test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010608
10609
10610 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010612}
10613
10614
10615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010616test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010618
10619
10620 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010622}
10623
10624
10625static int
10626test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010629 int mem_base;
10630 int ret_val;
10631 xmlListPtr l; /* a list */
10632 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010633
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010634 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010636 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010637
10638 ret_val = xmlListEmpty(l);
10639 desret_int(ret_val);
10640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010641 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010642 xmlResetLastError();
10643 if (mem_base != xmlMemBlocks()) {
10644 printf("Leak of %d blocks found in xmlListEmpty",
10645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010646 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010647 printf(" %d", n_l);
10648 printf("\n");
10649 }
10650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010652
Daniel Veillard42595322004-11-08 10:52:06 +000010653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654}
10655
10656
10657static int
10658test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010660
10661
10662 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010664}
10665
10666
10667static int
10668test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010670
10671
10672 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010674}
10675
10676
10677static int
10678test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010680
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010681 int mem_base;
10682 int ret_val;
10683 xmlListPtr l; /* a list */
10684 int n_l;
10685 void * data; /* the data */
10686 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010687
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010688 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10689 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010691 l = gen_xmlListPtr(n_l, 0);
10692 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010693
10694 ret_val = xmlListInsert(l, data);
10695 desret_int(ret_val);
10696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010697 des_xmlListPtr(n_l, l, 0);
10698 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010699 xmlResetLastError();
10700 if (mem_base != xmlMemBlocks()) {
10701 printf("Leak of %d blocks found in xmlListInsert",
10702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010703 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010704 printf(" %d", n_l);
10705 printf(" %d", n_data);
10706 printf("\n");
10707 }
10708 }
10709 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010710 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010711
Daniel Veillard42595322004-11-08 10:52:06 +000010712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010713}
10714
10715
10716static int
10717test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010719
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720 int mem_base;
10721 xmlListPtr l1; /* the original list */
10722 int n_l1;
10723 xmlListPtr l2; /* the new list */
10724 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010725
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010726 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10727 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010729 l1 = gen_xmlListPtr(n_l1, 0);
10730 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010731
10732 xmlListMerge(l1, l2);
10733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010734 des_xmlListPtr(n_l1, l1, 0);
10735 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010736 xmlResetLastError();
10737 if (mem_base != xmlMemBlocks()) {
10738 printf("Leak of %d blocks found in xmlListMerge",
10739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010740 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010741 printf(" %d", n_l1);
10742 printf(" %d", n_l2);
10743 printf("\n");
10744 }
10745 }
10746 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010747 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010748
Daniel Veillard42595322004-11-08 10:52:06 +000010749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010750}
10751
10752
10753static int
10754test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010756
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010757 int mem_base;
10758 xmlListPtr l; /* a list */
10759 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010760
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010761 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010763 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010764
10765 xmlListPopBack(l);
10766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010767 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010768 xmlResetLastError();
10769 if (mem_base != xmlMemBlocks()) {
10770 printf("Leak of %d blocks found in xmlListPopBack",
10771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010772 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010773 printf(" %d", n_l);
10774 printf("\n");
10775 }
10776 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010778
Daniel Veillard42595322004-11-08 10:52:06 +000010779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780}
10781
10782
10783static int
10784test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010786
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010787 int mem_base;
10788 xmlListPtr l; /* a list */
10789 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010790
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010791 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010793 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010794
10795 xmlListPopFront(l);
10796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010798 xmlResetLastError();
10799 if (mem_base != xmlMemBlocks()) {
10800 printf("Leak of %d blocks found in xmlListPopFront",
10801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010802 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803 printf(" %d", n_l);
10804 printf("\n");
10805 }
10806 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010807 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010808
Daniel Veillard42595322004-11-08 10:52:06 +000010809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010810}
10811
10812
10813static int
10814test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010816
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010817 int mem_base;
10818 int ret_val;
10819 xmlListPtr l; /* a list */
10820 int n_l;
10821 void * data; /* new data */
10822 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10825 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010827 l = gen_xmlListPtr(n_l, 0);
10828 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010829
10830 ret_val = xmlListPushBack(l, data);
10831 desret_int(ret_val);
10832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010833 des_xmlListPtr(n_l, l, 0);
10834 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010835 xmlResetLastError();
10836 if (mem_base != xmlMemBlocks()) {
10837 printf("Leak of %d blocks found in xmlListPushBack",
10838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010839 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010840 printf(" %d", n_l);
10841 printf(" %d", n_data);
10842 printf("\n");
10843 }
10844 }
10845 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010846 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010847
Daniel Veillard42595322004-11-08 10:52:06 +000010848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010849}
10850
10851
10852static int
10853test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010855
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010856 int mem_base;
10857 int ret_val;
10858 xmlListPtr l; /* a list */
10859 int n_l;
10860 void * data; /* new data */
10861 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010863 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10864 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10865 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010866 l = gen_xmlListPtr(n_l, 0);
10867 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010868
10869 ret_val = xmlListPushFront(l, data);
10870 desret_int(ret_val);
10871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010872 des_xmlListPtr(n_l, l, 0);
10873 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010874 xmlResetLastError();
10875 if (mem_base != xmlMemBlocks()) {
10876 printf("Leak of %d blocks found in xmlListPushFront",
10877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010878 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010879 printf(" %d", n_l);
10880 printf(" %d", n_data);
10881 printf("\n");
10882 }
10883 }
10884 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010885 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010886
Daniel Veillard42595322004-11-08 10:52:06 +000010887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010888}
10889
10890
10891static int
10892test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010894
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010895 int mem_base;
10896 int ret_val;
10897 xmlListPtr l; /* a list */
10898 int n_l;
10899 void * data; /* list data */
10900 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010902 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10903 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010905 l = gen_xmlListPtr(n_l, 0);
10906 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010907
10908 ret_val = xmlListRemoveAll(l, data);
10909 desret_int(ret_val);
10910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010911 des_xmlListPtr(n_l, l, 0);
10912 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010913 xmlResetLastError();
10914 if (mem_base != xmlMemBlocks()) {
10915 printf("Leak of %d blocks found in xmlListRemoveAll",
10916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010917 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010918 printf(" %d", n_l);
10919 printf(" %d", n_data);
10920 printf("\n");
10921 }
10922 }
10923 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010924 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010925
Daniel Veillard42595322004-11-08 10:52:06 +000010926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010927}
10928
10929
10930static int
10931test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010933
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010934 int mem_base;
10935 int ret_val;
10936 xmlListPtr l; /* a list */
10937 int n_l;
10938 void * data; /* list data */
10939 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010940
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010941 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10942 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010944 l = gen_xmlListPtr(n_l, 0);
10945 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010946
10947 ret_val = xmlListRemoveFirst(l, data);
10948 desret_int(ret_val);
10949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010950 des_xmlListPtr(n_l, l, 0);
10951 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010952 xmlResetLastError();
10953 if (mem_base != xmlMemBlocks()) {
10954 printf("Leak of %d blocks found in xmlListRemoveFirst",
10955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010956 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010957 printf(" %d", n_l);
10958 printf(" %d", n_data);
10959 printf("\n");
10960 }
10961 }
10962 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010963 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010964
Daniel Veillard42595322004-11-08 10:52:06 +000010965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010966}
10967
10968
10969static int
10970test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010973 int mem_base;
10974 int ret_val;
10975 xmlListPtr l; /* a list */
10976 int n_l;
10977 void * data; /* list data */
10978 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010979
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010980 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10981 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10982 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010983 l = gen_xmlListPtr(n_l, 0);
10984 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010985
10986 ret_val = xmlListRemoveLast(l, data);
10987 desret_int(ret_val);
10988 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010989 des_xmlListPtr(n_l, l, 0);
10990 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010991 xmlResetLastError();
10992 if (mem_base != xmlMemBlocks()) {
10993 printf("Leak of %d blocks found in xmlListRemoveLast",
10994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010995 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010996 printf(" %d", n_l);
10997 printf(" %d", n_data);
10998 printf("\n");
10999 }
11000 }
11001 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011002 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011003
Daniel Veillard42595322004-11-08 10:52:06 +000011004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011005}
11006
11007
11008static int
11009test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011012 int mem_base;
11013 xmlListPtr l; /* a list */
11014 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011015
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011016 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011018 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011019
11020 xmlListReverse(l);
11021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011022 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011023 xmlResetLastError();
11024 if (mem_base != xmlMemBlocks()) {
11025 printf("Leak of %d blocks found in xmlListReverse",
11026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011027 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011028 printf(" %d", n_l);
11029 printf("\n");
11030 }
11031 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011033
Daniel Veillard42595322004-11-08 10:52:06 +000011034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011035}
11036
11037
11038static int
11039test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011041
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011042 int mem_base;
11043 void * ret_val;
11044 xmlListPtr l; /* a list */
11045 int n_l;
11046 void * data; /* a search value */
11047 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011048
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011049 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11050 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11051 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011052 l = gen_xmlListPtr(n_l, 0);
11053 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011054
11055 ret_val = xmlListReverseSearch(l, data);
11056 desret_void_ptr(ret_val);
11057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011058 des_xmlListPtr(n_l, l, 0);
11059 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011060 xmlResetLastError();
11061 if (mem_base != xmlMemBlocks()) {
11062 printf("Leak of %d blocks found in xmlListReverseSearch",
11063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011064 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011065 printf(" %d", n_l);
11066 printf(" %d", n_data);
11067 printf("\n");
11068 }
11069 }
11070 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011072
Daniel Veillard42595322004-11-08 10:52:06 +000011073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011074}
11075
11076
11077static int
11078test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011080
11081
11082 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011084}
11085
11086
11087static int
11088test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011090
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011091 int mem_base;
11092 void * ret_val;
11093 xmlListPtr l; /* a list */
11094 int n_l;
11095 void * data; /* a search value */
11096 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011097
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011098 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11099 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 l = gen_xmlListPtr(n_l, 0);
11102 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011103
11104 ret_val = xmlListSearch(l, data);
11105 desret_void_ptr(ret_val);
11106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011107 des_xmlListPtr(n_l, l, 0);
11108 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011109 xmlResetLastError();
11110 if (mem_base != xmlMemBlocks()) {
11111 printf("Leak of %d blocks found in xmlListSearch",
11112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011113 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011114 printf(" %d", n_l);
11115 printf(" %d", n_data);
11116 printf("\n");
11117 }
11118 }
11119 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011121
Daniel Veillard42595322004-11-08 10:52:06 +000011122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011123}
11124
11125
11126static int
11127test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011130 int mem_base;
11131 int ret_val;
11132 xmlListPtr l; /* a list */
11133 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011134
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011135 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11136 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011137 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011138
11139 ret_val = xmlListSize(l);
11140 desret_int(ret_val);
11141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011142 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011143 xmlResetLastError();
11144 if (mem_base != xmlMemBlocks()) {
11145 printf("Leak of %d blocks found in xmlListSize",
11146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011147 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011148 printf(" %d", n_l);
11149 printf("\n");
11150 }
11151 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011152 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011153
Daniel Veillard42595322004-11-08 10:52:06 +000011154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011155}
11156
11157
11158static int
11159test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011161
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011162 int mem_base;
11163 xmlListPtr l; /* a list */
11164 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011165
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011166 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011168 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011169
11170 xmlListSort(l);
11171 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011172 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011173 xmlResetLastError();
11174 if (mem_base != xmlMemBlocks()) {
11175 printf("Leak of %d blocks found in xmlListSort",
11176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011177 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011178 printf(" %d", n_l);
11179 printf("\n");
11180 }
11181 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011182 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011183
Daniel Veillard42595322004-11-08 10:52:06 +000011184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011185}
11186
11187
11188static int
11189test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011191
11192
11193 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011195}
11196
11197static int
11198test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011200
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011201 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011202 test_ret += test_xmlLinkGetData();
11203 test_ret += test_xmlListAppend();
11204 test_ret += test_xmlListClear();
11205 test_ret += test_xmlListCopy();
11206 test_ret += test_xmlListCreate();
11207 test_ret += test_xmlListDup();
11208 test_ret += test_xmlListEmpty();
11209 test_ret += test_xmlListEnd();
11210 test_ret += test_xmlListFront();
11211 test_ret += test_xmlListInsert();
11212 test_ret += test_xmlListMerge();
11213 test_ret += test_xmlListPopBack();
11214 test_ret += test_xmlListPopFront();
11215 test_ret += test_xmlListPushBack();
11216 test_ret += test_xmlListPushFront();
11217 test_ret += test_xmlListRemoveAll();
11218 test_ret += test_xmlListRemoveFirst();
11219 test_ret += test_xmlListRemoveLast();
11220 test_ret += test_xmlListReverse();
11221 test_ret += test_xmlListReverseSearch();
11222 test_ret += test_xmlListReverseWalk();
11223 test_ret += test_xmlListSearch();
11224 test_ret += test_xmlListSize();
11225 test_ret += test_xmlListSort();
11226 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227
Daniel Veillard42595322004-11-08 10:52:06 +000011228 if (test_ret != 0)
11229 printf("Module list: %d errors\n", test_ret);
11230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011231}
11232
11233static int
11234test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011236
William M. Brack21e4ef22005-01-02 09:53:13 +000011237#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011238 int mem_base;
11239 int ret_val;
11240 void * ctx; /* an FTP context */
11241 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011242
Daniel Veillard27f20102004-11-05 11:50:11 +000011243 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11244 mem_base = xmlMemBlocks();
11245 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11246
11247 ret_val = xmlNanoFTPCheckResponse(ctx);
11248 desret_int(ret_val);
11249 call_tests++;
11250 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11251 xmlResetLastError();
11252 if (mem_base != xmlMemBlocks()) {
11253 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011255 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011256 printf(" %d", n_ctx);
11257 printf("\n");
11258 }
11259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011260 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011261#endif
11262
Daniel Veillard42595322004-11-08 10:52:06 +000011263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011264}
11265
11266
11267static int
11268test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011270
William M. Brack21e4ef22005-01-02 09:53:13 +000011271#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011272 int mem_base;
11273
11274 mem_base = xmlMemBlocks();
11275
11276 xmlNanoFTPCleanup();
11277 call_tests++;
11278 xmlResetLastError();
11279 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011280 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011282 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011283 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011285 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011286#endif
11287
Daniel Veillard42595322004-11-08 10:52:06 +000011288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011289}
11290
11291
11292static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011295
William M. Brack21e4ef22005-01-02 09:53:13 +000011296#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011297 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011298 int ret_val;
11299 void * ctx; /* an FTP context */
11300 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011301
Daniel Veillard27f20102004-11-05 11:50:11 +000011302 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011303 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011304 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011305
Daniel Veillard27f20102004-11-05 11:50:11 +000011306 ret_val = xmlNanoFTPCloseConnection(ctx);
11307 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011308 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011309 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011310 xmlResetLastError();
11311 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011312 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011314 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011315 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011316 printf("\n");
11317 }
11318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011319 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011320#endif
11321
Daniel Veillard42595322004-11-08 10:52:06 +000011322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011323}
11324
11325
11326static int
11327test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011329
William M. Brack21e4ef22005-01-02 09:53:13 +000011330#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011331 int mem_base;
11332 int ret_val;
11333 void * ctx; /* an FTP context */
11334 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011335 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011336 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011337
Daniel Veillard27f20102004-11-05 11:50:11 +000011338 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11339 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11340 mem_base = xmlMemBlocks();
11341 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11342 directory = gen_const_char_ptr(n_directory, 1);
11343
William M. Brackf13f77f2004-11-12 16:03:48 +000011344 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011345 desret_int(ret_val);
11346 call_tests++;
11347 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011348 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011349 xmlResetLastError();
11350 if (mem_base != xmlMemBlocks()) {
11351 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011353 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011354 printf(" %d", n_ctx);
11355 printf(" %d", n_directory);
11356 printf("\n");
11357 }
11358 }
11359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011360 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011361#endif
11362
Daniel Veillard42595322004-11-08 10:52:06 +000011363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011364}
11365
11366
11367static int
11368test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011370
William M. Brack21e4ef22005-01-02 09:53:13 +000011371#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011372 int mem_base;
11373 int ret_val;
11374 void * ctx; /* an FTP context */
11375 int n_ctx;
11376 const char * file; /* a file or directory on the server */
11377 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011378
Daniel Veillard27f20102004-11-05 11:50:11 +000011379 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11380 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11381 mem_base = xmlMemBlocks();
11382 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11383 file = gen_filepath(n_file, 1);
11384
11385 ret_val = xmlNanoFTPDele(ctx, file);
11386 desret_int(ret_val);
11387 call_tests++;
11388 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11389 des_filepath(n_file, file, 1);
11390 xmlResetLastError();
11391 if (mem_base != xmlMemBlocks()) {
11392 printf("Leak of %d blocks found in xmlNanoFTPDele",
11393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011394 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011395 printf(" %d", n_ctx);
11396 printf(" %d", n_file);
11397 printf("\n");
11398 }
11399 }
11400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011401 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011402#endif
11403
Daniel Veillard42595322004-11-08 10:52:06 +000011404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011405}
11406
11407
11408static int
11409test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011411
11412
11413 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011415}
11416
11417
11418static int
11419test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011421
William M. Brack21e4ef22005-01-02 09:53:13 +000011422#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011423 int mem_base;
11424 int ret_val;
11425 void * ctx; /* an FTP context */
11426 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011427
Daniel Veillard27f20102004-11-05 11:50:11 +000011428 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11429 mem_base = xmlMemBlocks();
11430 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11431
11432 ret_val = xmlNanoFTPGetConnection(ctx);
11433 desret_int(ret_val);
11434 call_tests++;
11435 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11436 xmlResetLastError();
11437 if (mem_base != xmlMemBlocks()) {
11438 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011440 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011441 printf(" %d", n_ctx);
11442 printf("\n");
11443 }
11444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011445 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011446#endif
11447
Daniel Veillard42595322004-11-08 10:52:06 +000011448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011449}
11450
11451
11452static int
11453test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011455
William M. Brack21e4ef22005-01-02 09:53:13 +000011456#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011457 int mem_base;
11458 int ret_val;
11459 void * ctx; /* an FTP context */
11460 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011461
Daniel Veillard27f20102004-11-05 11:50:11 +000011462 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11463 mem_base = xmlMemBlocks();
11464 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11465
11466 ret_val = xmlNanoFTPGetResponse(ctx);
11467 desret_int(ret_val);
11468 call_tests++;
11469 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11470 xmlResetLastError();
11471 if (mem_base != xmlMemBlocks()) {
11472 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011474 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011475 printf(" %d", n_ctx);
11476 printf("\n");
11477 }
11478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011479 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011480#endif
11481
Daniel Veillard42595322004-11-08 10:52:06 +000011482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011483}
11484
11485
11486static int
11487test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011489
William M. Brack21e4ef22005-01-02 09:53:13 +000011490#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011491 int mem_base;
11492 int ret_val;
11493 void * ctx; /* an FTP context */
11494 int n_ctx;
11495 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11496 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011497
Daniel Veillard27f20102004-11-05 11:50:11 +000011498 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11499 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11500 mem_base = xmlMemBlocks();
11501 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11502 filename = gen_filepath(n_filename, 1);
11503
11504 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11505 desret_int(ret_val);
11506 call_tests++;
11507 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11508 des_filepath(n_filename, filename, 1);
11509 xmlResetLastError();
11510 if (mem_base != xmlMemBlocks()) {
11511 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011513 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011514 printf(" %d", n_ctx);
11515 printf(" %d", n_filename);
11516 printf("\n");
11517 }
11518 }
11519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011520 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011521#endif
11522
Daniel Veillard42595322004-11-08 10:52:06 +000011523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011524}
11525
11526
11527static int
11528test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011530
William M. Brack21e4ef22005-01-02 09:53:13 +000011531#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011532 int mem_base;
11533
11534 mem_base = xmlMemBlocks();
11535
11536 xmlNanoFTPInit();
11537 call_tests++;
11538 xmlResetLastError();
11539 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011540 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011542 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011543 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011545 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011546#endif
11547
Daniel Veillard42595322004-11-08 10:52:06 +000011548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011549}
11550
11551
11552static int
11553test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011555
11556
11557 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011559}
11560
11561
11562static int
11563test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011565
William M. Brack015ccb22005-02-13 08:18:52 +000011566#if defined(LIBXML_FTP_ENABLED)
11567 int mem_base;
11568 void * ret_val;
11569 const char * URL; /* The URL used to initialize the context */
11570 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011571
William M. Brack015ccb22005-02-13 08:18:52 +000011572 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11573 mem_base = xmlMemBlocks();
11574 URL = gen_filepath(n_URL, 0);
11575
11576 ret_val = xmlNanoFTPNewCtxt(URL);
11577 desret_xmlNanoFTPCtxtPtr(ret_val);
11578 call_tests++;
11579 des_filepath(n_URL, URL, 0);
11580 xmlResetLastError();
11581 if (mem_base != xmlMemBlocks()) {
11582 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
11583 xmlMemBlocks() - mem_base);
11584 test_ret++;
11585 printf(" %d", n_URL);
11586 printf("\n");
11587 }
11588 }
11589 function_tests++;
11590#endif
11591
Daniel Veillard42595322004-11-08 10:52:06 +000011592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011593}
11594
11595
11596static int
11597test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011599
William M. Brack21e4ef22005-01-02 09:53:13 +000011600#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011601 int mem_base;
11602 void * ret_val;
11603 const char * URL; /* the URL to the resource */
11604 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011605
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011606 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11607 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011608 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011609
11610 ret_val = xmlNanoFTPOpen(URL);
William M. Brack015ccb22005-02-13 08:18:52 +000011611 desret_xmlNanoFTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011612 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011613 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011614 xmlResetLastError();
11615 if (mem_base != xmlMemBlocks()) {
11616 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011618 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011619 printf(" %d", n_URL);
11620 printf("\n");
11621 }
11622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011623 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011624#endif
11625
Daniel Veillard42595322004-11-08 10:52:06 +000011626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011627}
11628
11629
11630static int
11631test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011633
William M. Brack21e4ef22005-01-02 09:53:13 +000011634#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011635 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011636 int n_host;
11637 int port; /* the proxy port */
11638 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011639 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011640 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011641 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011642 int n_passwd;
11643 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11644 int n_type;
11645
11646 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11647 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11648 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11649 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11650 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011651 host = gen_const_char_ptr(n_host, 0);
11652 port = gen_int(n_port, 1);
11653 user = gen_const_char_ptr(n_user, 2);
11654 passwd = gen_const_char_ptr(n_passwd, 3);
11655 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011656
William M. Brackf13f77f2004-11-12 16:03:48 +000011657 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011658 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011659 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011660 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011661 des_const_char_ptr(n_user, (const char *)user, 2);
11662 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011663 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664 xmlResetLastError();
11665 }
11666 }
11667 }
11668 }
11669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011670 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671#endif
11672
Daniel Veillard42595322004-11-08 10:52:06 +000011673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674}
11675
11676
11677static int
11678test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011680
William M. Brack21e4ef22005-01-02 09:53:13 +000011681#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011682 int mem_base;
11683 int ret_val;
11684 void * ctx; /* an FTP context */
11685 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011686
Daniel Veillard27f20102004-11-05 11:50:11 +000011687 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11688 mem_base = xmlMemBlocks();
11689 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11690
11691 ret_val = xmlNanoFTPQuit(ctx);
11692 desret_int(ret_val);
11693 call_tests++;
11694 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11695 xmlResetLastError();
11696 if (mem_base != xmlMemBlocks()) {
11697 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011699 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011700 printf(" %d", n_ctx);
11701 printf("\n");
11702 }
11703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011704 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011705#endif
11706
Daniel Veillard42595322004-11-08 10:52:06 +000011707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011708}
11709
11710
11711static int
11712test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011714
William M. Brack21e4ef22005-01-02 09:53:13 +000011715#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011716 int mem_base;
11717 int ret_val;
11718 void * ctx; /* the FTP context */
11719 int n_ctx;
11720 void * dest; /* a buffer */
11721 int n_dest;
11722 int len; /* the buffer length */
11723 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011724
Daniel Veillard27f20102004-11-05 11:50:11 +000011725 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11726 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11727 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11728 mem_base = xmlMemBlocks();
11729 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11730 dest = gen_void_ptr(n_dest, 1);
11731 len = gen_int(n_len, 2);
11732
11733 ret_val = xmlNanoFTPRead(ctx, dest, len);
11734 desret_int(ret_val);
11735 call_tests++;
11736 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11737 des_void_ptr(n_dest, dest, 1);
11738 des_int(n_len, len, 2);
11739 xmlResetLastError();
11740 if (mem_base != xmlMemBlocks()) {
11741 printf("Leak of %d blocks found in xmlNanoFTPRead",
11742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011743 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011744 printf(" %d", n_ctx);
11745 printf(" %d", n_dest);
11746 printf(" %d", n_len);
11747 printf("\n");
11748 }
11749 }
11750 }
11751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011752 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011753#endif
11754
Daniel Veillard42595322004-11-08 10:52:06 +000011755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011756}
11757
11758
11759static int
11760test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011762
William M. Brack21e4ef22005-01-02 09:53:13 +000011763#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764 const char * URL; /* The proxy URL used to initialize the proxy context */
11765 int n_URL;
11766
11767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011768 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011769
11770 xmlNanoFTPScanProxy(URL);
11771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011772 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011773 xmlResetLastError();
11774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011775 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011776#endif
11777
Daniel Veillard42595322004-11-08 10:52:06 +000011778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011779}
11780
11781
11782static int
11783test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011785
William M. Brack21e4ef22005-01-02 09:53:13 +000011786#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011787 int mem_base;
11788 int ret_val;
11789 void * ctx; /* an FTP context */
11790 int n_ctx;
11791 const char * URL; /* The URL used to update the context */
11792 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793
Daniel Veillard27f20102004-11-05 11:50:11 +000011794 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11795 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11796 mem_base = xmlMemBlocks();
11797 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11798 URL = gen_filepath(n_URL, 1);
11799
11800 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11801 desret_int(ret_val);
11802 call_tests++;
11803 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11804 des_filepath(n_URL, URL, 1);
11805 xmlResetLastError();
11806 if (mem_base != xmlMemBlocks()) {
11807 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011809 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011810 printf(" %d", n_ctx);
11811 printf(" %d", n_URL);
11812 printf("\n");
11813 }
11814 }
11815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011816 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011817#endif
11818
Daniel Veillard42595322004-11-08 10:52:06 +000011819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011820}
11821
11822static int
11823test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011825
William M. Brack015ccb22005-02-13 08:18:52 +000011826 if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011827 test_ret += test_xmlNanoFTPCheckResponse();
11828 test_ret += test_xmlNanoFTPCleanup();
11829 test_ret += test_xmlNanoFTPCloseConnection();
11830 test_ret += test_xmlNanoFTPCwd();
11831 test_ret += test_xmlNanoFTPDele();
11832 test_ret += test_xmlNanoFTPGet();
11833 test_ret += test_xmlNanoFTPGetConnection();
11834 test_ret += test_xmlNanoFTPGetResponse();
11835 test_ret += test_xmlNanoFTPGetSocket();
11836 test_ret += test_xmlNanoFTPInit();
11837 test_ret += test_xmlNanoFTPList();
11838 test_ret += test_xmlNanoFTPNewCtxt();
11839 test_ret += test_xmlNanoFTPOpen();
11840 test_ret += test_xmlNanoFTPProxy();
11841 test_ret += test_xmlNanoFTPQuit();
11842 test_ret += test_xmlNanoFTPRead();
11843 test_ret += test_xmlNanoFTPScanProxy();
11844 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011845
Daniel Veillard42595322004-11-08 10:52:06 +000011846 if (test_ret != 0)
11847 printf("Module nanoftp: %d errors\n", test_ret);
11848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011849}
11850
11851static int
11852test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011854
William M. Brack21e4ef22005-01-02 09:53:13 +000011855#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011856 int mem_base;
11857 const char * ret_val;
11858 void * ctx; /* the HTTP context */
11859 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011860
Daniel Veillard27f20102004-11-05 11:50:11 +000011861 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11862 mem_base = xmlMemBlocks();
11863 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11864
11865 ret_val = xmlNanoHTTPAuthHeader(ctx);
11866 desret_const_char_ptr(ret_val);
11867 call_tests++;
11868 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11869 xmlResetLastError();
11870 if (mem_base != xmlMemBlocks()) {
11871 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011873 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011874 printf(" %d", n_ctx);
11875 printf("\n");
11876 }
11877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011878 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011879#endif
11880
Daniel Veillard42595322004-11-08 10:52:06 +000011881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011882}
11883
11884
11885static int
11886test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011888
William M. Brack21e4ef22005-01-02 09:53:13 +000011889#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890 int mem_base;
11891
11892 mem_base = xmlMemBlocks();
11893
11894 xmlNanoHTTPCleanup();
11895 call_tests++;
11896 xmlResetLastError();
11897 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011898 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011900 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011903 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011904#endif
11905
Daniel Veillard42595322004-11-08 10:52:06 +000011906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011907}
11908
11909
11910static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011911test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011913
William M. Brack21e4ef22005-01-02 09:53:13 +000011914#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011915 int mem_base;
11916 int ret_val;
11917 void * ctx; /* the HTTP context */
11918 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919
Daniel Veillard27f20102004-11-05 11:50:11 +000011920 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11921 mem_base = xmlMemBlocks();
11922 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11923
11924 ret_val = xmlNanoHTTPContentLength(ctx);
11925 desret_int(ret_val);
11926 call_tests++;
11927 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11928 xmlResetLastError();
11929 if (mem_base != xmlMemBlocks()) {
11930 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011932 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011933 printf(" %d", n_ctx);
11934 printf("\n");
11935 }
11936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011937 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011938#endif
11939
Daniel Veillard42595322004-11-08 10:52:06 +000011940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011941}
11942
11943
11944static int
11945test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011947
William M. Brack21e4ef22005-01-02 09:53:13 +000011948#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011949 int mem_base;
11950 const char * ret_val;
11951 void * ctx; /* the HTTP context */
11952 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011953
Daniel Veillard27f20102004-11-05 11:50:11 +000011954 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11955 mem_base = xmlMemBlocks();
11956 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11957
11958 ret_val = xmlNanoHTTPEncoding(ctx);
11959 desret_const_char_ptr(ret_val);
11960 call_tests++;
11961 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11962 xmlResetLastError();
11963 if (mem_base != xmlMemBlocks()) {
11964 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011966 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011967 printf(" %d", n_ctx);
11968 printf("\n");
11969 }
11970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011971 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011972#endif
11973
Daniel Veillard42595322004-11-08 10:52:06 +000011974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011975}
11976
11977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011978#define gen_nb_char_ptr_ptr 1
11979static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11980 return(NULL);
11981}
11982static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11983}
11984
Daniel Veillardd93f6252004-11-02 15:53:51 +000011985static int
11986test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011988
William M. Brack21e4ef22005-01-02 09:53:13 +000011989#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011990 int mem_base;
11991 int ret_val;
11992 const char * URL; /* The URL to load */
11993 int n_URL;
11994 const char * filename; /* the filename where the content should be saved */
11995 int n_filename;
11996 char ** contentType; /* if available the Content-Type information will be returned at that location */
11997 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011998
William M. Brack015ccb22005-02-13 08:18:52 +000011999 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
12000 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012001 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12002 mem_base = xmlMemBlocks();
William M. Brack015ccb22005-02-13 08:18:52 +000012003 URL = gen_fileoutput(n_URL, 0);
12004 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012005 contentType = gen_char_ptr_ptr(n_contentType, 2);
12006
12007 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12008 desret_int(ret_val);
12009 call_tests++;
William M. Brack015ccb22005-02-13 08:18:52 +000012010 des_fileoutput(n_URL, URL, 0);
12011 des_fileoutput(n_filename, filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012012 des_char_ptr_ptr(n_contentType, contentType, 2);
12013 xmlResetLastError();
12014 if (mem_base != xmlMemBlocks()) {
12015 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012017 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012018 printf(" %d", n_URL);
12019 printf(" %d", n_filename);
12020 printf(" %d", n_contentType);
12021 printf("\n");
12022 }
12023 }
12024 }
12025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012026 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012027#endif
12028
Daniel Veillard42595322004-11-08 10:52:06 +000012029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012030}
12031
12032
12033static int
12034test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012036
William M. Brack21e4ef22005-01-02 09:53:13 +000012037#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012038 int mem_base;
12039
12040 mem_base = xmlMemBlocks();
12041
12042 xmlNanoHTTPInit();
12043 call_tests++;
12044 xmlResetLastError();
12045 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012046 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012048 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012049 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012051 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012052#endif
12053
Daniel Veillard42595322004-11-08 10:52:06 +000012054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012055}
12056
12057
12058static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012059test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012061
William M. Brack21e4ef22005-01-02 09:53:13 +000012062#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012063 int mem_base;
12064 const char * ret_val;
12065 void * ctx; /* the HTTP context */
12066 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067
Daniel Veillard27f20102004-11-05 11:50:11 +000012068 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12069 mem_base = xmlMemBlocks();
12070 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12071
12072 ret_val = xmlNanoHTTPMimeType(ctx);
12073 desret_const_char_ptr(ret_val);
12074 call_tests++;
12075 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12076 xmlResetLastError();
12077 if (mem_base != xmlMemBlocks()) {
12078 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012080 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012081 printf(" %d", n_ctx);
12082 printf("\n");
12083 }
12084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012085 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012086#endif
12087
Daniel Veillard42595322004-11-08 10:52:06 +000012088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012089}
12090
12091
12092static int
12093test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012095
William M. Brack21e4ef22005-01-02 09:53:13 +000012096#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012097 int mem_base;
12098 void * ret_val;
12099 const char * URL; /* The URL to load */
12100 int n_URL;
12101 char ** contentType; /* if available the Content-Type information will be returned at that location */
12102 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012103
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012104 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12105 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12106 mem_base = xmlMemBlocks();
12107 URL = gen_filepath(n_URL, 0);
12108 contentType = gen_char_ptr_ptr(n_contentType, 1);
12109
12110 ret_val = xmlNanoHTTPOpen(URL, contentType);
William M. Brack015ccb22005-02-13 08:18:52 +000012111 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012112 call_tests++;
12113 des_filepath(n_URL, URL, 0);
12114 des_char_ptr_ptr(n_contentType, contentType, 1);
12115 xmlResetLastError();
12116 if (mem_base != xmlMemBlocks()) {
12117 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012119 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012120 printf(" %d", n_URL);
12121 printf(" %d", n_contentType);
12122 printf("\n");
12123 }
12124 }
12125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012126 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012127#endif
12128
Daniel Veillard42595322004-11-08 10:52:06 +000012129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012130}
12131
12132
12133static int
12134test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012136
William M. Brack21e4ef22005-01-02 09:53:13 +000012137#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012138 int mem_base;
12139 void * ret_val;
12140 const char * URL; /* The URL to load */
12141 int n_URL;
12142 char ** contentType; /* if available the Content-Type information will be returned at that location */
12143 int n_contentType;
12144 char ** redir; /* if available the redirected URL will be returned */
12145 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012146
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012147 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12148 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12149 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12150 mem_base = xmlMemBlocks();
12151 URL = gen_filepath(n_URL, 0);
12152 contentType = gen_char_ptr_ptr(n_contentType, 1);
12153 redir = gen_char_ptr_ptr(n_redir, 2);
12154
12155 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
William M. Brack015ccb22005-02-13 08:18:52 +000012156 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012157 call_tests++;
12158 des_filepath(n_URL, URL, 0);
12159 des_char_ptr_ptr(n_contentType, contentType, 1);
12160 des_char_ptr_ptr(n_redir, redir, 2);
12161 xmlResetLastError();
12162 if (mem_base != xmlMemBlocks()) {
12163 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012165 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012166 printf(" %d", n_URL);
12167 printf(" %d", n_contentType);
12168 printf(" %d", n_redir);
12169 printf("\n");
12170 }
12171 }
12172 }
12173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012174 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012175#endif
12176
Daniel Veillard42595322004-11-08 10:52:06 +000012177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012178}
12179
12180
12181static int
12182test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012184
William M. Brack21e4ef22005-01-02 09:53:13 +000012185#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012186 int mem_base;
12187 int ret_val;
12188 void * ctx; /* the HTTP context */
12189 int n_ctx;
12190 void * dest; /* a buffer */
12191 int n_dest;
12192 int len; /* the buffer length */
12193 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012194
Daniel Veillard27f20102004-11-05 11:50:11 +000012195 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12196 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12197 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12198 mem_base = xmlMemBlocks();
12199 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12200 dest = gen_void_ptr(n_dest, 1);
12201 len = gen_int(n_len, 2);
12202
12203 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12204 desret_int(ret_val);
12205 call_tests++;
12206 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12207 des_void_ptr(n_dest, dest, 1);
12208 des_int(n_len, len, 2);
12209 xmlResetLastError();
12210 if (mem_base != xmlMemBlocks()) {
12211 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012213 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012214 printf(" %d", n_ctx);
12215 printf(" %d", n_dest);
12216 printf(" %d", n_len);
12217 printf("\n");
12218 }
12219 }
12220 }
12221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012222 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012223#endif
12224
Daniel Veillard42595322004-11-08 10:52:06 +000012225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012226}
12227
12228
12229static int
12230test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012232
12233
12234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012236}
12237
12238
12239static int
12240test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012242
William M. Brack21e4ef22005-01-02 09:53:13 +000012243#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012244 int mem_base;
12245 int ret_val;
12246 void * ctx; /* the HTTP context */
12247 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012248
Daniel Veillard27f20102004-11-05 11:50:11 +000012249 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12250 mem_base = xmlMemBlocks();
12251 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12252
12253 ret_val = xmlNanoHTTPReturnCode(ctx);
12254 desret_int(ret_val);
12255 call_tests++;
12256 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12257 xmlResetLastError();
12258 if (mem_base != xmlMemBlocks()) {
12259 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012261 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012262 printf(" %d", n_ctx);
12263 printf("\n");
12264 }
12265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012266 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012267#endif
12268
Daniel Veillard42595322004-11-08 10:52:06 +000012269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012270}
12271
12272
12273static int
12274test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012276
William M. Brack21e4ef22005-01-02 09:53:13 +000012277#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012278 int mem_base;
12279 int ret_val;
12280 void * ctxt; /* the HTTP context */
12281 int n_ctxt;
12282 const char * filename; /* the filename where the content should be saved */
12283 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012284
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012285 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12286 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012288 ctxt = gen_void_ptr(n_ctxt, 0);
12289 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012290
12291 ret_val = xmlNanoHTTPSave(ctxt, filename);
12292 desret_int(ret_val);
12293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012294 des_void_ptr(n_ctxt, ctxt, 0);
12295 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012296 xmlResetLastError();
12297 if (mem_base != xmlMemBlocks()) {
12298 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012300 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012301 printf(" %d", n_ctxt);
12302 printf(" %d", n_filename);
12303 printf("\n");
12304 }
12305 }
12306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012307 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012308#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012309
Daniel Veillard42595322004-11-08 10:52:06 +000012310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311}
12312
12313
12314static int
12315test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012317
William M. Brack21e4ef22005-01-02 09:53:13 +000012318#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012319 const char * URL; /* The proxy URL used to initialize the proxy context */
12320 int n_URL;
12321
12322 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012323 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
12325 xmlNanoHTTPScanProxy(URL);
12326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012327 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012328 xmlResetLastError();
12329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012330 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012331#endif
12332
Daniel Veillard42595322004-11-08 10:52:06 +000012333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012334}
12335
12336static int
12337test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012339
William M. Brack015ccb22005-02-13 08:18:52 +000012340 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012341 test_ret += test_xmlNanoHTTPAuthHeader();
12342 test_ret += test_xmlNanoHTTPCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +000012343 test_ret += test_xmlNanoHTTPContentLength();
12344 test_ret += test_xmlNanoHTTPEncoding();
12345 test_ret += test_xmlNanoHTTPFetch();
12346 test_ret += test_xmlNanoHTTPInit();
Daniel Veillard42595322004-11-08 10:52:06 +000012347 test_ret += test_xmlNanoHTTPMimeType();
12348 test_ret += test_xmlNanoHTTPOpen();
12349 test_ret += test_xmlNanoHTTPOpenRedir();
12350 test_ret += test_xmlNanoHTTPRead();
12351 test_ret += test_xmlNanoHTTPRedir();
12352 test_ret += test_xmlNanoHTTPReturnCode();
12353 test_ret += test_xmlNanoHTTPSave();
12354 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012355
Daniel Veillard42595322004-11-08 10:52:06 +000012356 if (test_ret != 0)
12357 printf("Module nanohttp: %d errors\n", test_ret);
12358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359}
12360
12361static int
12362test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012365 int mem_base;
12366 long ret_val;
12367 xmlParserCtxtPtr ctxt; /* an XML parser context */
12368 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012369
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012370 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12371 mem_base = xmlMemBlocks();
12372 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12373
12374 ret_val = xmlByteConsumed(ctxt);
12375 desret_long(ret_val);
12376 call_tests++;
12377 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12378 xmlResetLastError();
12379 if (mem_base != xmlMemBlocks()) {
12380 printf("Leak of %d blocks found in xmlByteConsumed",
12381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012382 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012383 printf(" %d", n_ctxt);
12384 printf("\n");
12385 }
12386 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012388
Daniel Veillard42595322004-11-08 10:52:06 +000012389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012390}
12391
12392
12393static int
12394test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012396
Daniel Veillardce682bc2004-11-05 17:22:25 +000012397 int mem_base;
12398 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12399 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012400
Daniel Veillardce682bc2004-11-05 17:22:25 +000012401 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12402 mem_base = xmlMemBlocks();
12403 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12404
12405 xmlClearNodeInfoSeq(seq);
12406 call_tests++;
12407 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12408 xmlResetLastError();
12409 if (mem_base != xmlMemBlocks()) {
12410 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012412 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012413 printf(" %d", n_seq);
12414 printf("\n");
12415 }
12416 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012418
Daniel Veillard42595322004-11-08 10:52:06 +000012419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012420}
12421
12422
12423static int
12424test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012426
12427 int mem_base;
12428 xmlParserCtxtPtr ctxt; /* an XML parser context */
12429 int n_ctxt;
12430
12431 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012433 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012434
12435 xmlClearParserCtxt(ctxt);
12436 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012437 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012438 xmlResetLastError();
12439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012440 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012443 printf(" %d", n_ctxt);
12444 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012445 }
12446 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012448
Daniel Veillard42595322004-11-08 10:52:06 +000012449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012450}
12451
12452
12453static int
12454test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456
Daniel Veillard34099b42004-11-04 17:34:35 +000012457 int mem_base;
12458 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012459 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012460 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012461
Daniel Veillard34099b42004-11-04 17:34:35 +000012462 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12463 mem_base = xmlMemBlocks();
12464 cur = gen_const_xmlChar_ptr(n_cur, 0);
12465
William M. Brackf13f77f2004-11-12 16:03:48 +000012466 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012467 desret_xmlParserCtxtPtr(ret_val);
12468 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012469 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012470 xmlResetLastError();
12471 if (mem_base != xmlMemBlocks()) {
12472 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012474 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012475 printf(" %d", n_cur);
12476 printf("\n");
12477 }
12478 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012480
Daniel Veillard42595322004-11-08 10:52:06 +000012481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012482}
12483
12484
12485static int
12486test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012488
William M. Brack21e4ef22005-01-02 09:53:13 +000012489#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012490 int mem_base;
12491 xmlParserCtxtPtr ret_val;
12492 xmlSAXHandlerPtr sax; /* a SAX handler */
12493 int n_sax;
12494 void * user_data; /* The user data returned on SAX callbacks */
12495 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012496 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012497 int n_chunk;
12498 int size; /* number of chars in the array */
12499 int n_size;
12500 const char * filename; /* an optional file name or URI */
12501 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012502
Daniel Veillard34099b42004-11-04 17:34:35 +000012503 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12504 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12505 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12506 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012507 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012508 mem_base = xmlMemBlocks();
12509 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12510 user_data = gen_userdata(n_user_data, 1);
12511 chunk = gen_const_char_ptr(n_chunk, 2);
12512 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012513 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012514
William M. Brackf13f77f2004-11-12 16:03:48 +000012515 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012516 desret_xmlParserCtxtPtr(ret_val);
12517 call_tests++;
12518 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12519 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012520 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012521 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012522 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012523 xmlResetLastError();
12524 if (mem_base != xmlMemBlocks()) {
12525 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012527 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012528 printf(" %d", n_sax);
12529 printf(" %d", n_user_data);
12530 printf(" %d", n_chunk);
12531 printf(" %d", n_size);
12532 printf(" %d", n_filename);
12533 printf("\n");
12534 }
12535 }
12536 }
12537 }
12538 }
12539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012540 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012541#endif
12542
Daniel Veillard42595322004-11-08 10:52:06 +000012543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012544}
12545
12546
12547static int
12548test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012550
12551 int mem_base;
12552 xmlDocPtr ret_val;
12553 xmlParserCtxtPtr ctxt; /* an XML parser context */
12554 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012555 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012556 int n_cur;
12557 const char * URL; /* the base URL to use for the document */
12558 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012559 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012560 int n_encoding;
12561 int options; /* a combination of xmlParserOption */
12562 int n_options;
12563
12564 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12565 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12566 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12567 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012568 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012570 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12571 cur = gen_const_xmlChar_ptr(n_cur, 1);
12572 URL = gen_filepath(n_URL, 2);
12573 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012574 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012575
William M. Brackf13f77f2004-11-12 16:03:48 +000012576 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012577 desret_xmlDocPtr(ret_val);
12578 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012579 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012580 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012581 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012582 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012583 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012584 xmlResetLastError();
12585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012586 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012589 printf(" %d", n_ctxt);
12590 printf(" %d", n_cur);
12591 printf(" %d", n_URL);
12592 printf(" %d", n_encoding);
12593 printf(" %d", n_options);
12594 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012595 }
12596 }
12597 }
12598 }
12599 }
12600 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012602
Daniel Veillard42595322004-11-08 10:52:06 +000012603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012604}
12605
12606
12607static int
12608test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012610
12611 int mem_base;
12612 xmlDocPtr ret_val;
12613 xmlParserCtxtPtr ctxt; /* an XML parser context */
12614 int n_ctxt;
12615 const char * filename; /* a file or URL */
12616 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012617 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012618 int n_encoding;
12619 int options; /* a combination of xmlParserOption */
12620 int n_options;
12621
12622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12623 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12624 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012625 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012627 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12628 filename = gen_filepath(n_filename, 1);
12629 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012630 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012631
William M. Brackf13f77f2004-11-12 16:03:48 +000012632 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012633 desret_xmlDocPtr(ret_val);
12634 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012635 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12636 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012637 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012638 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012639 xmlResetLastError();
12640 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012641 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012643 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012644 printf(" %d", n_ctxt);
12645 printf(" %d", n_filename);
12646 printf(" %d", n_encoding);
12647 printf(" %d", n_options);
12648 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012649 }
12650 }
12651 }
12652 }
12653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012655
Daniel Veillard42595322004-11-08 10:52:06 +000012656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012657}
12658
12659
12660static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012661test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012663
12664 int mem_base;
12665 xmlDocPtr ret_val;
12666 xmlParserCtxtPtr ctxt; /* an XML parser context */
12667 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012668 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 int n_buffer;
12670 int size; /* the size of the array */
12671 int n_size;
12672 const char * URL; /* the base URL to use for the document */
12673 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012674 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012675 int n_encoding;
12676 int options; /* a combination of xmlParserOption */
12677 int n_options;
12678
12679 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12680 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12681 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12682 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12683 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012684 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012686 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12687 buffer = gen_const_char_ptr(n_buffer, 1);
12688 size = gen_int(n_size, 2);
12689 URL = gen_filepath(n_URL, 3);
12690 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012691 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012692
William M. Brackf13f77f2004-11-12 16:03:48 +000012693 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012694 desret_xmlDocPtr(ret_val);
12695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012696 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012697 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012698 des_int(n_size, size, 2);
12699 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012700 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012701 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012702 xmlResetLastError();
12703 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012704 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012707 printf(" %d", n_ctxt);
12708 printf(" %d", n_buffer);
12709 printf(" %d", n_size);
12710 printf(" %d", n_URL);
12711 printf(" %d", n_encoding);
12712 printf(" %d", n_options);
12713 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012714 }
12715 }
12716 }
12717 }
12718 }
12719 }
12720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012722
Daniel Veillard42595322004-11-08 10:52:06 +000012723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724}
12725
12726
12727static int
12728test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730
12731 int mem_base;
12732 xmlParserCtxtPtr ctxt; /* an XML parser context */
12733 int n_ctxt;
12734
12735 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012737 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012738
12739 xmlCtxtReset(ctxt);
12740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012741 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012742 xmlResetLastError();
12743 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012744 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012746 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012747 printf(" %d", n_ctxt);
12748 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012749 }
12750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012752
Daniel Veillard42595322004-11-08 10:52:06 +000012753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012754}
12755
12756
12757static int
12758test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760
12761 int mem_base;
12762 int ret_val;
12763 xmlParserCtxtPtr ctxt; /* an XML parser context */
12764 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012765 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012766 int n_chunk;
12767 int size; /* number of chars in the array */
12768 int n_size;
12769 const char * filename; /* an optional file name or URI */
12770 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012771 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012772 int n_encoding;
12773
12774 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12775 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12776 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12777 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12778 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012780 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12781 chunk = gen_const_char_ptr(n_chunk, 1);
12782 size = gen_int(n_size, 2);
12783 filename = gen_filepath(n_filename, 3);
12784 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012785
William M. Brackf13f77f2004-11-12 16:03:48 +000012786 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 desret_int(ret_val);
12788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012789 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012790 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012791 des_int(n_size, size, 2);
12792 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012793 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012794 xmlResetLastError();
12795 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012796 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012798 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012799 printf(" %d", n_ctxt);
12800 printf(" %d", n_chunk);
12801 printf(" %d", n_size);
12802 printf(" %d", n_filename);
12803 printf(" %d", n_encoding);
12804 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805 }
12806 }
12807 }
12808 }
12809 }
12810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012812
Daniel Veillard42595322004-11-08 10:52:06 +000012813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814}
12815
12816
12817static int
12818test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012820
12821 int mem_base;
12822 int ret_val;
12823 xmlParserCtxtPtr ctxt; /* an XML parser context */
12824 int n_ctxt;
12825 int options; /* a combination of xmlParserOption */
12826 int n_options;
12827
12828 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012829 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012831 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012832 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012833
12834 ret_val = xmlCtxtUseOptions(ctxt, options);
12835 desret_int(ret_val);
12836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012837 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012838 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839 xmlResetLastError();
12840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012841 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012844 printf(" %d", n_ctxt);
12845 printf(" %d", n_options);
12846 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012847 }
12848 }
12849 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012850 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012851
Daniel Veillard42595322004-11-08 10:52:06 +000012852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012853}
12854
12855
12856static int
12857test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012859
12860
12861 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012863}
12864
12865
12866static int
12867test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869
William M. Brack21e4ef22005-01-02 09:53:13 +000012870#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012871#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012872 int mem_base;
12873 int ret_val;
12874 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12875 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012876 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012877 int n_name;
12878 void * result; /* location to store the result */
12879 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012881 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12882 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12883 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012885 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12886 name = gen_const_char_ptr(n_name, 1);
12887 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012888
William M. Brackf13f77f2004-11-12 16:03:48 +000012889 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012890 desret_int(ret_val);
12891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012892 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012893 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012894 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012895 xmlResetLastError();
12896 if (mem_base != xmlMemBlocks()) {
12897 printf("Leak of %d blocks found in xmlGetFeature",
12898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012899 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012900 printf(" %d", n_ctxt);
12901 printf(" %d", n_name);
12902 printf(" %d", n_result);
12903 printf("\n");
12904 }
12905 }
12906 }
12907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012908 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012909#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012910#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012911
Daniel Veillard42595322004-11-08 10:52:06 +000012912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012913}
12914
12915
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012916#define gen_nb_const_char_ptr_ptr 1
12917static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12918 return(NULL);
12919}
12920static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12921}
12922
Daniel Veillardd93f6252004-11-02 15:53:51 +000012923static int
12924test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012926
William M. Brack21e4ef22005-01-02 09:53:13 +000012927#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012928#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012929 int mem_base;
12930 int ret_val;
12931 int * len; /* the length of the features name array (input/output) */
12932 int n_len;
12933 char ** result; /* an array of string to be filled with the features name. */
12934 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012936 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
12937 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
12938 mem_base = xmlMemBlocks();
12939 len = gen_int_ptr(n_len, 0);
12940 result = gen_const_char_ptr_ptr(n_result, 1);
12941
William M. Brackf13f77f2004-11-12 16:03:48 +000012942 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012943 desret_int(ret_val);
12944 call_tests++;
12945 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012946 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012947 xmlResetLastError();
12948 if (mem_base != xmlMemBlocks()) {
12949 printf("Leak of %d blocks found in xmlGetFeaturesList",
12950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012951 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012952 printf(" %d", n_len);
12953 printf(" %d", n_result);
12954 printf("\n");
12955 }
12956 }
12957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012958 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012959#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012960#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012961
Daniel Veillard42595322004-11-08 10:52:06 +000012962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012963}
12964
12965
12966static int
12967test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012969
William M. Brack21e4ef22005-01-02 09:53:13 +000012970#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012971#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000012972 int mem_base;
12973 xmlDtdPtr ret_val;
12974 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12975 int n_sax;
12976 xmlParserInputBufferPtr input; /* an Input Buffer */
12977 int n_input;
12978 xmlCharEncoding enc; /* the charset encoding if known */
12979 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012980
Daniel Veillard34099b42004-11-04 17:34:35 +000012981 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12982 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
12983 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
12984 mem_base = xmlMemBlocks();
12985 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12986 input = gen_xmlParserInputBufferPtr(n_input, 1);
12987 enc = gen_xmlCharEncoding(n_enc, 2);
12988
12989 ret_val = xmlIOParseDTD(sax, input, enc);
12990 input = NULL;
12991 desret_xmlDtdPtr(ret_val);
12992 call_tests++;
12993 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12994 des_xmlParserInputBufferPtr(n_input, input, 1);
12995 des_xmlCharEncoding(n_enc, enc, 2);
12996 xmlResetLastError();
12997 if (mem_base != xmlMemBlocks()) {
12998 printf("Leak of %d blocks found in xmlIOParseDTD",
12999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013000 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013001 printf(" %d", n_sax);
13002 printf(" %d", n_input);
13003 printf(" %d", n_enc);
13004 printf("\n");
13005 }
13006 }
13007 }
13008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013009 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013010#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013011#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013012
Daniel Veillard42595322004-11-08 10:52:06 +000013013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013014}
13015
13016
13017static int
13018test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013020
Daniel Veillardce682bc2004-11-05 17:22:25 +000013021 int mem_base;
13022 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13023 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013024
Daniel Veillardce682bc2004-11-05 17:22:25 +000013025 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13026 mem_base = xmlMemBlocks();
13027 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13028
13029 xmlInitNodeInfoSeq(seq);
13030 call_tests++;
13031 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13032 xmlResetLastError();
13033 if (mem_base != xmlMemBlocks()) {
13034 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013036 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013037 printf(" %d", n_seq);
13038 printf("\n");
13039 }
13040 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013042
Daniel Veillard42595322004-11-08 10:52:06 +000013043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013044}
13045
13046
13047static int
13048test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013050
13051 int mem_base;
13052
13053 mem_base = xmlMemBlocks();
13054
13055 xmlInitParser();
13056 call_tests++;
13057 xmlResetLastError();
13058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013059 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013062 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013063 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013065
Daniel Veillard42595322004-11-08 10:52:06 +000013066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013067}
13068
13069
13070static int
13071test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013073
13074 int mem_base;
13075 int ret_val;
13076 xmlParserCtxtPtr ctxt; /* an XML parser context */
13077 int n_ctxt;
13078
13079 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013081 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013082
13083 ret_val = xmlInitParserCtxt(ctxt);
13084 desret_int(ret_val);
13085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013086 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013087 xmlResetLastError();
13088 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013089 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013091 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013092 printf(" %d", n_ctxt);
13093 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013094 }
13095 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013096 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013097
Daniel Veillard42595322004-11-08 10:52:06 +000013098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099}
13100
13101
13102static int
13103test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013105
13106 int mem_base;
13107 int ret_val;
13108 int val; /* int 0 or 1 */
13109 int n_val;
13110
13111 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013113 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013114
13115 ret_val = xmlKeepBlanksDefault(val);
13116 desret_int(ret_val);
13117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013118 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013119 xmlResetLastError();
13120 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013121 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013123 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013124 printf(" %d", n_val);
13125 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013126 }
13127 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013129
Daniel Veillard42595322004-11-08 10:52:06 +000013130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013131}
13132
13133
13134static int
13135test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013137
13138 int mem_base;
13139 int ret_val;
13140 int val; /* int 0 or 1 */
13141 int n_val;
13142
13143 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13144 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013145 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013146
13147 ret_val = xmlLineNumbersDefault(val);
13148 desret_int(ret_val);
13149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013150 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013151 xmlResetLastError();
13152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013153 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013156 printf(" %d", n_val);
13157 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158 }
13159 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013161
Daniel Veillard42595322004-11-08 10:52:06 +000013162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013163}
13164
13165
13166static int
13167test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013169
Daniel Veillard42595322004-11-08 10:52:06 +000013170 int mem_base;
13171 xmlParserInputPtr ret_val;
13172 const char * URL; /* the URL for the entity to load */
13173 int n_URL;
13174 char * ID; /* the Public ID for the entity to load */
13175 int n_ID;
13176 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13177 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178
Daniel Veillard42595322004-11-08 10:52:06 +000013179 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13180 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13182 mem_base = xmlMemBlocks();
13183 URL = gen_filepath(n_URL, 0);
13184 ID = gen_const_char_ptr(n_ID, 1);
13185 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13186
William M. Brackf13f77f2004-11-12 16:03:48 +000013187 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013188 desret_xmlParserInputPtr(ret_val);
13189 call_tests++;
13190 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013191 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013192 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13193 xmlResetLastError();
13194 if (mem_base != xmlMemBlocks()) {
13195 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13196 xmlMemBlocks() - mem_base);
13197 test_ret++;
13198 printf(" %d", n_URL);
13199 printf(" %d", n_ID);
13200 printf(" %d", n_ctxt);
13201 printf("\n");
13202 }
13203 }
13204 }
13205 }
Daniel Veillard42595322004-11-08 10:52:06 +000013206 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013207
Daniel Veillard42595322004-11-08 10:52:06 +000013208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013209}
13210
13211
13212static int
13213test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013215
Daniel Veillard42595322004-11-08 10:52:06 +000013216 int mem_base;
13217 xmlParserInputPtr ret_val;
13218 xmlParserCtxtPtr ctxt; /* an XML parser context */
13219 int n_ctxt;
13220 xmlParserInputBufferPtr input; /* an I/O Input */
13221 int n_input;
13222 xmlCharEncoding enc; /* the charset encoding if known */
13223 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013224
Daniel Veillard42595322004-11-08 10:52:06 +000013225 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13226 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13227 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13228 mem_base = xmlMemBlocks();
13229 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13230 input = gen_xmlParserInputBufferPtr(n_input, 1);
13231 enc = gen_xmlCharEncoding(n_enc, 2);
13232
13233 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13234 if (ret_val != NULL) input = NULL;
13235 desret_xmlParserInputPtr(ret_val);
13236 call_tests++;
13237 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13238 des_xmlParserInputBufferPtr(n_input, input, 1);
13239 des_xmlCharEncoding(n_enc, enc, 2);
13240 xmlResetLastError();
13241 if (mem_base != xmlMemBlocks()) {
13242 printf("Leak of %d blocks found in xmlNewIOInputStream",
13243 xmlMemBlocks() - mem_base);
13244 test_ret++;
13245 printf(" %d", n_ctxt);
13246 printf(" %d", n_input);
13247 printf(" %d", n_enc);
13248 printf("\n");
13249 }
13250 }
13251 }
13252 }
Daniel Veillard42595322004-11-08 10:52:06 +000013253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013254
Daniel Veillard42595322004-11-08 10:52:06 +000013255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013256}
13257
13258
13259static int
13260test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013262
Daniel Veillard34099b42004-11-04 17:34:35 +000013263 int mem_base;
13264 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013265
Daniel Veillard34099b42004-11-04 17:34:35 +000013266 mem_base = xmlMemBlocks();
13267
13268 ret_val = xmlNewParserCtxt();
13269 desret_xmlParserCtxtPtr(ret_val);
13270 call_tests++;
13271 xmlResetLastError();
13272 if (mem_base != xmlMemBlocks()) {
13273 printf("Leak of %d blocks found in xmlNewParserCtxt",
13274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013275 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013276 printf("\n");
13277 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013279
Daniel Veillard42595322004-11-08 10:52:06 +000013280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013281}
13282
13283
Daniel Veillardce682bc2004-11-05 17:22:25 +000013284#define gen_nb_xmlNodePtr_ptr 1
13285static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13286 return(NULL);
13287}
13288static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13289}
13290
Daniel Veillardd93f6252004-11-02 15:53:51 +000013291static int
13292test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294
William M. Brack21e4ef22005-01-02 09:53:13 +000013295#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013296#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013297 int mem_base;
13298 int ret_val;
13299 xmlDocPtr doc; /* the document the chunk pertains to */
13300 int n_doc;
13301 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13302 int n_sax;
13303 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13304 int n_user_data;
13305 int depth; /* Used for loop detection, use 0 */
13306 int n_depth;
13307 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13308 int n_string;
13309 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13310 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013311
Daniel Veillardce682bc2004-11-05 17:22:25 +000013312 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13313 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13314 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13315 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13316 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13317 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13318 mem_base = xmlMemBlocks();
13319 doc = gen_xmlDocPtr(n_doc, 0);
13320 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13321 user_data = gen_userdata(n_user_data, 2);
13322 depth = gen_int(n_depth, 3);
13323 string = gen_const_xmlChar_ptr(n_string, 4);
13324 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013325
13326#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013327 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013328#endif
13329
Daniel Veillardce682bc2004-11-05 17:22:25 +000013330
William M. Brackf13f77f2004-11-12 16:03:48 +000013331 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013332 desret_int(ret_val);
13333 call_tests++;
13334 des_xmlDocPtr(n_doc, doc, 0);
13335 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13336 des_userdata(n_user_data, user_data, 2);
13337 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013338 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013339 des_xmlNodePtr_ptr(n_lst, lst, 5);
13340 xmlResetLastError();
13341 if (mem_base != xmlMemBlocks()) {
13342 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013344 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013345 printf(" %d", n_doc);
13346 printf(" %d", n_sax);
13347 printf(" %d", n_user_data);
13348 printf(" %d", n_depth);
13349 printf(" %d", n_string);
13350 printf(" %d", n_lst);
13351 printf("\n");
13352 }
13353 }
13354 }
13355 }
13356 }
13357 }
13358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013359 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013360#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013361#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013362
Daniel Veillard42595322004-11-08 10:52:06 +000013363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013364}
13365
13366
13367static int
13368test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013370
William M. Brack21e4ef22005-01-02 09:53:13 +000013371#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013372#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013373 int mem_base;
13374 int ret_val;
13375 xmlDocPtr doc; /* the document the chunk pertains to */
13376 int n_doc;
13377 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13378 int n_sax;
13379 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13380 int n_user_data;
13381 int depth; /* Used for loop detection, use 0 */
13382 int n_depth;
13383 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13384 int n_string;
13385 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13386 int n_lst;
13387 int recover; /* return nodes even if the data is broken (use 0) */
13388 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013389
Daniel Veillardce682bc2004-11-05 17:22:25 +000013390 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13391 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13392 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13393 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13394 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13395 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13396 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13397 mem_base = xmlMemBlocks();
13398 doc = gen_xmlDocPtr(n_doc, 0);
13399 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13400 user_data = gen_userdata(n_user_data, 2);
13401 depth = gen_int(n_depth, 3);
13402 string = gen_const_xmlChar_ptr(n_string, 4);
13403 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13404 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013405
13406#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013407 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013408#endif
13409
Daniel Veillardce682bc2004-11-05 17:22:25 +000013410
William M. Brackf13f77f2004-11-12 16:03:48 +000013411 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013412 desret_int(ret_val);
13413 call_tests++;
13414 des_xmlDocPtr(n_doc, doc, 0);
13415 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13416 des_userdata(n_user_data, user_data, 2);
13417 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013418 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013419 des_xmlNodePtr_ptr(n_lst, lst, 5);
13420 des_int(n_recover, recover, 6);
13421 xmlResetLastError();
13422 if (mem_base != xmlMemBlocks()) {
13423 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013425 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013426 printf(" %d", n_doc);
13427 printf(" %d", n_sax);
13428 printf(" %d", n_user_data);
13429 printf(" %d", n_depth);
13430 printf(" %d", n_string);
13431 printf(" %d", n_lst);
13432 printf(" %d", n_recover);
13433 printf("\n");
13434 }
13435 }
13436 }
13437 }
13438 }
13439 }
13440 }
13441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013442 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013443#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013444#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013445
Daniel Veillard42595322004-11-08 10:52:06 +000013446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013447}
13448
13449
13450static int
13451test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013453
William M. Brack21e4ef22005-01-02 09:53:13 +000013454#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013455 int mem_base;
13456 int ret_val;
13457 xmlParserCtxtPtr ctxt; /* an XML parser context */
13458 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013459 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013460 int n_chunk;
13461 int size; /* the size in byte of the chunk */
13462 int n_size;
13463 int terminate; /* last chunk indicator */
13464 int n_terminate;
13465
13466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13467 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13468 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13469 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013471 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13472 chunk = gen_const_char_ptr(n_chunk, 1);
13473 size = gen_int(n_size, 2);
13474 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013475
William M. Brackf13f77f2004-11-12 16:03:48 +000013476 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013477 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013478 desret_int(ret_val);
13479 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013480 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013481 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013482 des_int(n_size, size, 2);
13483 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013484 xmlResetLastError();
13485 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013486 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013488 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013489 printf(" %d", n_ctxt);
13490 printf(" %d", n_chunk);
13491 printf(" %d", n_size);
13492 printf(" %d", n_terminate);
13493 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013494 }
13495 }
13496 }
13497 }
13498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013499 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013500#endif
13501
Daniel Veillard42595322004-11-08 10:52:06 +000013502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013503}
13504
13505
13506static int
13507test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013509
Daniel Veillardce682bc2004-11-05 17:22:25 +000013510 int mem_base;
13511 int ret_val;
13512 xmlParserCtxtPtr ctx; /* the existing parsing context */
13513 int n_ctx;
13514 xmlChar * URL; /* the URL for the entity to load */
13515 int n_URL;
13516 xmlChar * ID; /* the System ID for the entity to load */
13517 int n_ID;
13518 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13519 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013520
Daniel Veillardce682bc2004-11-05 17:22:25 +000013521 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13522 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13523 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13524 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13525 mem_base = xmlMemBlocks();
13526 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13527 URL = gen_const_xmlChar_ptr(n_URL, 1);
13528 ID = gen_const_xmlChar_ptr(n_ID, 2);
13529 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13530
William M. Brackf13f77f2004-11-12 16:03:48 +000013531 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013532 desret_int(ret_val);
13533 call_tests++;
13534 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013535 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13536 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013537 des_xmlNodePtr_ptr(n_lst, lst, 3);
13538 xmlResetLastError();
13539 if (mem_base != xmlMemBlocks()) {
13540 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013542 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013543 printf(" %d", n_ctx);
13544 printf(" %d", n_URL);
13545 printf(" %d", n_ID);
13546 printf(" %d", n_lst);
13547 printf("\n");
13548 }
13549 }
13550 }
13551 }
13552 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013554
Daniel Veillard42595322004-11-08 10:52:06 +000013555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013556}
13557
13558
13559static int
13560test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013562
William M. Brack21e4ef22005-01-02 09:53:13 +000013563#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013564#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013565 int mem_base;
13566 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013567 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013568 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013569 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013570 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013571
Daniel Veillard34099b42004-11-04 17:34:35 +000013572 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13573 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13574 mem_base = xmlMemBlocks();
13575 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13576 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13577
William M. Brackf13f77f2004-11-12 16:03:48 +000013578 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013579 desret_xmlDtdPtr(ret_val);
13580 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013581 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13582 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013583 xmlResetLastError();
13584 if (mem_base != xmlMemBlocks()) {
13585 printf("Leak of %d blocks found in xmlParseDTD",
13586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013587 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013588 printf(" %d", n_ExternalID);
13589 printf(" %d", n_SystemID);
13590 printf("\n");
13591 }
13592 }
13593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013594 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013595#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013596#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013597
Daniel Veillard42595322004-11-08 10:52:06 +000013598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013599}
13600
13601
13602static int
13603test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013605
William M. Brack21e4ef22005-01-02 09:53:13 +000013606#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013607#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013608 int mem_base;
13609 xmlDocPtr ret_val;
13610 xmlChar * cur; /* a pointer to an array of xmlChar */
13611 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013612
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013613 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13614 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013615 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013616
13617 ret_val = xmlParseDoc(cur);
13618 desret_xmlDocPtr(ret_val);
13619 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013620 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013621 xmlResetLastError();
13622 if (mem_base != xmlMemBlocks()) {
13623 printf("Leak of %d blocks found in xmlParseDoc",
13624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013625 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013626 printf(" %d", n_cur);
13627 printf("\n");
13628 }
13629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013630 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013631#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013632#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013633
Daniel Veillard42595322004-11-08 10:52:06 +000013634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013635}
13636
13637
13638static int
13639test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013641
13642 int mem_base;
13643 int ret_val;
13644 xmlParserCtxtPtr ctxt; /* an XML parser context */
13645 int n_ctxt;
13646
13647 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13648 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013649 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013650
13651 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013652 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013653 desret_int(ret_val);
13654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013655 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013656 xmlResetLastError();
13657 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013658 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013660 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013661 printf(" %d", n_ctxt);
13662 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013663 }
13664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013666
Daniel Veillard42595322004-11-08 10:52:06 +000013667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013668}
13669
13670
13671static int
13672test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013674
William M. Brack21e4ef22005-01-02 09:53:13 +000013675#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013676#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013677 int mem_base;
13678 xmlDocPtr ret_val;
13679 const char * filename; /* the filename */
13680 int n_filename;
13681
13682 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013684 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013685
13686 ret_val = xmlParseEntity(filename);
13687 desret_xmlDocPtr(ret_val);
13688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013689 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013690 xmlResetLastError();
13691 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013692 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013694 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013695 printf(" %d", n_filename);
13696 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697 }
13698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013699 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013700#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013701#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013702
Daniel Veillard42595322004-11-08 10:52:06 +000013703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013704}
13705
13706
13707static int
13708test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013710
13711 int mem_base;
13712 int ret_val;
13713 xmlParserCtxtPtr ctxt; /* an XML parser context */
13714 int n_ctxt;
13715
13716 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013718 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013719
13720 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013721 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013722 desret_int(ret_val);
13723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013724 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013725 xmlResetLastError();
13726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013727 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013730 printf(" %d", n_ctxt);
13731 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013732 }
13733 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013735
Daniel Veillard42595322004-11-08 10:52:06 +000013736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013737}
13738
13739
13740static int
13741test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013743
William M. Brack21e4ef22005-01-02 09:53:13 +000013744#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013745#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013746 int mem_base;
13747 int ret_val;
13748 xmlDocPtr doc; /* the document the chunk pertains to */
13749 int n_doc;
13750 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13751 int n_sax;
13752 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13753 int n_user_data;
13754 int depth; /* Used for loop detection, use 0 */
13755 int n_depth;
13756 xmlChar * URL; /* the URL for the entity to load */
13757 int n_URL;
13758 xmlChar * ID; /* the System ID for the entity to load */
13759 int n_ID;
13760 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13761 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013762
Daniel Veillardce682bc2004-11-05 17:22:25 +000013763 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13764 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13765 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13766 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13767 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13768 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13769 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13770 mem_base = xmlMemBlocks();
13771 doc = gen_xmlDocPtr(n_doc, 0);
13772 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13773 user_data = gen_userdata(n_user_data, 2);
13774 depth = gen_int(n_depth, 3);
13775 URL = gen_const_xmlChar_ptr(n_URL, 4);
13776 ID = gen_const_xmlChar_ptr(n_ID, 5);
13777 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13778
William M. Brackf13f77f2004-11-12 16:03:48 +000013779 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013780 desret_int(ret_val);
13781 call_tests++;
13782 des_xmlDocPtr(n_doc, doc, 0);
13783 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13784 des_userdata(n_user_data, user_data, 2);
13785 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013786 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13787 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013788 des_xmlNodePtr_ptr(n_lst, lst, 6);
13789 xmlResetLastError();
13790 if (mem_base != xmlMemBlocks()) {
13791 printf("Leak of %d blocks found in xmlParseExternalEntity",
13792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013793 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013794 printf(" %d", n_doc);
13795 printf(" %d", n_sax);
13796 printf(" %d", n_user_data);
13797 printf(" %d", n_depth);
13798 printf(" %d", n_URL);
13799 printf(" %d", n_ID);
13800 printf(" %d", n_lst);
13801 printf("\n");
13802 }
13803 }
13804 }
13805 }
13806 }
13807 }
13808 }
13809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013810 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013811#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013812#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013813
Daniel Veillard42595322004-11-08 10:52:06 +000013814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013815}
13816
13817
13818static int
13819test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013821
William M. Brack21e4ef22005-01-02 09:53:13 +000013822#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013823#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013824 int mem_base;
13825 xmlDocPtr ret_val;
13826 const char * filename; /* the filename */
13827 int n_filename;
13828
13829 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013831 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013832
13833 ret_val = xmlParseFile(filename);
13834 desret_xmlDocPtr(ret_val);
13835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013836 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013837 xmlResetLastError();
13838 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013839 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013842 printf(" %d", n_filename);
13843 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013844 }
13845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013846 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013847#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013848#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013849
Daniel Veillard42595322004-11-08 10:52:06 +000013850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013851}
13852
13853
13854static int
13855test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857
Daniel Veillard57b25162004-11-06 14:50:18 +000013858 int mem_base;
13859 xmlParserErrors ret_val;
13860 xmlNodePtr node; /* the context node */
13861 int n_node;
13862 char * data; /* the input string */
13863 int n_data;
13864 int datalen; /* the input string length in bytes */
13865 int n_datalen;
13866 int options; /* a combination of xmlParserOption */
13867 int n_options;
13868 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13869 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013870
Daniel Veillard57b25162004-11-06 14:50:18 +000013871 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13872 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13873 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013874 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013875 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13876 mem_base = xmlMemBlocks();
13877 node = gen_xmlNodePtr(n_node, 0);
13878 data = gen_const_char_ptr(n_data, 1);
13879 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013880 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013881 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13882
William M. Brackf13f77f2004-11-12 16:03:48 +000013883 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013884 desret_xmlParserErrors(ret_val);
13885 call_tests++;
13886 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013887 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013888 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013889 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013890 des_xmlNodePtr_ptr(n_lst, lst, 4);
13891 xmlResetLastError();
13892 if (mem_base != xmlMemBlocks()) {
13893 printf("Leak of %d blocks found in xmlParseInNodeContext",
13894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013895 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013896 printf(" %d", n_node);
13897 printf(" %d", n_data);
13898 printf(" %d", n_datalen);
13899 printf(" %d", n_options);
13900 printf(" %d", n_lst);
13901 printf("\n");
13902 }
13903 }
13904 }
13905 }
13906 }
13907 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013908 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013909
Daniel Veillard42595322004-11-08 10:52:06 +000013910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013911}
13912
13913
13914static int
13915test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
William M. Brack21e4ef22005-01-02 09:53:13 +000013918#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013919#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013920 int mem_base;
13921 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013922 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013923 int n_buffer;
13924 int size; /* the size of the array */
13925 int n_size;
13926
13927 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13928 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013930 buffer = gen_const_char_ptr(n_buffer, 0);
13931 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013932
William M. Brackf13f77f2004-11-12 16:03:48 +000013933 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013934 desret_xmlDocPtr(ret_val);
13935 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013936 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013937 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013938 xmlResetLastError();
13939 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013940 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013942 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013943 printf(" %d", n_buffer);
13944 printf(" %d", n_size);
13945 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013946 }
13947 }
13948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013949 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013950#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013951#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
Daniel Veillard42595322004-11-08 10:52:06 +000013953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013954}
13955
13956
Daniel Veillardce682bc2004-11-05 17:22:25 +000013957#define gen_nb_const_xmlParserNodeInfoPtr 1
13958static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13959 return(NULL);
13960}
13961static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13962}
13963
Daniel Veillardd93f6252004-11-02 15:53:51 +000013964static int
13965test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013967
Daniel Veillardce682bc2004-11-05 17:22:25 +000013968 int mem_base;
13969 xmlParserCtxtPtr ctxt; /* an XML parser context */
13970 int n_ctxt;
13971 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13972 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013973
Daniel Veillardce682bc2004-11-05 17:22:25 +000013974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13975 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
13976 mem_base = xmlMemBlocks();
13977 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13978 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
13979
William M. Brackf13f77f2004-11-12 16:03:48 +000013980 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013981 call_tests++;
13982 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013983 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013984 xmlResetLastError();
13985 if (mem_base != xmlMemBlocks()) {
13986 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
13987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013988 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013989 printf(" %d", n_ctxt);
13990 printf(" %d", n_info);
13991 printf("\n");
13992 }
13993 }
13994 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013996
Daniel Veillard42595322004-11-08 10:52:06 +000013997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013998}
13999
14000
Daniel Veillardce682bc2004-11-05 17:22:25 +000014001#define gen_nb_const_xmlParserCtxtPtr 1
14002static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14003 return(NULL);
14004}
14005static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14006}
14007
Daniel Veillarda521d282004-11-09 14:59:59 +000014008#define gen_nb_const_xmlNodePtr 1
14009static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14010 return(NULL);
14011}
14012static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14013}
14014
Daniel Veillardd93f6252004-11-02 15:53:51 +000014015static int
14016test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014018
William M. Brack094dd862004-11-14 14:28:34 +000014019 int mem_base;
14020 const xmlParserNodeInfo * ret_val;
14021 xmlParserCtxtPtr ctx; /* an XML parser context */
14022 int n_ctx;
14023 xmlNodePtr node; /* an XML node within the tree */
14024 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014025
William M. Brack094dd862004-11-14 14:28:34 +000014026 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14027 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14028 mem_base = xmlMemBlocks();
14029 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14030 node = gen_const_xmlNodePtr(n_node, 1);
14031
14032 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14033 desret_const_xmlParserNodeInfo_ptr(ret_val);
14034 call_tests++;
14035 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14036 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14037 xmlResetLastError();
14038 if (mem_base != xmlMemBlocks()) {
14039 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14040 xmlMemBlocks() - mem_base);
14041 test_ret++;
14042 printf(" %d", n_ctx);
14043 printf(" %d", n_node);
14044 printf("\n");
14045 }
14046 }
14047 }
14048 function_tests++;
14049
Daniel Veillard42595322004-11-08 10:52:06 +000014050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014051}
14052
14053
Daniel Veillardce682bc2004-11-05 17:22:25 +000014054#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14055static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14056 return(NULL);
14057}
14058static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14059}
14060
Daniel Veillardd93f6252004-11-02 15:53:51 +000014061static int
14062test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014064
William M. Brack094dd862004-11-14 14:28:34 +000014065 int mem_base;
14066 unsigned long ret_val;
14067 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14068 int n_seq;
14069 xmlNodePtr node; /* an XML node pointer */
14070 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014071
William M. Brack094dd862004-11-14 14:28:34 +000014072 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14073 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14074 mem_base = xmlMemBlocks();
14075 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14076 node = gen_const_xmlNodePtr(n_node, 1);
14077
14078 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14079 desret_unsigned_long(ret_val);
14080 call_tests++;
14081 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14082 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14083 xmlResetLastError();
14084 if (mem_base != xmlMemBlocks()) {
14085 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14086 xmlMemBlocks() - mem_base);
14087 test_ret++;
14088 printf(" %d", n_seq);
14089 printf(" %d", n_node);
14090 printf("\n");
14091 }
14092 }
14093 }
14094 function_tests++;
14095
Daniel Veillard42595322004-11-08 10:52:06 +000014096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014097}
14098
14099
Daniel Veillardce682bc2004-11-05 17:22:25 +000014100#define gen_nb_xmlParserInputPtr 1
14101static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14102 return(NULL);
14103}
14104static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14105}
14106
Daniel Veillardd93f6252004-11-02 15:53:51 +000014107static int
14108test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014110
Daniel Veillardce682bc2004-11-05 17:22:25 +000014111 int mem_base;
14112 int ret_val;
14113 xmlParserInputPtr in; /* an XML parser input */
14114 int n_in;
14115 int len; /* an indicative size for the lookahead */
14116 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014117
Daniel Veillardce682bc2004-11-05 17:22:25 +000014118 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14119 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14120 mem_base = xmlMemBlocks();
14121 in = gen_xmlParserInputPtr(n_in, 0);
14122 len = gen_int(n_len, 1);
14123
14124 ret_val = xmlParserInputGrow(in, len);
14125 desret_int(ret_val);
14126 call_tests++;
14127 des_xmlParserInputPtr(n_in, in, 0);
14128 des_int(n_len, len, 1);
14129 xmlResetLastError();
14130 if (mem_base != xmlMemBlocks()) {
14131 printf("Leak of %d blocks found in xmlParserInputGrow",
14132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014134 printf(" %d", n_in);
14135 printf(" %d", n_len);
14136 printf("\n");
14137 }
14138 }
14139 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014141
Daniel Veillard42595322004-11-08 10:52:06 +000014142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014143}
14144
14145
14146static int
14147test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014149
Daniel Veillardce682bc2004-11-05 17:22:25 +000014150 int mem_base;
14151 int ret_val;
14152 xmlParserInputPtr in; /* an XML parser input */
14153 int n_in;
14154 int len; /* an indicative size for the lookahead */
14155 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014156
Daniel Veillardce682bc2004-11-05 17:22:25 +000014157 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14158 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14159 mem_base = xmlMemBlocks();
14160 in = gen_xmlParserInputPtr(n_in, 0);
14161 len = gen_int(n_len, 1);
14162
14163 ret_val = xmlParserInputRead(in, len);
14164 desret_int(ret_val);
14165 call_tests++;
14166 des_xmlParserInputPtr(n_in, in, 0);
14167 des_int(n_len, len, 1);
14168 xmlResetLastError();
14169 if (mem_base != xmlMemBlocks()) {
14170 printf("Leak of %d blocks found in xmlParserInputRead",
14171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014173 printf(" %d", n_in);
14174 printf(" %d", n_len);
14175 printf("\n");
14176 }
14177 }
14178 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014180
Daniel Veillard42595322004-11-08 10:52:06 +000014181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182}
14183
14184
14185static int
14186test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014188
14189 int mem_base;
14190 int ret_val;
14191 int val; /* int 0 or 1 */
14192 int n_val;
14193
14194 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014196 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014197
14198 ret_val = xmlPedanticParserDefault(val);
14199 desret_int(ret_val);
14200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014201 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014202 xmlResetLastError();
14203 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014204 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014206 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014207 printf(" %d", n_val);
14208 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209 }
14210 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014211 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014212
Daniel Veillard42595322004-11-08 10:52:06 +000014213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014214}
14215
14216
14217static int
14218test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014220
14221 int mem_base;
14222 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014223 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014224 int n_cur;
14225 const char * URL; /* the base URL to use for the document */
14226 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014227 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014228 int n_encoding;
14229 int options; /* a combination of xmlParserOption */
14230 int n_options;
14231
14232 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14233 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14234 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014235 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014237 cur = gen_const_xmlChar_ptr(n_cur, 0);
14238 URL = gen_filepath(n_URL, 1);
14239 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014240 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014241
William M. Brackf13f77f2004-11-12 16:03:48 +000014242 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014243 desret_xmlDocPtr(ret_val);
14244 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014245 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014246 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014247 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014248 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249 xmlResetLastError();
14250 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014251 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014253 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014254 printf(" %d", n_cur);
14255 printf(" %d", n_URL);
14256 printf(" %d", n_encoding);
14257 printf(" %d", n_options);
14258 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014259 }
14260 }
14261 }
14262 }
14263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014265
Daniel Veillard42595322004-11-08 10:52:06 +000014266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014267}
14268
14269
14270static int
14271test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273
14274 int mem_base;
14275 xmlDocPtr ret_val;
14276 const char * filename; /* a file or URL */
14277 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014278 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014279 int n_encoding;
14280 int options; /* a combination of xmlParserOption */
14281 int n_options;
14282
14283 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14284 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014285 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014287 filename = gen_filepath(n_filename, 0);
14288 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014289 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014290
William M. Brackf13f77f2004-11-12 16:03:48 +000014291 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014292 desret_xmlDocPtr(ret_val);
14293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014294 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014295 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014296 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014297 xmlResetLastError();
14298 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014299 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014301 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014302 printf(" %d", n_filename);
14303 printf(" %d", n_encoding);
14304 printf(" %d", n_options);
14305 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014306 }
14307 }
14308 }
14309 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014311
Daniel Veillard42595322004-11-08 10:52:06 +000014312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014313}
14314
14315
14316static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014317test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014319
14320 int mem_base;
14321 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014322 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014323 int n_buffer;
14324 int size; /* the size of the array */
14325 int n_size;
14326 const char * URL; /* the base URL to use for the document */
14327 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014328 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329 int n_encoding;
14330 int options; /* a combination of xmlParserOption */
14331 int n_options;
14332
14333 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14334 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14335 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14336 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014337 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014338 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014339 buffer = gen_const_char_ptr(n_buffer, 0);
14340 size = gen_int(n_size, 1);
14341 URL = gen_filepath(n_URL, 2);
14342 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014343 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344
William M. Brackf13f77f2004-11-12 16:03:48 +000014345 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014346 desret_xmlDocPtr(ret_val);
14347 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014348 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014349 des_int(n_size, size, 1);
14350 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014351 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014352 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014353 xmlResetLastError();
14354 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014355 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014357 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014358 printf(" %d", n_buffer);
14359 printf(" %d", n_size);
14360 printf(" %d", n_URL);
14361 printf(" %d", n_encoding);
14362 printf(" %d", n_options);
14363 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364 }
14365 }
14366 }
14367 }
14368 }
14369 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014371
Daniel Veillard42595322004-11-08 10:52:06 +000014372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014373}
14374
14375
14376static int
14377test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014379
William M. Brack21e4ef22005-01-02 09:53:13 +000014380#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014381#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014382 int mem_base;
14383 xmlDocPtr ret_val;
14384 xmlChar * cur; /* a pointer to an array of xmlChar */
14385 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014386
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014387 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014389 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014390
14391 ret_val = xmlRecoverDoc(cur);
14392 desret_xmlDocPtr(ret_val);
14393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014394 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014395 xmlResetLastError();
14396 if (mem_base != xmlMemBlocks()) {
14397 printf("Leak of %d blocks found in xmlRecoverDoc",
14398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014399 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014400 printf(" %d", n_cur);
14401 printf("\n");
14402 }
14403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014404 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014405#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014406#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014407
Daniel Veillard42595322004-11-08 10:52:06 +000014408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014409}
14410
14411
14412static int
14413test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014415
William M. Brack21e4ef22005-01-02 09:53:13 +000014416#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014417#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014418 int mem_base;
14419 xmlDocPtr ret_val;
14420 const char * filename; /* the filename */
14421 int n_filename;
14422
14423 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014425 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014426
14427 ret_val = xmlRecoverFile(filename);
14428 desret_xmlDocPtr(ret_val);
14429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014430 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014431 xmlResetLastError();
14432 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014433 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014435 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014436 printf(" %d", n_filename);
14437 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 }
14439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014440 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014441#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014442#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014443
Daniel Veillard42595322004-11-08 10:52:06 +000014444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014445}
14446
14447
14448static int
14449test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014451
William M. Brack21e4ef22005-01-02 09:53:13 +000014452#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014453#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014454 int mem_base;
14455 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014456 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014457 int n_buffer;
14458 int size; /* the size of the array */
14459 int n_size;
14460
14461 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14462 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14463 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014464 buffer = gen_const_char_ptr(n_buffer, 0);
14465 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466
William M. Brackf13f77f2004-11-12 16:03:48 +000014467 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014468 desret_xmlDocPtr(ret_val);
14469 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014470 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014471 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014472 xmlResetLastError();
14473 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014474 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014477 printf(" %d", n_buffer);
14478 printf(" %d", n_size);
14479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014480 }
14481 }
14482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014483 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014484#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014485#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014486
Daniel Veillard42595322004-11-08 10:52:06 +000014487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014488}
14489
14490
14491static int
14492test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014494
William M. Brack21e4ef22005-01-02 09:53:13 +000014495#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014496#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014497 int mem_base;
14498 xmlDtdPtr ret_val;
14499 xmlSAXHandlerPtr sax; /* the SAX handler block */
14500 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014501 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014502 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014503 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014504 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014505
Daniel Veillard34099b42004-11-04 17:34:35 +000014506 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14507 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14508 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14509 mem_base = xmlMemBlocks();
14510 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14511 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14512 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14513
William M. Brackf13f77f2004-11-12 16:03:48 +000014514 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014515 desret_xmlDtdPtr(ret_val);
14516 call_tests++;
14517 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014518 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14519 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014520 xmlResetLastError();
14521 if (mem_base != xmlMemBlocks()) {
14522 printf("Leak of %d blocks found in xmlSAXParseDTD",
14523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014524 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014525 printf(" %d", n_sax);
14526 printf(" %d", n_ExternalID);
14527 printf(" %d", n_SystemID);
14528 printf("\n");
14529 }
14530 }
14531 }
14532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014533 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014534#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014535#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014536
Daniel Veillard42595322004-11-08 10:52:06 +000014537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538}
14539
14540
14541static int
14542test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014544
William M. Brack21e4ef22005-01-02 09:53:13 +000014545#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014546#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014547 int mem_base;
14548 xmlDocPtr ret_val;
14549 xmlSAXHandlerPtr sax; /* the SAX handler block */
14550 int n_sax;
14551 xmlChar * cur; /* a pointer to an array of xmlChar */
14552 int n_cur;
14553 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14554 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014555
Daniel Veillard34099b42004-11-04 17:34:35 +000014556 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14557 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14558 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14559 mem_base = xmlMemBlocks();
14560 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14561 cur = gen_xmlChar_ptr(n_cur, 1);
14562 recovery = gen_int(n_recovery, 2);
14563
14564 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14565 desret_xmlDocPtr(ret_val);
14566 call_tests++;
14567 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14568 des_xmlChar_ptr(n_cur, cur, 1);
14569 des_int(n_recovery, recovery, 2);
14570 xmlResetLastError();
14571 if (mem_base != xmlMemBlocks()) {
14572 printf("Leak of %d blocks found in xmlSAXParseDoc",
14573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014574 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014575 printf(" %d", n_sax);
14576 printf(" %d", n_cur);
14577 printf(" %d", n_recovery);
14578 printf("\n");
14579 }
14580 }
14581 }
14582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014583 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014584#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014585#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014586
Daniel Veillard42595322004-11-08 10:52:06 +000014587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014588}
14589
14590
14591static int
14592test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014594
William M. Brack21e4ef22005-01-02 09:53:13 +000014595#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014596#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014597 int mem_base;
14598 xmlDocPtr ret_val;
14599 xmlSAXHandlerPtr sax; /* the SAX handler block */
14600 int n_sax;
14601 const char * filename; /* the filename */
14602 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014603
Daniel Veillard34099b42004-11-04 17:34:35 +000014604 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14605 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14606 mem_base = xmlMemBlocks();
14607 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14608 filename = gen_filepath(n_filename, 1);
14609
14610 ret_val = xmlSAXParseEntity(sax, filename);
14611 desret_xmlDocPtr(ret_val);
14612 call_tests++;
14613 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14614 des_filepath(n_filename, filename, 1);
14615 xmlResetLastError();
14616 if (mem_base != xmlMemBlocks()) {
14617 printf("Leak of %d blocks found in xmlSAXParseEntity",
14618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014619 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014620 printf(" %d", n_sax);
14621 printf(" %d", n_filename);
14622 printf("\n");
14623 }
14624 }
14625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014626 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014627#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014628#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014629
Daniel Veillard42595322004-11-08 10:52:06 +000014630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014631}
14632
14633
14634static int
14635test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014637
William M. Brack21e4ef22005-01-02 09:53:13 +000014638#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014639#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014640 int mem_base;
14641 xmlDocPtr ret_val;
14642 xmlSAXHandlerPtr sax; /* the SAX handler block */
14643 int n_sax;
14644 const char * filename; /* the filename */
14645 int n_filename;
14646 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14647 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014648
Daniel Veillard34099b42004-11-04 17:34:35 +000014649 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14650 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14651 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14652 mem_base = xmlMemBlocks();
14653 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14654 filename = gen_filepath(n_filename, 1);
14655 recovery = gen_int(n_recovery, 2);
14656
14657 ret_val = xmlSAXParseFile(sax, filename, recovery);
14658 desret_xmlDocPtr(ret_val);
14659 call_tests++;
14660 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14661 des_filepath(n_filename, filename, 1);
14662 des_int(n_recovery, recovery, 2);
14663 xmlResetLastError();
14664 if (mem_base != xmlMemBlocks()) {
14665 printf("Leak of %d blocks found in xmlSAXParseFile",
14666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014667 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014668 printf(" %d", n_sax);
14669 printf(" %d", n_filename);
14670 printf(" %d", n_recovery);
14671 printf("\n");
14672 }
14673 }
14674 }
14675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014676 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014677#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014678#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014679
Daniel Veillard42595322004-11-08 10:52:06 +000014680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014681}
14682
14683
14684static int
14685test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014687
William M. Brack21e4ef22005-01-02 09:53:13 +000014688#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014689#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014690 int mem_base;
14691 xmlDocPtr ret_val;
14692 xmlSAXHandlerPtr sax; /* the SAX handler block */
14693 int n_sax;
14694 const char * filename; /* the filename */
14695 int n_filename;
14696 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14697 int n_recovery;
14698 void * data; /* the userdata */
14699 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014700
Daniel Veillard34099b42004-11-04 17:34:35 +000014701 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14702 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14703 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14704 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14705 mem_base = xmlMemBlocks();
14706 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14707 filename = gen_filepath(n_filename, 1);
14708 recovery = gen_int(n_recovery, 2);
14709 data = gen_userdata(n_data, 3);
14710
14711 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14712 desret_xmlDocPtr(ret_val);
14713 call_tests++;
14714 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14715 des_filepath(n_filename, filename, 1);
14716 des_int(n_recovery, recovery, 2);
14717 des_userdata(n_data, data, 3);
14718 xmlResetLastError();
14719 if (mem_base != xmlMemBlocks()) {
14720 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014722 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014723 printf(" %d", n_sax);
14724 printf(" %d", n_filename);
14725 printf(" %d", n_recovery);
14726 printf(" %d", n_data);
14727 printf("\n");
14728 }
14729 }
14730 }
14731 }
14732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014733 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014734#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014735#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014736
Daniel Veillard42595322004-11-08 10:52:06 +000014737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014738}
14739
14740
14741static int
14742test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014744
William M. Brack21e4ef22005-01-02 09:53:13 +000014745#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014746#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014747 int mem_base;
14748 xmlDocPtr ret_val;
14749 xmlSAXHandlerPtr sax; /* the SAX handler block */
14750 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014751 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014752 int n_buffer;
14753 int size; /* the size of the array */
14754 int n_size;
14755 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14756 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014757
Daniel Veillard34099b42004-11-04 17:34:35 +000014758 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14759 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14760 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14761 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14762 mem_base = xmlMemBlocks();
14763 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14764 buffer = gen_const_char_ptr(n_buffer, 1);
14765 size = gen_int(n_size, 2);
14766 recovery = gen_int(n_recovery, 3);
14767
William M. Brackf13f77f2004-11-12 16:03:48 +000014768 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014769 desret_xmlDocPtr(ret_val);
14770 call_tests++;
14771 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014772 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014773 des_int(n_size, size, 2);
14774 des_int(n_recovery, recovery, 3);
14775 xmlResetLastError();
14776 if (mem_base != xmlMemBlocks()) {
14777 printf("Leak of %d blocks found in xmlSAXParseMemory",
14778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014779 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014780 printf(" %d", n_sax);
14781 printf(" %d", n_buffer);
14782 printf(" %d", n_size);
14783 printf(" %d", n_recovery);
14784 printf("\n");
14785 }
14786 }
14787 }
14788 }
14789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014790 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014791#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014792#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014793
Daniel Veillard42595322004-11-08 10:52:06 +000014794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014795}
14796
14797
14798static int
14799test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801
William M. Brack21e4ef22005-01-02 09:53:13 +000014802#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014803#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014804 int mem_base;
14805 xmlDocPtr ret_val;
14806 xmlSAXHandlerPtr sax; /* the SAX handler block */
14807 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014808 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014809 int n_buffer;
14810 int size; /* the size of the array */
14811 int n_size;
14812 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14813 int n_recovery;
14814 void * data; /* the userdata */
14815 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014816
Daniel Veillard34099b42004-11-04 17:34:35 +000014817 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14818 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14819 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14820 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14821 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14822 mem_base = xmlMemBlocks();
14823 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14824 buffer = gen_const_char_ptr(n_buffer, 1);
14825 size = gen_int(n_size, 2);
14826 recovery = gen_int(n_recovery, 3);
14827 data = gen_userdata(n_data, 4);
14828
William M. Brackf13f77f2004-11-12 16:03:48 +000014829 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014830 desret_xmlDocPtr(ret_val);
14831 call_tests++;
14832 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014833 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014834 des_int(n_size, size, 2);
14835 des_int(n_recovery, recovery, 3);
14836 des_userdata(n_data, data, 4);
14837 xmlResetLastError();
14838 if (mem_base != xmlMemBlocks()) {
14839 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014841 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014842 printf(" %d", n_sax);
14843 printf(" %d", n_buffer);
14844 printf(" %d", n_size);
14845 printf(" %d", n_recovery);
14846 printf(" %d", n_data);
14847 printf("\n");
14848 }
14849 }
14850 }
14851 }
14852 }
14853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014854 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014855#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014856#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014857
Daniel Veillard42595322004-11-08 10:52:06 +000014858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014859}
14860
14861
14862static int
14863test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014865
William M. Brack21e4ef22005-01-02 09:53:13 +000014866#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014867#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014868 int mem_base;
14869 int ret_val;
14870 xmlSAXHandlerPtr sax; /* a SAX handler */
14871 int n_sax;
14872 void * user_data; /* The user data returned on SAX callbacks */
14873 int n_user_data;
14874 const char * filename; /* a file name */
14875 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014876
Daniel Veillard34099b42004-11-04 17:34:35 +000014877 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14878 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14879 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14880 mem_base = xmlMemBlocks();
14881 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14882 user_data = gen_userdata(n_user_data, 1);
14883 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014884
14885#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014886 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014887#endif
14888
Daniel Veillard34099b42004-11-04 17:34:35 +000014889
14890 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14891 desret_int(ret_val);
14892 call_tests++;
14893 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14894 des_userdata(n_user_data, user_data, 1);
14895 des_filepath(n_filename, filename, 2);
14896 xmlResetLastError();
14897 if (mem_base != xmlMemBlocks()) {
14898 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014900 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014901 printf(" %d", n_sax);
14902 printf(" %d", n_user_data);
14903 printf(" %d", n_filename);
14904 printf("\n");
14905 }
14906 }
14907 }
14908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014909 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014910#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014911#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014912
Daniel Veillard42595322004-11-08 10:52:06 +000014913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014914}
14915
14916
14917static int
14918test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014920
William M. Brack21e4ef22005-01-02 09:53:13 +000014921#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014922#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014923 int mem_base;
14924 int ret_val;
14925 xmlSAXHandlerPtr sax; /* a SAX handler */
14926 int n_sax;
14927 void * user_data; /* The user data returned on SAX callbacks */
14928 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014929 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014930 int n_buffer;
14931 int size; /* the length of the XML document in bytes */
14932 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014933
Daniel Veillard34099b42004-11-04 17:34:35 +000014934 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14935 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14936 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14937 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14938 mem_base = xmlMemBlocks();
14939 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14940 user_data = gen_userdata(n_user_data, 1);
14941 buffer = gen_const_char_ptr(n_buffer, 2);
14942 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014943
14944#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014945 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014946#endif
14947
Daniel Veillard34099b42004-11-04 17:34:35 +000014948
William M. Brackf13f77f2004-11-12 16:03:48 +000014949 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 desret_int(ret_val);
14951 call_tests++;
14952 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14953 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014954 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014955 des_int(n_size, size, 3);
14956 xmlResetLastError();
14957 if (mem_base != xmlMemBlocks()) {
14958 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014960 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014961 printf(" %d", n_sax);
14962 printf(" %d", n_user_data);
14963 printf(" %d", n_buffer);
14964 printf(" %d", n_size);
14965 printf("\n");
14966 }
14967 }
14968 }
14969 }
14970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014971 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014972#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014973#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014974
Daniel Veillard42595322004-11-08 10:52:06 +000014975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014976}
14977
14978
14979static int
14980test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014982
14983
14984 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014986}
14987
14988
14989static int
14990test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014992
William M. Brack21e4ef22005-01-02 09:53:13 +000014993#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014994#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014995 int mem_base;
14996 int ret_val;
14997 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
14998 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014999 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015000 int n_name;
15001 void * value; /* pointer to the location of the new value */
15002 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015003
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015004 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15005 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15006 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15007 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015008 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15009 name = gen_const_char_ptr(n_name, 1);
15010 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015011
William M. Brackf13f77f2004-11-12 16:03:48 +000015012 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015013 desret_int(ret_val);
15014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015015 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015016 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015017 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015018 xmlResetLastError();
15019 if (mem_base != xmlMemBlocks()) {
15020 printf("Leak of %d blocks found in xmlSetFeature",
15021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015022 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015023 printf(" %d", n_ctxt);
15024 printf(" %d", n_name);
15025 printf(" %d", n_value);
15026 printf("\n");
15027 }
15028 }
15029 }
15030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015031 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015032#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015033#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015034
Daniel Veillard42595322004-11-08 10:52:06 +000015035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015036}
15037
15038
15039static int
15040test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015042
William M. Brack21e4ef22005-01-02 09:53:13 +000015043#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015044#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015045 int mem_base;
15046 xmlParserCtxtPtr ctxt; /* an XML parser context */
15047 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015048 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015049 int n_buffer;
15050 const char * filename; /* a file name */
15051 int n_filename;
15052
15053 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15054 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15055 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15056 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015057 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15058 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15059 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015060
William M. Brackf13f77f2004-11-12 16:03:48 +000015061 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015063 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015064 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015065 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015066 xmlResetLastError();
15067 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015068 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015070 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015071 printf(" %d", n_ctxt);
15072 printf(" %d", n_buffer);
15073 printf(" %d", n_filename);
15074 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015075 }
15076 }
15077 }
15078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015079 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015080#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015081#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015082
Daniel Veillard42595322004-11-08 10:52:06 +000015083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015084}
15085
15086
15087static int
15088test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015090
William M. Brack21e4ef22005-01-02 09:53:13 +000015091#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015092#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015093 int mem_base;
15094 xmlParserCtxtPtr ctxt; /* an XML parser context */
15095 int n_ctxt;
15096
15097 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015099 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015100
15101 xmlStopParser(ctxt);
15102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015103 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015104 xmlResetLastError();
15105 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015106 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015108 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015109 printf(" %d", n_ctxt);
15110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015111 }
15112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015113 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015114#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015115#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015116
Daniel Veillard42595322004-11-08 10:52:06 +000015117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015118}
15119
15120
15121static int
15122test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015124
15125 int mem_base;
15126 int ret_val;
15127 int val; /* int 0 or 1 */
15128 int n_val;
15129
15130 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015132 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015133
15134 ret_val = xmlSubstituteEntitiesDefault(val);
15135 desret_int(ret_val);
15136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015137 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015138 xmlResetLastError();
15139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015140 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015143 printf(" %d", n_val);
15144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145 }
15146 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015147 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015148
Daniel Veillard42595322004-11-08 10:52:06 +000015149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015150}
15151
15152static int
15153test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015155
William M. Brack094dd862004-11-14 14:28:34 +000015156 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015157 test_ret += test_xmlByteConsumed();
15158 test_ret += test_xmlClearNodeInfoSeq();
15159 test_ret += test_xmlClearParserCtxt();
15160 test_ret += test_xmlCreateDocParserCtxt();
15161 test_ret += test_xmlCreatePushParserCtxt();
15162 test_ret += test_xmlCtxtReadDoc();
15163 test_ret += test_xmlCtxtReadFile();
15164 test_ret += test_xmlCtxtReadMemory();
15165 test_ret += test_xmlCtxtReset();
15166 test_ret += test_xmlCtxtResetPush();
15167 test_ret += test_xmlCtxtUseOptions();
15168 test_ret += test_xmlGetExternalEntityLoader();
15169 test_ret += test_xmlGetFeature();
15170 test_ret += test_xmlGetFeaturesList();
15171 test_ret += test_xmlIOParseDTD();
15172 test_ret += test_xmlInitNodeInfoSeq();
15173 test_ret += test_xmlInitParser();
15174 test_ret += test_xmlInitParserCtxt();
15175 test_ret += test_xmlKeepBlanksDefault();
15176 test_ret += test_xmlLineNumbersDefault();
15177 test_ret += test_xmlLoadExternalEntity();
15178 test_ret += test_xmlNewIOInputStream();
15179 test_ret += test_xmlNewParserCtxt();
15180 test_ret += test_xmlParseBalancedChunkMemory();
15181 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15182 test_ret += test_xmlParseChunk();
15183 test_ret += test_xmlParseCtxtExternalEntity();
15184 test_ret += test_xmlParseDTD();
15185 test_ret += test_xmlParseDoc();
15186 test_ret += test_xmlParseDocument();
15187 test_ret += test_xmlParseEntity();
15188 test_ret += test_xmlParseExtParsedEnt();
15189 test_ret += test_xmlParseExternalEntity();
15190 test_ret += test_xmlParseFile();
15191 test_ret += test_xmlParseInNodeContext();
15192 test_ret += test_xmlParseMemory();
15193 test_ret += test_xmlParserAddNodeInfo();
15194 test_ret += test_xmlParserFindNodeInfo();
15195 test_ret += test_xmlParserFindNodeInfoIndex();
15196 test_ret += test_xmlParserInputGrow();
15197 test_ret += test_xmlParserInputRead();
15198 test_ret += test_xmlPedanticParserDefault();
15199 test_ret += test_xmlReadDoc();
15200 test_ret += test_xmlReadFile();
15201 test_ret += test_xmlReadMemory();
15202 test_ret += test_xmlRecoverDoc();
15203 test_ret += test_xmlRecoverFile();
15204 test_ret += test_xmlRecoverMemory();
15205 test_ret += test_xmlSAXParseDTD();
15206 test_ret += test_xmlSAXParseDoc();
15207 test_ret += test_xmlSAXParseEntity();
15208 test_ret += test_xmlSAXParseFile();
15209 test_ret += test_xmlSAXParseFileWithData();
15210 test_ret += test_xmlSAXParseMemory();
15211 test_ret += test_xmlSAXParseMemoryWithData();
15212 test_ret += test_xmlSAXUserParseFile();
15213 test_ret += test_xmlSAXUserParseMemory();
15214 test_ret += test_xmlSetExternalEntityLoader();
15215 test_ret += test_xmlSetFeature();
15216 test_ret += test_xmlSetupParserForBuffer();
15217 test_ret += test_xmlStopParser();
15218 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015219
Daniel Veillard42595322004-11-08 10:52:06 +000015220 if (test_ret != 0)
15221 printf("Module parser: %d errors\n", test_ret);
15222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015223}
15224
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015225static int
15226test_htmlCreateFileParserCtxt(void) {
15227 int test_ret = 0;
15228
William M. Brack21e4ef22005-01-02 09:53:13 +000015229#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015230 int mem_base;
15231 htmlParserCtxtPtr ret_val;
15232 const char * filename; /* the filename */
15233 int n_filename;
15234 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15235 int n_encoding;
15236
15237 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15238 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15239 mem_base = xmlMemBlocks();
15240 filename = gen_fileoutput(n_filename, 0);
15241 encoding = gen_const_char_ptr(n_encoding, 1);
15242
William M. Brackf13f77f2004-11-12 16:03:48 +000015243 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015244 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015245 call_tests++;
15246 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015247 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015248 xmlResetLastError();
15249 if (mem_base != xmlMemBlocks()) {
15250 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15251 xmlMemBlocks() - mem_base);
15252 test_ret++;
15253 printf(" %d", n_filename);
15254 printf(" %d", n_encoding);
15255 printf("\n");
15256 }
15257 }
15258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015259 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015260#endif
15261
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015262 return(test_ret);
15263}
15264
15265
15266static int
15267test_htmlInitAutoClose(void) {
15268 int test_ret = 0;
15269
William M. Brack21e4ef22005-01-02 09:53:13 +000015270#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015271 int mem_base;
15272
15273 mem_base = xmlMemBlocks();
15274
15275 htmlInitAutoClose();
15276 call_tests++;
15277 xmlResetLastError();
15278 if (mem_base != xmlMemBlocks()) {
15279 printf("Leak of %d blocks found in htmlInitAutoClose",
15280 xmlMemBlocks() - mem_base);
15281 test_ret++;
15282 printf("\n");
15283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015284 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015285#endif
15286
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015287 return(test_ret);
15288}
15289
15290
15291static int
15292test_inputPop(void) {
15293 int test_ret = 0;
15294
15295 int mem_base;
15296 xmlParserInputPtr ret_val;
15297 xmlParserCtxtPtr ctxt; /* an XML parser context */
15298 int n_ctxt;
15299
15300 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15301 mem_base = xmlMemBlocks();
15302 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15303
15304 ret_val = inputPop(ctxt);
15305 desret_xmlParserInputPtr(ret_val);
15306 call_tests++;
15307 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15308 xmlResetLastError();
15309 if (mem_base != xmlMemBlocks()) {
15310 printf("Leak of %d blocks found in inputPop",
15311 xmlMemBlocks() - mem_base);
15312 test_ret++;
15313 printf(" %d", n_ctxt);
15314 printf("\n");
15315 }
15316 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015318
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015319 return(test_ret);
15320}
15321
15322
15323static int
15324test_inputPush(void) {
15325 int test_ret = 0;
15326
15327 int mem_base;
15328 int ret_val;
15329 xmlParserCtxtPtr ctxt; /* an XML parser context */
15330 int n_ctxt;
15331 xmlParserInputPtr value; /* the parser input */
15332 int n_value;
15333
15334 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15335 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15336 mem_base = xmlMemBlocks();
15337 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15338 value = gen_xmlParserInputPtr(n_value, 1);
15339
15340 ret_val = inputPush(ctxt, value);
15341 desret_int(ret_val);
15342 call_tests++;
15343 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15344 des_xmlParserInputPtr(n_value, value, 1);
15345 xmlResetLastError();
15346 if (mem_base != xmlMemBlocks()) {
15347 printf("Leak of %d blocks found in inputPush",
15348 xmlMemBlocks() - mem_base);
15349 test_ret++;
15350 printf(" %d", n_ctxt);
15351 printf(" %d", n_value);
15352 printf("\n");
15353 }
15354 }
15355 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015357
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015358 return(test_ret);
15359}
15360
15361
15362static int
15363test_namePop(void) {
15364 int test_ret = 0;
15365
15366 int mem_base;
15367 const xmlChar * ret_val;
15368 xmlParserCtxtPtr ctxt; /* an XML parser context */
15369 int n_ctxt;
15370
15371 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15372 mem_base = xmlMemBlocks();
15373 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15374
15375 ret_val = namePop(ctxt);
15376 desret_const_xmlChar_ptr(ret_val);
15377 call_tests++;
15378 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15379 xmlResetLastError();
15380 if (mem_base != xmlMemBlocks()) {
15381 printf("Leak of %d blocks found in namePop",
15382 xmlMemBlocks() - mem_base);
15383 test_ret++;
15384 printf(" %d", n_ctxt);
15385 printf("\n");
15386 }
15387 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015389
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015390 return(test_ret);
15391}
15392
15393
15394static int
15395test_namePush(void) {
15396 int test_ret = 0;
15397
15398 int mem_base;
15399 int ret_val;
15400 xmlParserCtxtPtr ctxt; /* an XML parser context */
15401 int n_ctxt;
15402 xmlChar * value; /* the element name */
15403 int n_value;
15404
15405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15406 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15407 mem_base = xmlMemBlocks();
15408 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15409 value = gen_const_xmlChar_ptr(n_value, 1);
15410
William M. Brackf13f77f2004-11-12 16:03:48 +000015411 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015412 desret_int(ret_val);
15413 call_tests++;
15414 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015415 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015416 xmlResetLastError();
15417 if (mem_base != xmlMemBlocks()) {
15418 printf("Leak of %d blocks found in namePush",
15419 xmlMemBlocks() - mem_base);
15420 test_ret++;
15421 printf(" %d", n_ctxt);
15422 printf(" %d", n_value);
15423 printf("\n");
15424 }
15425 }
15426 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015428
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015429 return(test_ret);
15430}
15431
15432
15433static int
15434test_nodePop(void) {
15435 int test_ret = 0;
15436
15437 int mem_base;
15438 xmlNodePtr ret_val;
15439 xmlParserCtxtPtr ctxt; /* an XML parser context */
15440 int n_ctxt;
15441
15442 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15443 mem_base = xmlMemBlocks();
15444 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15445
15446 ret_val = nodePop(ctxt);
15447 desret_xmlNodePtr(ret_val);
15448 call_tests++;
15449 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15450 xmlResetLastError();
15451 if (mem_base != xmlMemBlocks()) {
15452 printf("Leak of %d blocks found in nodePop",
15453 xmlMemBlocks() - mem_base);
15454 test_ret++;
15455 printf(" %d", n_ctxt);
15456 printf("\n");
15457 }
15458 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015460
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015461 return(test_ret);
15462}
15463
15464
15465static int
15466test_nodePush(void) {
15467 int test_ret = 0;
15468
15469 int mem_base;
15470 int ret_val;
15471 xmlParserCtxtPtr ctxt; /* an XML parser context */
15472 int n_ctxt;
15473 xmlNodePtr value; /* the element node */
15474 int n_value;
15475
15476 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15477 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15478 mem_base = xmlMemBlocks();
15479 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15480 value = gen_xmlNodePtr(n_value, 1);
15481
15482 ret_val = nodePush(ctxt, value);
15483 desret_int(ret_val);
15484 call_tests++;
15485 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15486 des_xmlNodePtr(n_value, value, 1);
15487 xmlResetLastError();
15488 if (mem_base != xmlMemBlocks()) {
15489 printf("Leak of %d blocks found in nodePush",
15490 xmlMemBlocks() - mem_base);
15491 test_ret++;
15492 printf(" %d", n_ctxt);
15493 printf(" %d", n_value);
15494 printf("\n");
15495 }
15496 }
15497 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015499
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015500 return(test_ret);
15501}
15502
15503
15504static int
15505test_xmlCheckLanguageID(void) {
15506 int test_ret = 0;
15507
15508 int mem_base;
15509 int ret_val;
15510 xmlChar * lang; /* pointer to the string value */
15511 int n_lang;
15512
15513 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15514 mem_base = xmlMemBlocks();
15515 lang = gen_const_xmlChar_ptr(n_lang, 0);
15516
William M. Brackf13f77f2004-11-12 16:03:48 +000015517 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015518 desret_int(ret_val);
15519 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015520 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015521 xmlResetLastError();
15522 if (mem_base != xmlMemBlocks()) {
15523 printf("Leak of %d blocks found in xmlCheckLanguageID",
15524 xmlMemBlocks() - mem_base);
15525 test_ret++;
15526 printf(" %d", n_lang);
15527 printf("\n");
15528 }
15529 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015531
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015532 return(test_ret);
15533}
15534
15535
15536static int
15537test_xmlCopyChar(void) {
15538 int test_ret = 0;
15539
15540 int mem_base;
15541 int ret_val;
15542 int len; /* Ignored, compatibility */
15543 int n_len;
15544 xmlChar * out; /* pointer to an array of xmlChar */
15545 int n_out;
15546 int val; /* the char value */
15547 int n_val;
15548
15549 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15550 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15551 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15552 mem_base = xmlMemBlocks();
15553 len = gen_int(n_len, 0);
15554 out = gen_xmlChar_ptr(n_out, 1);
15555 val = gen_int(n_val, 2);
15556
15557 ret_val = xmlCopyChar(len, out, val);
15558 desret_int(ret_val);
15559 call_tests++;
15560 des_int(n_len, len, 0);
15561 des_xmlChar_ptr(n_out, out, 1);
15562 des_int(n_val, val, 2);
15563 xmlResetLastError();
15564 if (mem_base != xmlMemBlocks()) {
15565 printf("Leak of %d blocks found in xmlCopyChar",
15566 xmlMemBlocks() - mem_base);
15567 test_ret++;
15568 printf(" %d", n_len);
15569 printf(" %d", n_out);
15570 printf(" %d", n_val);
15571 printf("\n");
15572 }
15573 }
15574 }
15575 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015576 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015577
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015578 return(test_ret);
15579}
15580
15581
15582static int
15583test_xmlCopyCharMultiByte(void) {
15584 int test_ret = 0;
15585
15586 int mem_base;
15587 int ret_val;
15588 xmlChar * out; /* pointer to an array of xmlChar */
15589 int n_out;
15590 int val; /* the char value */
15591 int n_val;
15592
15593 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15594 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15595 mem_base = xmlMemBlocks();
15596 out = gen_xmlChar_ptr(n_out, 0);
15597 val = gen_int(n_val, 1);
15598
15599 ret_val = xmlCopyCharMultiByte(out, val);
15600 desret_int(ret_val);
15601 call_tests++;
15602 des_xmlChar_ptr(n_out, out, 0);
15603 des_int(n_val, val, 1);
15604 xmlResetLastError();
15605 if (mem_base != xmlMemBlocks()) {
15606 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15607 xmlMemBlocks() - mem_base);
15608 test_ret++;
15609 printf(" %d", n_out);
15610 printf(" %d", n_val);
15611 printf("\n");
15612 }
15613 }
15614 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015616
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015617 return(test_ret);
15618}
15619
15620
15621static int
15622test_xmlCreateEntityParserCtxt(void) {
15623 int test_ret = 0;
15624
15625 int mem_base;
15626 xmlParserCtxtPtr ret_val;
15627 xmlChar * URL; /* the entity URL */
15628 int n_URL;
15629 xmlChar * ID; /* the entity PUBLIC ID */
15630 int n_ID;
15631 xmlChar * base; /* a possible base for the target URI */
15632 int n_base;
15633
15634 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15635 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15636 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15637 mem_base = xmlMemBlocks();
15638 URL = gen_const_xmlChar_ptr(n_URL, 0);
15639 ID = gen_const_xmlChar_ptr(n_ID, 1);
15640 base = gen_const_xmlChar_ptr(n_base, 2);
15641
William M. Brackf13f77f2004-11-12 16:03:48 +000015642 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015643 desret_xmlParserCtxtPtr(ret_val);
15644 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015645 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15646 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15647 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015648 xmlResetLastError();
15649 if (mem_base != xmlMemBlocks()) {
15650 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15651 xmlMemBlocks() - mem_base);
15652 test_ret++;
15653 printf(" %d", n_URL);
15654 printf(" %d", n_ID);
15655 printf(" %d", n_base);
15656 printf("\n");
15657 }
15658 }
15659 }
15660 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015662
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015663 return(test_ret);
15664}
15665
15666
15667static int
15668test_xmlCreateFileParserCtxt(void) {
15669 int test_ret = 0;
15670
15671 int mem_base;
15672 xmlParserCtxtPtr ret_val;
15673 const char * filename; /* the filename */
15674 int n_filename;
15675
15676 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15677 mem_base = xmlMemBlocks();
15678 filename = gen_fileoutput(n_filename, 0);
15679
15680 ret_val = xmlCreateFileParserCtxt(filename);
15681 desret_xmlParserCtxtPtr(ret_val);
15682 call_tests++;
15683 des_fileoutput(n_filename, filename, 0);
15684 xmlResetLastError();
15685 if (mem_base != xmlMemBlocks()) {
15686 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15687 xmlMemBlocks() - mem_base);
15688 test_ret++;
15689 printf(" %d", n_filename);
15690 printf("\n");
15691 }
15692 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015693 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015694
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015695 return(test_ret);
15696}
15697
15698
15699static int
15700test_xmlCreateMemoryParserCtxt(void) {
15701 int test_ret = 0;
15702
15703 int mem_base;
15704 xmlParserCtxtPtr ret_val;
15705 char * buffer; /* a pointer to a char array */
15706 int n_buffer;
15707 int size; /* the size of the array */
15708 int n_size;
15709
15710 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15711 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15712 mem_base = xmlMemBlocks();
15713 buffer = gen_const_char_ptr(n_buffer, 0);
15714 size = gen_int(n_size, 1);
15715
William M. Brackf13f77f2004-11-12 16:03:48 +000015716 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015717 desret_xmlParserCtxtPtr(ret_val);
15718 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015719 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015720 des_int(n_size, size, 1);
15721 xmlResetLastError();
15722 if (mem_base != xmlMemBlocks()) {
15723 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15724 xmlMemBlocks() - mem_base);
15725 test_ret++;
15726 printf(" %d", n_buffer);
15727 printf(" %d", n_size);
15728 printf("\n");
15729 }
15730 }
15731 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015733
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015734 return(test_ret);
15735}
15736
15737
15738static int
15739test_xmlCreateURLParserCtxt(void) {
15740 int test_ret = 0;
15741
15742 int mem_base;
15743 xmlParserCtxtPtr ret_val;
15744 const char * filename; /* the filename or URL */
15745 int n_filename;
15746 int options; /* a combination of xmlParserOption */
15747 int n_options;
15748
15749 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15750 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15751 mem_base = xmlMemBlocks();
15752 filename = gen_fileoutput(n_filename, 0);
15753 options = gen_int(n_options, 1);
15754
15755 ret_val = xmlCreateURLParserCtxt(filename, options);
15756 desret_xmlParserCtxtPtr(ret_val);
15757 call_tests++;
15758 des_fileoutput(n_filename, filename, 0);
15759 des_int(n_options, options, 1);
15760 xmlResetLastError();
15761 if (mem_base != xmlMemBlocks()) {
15762 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15763 xmlMemBlocks() - mem_base);
15764 test_ret++;
15765 printf(" %d", n_filename);
15766 printf(" %d", n_options);
15767 printf("\n");
15768 }
15769 }
15770 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015772
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015773 return(test_ret);
15774}
15775
15776
15777static int
15778test_xmlCurrentChar(void) {
15779 int test_ret = 0;
15780
15781 int mem_base;
15782 int ret_val;
15783 xmlParserCtxtPtr ctxt; /* the XML parser context */
15784 int n_ctxt;
15785 int * len; /* pointer to the length of the char read */
15786 int n_len;
15787
15788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15789 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15790 mem_base = xmlMemBlocks();
15791 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15792 len = gen_int_ptr(n_len, 1);
15793
15794 ret_val = xmlCurrentChar(ctxt, len);
15795 desret_int(ret_val);
15796 call_tests++;
15797 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15798 des_int_ptr(n_len, len, 1);
15799 xmlResetLastError();
15800 if (mem_base != xmlMemBlocks()) {
15801 printf("Leak of %d blocks found in xmlCurrentChar",
15802 xmlMemBlocks() - mem_base);
15803 test_ret++;
15804 printf(" %d", n_ctxt);
15805 printf(" %d", n_len);
15806 printf("\n");
15807 }
15808 }
15809 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015811
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015812 return(test_ret);
15813}
15814
15815
15816static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015817test_xmlErrMemory(void) {
15818 int test_ret = 0;
15819
15820 int mem_base;
15821 xmlParserCtxtPtr ctxt; /* an XML parser context */
15822 int n_ctxt;
15823 char * extra; /* extra informations */
15824 int n_extra;
15825
15826 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15827 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15828 mem_base = xmlMemBlocks();
15829 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15830 extra = gen_const_char_ptr(n_extra, 1);
15831
William M. Brackf13f77f2004-11-12 16:03:48 +000015832 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015833 call_tests++;
15834 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015835 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015836 xmlResetLastError();
15837 if (mem_base != xmlMemBlocks()) {
15838 printf("Leak of %d blocks found in xmlErrMemory",
15839 xmlMemBlocks() - mem_base);
15840 test_ret++;
15841 printf(" %d", n_ctxt);
15842 printf(" %d", n_extra);
15843 printf("\n");
15844 }
15845 }
15846 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015847 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015848
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015849 return(test_ret);
15850}
15851
15852
15853static int
15854test_xmlIsLetter(void) {
15855 int test_ret = 0;
15856
15857 int mem_base;
15858 int ret_val;
15859 int c; /* an unicode character (int) */
15860 int n_c;
15861
15862 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15863 mem_base = xmlMemBlocks();
15864 c = gen_int(n_c, 0);
15865
15866 ret_val = xmlIsLetter(c);
15867 desret_int(ret_val);
15868 call_tests++;
15869 des_int(n_c, c, 0);
15870 xmlResetLastError();
15871 if (mem_base != xmlMemBlocks()) {
15872 printf("Leak of %d blocks found in xmlIsLetter",
15873 xmlMemBlocks() - mem_base);
15874 test_ret++;
15875 printf(" %d", n_c);
15876 printf("\n");
15877 }
15878 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015879 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015880
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015881 return(test_ret);
15882}
15883
15884
15885static int
15886test_xmlNewEntityInputStream(void) {
15887 int test_ret = 0;
15888
15889 int mem_base;
15890 xmlParserInputPtr ret_val;
15891 xmlParserCtxtPtr ctxt; /* an XML parser context */
15892 int n_ctxt;
15893 xmlEntityPtr entity; /* an Entity pointer */
15894 int n_entity;
15895
15896 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15897 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15898 mem_base = xmlMemBlocks();
15899 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15900 entity = gen_xmlEntityPtr(n_entity, 1);
15901
15902 ret_val = xmlNewEntityInputStream(ctxt, entity);
15903 desret_xmlParserInputPtr(ret_val);
15904 call_tests++;
15905 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15906 des_xmlEntityPtr(n_entity, entity, 1);
15907 xmlResetLastError();
15908 if (mem_base != xmlMemBlocks()) {
15909 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15910 xmlMemBlocks() - mem_base);
15911 test_ret++;
15912 printf(" %d", n_ctxt);
15913 printf(" %d", n_entity);
15914 printf("\n");
15915 }
15916 }
15917 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015919
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015920 return(test_ret);
15921}
15922
15923
15924static int
15925test_xmlNewInputFromFile(void) {
15926 int test_ret = 0;
15927
15928 int mem_base;
15929 xmlParserInputPtr ret_val;
15930 xmlParserCtxtPtr ctxt; /* an XML parser context */
15931 int n_ctxt;
15932 const char * filename; /* the filename to use as entity */
15933 int n_filename;
15934
15935 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15936 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15937 mem_base = xmlMemBlocks();
15938 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15939 filename = gen_filepath(n_filename, 1);
15940
15941 ret_val = xmlNewInputFromFile(ctxt, filename);
15942 desret_xmlParserInputPtr(ret_val);
15943 call_tests++;
15944 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15945 des_filepath(n_filename, filename, 1);
15946 xmlResetLastError();
15947 if (mem_base != xmlMemBlocks()) {
15948 printf("Leak of %d blocks found in xmlNewInputFromFile",
15949 xmlMemBlocks() - mem_base);
15950 test_ret++;
15951 printf(" %d", n_ctxt);
15952 printf(" %d", n_filename);
15953 printf("\n");
15954 }
15955 }
15956 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015958
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015959 return(test_ret);
15960}
15961
15962
15963static int
15964test_xmlNewInputStream(void) {
15965 int test_ret = 0;
15966
15967 int mem_base;
15968 xmlParserInputPtr ret_val;
15969 xmlParserCtxtPtr ctxt; /* an XML parser context */
15970 int n_ctxt;
15971
15972 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15973 mem_base = xmlMemBlocks();
15974 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15975
15976 ret_val = xmlNewInputStream(ctxt);
15977 desret_xmlParserInputPtr(ret_val);
15978 call_tests++;
15979 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15980 xmlResetLastError();
15981 if (mem_base != xmlMemBlocks()) {
15982 printf("Leak of %d blocks found in xmlNewInputStream",
15983 xmlMemBlocks() - mem_base);
15984 test_ret++;
15985 printf(" %d", n_ctxt);
15986 printf("\n");
15987 }
15988 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015989 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015990
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015991 return(test_ret);
15992}
15993
15994
15995static int
15996test_xmlNewStringInputStream(void) {
15997 int test_ret = 0;
15998
15999 int mem_base;
16000 xmlParserInputPtr ret_val;
16001 xmlParserCtxtPtr ctxt; /* an XML parser context */
16002 int n_ctxt;
16003 xmlChar * buffer; /* an memory buffer */
16004 int n_buffer;
16005
16006 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16007 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16008 mem_base = xmlMemBlocks();
16009 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16010 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16011
William M. Brackf13f77f2004-11-12 16:03:48 +000016012 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016013 desret_xmlParserInputPtr(ret_val);
16014 call_tests++;
16015 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016016 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016017 xmlResetLastError();
16018 if (mem_base != xmlMemBlocks()) {
16019 printf("Leak of %d blocks found in xmlNewStringInputStream",
16020 xmlMemBlocks() - mem_base);
16021 test_ret++;
16022 printf(" %d", n_ctxt);
16023 printf(" %d", n_buffer);
16024 printf("\n");
16025 }
16026 }
16027 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016029
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016030 return(test_ret);
16031}
16032
16033
16034static int
16035test_xmlNextChar(void) {
16036 int test_ret = 0;
16037
16038 int mem_base;
16039 xmlParserCtxtPtr ctxt; /* the XML parser context */
16040 int n_ctxt;
16041
16042 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16043 mem_base = xmlMemBlocks();
16044 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16045
16046 xmlNextChar(ctxt);
16047 call_tests++;
16048 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16049 xmlResetLastError();
16050 if (mem_base != xmlMemBlocks()) {
16051 printf("Leak of %d blocks found in xmlNextChar",
16052 xmlMemBlocks() - mem_base);
16053 test_ret++;
16054 printf(" %d", n_ctxt);
16055 printf("\n");
16056 }
16057 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016058 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016059
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016060 return(test_ret);
16061}
16062
16063
16064static int
16065test_xmlParserInputShrink(void) {
16066 int test_ret = 0;
16067
16068 int mem_base;
16069 xmlParserInputPtr in; /* an XML parser input */
16070 int n_in;
16071
16072 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16073 mem_base = xmlMemBlocks();
16074 in = gen_xmlParserInputPtr(n_in, 0);
16075
16076 xmlParserInputShrink(in);
16077 call_tests++;
16078 des_xmlParserInputPtr(n_in, in, 0);
16079 xmlResetLastError();
16080 if (mem_base != xmlMemBlocks()) {
16081 printf("Leak of %d blocks found in xmlParserInputShrink",
16082 xmlMemBlocks() - mem_base);
16083 test_ret++;
16084 printf(" %d", n_in);
16085 printf("\n");
16086 }
16087 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016088 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016089
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016090 return(test_ret);
16091}
16092
16093
16094static int
16095test_xmlPopInput(void) {
16096 int test_ret = 0;
16097
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016098 int mem_base;
16099 xmlChar ret_val;
16100 xmlParserCtxtPtr ctxt; /* an XML parser context */
16101 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016102
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016103 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16104 mem_base = xmlMemBlocks();
16105 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16106
16107 ret_val = xmlPopInput(ctxt);
16108 desret_xmlChar(ret_val);
16109 call_tests++;
16110 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16111 xmlResetLastError();
16112 if (mem_base != xmlMemBlocks()) {
16113 printf("Leak of %d blocks found in xmlPopInput",
16114 xmlMemBlocks() - mem_base);
16115 test_ret++;
16116 printf(" %d", n_ctxt);
16117 printf("\n");
16118 }
16119 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016121
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016122 return(test_ret);
16123}
16124
16125
16126static int
16127test_xmlPushInput(void) {
16128 int test_ret = 0;
16129
16130 int mem_base;
16131 xmlParserCtxtPtr ctxt; /* an XML parser context */
16132 int n_ctxt;
16133 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16134 int n_input;
16135
16136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16137 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16138 mem_base = xmlMemBlocks();
16139 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16140 input = gen_xmlParserInputPtr(n_input, 1);
16141
16142 xmlPushInput(ctxt, input);
16143 call_tests++;
16144 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16145 des_xmlParserInputPtr(n_input, input, 1);
16146 xmlResetLastError();
16147 if (mem_base != xmlMemBlocks()) {
16148 printf("Leak of %d blocks found in xmlPushInput",
16149 xmlMemBlocks() - mem_base);
16150 test_ret++;
16151 printf(" %d", n_ctxt);
16152 printf(" %d", n_input);
16153 printf("\n");
16154 }
16155 }
16156 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016158
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016159 return(test_ret);
16160}
16161
16162
16163static int
16164test_xmlSetEntityReferenceFunc(void) {
16165 int test_ret = 0;
16166
16167
16168 /* missing type support */
16169 return(test_ret);
16170}
16171
16172
16173static int
16174test_xmlSplitQName(void) {
16175 int test_ret = 0;
16176
16177 int mem_base;
16178 xmlChar * ret_val;
16179 xmlParserCtxtPtr ctxt; /* an XML parser context */
16180 int n_ctxt;
16181 xmlChar * name; /* an XML parser context */
16182 int n_name;
16183 xmlChar ** prefix; /* a xmlChar ** */
16184 int n_prefix;
16185
16186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16187 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16188 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16189 mem_base = xmlMemBlocks();
16190 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16191 name = gen_const_xmlChar_ptr(n_name, 1);
16192 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16193
William M. Brackf13f77f2004-11-12 16:03:48 +000016194 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016195 desret_xmlChar_ptr(ret_val);
16196 call_tests++;
16197 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016199 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16200 xmlResetLastError();
16201 if (mem_base != xmlMemBlocks()) {
16202 printf("Leak of %d blocks found in xmlSplitQName",
16203 xmlMemBlocks() - mem_base);
16204 test_ret++;
16205 printf(" %d", n_ctxt);
16206 printf(" %d", n_name);
16207 printf(" %d", n_prefix);
16208 printf("\n");
16209 }
16210 }
16211 }
16212 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016214
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016215 return(test_ret);
16216}
16217
16218
16219static int
16220test_xmlStringCurrentChar(void) {
16221 int test_ret = 0;
16222
16223 int mem_base;
16224 int ret_val;
16225 xmlParserCtxtPtr ctxt; /* the XML parser context */
16226 int n_ctxt;
16227 xmlChar * cur; /* pointer to the beginning of the char */
16228 int n_cur;
16229 int * len; /* pointer to the length of the char read */
16230 int n_len;
16231
16232 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16233 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16234 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16235 mem_base = xmlMemBlocks();
16236 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16237 cur = gen_const_xmlChar_ptr(n_cur, 1);
16238 len = gen_int_ptr(n_len, 2);
16239
William M. Brackf13f77f2004-11-12 16:03:48 +000016240 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016241 desret_int(ret_val);
16242 call_tests++;
16243 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016244 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016245 des_int_ptr(n_len, len, 2);
16246 xmlResetLastError();
16247 if (mem_base != xmlMemBlocks()) {
16248 printf("Leak of %d blocks found in xmlStringCurrentChar",
16249 xmlMemBlocks() - mem_base);
16250 test_ret++;
16251 printf(" %d", n_ctxt);
16252 printf(" %d", n_cur);
16253 printf(" %d", n_len);
16254 printf("\n");
16255 }
16256 }
16257 }
16258 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016259 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016260
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016261 return(test_ret);
16262}
16263
16264
16265static int
16266test_xmlStringDecodeEntities(void) {
16267 int test_ret = 0;
16268
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016269 int mem_base;
16270 xmlChar * ret_val;
16271 xmlParserCtxtPtr ctxt; /* the parser context */
16272 int n_ctxt;
16273 xmlChar * str; /* the input string */
16274 int n_str;
16275 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16276 int n_what;
16277 xmlChar end; /* an end marker xmlChar, 0 if none */
16278 int n_end;
16279 xmlChar end2; /* an end marker xmlChar, 0 if none */
16280 int n_end2;
16281 xmlChar end3; /* an end marker xmlChar, 0 if none */
16282 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016283
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16285 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16286 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16287 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16288 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16289 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16290 mem_base = xmlMemBlocks();
16291 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16292 str = gen_const_xmlChar_ptr(n_str, 1);
16293 what = gen_int(n_what, 2);
16294 end = gen_xmlChar(n_end, 3);
16295 end2 = gen_xmlChar(n_end2, 4);
16296 end3 = gen_xmlChar(n_end3, 5);
16297
William M. Brackf13f77f2004-11-12 16:03:48 +000016298 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016299 desret_xmlChar_ptr(ret_val);
16300 call_tests++;
16301 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016302 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016303 des_int(n_what, what, 2);
16304 des_xmlChar(n_end, end, 3);
16305 des_xmlChar(n_end2, end2, 4);
16306 des_xmlChar(n_end3, end3, 5);
16307 xmlResetLastError();
16308 if (mem_base != xmlMemBlocks()) {
16309 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16310 xmlMemBlocks() - mem_base);
16311 test_ret++;
16312 printf(" %d", n_ctxt);
16313 printf(" %d", n_str);
16314 printf(" %d", n_what);
16315 printf(" %d", n_end);
16316 printf(" %d", n_end2);
16317 printf(" %d", n_end3);
16318 printf("\n");
16319 }
16320 }
16321 }
16322 }
16323 }
16324 }
16325 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016326 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016327
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016328 return(test_ret);
16329}
16330
16331
16332static int
16333test_xmlStringLenDecodeEntities(void) {
16334 int test_ret = 0;
16335
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016336 int mem_base;
16337 xmlChar * ret_val;
16338 xmlParserCtxtPtr ctxt; /* the parser context */
16339 int n_ctxt;
16340 xmlChar * str; /* the input string */
16341 int n_str;
16342 int len; /* the string length */
16343 int n_len;
16344 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16345 int n_what;
16346 xmlChar end; /* an end marker xmlChar, 0 if none */
16347 int n_end;
16348 xmlChar end2; /* an end marker xmlChar, 0 if none */
16349 int n_end2;
16350 xmlChar end3; /* an end marker xmlChar, 0 if none */
16351 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016352
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16354 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16355 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16356 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16357 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16358 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16359 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16360 mem_base = xmlMemBlocks();
16361 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16362 str = gen_const_xmlChar_ptr(n_str, 1);
16363 len = gen_int(n_len, 2);
16364 what = gen_int(n_what, 3);
16365 end = gen_xmlChar(n_end, 4);
16366 end2 = gen_xmlChar(n_end2, 5);
16367 end3 = gen_xmlChar(n_end3, 6);
16368
William M. Brackf13f77f2004-11-12 16:03:48 +000016369 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016370 desret_xmlChar_ptr(ret_val);
16371 call_tests++;
16372 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016373 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016374 des_int(n_len, len, 2);
16375 des_int(n_what, what, 3);
16376 des_xmlChar(n_end, end, 4);
16377 des_xmlChar(n_end2, end2, 5);
16378 des_xmlChar(n_end3, end3, 6);
16379 xmlResetLastError();
16380 if (mem_base != xmlMemBlocks()) {
16381 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16382 xmlMemBlocks() - mem_base);
16383 test_ret++;
16384 printf(" %d", n_ctxt);
16385 printf(" %d", n_str);
16386 printf(" %d", n_len);
16387 printf(" %d", n_what);
16388 printf(" %d", n_end);
16389 printf(" %d", n_end2);
16390 printf(" %d", n_end3);
16391 printf("\n");
16392 }
16393 }
16394 }
16395 }
16396 }
16397 }
16398 }
16399 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016400 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016401
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016402 return(test_ret);
16403}
16404
16405
16406static int
16407test_xmlSwitchEncoding(void) {
16408 int test_ret = 0;
16409
16410 int mem_base;
16411 int ret_val;
16412 xmlParserCtxtPtr ctxt; /* the parser context */
16413 int n_ctxt;
16414 xmlCharEncoding enc; /* the encoding value (number) */
16415 int n_enc;
16416
16417 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16418 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16419 mem_base = xmlMemBlocks();
16420 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16421 enc = gen_xmlCharEncoding(n_enc, 1);
16422
16423 ret_val = xmlSwitchEncoding(ctxt, enc);
16424 desret_int(ret_val);
16425 call_tests++;
16426 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16427 des_xmlCharEncoding(n_enc, enc, 1);
16428 xmlResetLastError();
16429 if (mem_base != xmlMemBlocks()) {
16430 printf("Leak of %d blocks found in xmlSwitchEncoding",
16431 xmlMemBlocks() - mem_base);
16432 test_ret++;
16433 printf(" %d", n_ctxt);
16434 printf(" %d", n_enc);
16435 printf("\n");
16436 }
16437 }
16438 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016440
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016441 return(test_ret);
16442}
16443
16444
16445static int
16446test_xmlSwitchInputEncoding(void) {
16447 int test_ret = 0;
16448
16449 int mem_base;
16450 int ret_val;
16451 xmlParserCtxtPtr ctxt; /* the parser context */
16452 int n_ctxt;
16453 xmlParserInputPtr input; /* the input stream */
16454 int n_input;
16455 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16456 int n_handler;
16457
16458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16459 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16460 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16461 mem_base = xmlMemBlocks();
16462 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16463 input = gen_xmlParserInputPtr(n_input, 1);
16464 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16465
16466 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16467 desret_int(ret_val);
16468 call_tests++;
16469 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16470 des_xmlParserInputPtr(n_input, input, 1);
16471 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16472 xmlResetLastError();
16473 if (mem_base != xmlMemBlocks()) {
16474 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16475 xmlMemBlocks() - mem_base);
16476 test_ret++;
16477 printf(" %d", n_ctxt);
16478 printf(" %d", n_input);
16479 printf(" %d", n_handler);
16480 printf("\n");
16481 }
16482 }
16483 }
16484 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016486
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016487 return(test_ret);
16488}
16489
16490
16491static int
16492test_xmlSwitchToEncoding(void) {
16493 int test_ret = 0;
16494
16495 int mem_base;
16496 int ret_val;
16497 xmlParserCtxtPtr ctxt; /* the parser context */
16498 int n_ctxt;
16499 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16500 int n_handler;
16501
16502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16503 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16504 mem_base = xmlMemBlocks();
16505 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16506 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16507
16508 ret_val = xmlSwitchToEncoding(ctxt, handler);
16509 desret_int(ret_val);
16510 call_tests++;
16511 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16512 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16513 xmlResetLastError();
16514 if (mem_base != xmlMemBlocks()) {
16515 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16516 xmlMemBlocks() - mem_base);
16517 test_ret++;
16518 printf(" %d", n_ctxt);
16519 printf(" %d", n_handler);
16520 printf("\n");
16521 }
16522 }
16523 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016525
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016526 return(test_ret);
16527}
16528
16529static int
16530test_parserInternals(void) {
16531 int test_ret = 0;
16532
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016533 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016534 test_ret += test_htmlCreateFileParserCtxt();
16535 test_ret += test_htmlInitAutoClose();
16536 test_ret += test_inputPop();
16537 test_ret += test_inputPush();
16538 test_ret += test_namePop();
16539 test_ret += test_namePush();
16540 test_ret += test_nodePop();
16541 test_ret += test_nodePush();
16542 test_ret += test_xmlCheckLanguageID();
16543 test_ret += test_xmlCopyChar();
16544 test_ret += test_xmlCopyCharMultiByte();
16545 test_ret += test_xmlCreateEntityParserCtxt();
16546 test_ret += test_xmlCreateFileParserCtxt();
16547 test_ret += test_xmlCreateMemoryParserCtxt();
16548 test_ret += test_xmlCreateURLParserCtxt();
16549 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016550 test_ret += test_xmlErrMemory();
16551 test_ret += test_xmlIsLetter();
16552 test_ret += test_xmlNewEntityInputStream();
16553 test_ret += test_xmlNewInputFromFile();
16554 test_ret += test_xmlNewInputStream();
16555 test_ret += test_xmlNewStringInputStream();
16556 test_ret += test_xmlNextChar();
16557 test_ret += test_xmlParserInputShrink();
16558 test_ret += test_xmlPopInput();
16559 test_ret += test_xmlPushInput();
16560 test_ret += test_xmlSetEntityReferenceFunc();
16561 test_ret += test_xmlSplitQName();
16562 test_ret += test_xmlStringCurrentChar();
16563 test_ret += test_xmlStringDecodeEntities();
16564 test_ret += test_xmlStringLenDecodeEntities();
16565 test_ret += test_xmlSwitchEncoding();
16566 test_ret += test_xmlSwitchInputEncoding();
16567 test_ret += test_xmlSwitchToEncoding();
16568
16569 if (test_ret != 0)
16570 printf("Module parserInternals: %d errors\n", test_ret);
16571 return(test_ret);
16572}
16573
Daniel Veillardd93f6252004-11-02 15:53:51 +000016574static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016575test_xmlPatternFromRoot(void) {
16576 int test_ret = 0;
16577
16578#if defined(LIBXML_PATTERN_ENABLED)
16579 int mem_base;
16580 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016581 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016582 int n_comp;
16583
16584 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16585 mem_base = xmlMemBlocks();
16586 comp = gen_xmlPatternPtr(n_comp, 0);
16587
16588 ret_val = xmlPatternFromRoot(comp);
16589 desret_int(ret_val);
16590 call_tests++;
16591 des_xmlPatternPtr(n_comp, comp, 0);
16592 xmlResetLastError();
16593 if (mem_base != xmlMemBlocks()) {
16594 printf("Leak of %d blocks found in xmlPatternFromRoot",
16595 xmlMemBlocks() - mem_base);
16596 test_ret++;
16597 printf(" %d", n_comp);
16598 printf("\n");
16599 }
16600 }
16601 function_tests++;
16602#endif
16603
16604 return(test_ret);
16605}
16606
16607
16608static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016609test_xmlPatternGetStreamCtxt(void) {
16610 int test_ret = 0;
16611
16612
16613 /* missing type support */
16614 return(test_ret);
16615}
16616
16617
16618static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016619test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016621
William M. Brack21e4ef22005-01-02 09:53:13 +000016622#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016623 int mem_base;
16624 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016625 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016626 int n_comp;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016627 xmlNodePtr node; /* a node */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016628 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016629
Daniel Veillardce682bc2004-11-05 17:22:25 +000016630 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16631 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16632 mem_base = xmlMemBlocks();
16633 comp = gen_xmlPatternPtr(n_comp, 0);
16634 node = gen_xmlNodePtr(n_node, 1);
16635
16636 ret_val = xmlPatternMatch(comp, node);
16637 desret_int(ret_val);
16638 call_tests++;
16639 des_xmlPatternPtr(n_comp, comp, 0);
16640 des_xmlNodePtr(n_node, node, 1);
16641 xmlResetLastError();
16642 if (mem_base != xmlMemBlocks()) {
16643 printf("Leak of %d blocks found in xmlPatternMatch",
16644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016646 printf(" %d", n_comp);
16647 printf(" %d", n_node);
16648 printf("\n");
16649 }
16650 }
16651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016653#endif
16654
Daniel Veillard42595322004-11-08 10:52:06 +000016655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016656}
16657
16658
16659static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016660test_xmlPatternMaxDepth(void) {
16661 int test_ret = 0;
16662
16663#if defined(LIBXML_PATTERN_ENABLED)
16664 int mem_base;
16665 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016666 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016667 int n_comp;
16668
16669 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16670 mem_base = xmlMemBlocks();
16671 comp = gen_xmlPatternPtr(n_comp, 0);
16672
16673 ret_val = xmlPatternMaxDepth(comp);
16674 desret_int(ret_val);
16675 call_tests++;
16676 des_xmlPatternPtr(n_comp, comp, 0);
16677 xmlResetLastError();
16678 if (mem_base != xmlMemBlocks()) {
16679 printf("Leak of %d blocks found in xmlPatternMaxDepth",
16680 xmlMemBlocks() - mem_base);
16681 test_ret++;
16682 printf(" %d", n_comp);
16683 printf("\n");
16684 }
16685 }
16686 function_tests++;
16687#endif
16688
16689 return(test_ret);
16690}
16691
16692
16693static int
16694test_xmlPatternStreamable(void) {
16695 int test_ret = 0;
16696
16697#if defined(LIBXML_PATTERN_ENABLED)
16698 int mem_base;
16699 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016700 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016701 int n_comp;
16702
16703 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16704 mem_base = xmlMemBlocks();
16705 comp = gen_xmlPatternPtr(n_comp, 0);
16706
16707 ret_val = xmlPatternStreamable(comp);
16708 desret_int(ret_val);
16709 call_tests++;
16710 des_xmlPatternPtr(n_comp, comp, 0);
16711 xmlResetLastError();
16712 if (mem_base != xmlMemBlocks()) {
16713 printf("Leak of %d blocks found in xmlPatternStreamable",
16714 xmlMemBlocks() - mem_base);
16715 test_ret++;
16716 printf(" %d", n_comp);
16717 printf("\n");
16718 }
16719 }
16720 function_tests++;
16721#endif
16722
16723 return(test_ret);
16724}
16725
16726
16727static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016728test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016730
16731
16732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016734}
16735
William M. Brackba1d3172005-03-25 03:05:46 +000016736#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016737
16738#define gen_nb_xmlStreamCtxtPtr 1
16739static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16740 return(NULL);
16741}
16742static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16743}
William M. Brackba1d3172005-03-25 03:05:46 +000016744#endif
16745
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016746
16747static int
16748test_xmlStreamPop(void) {
16749 int test_ret = 0;
16750
16751#if defined(LIBXML_PATTERN_ENABLED)
16752 int mem_base;
16753 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016754 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016755 int n_stream;
16756
16757 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16758 mem_base = xmlMemBlocks();
16759 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16760
16761 ret_val = xmlStreamPop(stream);
16762 desret_int(ret_val);
16763 call_tests++;
16764 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16765 xmlResetLastError();
16766 if (mem_base != xmlMemBlocks()) {
16767 printf("Leak of %d blocks found in xmlStreamPop",
16768 xmlMemBlocks() - mem_base);
16769 test_ret++;
16770 printf(" %d", n_stream);
16771 printf("\n");
16772 }
16773 }
16774 function_tests++;
16775#endif
16776
16777 return(test_ret);
16778}
16779
16780
16781static int
16782test_xmlStreamPush(void) {
16783 int test_ret = 0;
16784
16785#if defined(LIBXML_PATTERN_ENABLED)
16786 int mem_base;
16787 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016788 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016789 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016790 xmlChar * name; /* the current name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016791 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016792 xmlChar * ns; /* the namespace name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016793 int n_ns;
16794
16795 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16796 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16797 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16798 mem_base = xmlMemBlocks();
16799 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16800 name = gen_const_xmlChar_ptr(n_name, 1);
16801 ns = gen_const_xmlChar_ptr(n_ns, 2);
16802
16803 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16804 desret_int(ret_val);
16805 call_tests++;
16806 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16807 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16808 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16809 xmlResetLastError();
16810 if (mem_base != xmlMemBlocks()) {
16811 printf("Leak of %d blocks found in xmlStreamPush",
16812 xmlMemBlocks() - mem_base);
16813 test_ret++;
16814 printf(" %d", n_stream);
16815 printf(" %d", n_name);
16816 printf(" %d", n_ns);
16817 printf("\n");
16818 }
16819 }
16820 }
16821 }
16822 function_tests++;
16823#endif
16824
16825 return(test_ret);
16826}
16827
Daniel Veillardb5839c32005-02-19 18:27:14 +000016828
16829static int
16830test_xmlStreamPushAttr(void) {
16831 int test_ret = 0;
16832
16833#if defined(LIBXML_PATTERN_ENABLED)
16834 int mem_base;
16835 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016836 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016837 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016838 xmlChar * name; /* the current name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016839 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016840 xmlChar * ns; /* the namespace name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016841 int n_ns;
16842
16843 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16844 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16845 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16846 mem_base = xmlMemBlocks();
16847 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16848 name = gen_const_xmlChar_ptr(n_name, 1);
16849 ns = gen_const_xmlChar_ptr(n_ns, 2);
16850
16851 ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns);
16852 desret_int(ret_val);
16853 call_tests++;
16854 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16855 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16856 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16857 xmlResetLastError();
16858 if (mem_base != xmlMemBlocks()) {
16859 printf("Leak of %d blocks found in xmlStreamPushAttr",
16860 xmlMemBlocks() - mem_base);
16861 test_ret++;
16862 printf(" %d", n_stream);
16863 printf(" %d", n_name);
16864 printf(" %d", n_ns);
16865 printf("\n");
16866 }
16867 }
16868 }
16869 }
16870 function_tests++;
16871#endif
16872
16873 return(test_ret);
16874}
16875
Daniel Veillardd93f6252004-11-02 15:53:51 +000016876static int
16877test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016879
Daniel Veillardb5839c32005-02-19 18:27:14 +000016880 if (quiet == 0) printf("Testing pattern : 7 of 12 functions ...\n");
16881 test_ret += test_xmlPatternFromRoot();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016882 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016883 test_ret += test_xmlPatternMatch();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016884 test_ret += test_xmlPatternMaxDepth();
16885 test_ret += test_xmlPatternStreamable();
Daniel Veillard42595322004-11-08 10:52:06 +000016886 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016887 test_ret += test_xmlStreamPop();
16888 test_ret += test_xmlStreamPush();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016889 test_ret += test_xmlStreamPushAttr();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016890
Daniel Veillard42595322004-11-08 10:52:06 +000016891 if (test_ret != 0)
16892 printf("Module pattern: %d errors\n", test_ret);
16893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016894}
Daniel Veillarda521d282004-11-09 14:59:59 +000016895#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016896
Daniel Veillardce682bc2004-11-05 17:22:25 +000016897#define gen_nb_xmlRelaxNGPtr 1
16898static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16899 return(NULL);
16900}
16901static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16902}
Daniel Veillarda521d282004-11-09 14:59:59 +000016903#endif
16904
Daniel Veillardce682bc2004-11-05 17:22:25 +000016905
Daniel Veillardd93f6252004-11-02 15:53:51 +000016906static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016907test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016909
William M. Brack21e4ef22005-01-02 09:53:13 +000016910#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016911 int mem_base;
16912 FILE * output; /* the file output */
16913 int n_output;
16914 xmlRelaxNGPtr schema; /* a schema structure */
16915 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016916
Daniel Veillardce682bc2004-11-05 17:22:25 +000016917 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16918 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16919 mem_base = xmlMemBlocks();
16920 output = gen_FILE_ptr(n_output, 0);
16921 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16922
16923 xmlRelaxNGDump(output, schema);
16924 call_tests++;
16925 des_FILE_ptr(n_output, output, 0);
16926 des_xmlRelaxNGPtr(n_schema, schema, 1);
16927 xmlResetLastError();
16928 if (mem_base != xmlMemBlocks()) {
16929 printf("Leak of %d blocks found in xmlRelaxNGDump",
16930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016931 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016932 printf(" %d", n_output);
16933 printf(" %d", n_schema);
16934 printf("\n");
16935 }
16936 }
16937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016938 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016939#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016940
Daniel Veillard42595322004-11-08 10:52:06 +000016941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016942}
16943
16944
16945static int
16946test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016948
William M. Brack21e4ef22005-01-02 09:53:13 +000016949#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016950 int mem_base;
16951 FILE * output; /* the file output */
16952 int n_output;
16953 xmlRelaxNGPtr schema; /* a schema structure */
16954 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016955
Daniel Veillardce682bc2004-11-05 17:22:25 +000016956 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16957 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16958 mem_base = xmlMemBlocks();
16959 output = gen_FILE_ptr(n_output, 0);
16960 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16961
16962 xmlRelaxNGDumpTree(output, schema);
16963 call_tests++;
16964 des_FILE_ptr(n_output, output, 0);
16965 des_xmlRelaxNGPtr(n_schema, schema, 1);
16966 xmlResetLastError();
16967 if (mem_base != xmlMemBlocks()) {
16968 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016970 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016971 printf(" %d", n_output);
16972 printf(" %d", n_schema);
16973 printf("\n");
16974 }
16975 }
16976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016977 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016978#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016979
Daniel Veillard42595322004-11-08 10:52:06 +000016980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016981}
16982
Daniel Veillarda521d282004-11-09 14:59:59 +000016983#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016984
Daniel Veillardce682bc2004-11-05 17:22:25 +000016985#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16986static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16987 return(NULL);
16988}
16989static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16990}
Daniel Veillarda521d282004-11-09 14:59:59 +000016991#endif
16992
16993#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016994
16995#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16996static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16997 return(NULL);
16998}
16999static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17000}
Daniel Veillarda521d282004-11-09 14:59:59 +000017001#endif
17002
17003#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017004
17005#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17006static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17007 return(NULL);
17008}
17009static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17010}
Daniel Veillarda521d282004-11-09 14:59:59 +000017011#endif
17012
17013#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017014
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017015#define gen_nb_void_ptr_ptr 1
17016static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17017 return(NULL);
17018}
17019static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17020}
Daniel Veillarda521d282004-11-09 14:59:59 +000017021#endif
17022
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017023
Daniel Veillardd93f6252004-11-02 15:53:51 +000017024static int
17025test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017027
William M. Brack21e4ef22005-01-02 09:53:13 +000017028#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017029 int mem_base;
17030 int ret_val;
17031 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17032 int n_ctxt;
17033 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17034 int n_err;
17035 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17036 int n_warn;
17037 void ** ctx; /* contextual data for the callbacks result */
17038 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017039
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017040 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17041 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17042 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17043 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17044 mem_base = xmlMemBlocks();
17045 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17046 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17047 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17048 ctx = gen_void_ptr_ptr(n_ctx, 3);
17049
17050 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17051 desret_int(ret_val);
17052 call_tests++;
17053 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17054 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17055 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17056 des_void_ptr_ptr(n_ctx, ctx, 3);
17057 xmlResetLastError();
17058 if (mem_base != xmlMemBlocks()) {
17059 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017061 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017062 printf(" %d", n_ctxt);
17063 printf(" %d", n_err);
17064 printf(" %d", n_warn);
17065 printf(" %d", n_ctx);
17066 printf("\n");
17067 }
17068 }
17069 }
17070 }
17071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017072 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017073#endif
17074
Daniel Veillard42595322004-11-08 10:52:06 +000017075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017076}
17077
Daniel Veillarda521d282004-11-09 14:59:59 +000017078#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017079
Daniel Veillardce682bc2004-11-05 17:22:25 +000017080#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17081static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17082 return(NULL);
17083}
17084static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17085}
Daniel Veillarda521d282004-11-09 14:59:59 +000017086#endif
17087
Daniel Veillardce682bc2004-11-05 17:22:25 +000017088
Daniel Veillardd93f6252004-11-02 15:53:51 +000017089static int
17090test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017092
William M. Brack21e4ef22005-01-02 09:53:13 +000017093#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017094 int mem_base;
17095 int ret_val;
17096 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17097 int n_ctxt;
17098 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17099 int n_err;
17100 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17101 int n_warn;
17102 void ** ctx; /* the functions context result */
17103 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017104
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017105 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17106 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17107 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17108 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17109 mem_base = xmlMemBlocks();
17110 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17111 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17112 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17113 ctx = gen_void_ptr_ptr(n_ctx, 3);
17114
17115 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17116 desret_int(ret_val);
17117 call_tests++;
17118 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17119 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17120 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17121 des_void_ptr_ptr(n_ctx, ctx, 3);
17122 xmlResetLastError();
17123 if (mem_base != xmlMemBlocks()) {
17124 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017126 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017127 printf(" %d", n_ctxt);
17128 printf(" %d", n_err);
17129 printf(" %d", n_warn);
17130 printf(" %d", n_ctx);
17131 printf("\n");
17132 }
17133 }
17134 }
17135 }
17136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017137 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017138#endif
17139
Daniel Veillard42595322004-11-08 10:52:06 +000017140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017141}
17142
17143
17144static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017145test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017146 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017147
William M. Brack21e4ef22005-01-02 09:53:13 +000017148#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017149 int mem_base;
17150 int ret_val;
17151
17152 mem_base = xmlMemBlocks();
17153
17154 ret_val = xmlRelaxNGInitTypes();
17155 desret_int(ret_val);
17156 call_tests++;
17157 xmlResetLastError();
17158 if (mem_base != xmlMemBlocks()) {
17159 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017161 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017162 printf("\n");
17163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017164 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017165#endif
17166
Daniel Veillard42595322004-11-08 10:52:06 +000017167 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017168}
17169
17170
17171static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017172test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017174
William M. Brack21e4ef22005-01-02 09:53:13 +000017175#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017176 int mem_base;
17177 xmlRelaxNGParserCtxtPtr ret_val;
17178 xmlDocPtr doc; /* a preparsed document tree */
17179 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017180
Daniel Veillard42595322004-11-08 10:52:06 +000017181 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17182 mem_base = xmlMemBlocks();
17183 doc = gen_xmlDocPtr(n_doc, 0);
17184
17185 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17186 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17187 call_tests++;
17188 des_xmlDocPtr(n_doc, doc, 0);
17189 xmlResetLastError();
17190 if (mem_base != xmlMemBlocks()) {
17191 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17192 xmlMemBlocks() - mem_base);
17193 test_ret++;
17194 printf(" %d", n_doc);
17195 printf("\n");
17196 }
17197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017198 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017199#endif
17200
Daniel Veillard42595322004-11-08 10:52:06 +000017201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017202}
17203
17204
17205static int
17206test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017208
William M. Brack21e4ef22005-01-02 09:53:13 +000017209#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017210 int mem_base;
17211 xmlRelaxNGParserCtxtPtr ret_val;
17212 char * buffer; /* a pointer to a char array containing the schemas */
17213 int n_buffer;
17214 int size; /* the size of the array */
17215 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017216
Daniel Veillard42595322004-11-08 10:52:06 +000017217 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17218 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17219 mem_base = xmlMemBlocks();
17220 buffer = gen_const_char_ptr(n_buffer, 0);
17221 size = gen_int(n_size, 1);
17222
William M. Brackf13f77f2004-11-12 16:03:48 +000017223 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017224 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17225 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017226 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017227 des_int(n_size, size, 1);
17228 xmlResetLastError();
17229 if (mem_base != xmlMemBlocks()) {
17230 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17231 xmlMemBlocks() - mem_base);
17232 test_ret++;
17233 printf(" %d", n_buffer);
17234 printf(" %d", n_size);
17235 printf("\n");
17236 }
17237 }
17238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017240#endif
17241
Daniel Veillard42595322004-11-08 10:52:06 +000017242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017243}
17244
17245
17246static int
17247test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017249
William M. Brack21e4ef22005-01-02 09:53:13 +000017250#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017251 int mem_base;
17252 xmlRelaxNGParserCtxtPtr ret_val;
17253 char * URL; /* the location of the schema */
17254 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017255
Daniel Veillard42595322004-11-08 10:52:06 +000017256 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17257 mem_base = xmlMemBlocks();
17258 URL = gen_const_char_ptr(n_URL, 0);
17259
William M. Brackf13f77f2004-11-12 16:03:48 +000017260 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017261 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17262 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017263 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017264 xmlResetLastError();
17265 if (mem_base != xmlMemBlocks()) {
17266 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17267 xmlMemBlocks() - mem_base);
17268 test_ret++;
17269 printf(" %d", n_URL);
17270 printf("\n");
17271 }
17272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017273 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017274#endif
17275
Daniel Veillard42595322004-11-08 10:52:06 +000017276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017277}
17278
17279
17280static int
17281test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017283
17284
17285 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017287}
17288
17289
17290static int
17291test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017293
17294
17295 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017297}
17298
17299
17300static int
17301test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017303
17304
17305 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017307}
17308
17309
17310static int
17311test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017313
17314
17315 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017317}
17318
17319
17320static int
17321test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017323
William M. Brack21e4ef22005-01-02 09:53:13 +000017324#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017325 int mem_base;
17326 int ret_val;
17327 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17328 int n_ctxt;
17329 xmlDocPtr doc; /* a parsed document tree */
17330 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017331
Daniel Veillardce682bc2004-11-05 17:22:25 +000017332 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17333 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17334 mem_base = xmlMemBlocks();
17335 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17336 doc = gen_xmlDocPtr(n_doc, 1);
17337
17338 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17339 desret_int(ret_val);
17340 call_tests++;
17341 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17342 des_xmlDocPtr(n_doc, doc, 1);
17343 xmlResetLastError();
17344 if (mem_base != xmlMemBlocks()) {
17345 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017347 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017348 printf(" %d", n_ctxt);
17349 printf(" %d", n_doc);
17350 printf("\n");
17351 }
17352 }
17353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017354 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017355#endif
17356
Daniel Veillard42595322004-11-08 10:52:06 +000017357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017358}
17359
17360
17361static int
17362test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017364
William M. Brack21e4ef22005-01-02 09:53:13 +000017365#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017366 int mem_base;
17367 int ret_val;
17368 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17369 int n_ctxt;
17370 xmlDocPtr doc; /* a document instance */
17371 int n_doc;
17372 xmlNodePtr elem; /* an element instance */
17373 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017374
Daniel Veillardce682bc2004-11-05 17:22:25 +000017375 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17376 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17377 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17378 mem_base = xmlMemBlocks();
17379 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17380 doc = gen_xmlDocPtr(n_doc, 1);
17381 elem = gen_xmlNodePtr(n_elem, 2);
17382
17383 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17384 desret_int(ret_val);
17385 call_tests++;
17386 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17387 des_xmlDocPtr(n_doc, doc, 1);
17388 des_xmlNodePtr(n_elem, elem, 2);
17389 xmlResetLastError();
17390 if (mem_base != xmlMemBlocks()) {
17391 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017393 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017394 printf(" %d", n_ctxt);
17395 printf(" %d", n_doc);
17396 printf(" %d", n_elem);
17397 printf("\n");
17398 }
17399 }
17400 }
17401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017402 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017403#endif
17404
Daniel Veillard42595322004-11-08 10:52:06 +000017405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017406}
17407
17408
17409static int
17410test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017412
William M. Brack21e4ef22005-01-02 09:53:13 +000017413#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017414 int mem_base;
17415 int ret_val;
17416 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17417 int n_ctxt;
17418 xmlDocPtr doc; /* a document instance */
17419 int n_doc;
17420 xmlNodePtr elem; /* an element instance */
17421 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017422
Daniel Veillardce682bc2004-11-05 17:22:25 +000017423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17424 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17425 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17426 mem_base = xmlMemBlocks();
17427 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17428 doc = gen_xmlDocPtr(n_doc, 1);
17429 elem = gen_xmlNodePtr(n_elem, 2);
17430
17431 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17432 desret_int(ret_val);
17433 call_tests++;
17434 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17435 des_xmlDocPtr(n_doc, doc, 1);
17436 des_xmlNodePtr(n_elem, elem, 2);
17437 xmlResetLastError();
17438 if (mem_base != xmlMemBlocks()) {
17439 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017441 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017442 printf(" %d", n_ctxt);
17443 printf(" %d", n_doc);
17444 printf(" %d", n_elem);
17445 printf("\n");
17446 }
17447 }
17448 }
17449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017450 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017451#endif
17452
Daniel Veillard42595322004-11-08 10:52:06 +000017453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017454}
17455
17456
17457static int
17458test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017460
William M. Brack21e4ef22005-01-02 09:53:13 +000017461#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017462 int mem_base;
17463 int ret_val;
17464 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17465 int n_ctxt;
17466 xmlChar * data; /* some character data read */
17467 int n_data;
17468 int len; /* the lenght of the data */
17469 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017470
Daniel Veillardce682bc2004-11-05 17:22:25 +000017471 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17472 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17473 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17474 mem_base = xmlMemBlocks();
17475 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17476 data = gen_const_xmlChar_ptr(n_data, 1);
17477 len = gen_int(n_len, 2);
17478
William M. Brackf13f77f2004-11-12 16:03:48 +000017479 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017480 desret_int(ret_val);
17481 call_tests++;
17482 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017483 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017484 des_int(n_len, len, 2);
17485 xmlResetLastError();
17486 if (mem_base != xmlMemBlocks()) {
17487 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017489 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017490 printf(" %d", n_ctxt);
17491 printf(" %d", n_data);
17492 printf(" %d", n_len);
17493 printf("\n");
17494 }
17495 }
17496 }
17497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017498 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017499#endif
17500
Daniel Veillard42595322004-11-08 10:52:06 +000017501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017502}
17503
17504
17505static int
17506test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017508
William M. Brack21e4ef22005-01-02 09:53:13 +000017509#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017510 int mem_base;
17511 int ret_val;
17512 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17513 int n_ctxt;
17514 xmlDocPtr doc; /* a document instance */
17515 int n_doc;
17516 xmlNodePtr elem; /* an element instance */
17517 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017518
Daniel Veillardce682bc2004-11-05 17:22:25 +000017519 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17520 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17521 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17522 mem_base = xmlMemBlocks();
17523 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17524 doc = gen_xmlDocPtr(n_doc, 1);
17525 elem = gen_xmlNodePtr(n_elem, 2);
17526
17527 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17528 desret_int(ret_val);
17529 call_tests++;
17530 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17531 des_xmlDocPtr(n_doc, doc, 1);
17532 des_xmlNodePtr(n_elem, elem, 2);
17533 xmlResetLastError();
17534 if (mem_base != xmlMemBlocks()) {
17535 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017537 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017538 printf(" %d", n_ctxt);
17539 printf(" %d", n_doc);
17540 printf(" %d", n_elem);
17541 printf("\n");
17542 }
17543 }
17544 }
17545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017546 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017547#endif
17548
Daniel Veillard42595322004-11-08 10:52:06 +000017549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017550}
17551
17552
17553static int
17554test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017556
William M. Brack21e4ef22005-01-02 09:53:13 +000017557#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017558 int mem_base;
17559 int ret_val;
17560 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17561 int n_ctxt;
17562 int flags; /* a set of flags values */
17563 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017564
Daniel Veillardce682bc2004-11-05 17:22:25 +000017565 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17566 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17567 mem_base = xmlMemBlocks();
17568 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17569 flags = gen_int(n_flags, 1);
17570
17571 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17572 desret_int(ret_val);
17573 call_tests++;
17574 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17575 des_int(n_flags, flags, 1);
17576 xmlResetLastError();
17577 if (mem_base != xmlMemBlocks()) {
17578 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017580 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017581 printf(" %d", n_ctxt);
17582 printf(" %d", n_flags);
17583 printf("\n");
17584 }
17585 }
17586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017587 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017588#endif
17589
Daniel Veillard42595322004-11-08 10:52:06 +000017590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017591}
17592
17593static int
17594test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017596
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017597 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017598 test_ret += test_xmlRelaxNGDump();
17599 test_ret += test_xmlRelaxNGDumpTree();
17600 test_ret += test_xmlRelaxNGGetParserErrors();
17601 test_ret += test_xmlRelaxNGGetValidErrors();
17602 test_ret += test_xmlRelaxNGInitTypes();
17603 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17604 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17605 test_ret += test_xmlRelaxNGNewParserCtxt();
17606 test_ret += test_xmlRelaxNGNewValidCtxt();
17607 test_ret += test_xmlRelaxNGParse();
17608 test_ret += test_xmlRelaxNGSetParserErrors();
17609 test_ret += test_xmlRelaxNGSetValidErrors();
17610 test_ret += test_xmlRelaxNGValidateDoc();
17611 test_ret += test_xmlRelaxNGValidateFullElement();
17612 test_ret += test_xmlRelaxNGValidatePopElement();
17613 test_ret += test_xmlRelaxNGValidatePushCData();
17614 test_ret += test_xmlRelaxNGValidatePushElement();
17615 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616
Daniel Veillard42595322004-11-08 10:52:06 +000017617 if (test_ret != 0)
17618 printf("Module relaxng: %d errors\n", test_ret);
17619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017620}
17621static int
17622test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017624
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017625 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017626
Daniel Veillard42595322004-11-08 10:52:06 +000017627 if (test_ret != 0)
17628 printf("Module schemasInternals: %d errors\n", test_ret);
17629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017630}
17631
17632static int
17633test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017635
17636 int mem_base;
17637 xmlNodePtr ret_val;
17638 xmlNodePtr parent; /* the parent node */
17639 int n_parent;
17640 xmlNodePtr cur; /* the child node */
17641 int n_cur;
17642
Daniel Veillarda03e3652004-11-02 18:45:30 +000017643 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017644 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017646 parent = gen_xmlNodePtr(n_parent, 0);
17647 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017648
17649 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017650 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651 desret_xmlNodePtr(ret_val);
17652 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017653 des_xmlNodePtr(n_parent, parent, 0);
17654 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017655 xmlResetLastError();
17656 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017657 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017659 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017660 printf(" %d", n_parent);
17661 printf(" %d", n_cur);
17662 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017663 }
17664 }
17665 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017666 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017667
Daniel Veillard42595322004-11-08 10:52:06 +000017668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017669}
17670
17671
17672static int
17673test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017675
17676 int mem_base;
17677 xmlNodePtr ret_val;
17678 xmlNodePtr parent; /* the parent node */
17679 int n_parent;
17680 xmlNodePtr cur; /* the first node in the list */
17681 int n_cur;
17682
Daniel Veillarda03e3652004-11-02 18:45:30 +000017683 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017684 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017686 parent = gen_xmlNodePtr(n_parent, 0);
17687 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017688
17689 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017690 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017691 desret_xmlNodePtr(ret_val);
17692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017693 des_xmlNodePtr(n_parent, parent, 0);
17694 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017695 xmlResetLastError();
17696 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017697 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017699 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017700 printf(" %d", n_parent);
17701 printf(" %d", n_cur);
17702 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017703 }
17704 }
17705 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017707
Daniel Veillard42595322004-11-08 10:52:06 +000017708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017709}
17710
17711
17712static int
17713test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017715
17716 int mem_base;
17717 xmlNodePtr ret_val;
17718 xmlNodePtr cur; /* the child node */
17719 int n_cur;
17720 xmlNodePtr elem; /* the new node */
17721 int n_elem;
17722
17723 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017724 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017725 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017726 cur = gen_xmlNodePtr(n_cur, 0);
17727 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017728
17729 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017730 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017731 desret_xmlNodePtr(ret_val);
17732 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017733 des_xmlNodePtr(n_cur, cur, 0);
17734 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735 xmlResetLastError();
17736 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017737 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017739 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017740 printf(" %d", n_cur);
17741 printf(" %d", n_elem);
17742 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017743 }
17744 }
17745 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017747
Daniel Veillard42595322004-11-08 10:52:06 +000017748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017749}
17750
17751
17752static int
17753test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017755
William M. Brack21e4ef22005-01-02 09:53:13 +000017756#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017757 int mem_base;
17758 xmlNodePtr ret_val;
17759 xmlNodePtr cur; /* the child node */
17760 int n_cur;
17761 xmlNodePtr elem; /* the new node */
17762 int n_elem;
17763
17764 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017765 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017767 cur = gen_xmlNodePtr(n_cur, 0);
17768 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017769
17770 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017771 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017772 desret_xmlNodePtr(ret_val);
17773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017774 des_xmlNodePtr(n_cur, cur, 0);
17775 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017776 xmlResetLastError();
17777 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017778 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017780 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017781 printf(" %d", n_cur);
17782 printf(" %d", n_elem);
17783 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017784 }
17785 }
17786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017787 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017788#endif
17789
Daniel Veillard42595322004-11-08 10:52:06 +000017790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017791}
17792
17793
17794static int
17795test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017797
17798 int mem_base;
17799 xmlNodePtr ret_val;
17800 xmlNodePtr cur; /* the child node */
17801 int n_cur;
17802 xmlNodePtr elem; /* the new node */
17803 int n_elem;
17804
17805 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017806 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017808 cur = gen_xmlNodePtr(n_cur, 0);
17809 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017810
17811 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017812 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017813 desret_xmlNodePtr(ret_val);
17814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017815 des_xmlNodePtr(n_cur, cur, 0);
17816 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017817 xmlResetLastError();
17818 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017819 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017821 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017822 printf(" %d", n_cur);
17823 printf(" %d", n_elem);
17824 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017825 }
17826 }
17827 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017828 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017829
Daniel Veillard42595322004-11-08 10:52:06 +000017830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017831}
17832
17833
17834static int
17835test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017837
William M. Brack21e4ef22005-01-02 09:53:13 +000017838#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017839#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017840 int mem_base;
17841 xmlBufferPtr buf; /* the XML buffer output */
17842 int n_buf;
17843 xmlDocPtr doc; /* the document */
17844 int n_doc;
17845 xmlAttrPtr attr; /* the attribute node */
17846 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017847 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017848 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017849
Daniel Veillardce244ad2004-11-05 10:03:46 +000017850 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17851 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17852 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17853 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17854 mem_base = xmlMemBlocks();
17855 buf = gen_xmlBufferPtr(n_buf, 0);
17856 doc = gen_xmlDocPtr(n_doc, 1);
17857 attr = gen_xmlAttrPtr(n_attr, 2);
17858 string = gen_const_xmlChar_ptr(n_string, 3);
17859
William M. Brackf13f77f2004-11-12 16:03:48 +000017860 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017861 call_tests++;
17862 des_xmlBufferPtr(n_buf, buf, 0);
17863 des_xmlDocPtr(n_doc, doc, 1);
17864 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017865 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017866 xmlResetLastError();
17867 if (mem_base != xmlMemBlocks()) {
17868 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017870 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017871 printf(" %d", n_buf);
17872 printf(" %d", n_doc);
17873 printf(" %d", n_attr);
17874 printf(" %d", n_string);
17875 printf("\n");
17876 }
17877 }
17878 }
17879 }
17880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017881 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017882#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017883#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017884
Daniel Veillard42595322004-11-08 10:52:06 +000017885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017886}
17887
17888
17889static int
17890test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017893 int mem_base;
17894 int ret_val;
17895 xmlBufferPtr buf; /* the buffer to dump */
17896 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017897 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017898 int n_str;
17899 int len; /* the number of #xmlChar to add */
17900 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017902 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17903 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17904 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17905 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017906 buf = gen_xmlBufferPtr(n_buf, 0);
17907 str = gen_const_xmlChar_ptr(n_str, 1);
17908 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017909
William M. Brackf13f77f2004-11-12 16:03:48 +000017910 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017911 desret_int(ret_val);
17912 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017913 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017914 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017915 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017916 xmlResetLastError();
17917 if (mem_base != xmlMemBlocks()) {
17918 printf("Leak of %d blocks found in xmlBufferAdd",
17919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017920 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017921 printf(" %d", n_buf);
17922 printf(" %d", n_str);
17923 printf(" %d", n_len);
17924 printf("\n");
17925 }
17926 }
17927 }
17928 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017930
Daniel Veillard42595322004-11-08 10:52:06 +000017931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017932}
17933
17934
17935static int
17936test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017938
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017939 int mem_base;
17940 int ret_val;
17941 xmlBufferPtr buf; /* the buffer */
17942 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017943 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017944 int n_str;
17945 int len; /* the number of #xmlChar to add */
17946 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017947
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017948 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17949 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17950 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17951 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017952 buf = gen_xmlBufferPtr(n_buf, 0);
17953 str = gen_const_xmlChar_ptr(n_str, 1);
17954 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017955
William M. Brackf13f77f2004-11-12 16:03:48 +000017956 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017957 desret_int(ret_val);
17958 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017959 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017960 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017961 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017962 xmlResetLastError();
17963 if (mem_base != xmlMemBlocks()) {
17964 printf("Leak of %d blocks found in xmlBufferAddHead",
17965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017966 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017967 printf(" %d", n_buf);
17968 printf(" %d", n_str);
17969 printf(" %d", n_len);
17970 printf("\n");
17971 }
17972 }
17973 }
17974 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017975 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017976
Daniel Veillard42595322004-11-08 10:52:06 +000017977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017978}
17979
17980
17981static int
17982test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017984
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017985 int mem_base;
17986 int ret_val;
17987 xmlBufferPtr buf; /* the buffer to dump */
17988 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017989 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017990 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017991
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017992 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17993 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17994 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017995 buf = gen_xmlBufferPtr(n_buf, 0);
17996 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017997
William M. Brackf13f77f2004-11-12 16:03:48 +000017998 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017999 desret_int(ret_val);
18000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018001 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018002 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018003 xmlResetLastError();
18004 if (mem_base != xmlMemBlocks()) {
18005 printf("Leak of %d blocks found in xmlBufferCCat",
18006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018007 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018008 printf(" %d", n_buf);
18009 printf(" %d", n_str);
18010 printf("\n");
18011 }
18012 }
18013 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018015
Daniel Veillard42595322004-11-08 10:52:06 +000018016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018017}
18018
18019
18020static int
18021test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018023
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018024 int mem_base;
18025 int ret_val;
18026 xmlBufferPtr buf; /* the buffer to add to */
18027 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018028 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018029 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018030
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018031 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18032 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18033 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018034 buf = gen_xmlBufferPtr(n_buf, 0);
18035 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018036
William M. Brackf13f77f2004-11-12 16:03:48 +000018037 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018038 desret_int(ret_val);
18039 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018040 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018041 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018042 xmlResetLastError();
18043 if (mem_base != xmlMemBlocks()) {
18044 printf("Leak of %d blocks found in xmlBufferCat",
18045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018046 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018047 printf(" %d", n_buf);
18048 printf(" %d", n_str);
18049 printf("\n");
18050 }
18051 }
18052 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018054
Daniel Veillard42595322004-11-08 10:52:06 +000018055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018056}
18057
18058
Daniel Veillardce682bc2004-11-05 17:22:25 +000018059#define gen_nb_const_xmlBufferPtr 1
18060static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18061 return(NULL);
18062}
18063static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18064}
18065
Daniel Veillardd93f6252004-11-02 15:53:51 +000018066static int
18067test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018069
Daniel Veillardce682bc2004-11-05 17:22:25 +000018070 int mem_base;
18071 const xmlChar * ret_val;
18072 xmlBufferPtr buf; /* the buffer */
18073 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018074
Daniel Veillardce682bc2004-11-05 17:22:25 +000018075 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18076 mem_base = xmlMemBlocks();
18077 buf = gen_const_xmlBufferPtr(n_buf, 0);
18078
William M. Brackf13f77f2004-11-12 16:03:48 +000018079 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018080 desret_const_xmlChar_ptr(ret_val);
18081 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018082 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018083 xmlResetLastError();
18084 if (mem_base != xmlMemBlocks()) {
18085 printf("Leak of %d blocks found in xmlBufferContent",
18086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018087 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018088 printf(" %d", n_buf);
18089 printf("\n");
18090 }
18091 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018093
Daniel Veillard42595322004-11-08 10:52:06 +000018094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018095}
18096
18097
18098static int
18099test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018101
Daniel Veillard3d95c732004-11-06 22:25:14 +000018102 int mem_base;
18103 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018104
Daniel Veillard3d95c732004-11-06 22:25:14 +000018105 mem_base = xmlMemBlocks();
18106
18107 ret_val = xmlBufferCreate();
18108 desret_xmlBufferPtr(ret_val);
18109 call_tests++;
18110 xmlResetLastError();
18111 if (mem_base != xmlMemBlocks()) {
18112 printf("Leak of %d blocks found in xmlBufferCreate",
18113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018114 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018115 printf("\n");
18116 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018117 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018118
Daniel Veillard42595322004-11-08 10:52:06 +000018119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018120}
18121
18122
18123static int
18124test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018126
18127
18128 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018130}
18131
18132
18133static int
18134test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018136
18137
18138 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018140}
18141
18142
18143static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018144test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018147 int mem_base;
18148 xmlBufferPtr buf; /* the buffer */
18149 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018150
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018151 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18152 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018153 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018154
18155 xmlBufferEmpty(buf);
18156 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018157 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018158 xmlResetLastError();
18159 if (mem_base != xmlMemBlocks()) {
18160 printf("Leak of %d blocks found in xmlBufferEmpty",
18161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018162 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018163 printf(" %d", n_buf);
18164 printf("\n");
18165 }
18166 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018168
Daniel Veillard42595322004-11-08 10:52:06 +000018169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018170}
18171
18172
18173static int
18174test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018176
Daniel Veillard3d97e662004-11-04 10:49:00 +000018177 int mem_base;
18178 int ret_val;
18179 xmlBufferPtr buf; /* the buffer */
18180 int n_buf;
18181 unsigned int len; /* the minimum free size to allocate */
18182 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018183
Daniel Veillard3d97e662004-11-04 10:49:00 +000018184 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18185 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18186 mem_base = xmlMemBlocks();
18187 buf = gen_xmlBufferPtr(n_buf, 0);
18188 len = gen_unsigned_int(n_len, 1);
18189
18190 ret_val = xmlBufferGrow(buf, len);
18191 desret_int(ret_val);
18192 call_tests++;
18193 des_xmlBufferPtr(n_buf, buf, 0);
18194 des_unsigned_int(n_len, len, 1);
18195 xmlResetLastError();
18196 if (mem_base != xmlMemBlocks()) {
18197 printf("Leak of %d blocks found in xmlBufferGrow",
18198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018199 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018200 printf(" %d", n_buf);
18201 printf(" %d", n_len);
18202 printf("\n");
18203 }
18204 }
18205 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018206 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018207
Daniel Veillard42595322004-11-08 10:52:06 +000018208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018209}
18210
18211
18212static int
18213test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018215
Daniel Veillardce682bc2004-11-05 17:22:25 +000018216 int mem_base;
18217 int ret_val;
18218 xmlBufferPtr buf; /* the buffer */
18219 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018220
Daniel Veillardce682bc2004-11-05 17:22:25 +000018221 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18222 mem_base = xmlMemBlocks();
18223 buf = gen_const_xmlBufferPtr(n_buf, 0);
18224
William M. Brackf13f77f2004-11-12 16:03:48 +000018225 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018226 desret_int(ret_val);
18227 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018228 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018229 xmlResetLastError();
18230 if (mem_base != xmlMemBlocks()) {
18231 printf("Leak of %d blocks found in xmlBufferLength",
18232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018233 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018234 printf(" %d", n_buf);
18235 printf("\n");
18236 }
18237 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018238 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018239
Daniel Veillard42595322004-11-08 10:52:06 +000018240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018241}
18242
18243
18244static int
18245test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018247
Daniel Veillard3d97e662004-11-04 10:49:00 +000018248 int mem_base;
18249 int ret_val;
18250 xmlBufferPtr buf; /* the buffer to resize */
18251 int n_buf;
18252 unsigned int size; /* the desired size */
18253 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018254
Daniel Veillard3d97e662004-11-04 10:49:00 +000018255 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18256 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18257 mem_base = xmlMemBlocks();
18258 buf = gen_xmlBufferPtr(n_buf, 0);
18259 size = gen_unsigned_int(n_size, 1);
18260
18261 ret_val = xmlBufferResize(buf, size);
18262 desret_int(ret_val);
18263 call_tests++;
18264 des_xmlBufferPtr(n_buf, buf, 0);
18265 des_unsigned_int(n_size, size, 1);
18266 xmlResetLastError();
18267 if (mem_base != xmlMemBlocks()) {
18268 printf("Leak of %d blocks found in xmlBufferResize",
18269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018270 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018271 printf(" %d", n_buf);
18272 printf(" %d", n_size);
18273 printf("\n");
18274 }
18275 }
18276 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018277 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018278
Daniel Veillard42595322004-11-08 10:52:06 +000018279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018280}
18281
18282
18283static int
18284test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018286
Daniel Veillard57b25162004-11-06 14:50:18 +000018287 int mem_base;
18288 xmlBufferPtr buf; /* the buffer to tune */
18289 int n_buf;
18290 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18291 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018292
Daniel Veillard57b25162004-11-06 14:50:18 +000018293 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18294 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18295 mem_base = xmlMemBlocks();
18296 buf = gen_xmlBufferPtr(n_buf, 0);
18297 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18298
18299 xmlBufferSetAllocationScheme(buf, scheme);
18300 call_tests++;
18301 des_xmlBufferPtr(n_buf, buf, 0);
18302 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18303 xmlResetLastError();
18304 if (mem_base != xmlMemBlocks()) {
18305 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018307 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018308 printf(" %d", n_buf);
18309 printf(" %d", n_scheme);
18310 printf("\n");
18311 }
18312 }
18313 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018315
Daniel Veillard42595322004-11-08 10:52:06 +000018316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018317}
18318
18319
18320static int
18321test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018323
Daniel Veillard3d97e662004-11-04 10:49:00 +000018324 int mem_base;
18325 int ret_val;
18326 xmlBufferPtr buf; /* the buffer to dump */
18327 int n_buf;
18328 unsigned int len; /* the number of xmlChar to remove */
18329 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018330
Daniel Veillard3d97e662004-11-04 10:49:00 +000018331 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18332 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18333 mem_base = xmlMemBlocks();
18334 buf = gen_xmlBufferPtr(n_buf, 0);
18335 len = gen_unsigned_int(n_len, 1);
18336
18337 ret_val = xmlBufferShrink(buf, len);
18338 desret_int(ret_val);
18339 call_tests++;
18340 des_xmlBufferPtr(n_buf, buf, 0);
18341 des_unsigned_int(n_len, len, 1);
18342 xmlResetLastError();
18343 if (mem_base != xmlMemBlocks()) {
18344 printf("Leak of %d blocks found in xmlBufferShrink",
18345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018346 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018347 printf(" %d", n_buf);
18348 printf(" %d", n_len);
18349 printf("\n");
18350 }
18351 }
18352 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018353 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018354
Daniel Veillard42595322004-11-08 10:52:06 +000018355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018356}
18357
18358
18359static int
18360test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018362
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018363 int mem_base;
18364 xmlBufferPtr buf; /* the XML buffer */
18365 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018366 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018367 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018368
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018369 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18370 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018372 buf = gen_xmlBufferPtr(n_buf, 0);
18373 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018374
William M. Brackf13f77f2004-11-12 16:03:48 +000018375 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018377 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018378 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018379 xmlResetLastError();
18380 if (mem_base != xmlMemBlocks()) {
18381 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018383 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018384 printf(" %d", n_buf);
18385 printf(" %d", n_string);
18386 printf("\n");
18387 }
18388 }
18389 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018391
Daniel Veillard42595322004-11-08 10:52:06 +000018392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018393}
18394
18395
18396static int
18397test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018399
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018400 int mem_base;
18401 xmlBufferPtr buf; /* the XML buffer output */
18402 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018403 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018404 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018405
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018406 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18407 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018409 buf = gen_xmlBufferPtr(n_buf, 0);
18410 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018411
William M. Brackf13f77f2004-11-12 16:03:48 +000018412 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018414 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018415 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018416 xmlResetLastError();
18417 if (mem_base != xmlMemBlocks()) {
18418 printf("Leak of %d blocks found in xmlBufferWriteChar",
18419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018420 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018421 printf(" %d", n_buf);
18422 printf(" %d", n_string);
18423 printf("\n");
18424 }
18425 }
18426 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018428
Daniel Veillard42595322004-11-08 10:52:06 +000018429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018430}
18431
18432
18433static int
18434test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018436
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018437 int mem_base;
18438 xmlBufferPtr buf; /* the XML buffer output */
18439 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018440 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018441 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018442
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018443 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18444 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018446 buf = gen_xmlBufferPtr(n_buf, 0);
18447 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018448
William M. Brackf13f77f2004-11-12 16:03:48 +000018449 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018450 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018451 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018452 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018453 xmlResetLastError();
18454 if (mem_base != xmlMemBlocks()) {
18455 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018457 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018458 printf(" %d", n_buf);
18459 printf(" %d", n_string);
18460 printf("\n");
18461 }
18462 }
18463 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018464 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018465
Daniel Veillard42595322004-11-08 10:52:06 +000018466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018467}
18468
18469
18470static int
18471test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018473
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018474 int mem_base;
18475 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018476 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018477 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018478 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018479 int n_prefix;
18480 xmlChar * memory; /* preallocated memory */
18481 int n_memory;
18482 int len; /* preallocated memory length */
18483 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018484
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018485 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18486 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18487 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18488 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018490 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18491 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18492 memory = gen_xmlChar_ptr(n_memory, 2);
18493 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018494
William M. Brackf13f77f2004-11-12 16:03:48 +000018495 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018496 if ((ret_val != NULL) && (ret_val != ncname) &&
18497 (ret_val != prefix) && (ret_val != memory))
18498 xmlFree(ret_val);
18499 ret_val = NULL;
18500 desret_xmlChar_ptr(ret_val);
18501 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018502 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18503 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018504 des_xmlChar_ptr(n_memory, memory, 2);
18505 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018506 xmlResetLastError();
18507 if (mem_base != xmlMemBlocks()) {
18508 printf("Leak of %d blocks found in xmlBuildQName",
18509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018510 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018511 printf(" %d", n_ncname);
18512 printf(" %d", n_prefix);
18513 printf(" %d", n_memory);
18514 printf(" %d", n_len);
18515 printf("\n");
18516 }
18517 }
18518 }
18519 }
18520 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018522
Daniel Veillard42595322004-11-08 10:52:06 +000018523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018524}
18525
18526
18527static int
18528test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018530
William M. Brack21e4ef22005-01-02 09:53:13 +000018531#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018532 int mem_base;
18533 xmlDocPtr ret_val;
18534 xmlDocPtr doc; /* the document */
18535 int n_doc;
18536 int recursive; /* if not zero do a recursive copy. */
18537 int n_recursive;
18538
18539 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18540 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018542 doc = gen_xmlDocPtr(n_doc, 0);
18543 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018544
18545 ret_val = xmlCopyDoc(doc, recursive);
18546 desret_xmlDocPtr(ret_val);
18547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018548 des_xmlDocPtr(n_doc, doc, 0);
18549 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018550 xmlResetLastError();
18551 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018552 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018555 printf(" %d", n_doc);
18556 printf(" %d", n_recursive);
18557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018558 }
18559 }
18560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018561 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018562#endif
18563
Daniel Veillard42595322004-11-08 10:52:06 +000018564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018565}
18566
18567
18568static int
18569test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018571
William M. Brack21e4ef22005-01-02 09:53:13 +000018572#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018573 int mem_base;
18574 xmlDtdPtr ret_val;
18575 xmlDtdPtr dtd; /* the dtd */
18576 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018577
Daniel Veillard27f20102004-11-05 11:50:11 +000018578 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18579 mem_base = xmlMemBlocks();
18580 dtd = gen_xmlDtdPtr(n_dtd, 0);
18581
18582 ret_val = xmlCopyDtd(dtd);
18583 desret_xmlDtdPtr(ret_val);
18584 call_tests++;
18585 des_xmlDtdPtr(n_dtd, dtd, 0);
18586 xmlResetLastError();
18587 if (mem_base != xmlMemBlocks()) {
18588 printf("Leak of %d blocks found in xmlCopyDtd",
18589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018590 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018591 printf(" %d", n_dtd);
18592 printf("\n");
18593 }
18594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018595 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018596#endif
18597
Daniel Veillard42595322004-11-08 10:52:06 +000018598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018599}
18600
18601
18602static int
18603test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018605
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018606 int mem_base;
18607 xmlNsPtr ret_val;
18608 xmlNsPtr cur; /* the namespace */
18609 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018610
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018611 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18612 mem_base = xmlMemBlocks();
18613 cur = gen_xmlNsPtr(n_cur, 0);
18614
18615 ret_val = xmlCopyNamespace(cur);
18616 if (ret_val != NULL) xmlFreeNs(ret_val);
18617 desret_xmlNsPtr(ret_val);
18618 call_tests++;
18619 des_xmlNsPtr(n_cur, cur, 0);
18620 xmlResetLastError();
18621 if (mem_base != xmlMemBlocks()) {
18622 printf("Leak of %d blocks found in xmlCopyNamespace",
18623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018624 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018625 printf(" %d", n_cur);
18626 printf("\n");
18627 }
18628 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018629 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018630
Daniel Veillard42595322004-11-08 10:52:06 +000018631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018632}
18633
18634
18635static int
18636test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018638
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018639 int mem_base;
18640 xmlNsPtr ret_val;
18641 xmlNsPtr cur; /* the first namespace */
18642 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018643
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018644 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18645 mem_base = xmlMemBlocks();
18646 cur = gen_xmlNsPtr(n_cur, 0);
18647
18648 ret_val = xmlCopyNamespaceList(cur);
18649 if (ret_val != NULL) xmlFreeNsList(ret_val);
18650 desret_xmlNsPtr(ret_val);
18651 call_tests++;
18652 des_xmlNsPtr(n_cur, cur, 0);
18653 xmlResetLastError();
18654 if (mem_base != xmlMemBlocks()) {
18655 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018657 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018658 printf(" %d", n_cur);
18659 printf("\n");
18660 }
18661 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018662 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018663
Daniel Veillard42595322004-11-08 10:52:06 +000018664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018665}
18666
18667
18668static int
18669test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018671
Daniel Veillardce682bc2004-11-05 17:22:25 +000018672 int mem_base;
18673 xmlNodePtr ret_val;
18674 xmlNodePtr node; /* the node */
18675 int n_node;
18676 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18677 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018678
Daniel Veillardce682bc2004-11-05 17:22:25 +000018679 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18680 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18681 mem_base = xmlMemBlocks();
18682 node = gen_const_xmlNodePtr(n_node, 0);
18683 extended = gen_int(n_extended, 1);
18684
William M. Brackf13f77f2004-11-12 16:03:48 +000018685 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018686 desret_xmlNodePtr(ret_val);
18687 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018688 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018689 des_int(n_extended, extended, 1);
18690 xmlResetLastError();
18691 if (mem_base != xmlMemBlocks()) {
18692 printf("Leak of %d blocks found in xmlCopyNode",
18693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018694 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018695 printf(" %d", n_node);
18696 printf(" %d", n_extended);
18697 printf("\n");
18698 }
18699 }
18700 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018701 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018702
Daniel Veillard42595322004-11-08 10:52:06 +000018703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018704}
18705
18706
18707static int
18708test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018710
Daniel Veillardce682bc2004-11-05 17:22:25 +000018711 int mem_base;
18712 xmlNodePtr ret_val;
18713 xmlNodePtr node; /* the first node in the list. */
18714 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018715
Daniel Veillardce682bc2004-11-05 17:22:25 +000018716 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18717 mem_base = xmlMemBlocks();
18718 node = gen_const_xmlNodePtr(n_node, 0);
18719
William M. Brackf13f77f2004-11-12 16:03:48 +000018720 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018721 desret_xmlNodePtr(ret_val);
18722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018723 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018724 xmlResetLastError();
18725 if (mem_base != xmlMemBlocks()) {
18726 printf("Leak of %d blocks found in xmlCopyNodeList",
18727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018728 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018729 printf(" %d", n_node);
18730 printf("\n");
18731 }
18732 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018734
Daniel Veillard42595322004-11-08 10:52:06 +000018735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018736}
18737
18738
18739static int
18740test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018742
Daniel Veillard57b25162004-11-06 14:50:18 +000018743 int mem_base;
18744 xmlAttrPtr ret_val;
18745 xmlNodePtr target; /* the element where the attribute will be grafted */
18746 int n_target;
18747 xmlAttrPtr cur; /* the attribute */
18748 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018749
Daniel Veillard57b25162004-11-06 14:50:18 +000018750 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18751 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18752 mem_base = xmlMemBlocks();
18753 target = gen_xmlNodePtr(n_target, 0);
18754 cur = gen_xmlAttrPtr(n_cur, 1);
18755
18756 ret_val = xmlCopyProp(target, cur);
18757 desret_xmlAttrPtr(ret_val);
18758 call_tests++;
18759 des_xmlNodePtr(n_target, target, 0);
18760 des_xmlAttrPtr(n_cur, cur, 1);
18761 xmlResetLastError();
18762 if (mem_base != xmlMemBlocks()) {
18763 printf("Leak of %d blocks found in xmlCopyProp",
18764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018765 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018766 printf(" %d", n_target);
18767 printf(" %d", n_cur);
18768 printf("\n");
18769 }
18770 }
18771 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018773
Daniel Veillard42595322004-11-08 10:52:06 +000018774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018775}
18776
18777
18778static int
18779test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018781
Daniel Veillard57b25162004-11-06 14:50:18 +000018782 int mem_base;
18783 xmlAttrPtr ret_val;
18784 xmlNodePtr target; /* the element where the attributes will be grafted */
18785 int n_target;
18786 xmlAttrPtr cur; /* the first attribute */
18787 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018788
Daniel Veillard57b25162004-11-06 14:50:18 +000018789 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18790 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18791 mem_base = xmlMemBlocks();
18792 target = gen_xmlNodePtr(n_target, 0);
18793 cur = gen_xmlAttrPtr(n_cur, 1);
18794
18795 ret_val = xmlCopyPropList(target, cur);
18796 desret_xmlAttrPtr(ret_val);
18797 call_tests++;
18798 des_xmlNodePtr(n_target, target, 0);
18799 des_xmlAttrPtr(n_cur, cur, 1);
18800 xmlResetLastError();
18801 if (mem_base != xmlMemBlocks()) {
18802 printf("Leak of %d blocks found in xmlCopyPropList",
18803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018804 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018805 printf(" %d", n_target);
18806 printf(" %d", n_cur);
18807 printf("\n");
18808 }
18809 }
18810 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018812
Daniel Veillard42595322004-11-08 10:52:06 +000018813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018814}
18815
18816
18817static int
18818test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018820
Daniel Veillard34099b42004-11-04 17:34:35 +000018821 int mem_base;
18822 xmlDtdPtr ret_val;
18823 xmlDocPtr doc; /* the document pointer */
18824 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018825 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018826 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018827 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018828 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018829 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018830 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018831
Daniel Veillard34099b42004-11-04 17:34:35 +000018832 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18834 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18835 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18836 mem_base = xmlMemBlocks();
18837 doc = gen_xmlDocPtr(n_doc, 0);
18838 name = gen_const_xmlChar_ptr(n_name, 1);
18839 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18840 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18841
William M. Brackf13f77f2004-11-12 16:03:48 +000018842 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018843 desret_xmlDtdPtr(ret_val);
18844 call_tests++;
18845 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018846 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18847 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18848 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018849 xmlResetLastError();
18850 if (mem_base != xmlMemBlocks()) {
18851 printf("Leak of %d blocks found in xmlCreateIntSubset",
18852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018853 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018854 printf(" %d", n_doc);
18855 printf(" %d", n_name);
18856 printf(" %d", n_ExternalID);
18857 printf(" %d", n_SystemID);
18858 printf("\n");
18859 }
18860 }
18861 }
18862 }
18863 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018864 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018865
Daniel Veillard42595322004-11-08 10:52:06 +000018866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018867}
18868
18869
18870static int
18871test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018873
Daniel Veillardce682bc2004-11-05 17:22:25 +000018874 int mem_base;
18875 xmlNodePtr ret_val;
18876 xmlNodePtr node; /* the node */
18877 int n_node;
18878 xmlDocPtr doc; /* the document */
18879 int n_doc;
18880 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18881 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018882
Daniel Veillardce682bc2004-11-05 17:22:25 +000018883 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18884 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18885 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18886 mem_base = xmlMemBlocks();
18887 node = gen_const_xmlNodePtr(n_node, 0);
18888 doc = gen_xmlDocPtr(n_doc, 1);
18889 extended = gen_int(n_extended, 2);
18890
William M. Brackf13f77f2004-11-12 16:03:48 +000018891 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018892 desret_xmlNodePtr(ret_val);
18893 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018894 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018895 des_xmlDocPtr(n_doc, doc, 1);
18896 des_int(n_extended, extended, 2);
18897 xmlResetLastError();
18898 if (mem_base != xmlMemBlocks()) {
18899 printf("Leak of %d blocks found in xmlDocCopyNode",
18900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018901 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018902 printf(" %d", n_node);
18903 printf(" %d", n_doc);
18904 printf(" %d", n_extended);
18905 printf("\n");
18906 }
18907 }
18908 }
18909 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018910 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018911
Daniel Veillard42595322004-11-08 10:52:06 +000018912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018913}
18914
18915
18916static int
18917test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018919
Daniel Veillardce682bc2004-11-05 17:22:25 +000018920 int mem_base;
18921 xmlNodePtr ret_val;
18922 xmlDocPtr doc; /* the target document */
18923 int n_doc;
18924 xmlNodePtr node; /* the first node in the list. */
18925 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018926
Daniel Veillardce682bc2004-11-05 17:22:25 +000018927 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18928 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18929 mem_base = xmlMemBlocks();
18930 doc = gen_xmlDocPtr(n_doc, 0);
18931 node = gen_const_xmlNodePtr(n_node, 1);
18932
William M. Brackf13f77f2004-11-12 16:03:48 +000018933 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018934 desret_xmlNodePtr(ret_val);
18935 call_tests++;
18936 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018937 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018938 xmlResetLastError();
18939 if (mem_base != xmlMemBlocks()) {
18940 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018942 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018943 printf(" %d", n_doc);
18944 printf(" %d", n_node);
18945 printf("\n");
18946 }
18947 }
18948 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018950
Daniel Veillard42595322004-11-08 10:52:06 +000018951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018952}
18953
18954
18955static int
18956test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018958
William M. Brack21e4ef22005-01-02 09:53:13 +000018959#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018960 int mem_base;
18961 int ret_val;
18962 FILE * f; /* the FILE* */
18963 int n_f;
18964 xmlDocPtr cur; /* the document */
18965 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018966
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018967 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18968 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18969 mem_base = xmlMemBlocks();
18970 f = gen_FILE_ptr(n_f, 0);
18971 cur = gen_xmlDocPtr(n_cur, 1);
18972
18973 ret_val = xmlDocDump(f, cur);
18974 desret_int(ret_val);
18975 call_tests++;
18976 des_FILE_ptr(n_f, f, 0);
18977 des_xmlDocPtr(n_cur, cur, 1);
18978 xmlResetLastError();
18979 if (mem_base != xmlMemBlocks()) {
18980 printf("Leak of %d blocks found in xmlDocDump",
18981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018982 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018983 printf(" %d", n_f);
18984 printf(" %d", n_cur);
18985 printf("\n");
18986 }
18987 }
18988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018989 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018990#endif
18991
Daniel Veillard42595322004-11-08 10:52:06 +000018992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018993}
18994
18995
18996static int
18997test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018999
William M. Brack21e4ef22005-01-02 09:53:13 +000019000#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019001 int mem_base;
19002 xmlDocPtr cur; /* the document */
19003 int n_cur;
19004 xmlChar ** mem; /* OUT: the memory pointer */
19005 int n_mem;
19006 int * size; /* OUT: the memory length */
19007 int n_size;
19008 int format; /* should formatting spaces been added */
19009 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019010
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019011 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19012 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19013 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19014 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19015 mem_base = xmlMemBlocks();
19016 cur = gen_xmlDocPtr(n_cur, 0);
19017 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19018 size = gen_int_ptr(n_size, 2);
19019 format = gen_int(n_format, 3);
19020
19021 xmlDocDumpFormatMemory(cur, mem, size, format);
19022 call_tests++;
19023 des_xmlDocPtr(n_cur, cur, 0);
19024 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19025 des_int_ptr(n_size, size, 2);
19026 des_int(n_format, format, 3);
19027 xmlResetLastError();
19028 if (mem_base != xmlMemBlocks()) {
19029 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019031 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019032 printf(" %d", n_cur);
19033 printf(" %d", n_mem);
19034 printf(" %d", n_size);
19035 printf(" %d", n_format);
19036 printf("\n");
19037 }
19038 }
19039 }
19040 }
19041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019042 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019043#endif
19044
Daniel Veillard42595322004-11-08 10:52:06 +000019045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019046}
19047
19048
19049static int
19050test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019052
William M. Brack21e4ef22005-01-02 09:53:13 +000019053#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019054 int mem_base;
19055 xmlDocPtr out_doc; /* Document to generate XML text from */
19056 int n_out_doc;
19057 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19058 int n_doc_txt_ptr;
19059 int * doc_txt_len; /* Length of the generated XML text */
19060 int n_doc_txt_len;
19061 char * txt_encoding; /* Character encoding to use when generating XML text */
19062 int n_txt_encoding;
19063 int format; /* should formatting spaces been added */
19064 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019065
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019066 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19067 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19068 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19069 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19070 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19071 mem_base = xmlMemBlocks();
19072 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19073 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19074 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19075 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19076 format = gen_int(n_format, 4);
19077
William M. Brackf13f77f2004-11-12 16:03:48 +000019078 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019079 call_tests++;
19080 des_xmlDocPtr(n_out_doc, out_doc, 0);
19081 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19082 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019083 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019084 des_int(n_format, format, 4);
19085 xmlResetLastError();
19086 if (mem_base != xmlMemBlocks()) {
19087 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019089 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019090 printf(" %d", n_out_doc);
19091 printf(" %d", n_doc_txt_ptr);
19092 printf(" %d", n_doc_txt_len);
19093 printf(" %d", n_txt_encoding);
19094 printf(" %d", n_format);
19095 printf("\n");
19096 }
19097 }
19098 }
19099 }
19100 }
19101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019102 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019103#endif
19104
Daniel Veillard42595322004-11-08 10:52:06 +000019105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019106}
19107
19108
19109static int
19110test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019112
William M. Brack21e4ef22005-01-02 09:53:13 +000019113#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019114 int mem_base;
19115 xmlDocPtr cur; /* the document */
19116 int n_cur;
19117 xmlChar ** mem; /* OUT: the memory pointer */
19118 int n_mem;
19119 int * size; /* OUT: the memory length */
19120 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019121
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019122 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19123 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19124 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19125 mem_base = xmlMemBlocks();
19126 cur = gen_xmlDocPtr(n_cur, 0);
19127 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19128 size = gen_int_ptr(n_size, 2);
19129
19130 xmlDocDumpMemory(cur, mem, size);
19131 call_tests++;
19132 des_xmlDocPtr(n_cur, cur, 0);
19133 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19134 des_int_ptr(n_size, size, 2);
19135 xmlResetLastError();
19136 if (mem_base != xmlMemBlocks()) {
19137 printf("Leak of %d blocks found in xmlDocDumpMemory",
19138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019139 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019140 printf(" %d", n_cur);
19141 printf(" %d", n_mem);
19142 printf(" %d", n_size);
19143 printf("\n");
19144 }
19145 }
19146 }
19147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019148 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019149#endif
19150
Daniel Veillard42595322004-11-08 10:52:06 +000019151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019152}
19153
19154
19155static int
19156test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019158
William M. Brack21e4ef22005-01-02 09:53:13 +000019159#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019160 int mem_base;
19161 xmlDocPtr out_doc; /* Document to generate XML text from */
19162 int n_out_doc;
19163 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19164 int n_doc_txt_ptr;
19165 int * doc_txt_len; /* Length of the generated XML text */
19166 int n_doc_txt_len;
19167 char * txt_encoding; /* Character encoding to use when generating XML text */
19168 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019169
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019170 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19171 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19172 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19173 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19174 mem_base = xmlMemBlocks();
19175 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19176 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19177 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19178 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19179
William M. Brackf13f77f2004-11-12 16:03:48 +000019180 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019181 call_tests++;
19182 des_xmlDocPtr(n_out_doc, out_doc, 0);
19183 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19184 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019185 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019186 xmlResetLastError();
19187 if (mem_base != xmlMemBlocks()) {
19188 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019190 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019191 printf(" %d", n_out_doc);
19192 printf(" %d", n_doc_txt_ptr);
19193 printf(" %d", n_doc_txt_len);
19194 printf(" %d", n_txt_encoding);
19195 printf("\n");
19196 }
19197 }
19198 }
19199 }
19200 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019201 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019202#endif
19203
Daniel Veillard42595322004-11-08 10:52:06 +000019204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019205}
19206
19207
19208static int
19209test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019211
William M. Brack21e4ef22005-01-02 09:53:13 +000019212#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019213 int mem_base;
19214 int ret_val;
19215 FILE * f; /* the FILE* */
19216 int n_f;
19217 xmlDocPtr cur; /* the document */
19218 int n_cur;
19219 int format; /* should formatting spaces been added */
19220 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019221
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019222 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19223 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19224 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19225 mem_base = xmlMemBlocks();
19226 f = gen_FILE_ptr(n_f, 0);
19227 cur = gen_xmlDocPtr(n_cur, 1);
19228 format = gen_int(n_format, 2);
19229
19230 ret_val = xmlDocFormatDump(f, cur, format);
19231 desret_int(ret_val);
19232 call_tests++;
19233 des_FILE_ptr(n_f, f, 0);
19234 des_xmlDocPtr(n_cur, cur, 1);
19235 des_int(n_format, format, 2);
19236 xmlResetLastError();
19237 if (mem_base != xmlMemBlocks()) {
19238 printf("Leak of %d blocks found in xmlDocFormatDump",
19239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019240 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019241 printf(" %d", n_f);
19242 printf(" %d", n_cur);
19243 printf(" %d", n_format);
19244 printf("\n");
19245 }
19246 }
19247 }
19248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019249 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019250#endif
19251
Daniel Veillard42595322004-11-08 10:52:06 +000019252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019253}
19254
19255
19256static int
19257test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019259
19260 int mem_base;
19261 xmlNodePtr ret_val;
19262 xmlDocPtr doc; /* the document */
19263 int n_doc;
19264
19265 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19266 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019267 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019268
19269 ret_val = xmlDocGetRootElement(doc);
19270 desret_xmlNodePtr(ret_val);
19271 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019272 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019273 xmlResetLastError();
19274 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019275 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019277 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019278 printf(" %d", n_doc);
19279 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019280 }
19281 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019282 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019283
Daniel Veillard42595322004-11-08 10:52:06 +000019284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019285}
19286
19287
19288static int
19289test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019291
William M. Brack21e4ef22005-01-02 09:53:13 +000019292#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019293 int mem_base;
19294 xmlNodePtr ret_val;
19295 xmlDocPtr doc; /* the document */
19296 int n_doc;
19297 xmlNodePtr root; /* the new document root element */
19298 int n_root;
19299
19300 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019301 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019302 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019303 doc = gen_xmlDocPtr(n_doc, 0);
19304 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019305
19306 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019307 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019308 desret_xmlNodePtr(ret_val);
19309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019310 des_xmlDocPtr(n_doc, doc, 0);
19311 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019312 xmlResetLastError();
19313 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019314 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019316 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019317 printf(" %d", n_doc);
19318 printf(" %d", n_root);
19319 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019320 }
19321 }
19322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019323 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019324#endif
19325
Daniel Veillard42595322004-11-08 10:52:06 +000019326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019327}
19328
19329
19330static int
19331test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019333
William M. Brack21e4ef22005-01-02 09:53:13 +000019334#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019335 int mem_base;
19336 FILE * f; /* the FILE * for the output */
19337 int n_f;
19338 xmlDocPtr doc; /* the document */
19339 int n_doc;
19340 xmlNodePtr cur; /* the current node */
19341 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019342
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019343 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19344 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19345 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19346 mem_base = xmlMemBlocks();
19347 f = gen_FILE_ptr(n_f, 0);
19348 doc = gen_xmlDocPtr(n_doc, 1);
19349 cur = gen_xmlNodePtr(n_cur, 2);
19350
19351 xmlElemDump(f, doc, cur);
19352 call_tests++;
19353 des_FILE_ptr(n_f, f, 0);
19354 des_xmlDocPtr(n_doc, doc, 1);
19355 des_xmlNodePtr(n_cur, cur, 2);
19356 xmlResetLastError();
19357 if (mem_base != xmlMemBlocks()) {
19358 printf("Leak of %d blocks found in xmlElemDump",
19359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019360 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019361 printf(" %d", n_f);
19362 printf(" %d", n_doc);
19363 printf(" %d", n_cur);
19364 printf("\n");
19365 }
19366 }
19367 }
19368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019369 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019370#endif
19371
Daniel Veillard42595322004-11-08 10:52:06 +000019372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019373}
19374
19375
19376static int
19377test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019379
Daniel Veillard57b25162004-11-06 14:50:18 +000019380 int mem_base;
19381 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019382
Daniel Veillard57b25162004-11-06 14:50:18 +000019383 mem_base = xmlMemBlocks();
19384
19385 ret_val = xmlGetBufferAllocationScheme();
19386 desret_xmlBufferAllocationScheme(ret_val);
19387 call_tests++;
19388 xmlResetLastError();
19389 if (mem_base != xmlMemBlocks()) {
19390 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019392 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019393 printf("\n");
19394 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019396
Daniel Veillard42595322004-11-08 10:52:06 +000019397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019398}
19399
19400
19401static int
19402test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019404
19405 int mem_base;
19406 int ret_val;
19407
19408 mem_base = xmlMemBlocks();
19409
19410 ret_val = xmlGetCompressMode();
19411 desret_int(ret_val);
19412 call_tests++;
19413 xmlResetLastError();
19414 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019415 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019417 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019418 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019419 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019420 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019421
Daniel Veillard42595322004-11-08 10:52:06 +000019422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019423}
19424
19425
19426static int
19427test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019429
19430 int mem_base;
19431 int ret_val;
19432 xmlDocPtr doc; /* the document */
19433 int n_doc;
19434
19435 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19436 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019437 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019438
19439 ret_val = xmlGetDocCompressMode(doc);
19440 desret_int(ret_val);
19441 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019442 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019443 xmlResetLastError();
19444 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019445 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019447 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019448 printf(" %d", n_doc);
19449 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019450 }
19451 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019453
Daniel Veillard42595322004-11-08 10:52:06 +000019454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019455}
19456
19457
19458static int
19459test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019461
Daniel Veillard34099b42004-11-04 17:34:35 +000019462 int mem_base;
19463 xmlDtdPtr ret_val;
19464 xmlDocPtr doc; /* the document pointer */
19465 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019466
Daniel Veillard34099b42004-11-04 17:34:35 +000019467 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19468 mem_base = xmlMemBlocks();
19469 doc = gen_xmlDocPtr(n_doc, 0);
19470
19471 ret_val = xmlGetIntSubset(doc);
19472 desret_xmlDtdPtr(ret_val);
19473 call_tests++;
19474 des_xmlDocPtr(n_doc, doc, 0);
19475 xmlResetLastError();
19476 if (mem_base != xmlMemBlocks()) {
19477 printf("Leak of %d blocks found in xmlGetIntSubset",
19478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019479 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019480 printf(" %d", n_doc);
19481 printf("\n");
19482 }
19483 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019485
Daniel Veillard42595322004-11-08 10:52:06 +000019486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019487}
19488
19489
19490static int
19491test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019493
19494 int mem_base;
19495 xmlNodePtr ret_val;
19496 xmlNodePtr parent; /* the parent node */
19497 int n_parent;
19498
19499 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019501 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019502
19503 ret_val = xmlGetLastChild(parent);
19504 desret_xmlNodePtr(ret_val);
19505 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019506 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507 xmlResetLastError();
19508 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019509 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019511 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019512 printf(" %d", n_parent);
19513 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019514 }
19515 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019516 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019517
Daniel Veillard42595322004-11-08 10:52:06 +000019518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019519}
19520
19521
19522static int
19523test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019525
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019526 int mem_base;
19527 long ret_val;
19528 xmlNodePtr node; /* valid node */
19529 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019530
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019531 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19532 mem_base = xmlMemBlocks();
19533 node = gen_xmlNodePtr(n_node, 0);
19534
19535 ret_val = xmlGetLineNo(node);
19536 desret_long(ret_val);
19537 call_tests++;
19538 des_xmlNodePtr(n_node, node, 0);
19539 xmlResetLastError();
19540 if (mem_base != xmlMemBlocks()) {
19541 printf("Leak of %d blocks found in xmlGetLineNo",
19542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019543 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019544 printf(" %d", n_node);
19545 printf("\n");
19546 }
19547 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019548 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019549
Daniel Veillard42595322004-11-08 10:52:06 +000019550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019551}
19552
19553
19554static int
19555test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019557
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019558 int mem_base;
19559 xmlChar * ret_val;
19560 xmlNodePtr node; /* the node */
19561 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019562 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019563 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019564
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019565 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19566 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19567 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019568 node = gen_xmlNodePtr(n_node, 0);
19569 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019570
William M. Brackf13f77f2004-11-12 16:03:48 +000019571 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019572 desret_xmlChar_ptr(ret_val);
19573 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019574 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);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019576 xmlResetLastError();
19577 if (mem_base != xmlMemBlocks()) {
19578 printf("Leak of %d blocks found in xmlGetNoNsProp",
19579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019580 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019581 printf(" %d", n_node);
19582 printf(" %d", n_name);
19583 printf("\n");
19584 }
19585 }
19586 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019587 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019588
Daniel Veillard42595322004-11-08 10:52:06 +000019589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019590}
19591
19592
19593static int
19594test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019596
William M. Brack21e4ef22005-01-02 09:53:13 +000019597#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019598 int mem_base;
19599 xmlChar * ret_val;
19600 xmlNodePtr node; /* a node */
19601 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019602
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019603 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19604 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019605 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019606
19607 ret_val = xmlGetNodePath(node);
19608 desret_xmlChar_ptr(ret_val);
19609 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019610 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019611 xmlResetLastError();
19612 if (mem_base != xmlMemBlocks()) {
19613 printf("Leak of %d blocks found in xmlGetNodePath",
19614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019615 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019616 printf(" %d", n_node);
19617 printf("\n");
19618 }
19619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019620 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019621#endif
19622
Daniel Veillard42595322004-11-08 10:52:06 +000019623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019624}
19625
19626
19627static int
19628test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019629 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019630
19631
19632 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019634}
19635
19636
19637static int
19638test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019640
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019641 int mem_base;
19642 xmlChar * ret_val;
19643 xmlNodePtr node; /* the node */
19644 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019645 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019646 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019647 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019648 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019649
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019650 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19651 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19652 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19653 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019654 node = gen_xmlNodePtr(n_node, 0);
19655 name = gen_const_xmlChar_ptr(n_name, 1);
19656 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019657
William M. Brackf13f77f2004-11-12 16:03:48 +000019658 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019659 desret_xmlChar_ptr(ret_val);
19660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019661 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019662 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19663 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019664 xmlResetLastError();
19665 if (mem_base != xmlMemBlocks()) {
19666 printf("Leak of %d blocks found in xmlGetNsProp",
19667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019668 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019669 printf(" %d", n_node);
19670 printf(" %d", n_name);
19671 printf(" %d", n_nameSpace);
19672 printf("\n");
19673 }
19674 }
19675 }
19676 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019677 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019678
Daniel Veillard42595322004-11-08 10:52:06 +000019679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019680}
19681
19682
19683static int
19684test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019686
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019687 int mem_base;
19688 xmlChar * ret_val;
19689 xmlNodePtr node; /* the node */
19690 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019691 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019692 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019693
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019694 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19695 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019697 node = gen_xmlNodePtr(n_node, 0);
19698 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019699
William M. Brackf13f77f2004-11-12 16:03:48 +000019700 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019701 desret_xmlChar_ptr(ret_val);
19702 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019703 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019704 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019705 xmlResetLastError();
19706 if (mem_base != xmlMemBlocks()) {
19707 printf("Leak of %d blocks found in xmlGetProp",
19708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019709 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019710 printf(" %d", n_node);
19711 printf(" %d", n_name);
19712 printf("\n");
19713 }
19714 }
19715 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019716 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019717
Daniel Veillard42595322004-11-08 10:52:06 +000019718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019719}
19720
19721
19722static int
19723test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019725
Daniel Veillard57b25162004-11-06 14:50:18 +000019726 int mem_base;
19727 xmlAttrPtr ret_val;
19728 xmlNodePtr node; /* the node */
19729 int n_node;
19730 xmlChar * name; /* the attribute name */
19731 int n_name;
19732 xmlChar * nameSpace; /* the URI of the namespace */
19733 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734
Daniel Veillard57b25162004-11-06 14:50:18 +000019735 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19736 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19737 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19738 mem_base = xmlMemBlocks();
19739 node = gen_xmlNodePtr(n_node, 0);
19740 name = gen_const_xmlChar_ptr(n_name, 1);
19741 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19742
William M. Brackf13f77f2004-11-12 16:03:48 +000019743 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019744 desret_xmlAttrPtr(ret_val);
19745 call_tests++;
19746 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019747 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19748 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019749 xmlResetLastError();
19750 if (mem_base != xmlMemBlocks()) {
19751 printf("Leak of %d blocks found in xmlHasNsProp",
19752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019753 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019754 printf(" %d", n_node);
19755 printf(" %d", n_name);
19756 printf(" %d", n_nameSpace);
19757 printf("\n");
19758 }
19759 }
19760 }
19761 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019762 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019763
Daniel Veillard42595322004-11-08 10:52:06 +000019764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019765}
19766
19767
19768static int
19769test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019771
Daniel Veillard57b25162004-11-06 14:50:18 +000019772 int mem_base;
19773 xmlAttrPtr ret_val;
19774 xmlNodePtr node; /* the node */
19775 int n_node;
19776 xmlChar * name; /* the attribute name */
19777 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019778
Daniel Veillard57b25162004-11-06 14:50:18 +000019779 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19780 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19781 mem_base = xmlMemBlocks();
19782 node = gen_xmlNodePtr(n_node, 0);
19783 name = gen_const_xmlChar_ptr(n_name, 1);
19784
William M. Brackf13f77f2004-11-12 16:03:48 +000019785 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019786 desret_xmlAttrPtr(ret_val);
19787 call_tests++;
19788 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019789 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019790 xmlResetLastError();
19791 if (mem_base != xmlMemBlocks()) {
19792 printf("Leak of %d blocks found in xmlHasProp",
19793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019794 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019795 printf(" %d", n_node);
19796 printf(" %d", n_name);
19797 printf("\n");
19798 }
19799 }
19800 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019801 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019802
Daniel Veillard42595322004-11-08 10:52:06 +000019803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019804}
19805
19806
19807static int
19808test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019810
19811 int mem_base;
19812 int ret_val;
19813 xmlNodePtr node; /* the node */
19814 int n_node;
19815
19816 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019818 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019819
19820 ret_val = xmlIsBlankNode(node);
19821 desret_int(ret_val);
19822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019823 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019824 xmlResetLastError();
19825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019826 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019829 printf(" %d", n_node);
19830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019831 }
19832 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019833 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019834
Daniel Veillard42595322004-11-08 10:52:06 +000019835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019836}
19837
19838
19839static int
19840test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019842
19843 int mem_base;
19844 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019845 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019846 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019847 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019848 int n_publicID;
19849
19850 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19851 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19852 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019853 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19854 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019855
William M. Brackf13f77f2004-11-12 16:03:48 +000019856 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019857 desret_int(ret_val);
19858 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019859 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19860 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019861 xmlResetLastError();
19862 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019863 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019865 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019866 printf(" %d", n_systemID);
19867 printf(" %d", n_publicID);
19868 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019869 }
19870 }
19871 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019872 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019873
Daniel Veillard42595322004-11-08 10:52:06 +000019874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019875}
19876
19877
19878static int
19879test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019881
19882 int mem_base;
19883 xmlNodePtr ret_val;
19884 xmlDocPtr doc; /* the document */
19885 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019886 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019887 int n_content;
19888 int len; /* the length of the block */
19889 int n_len;
19890
19891 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19892 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19893 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019895 doc = gen_xmlDocPtr(n_doc, 0);
19896 content = gen_const_xmlChar_ptr(n_content, 1);
19897 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019898
William M. Brackf13f77f2004-11-12 16:03:48 +000019899 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019900 desret_xmlNodePtr(ret_val);
19901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019902 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019903 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019904 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019905 xmlResetLastError();
19906 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019907 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019909 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019910 printf(" %d", n_doc);
19911 printf(" %d", n_content);
19912 printf(" %d", n_len);
19913 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019914 }
19915 }
19916 }
19917 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019919
Daniel Veillard42595322004-11-08 10:52:06 +000019920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921}
19922
19923
19924static int
19925test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927
19928 int mem_base;
19929 xmlNodePtr ret_val;
19930 xmlDocPtr doc; /* the document */
19931 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019932 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019933 int n_name;
19934
19935 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19936 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19937 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019938 doc = gen_xmlDocPtr(n_doc, 0);
19939 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940
William M. Brackf13f77f2004-11-12 16:03:48 +000019941 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019942 desret_xmlNodePtr(ret_val);
19943 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019944 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946 xmlResetLastError();
19947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019948 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019951 printf(" %d", n_doc);
19952 printf(" %d", n_name);
19953 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954 }
19955 }
19956 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019958
Daniel Veillard42595322004-11-08 10:52:06 +000019959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019960}
19961
19962
19963static int
19964test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019966
William M. Brack21e4ef22005-01-02 09:53:13 +000019967#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019968#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019969 int mem_base;
19970 xmlNodePtr ret_val;
19971 xmlNodePtr parent; /* the parent node */
19972 int n_parent;
19973 xmlNsPtr ns; /* a namespace if any */
19974 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019975 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019976 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019977 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019978 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019979
Daniel Veillard27f20102004-11-05 11:50:11 +000019980 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19981 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19982 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19983 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19984 mem_base = xmlMemBlocks();
19985 parent = gen_xmlNodePtr(n_parent, 0);
19986 ns = gen_xmlNsPtr(n_ns, 1);
19987 name = gen_const_xmlChar_ptr(n_name, 2);
19988 content = gen_const_xmlChar_ptr(n_content, 3);
19989
William M. Brackf13f77f2004-11-12 16:03:48 +000019990 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019991 desret_xmlNodePtr(ret_val);
19992 call_tests++;
19993 des_xmlNodePtr(n_parent, parent, 0);
19994 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019995 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19996 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019997 xmlResetLastError();
19998 if (mem_base != xmlMemBlocks()) {
19999 printf("Leak of %d blocks found in xmlNewChild",
20000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020001 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020002 printf(" %d", n_parent);
20003 printf(" %d", n_ns);
20004 printf(" %d", n_name);
20005 printf(" %d", n_content);
20006 printf("\n");
20007 }
20008 }
20009 }
20010 }
20011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020012 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020013#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020014#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020015
Daniel Veillard42595322004-11-08 10:52:06 +000020016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020017}
20018
20019
20020static int
20021test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020023
20024 int mem_base;
20025 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020026 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020027 int n_content;
20028
20029 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020031 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020032
William M. Brackf13f77f2004-11-12 16:03:48 +000020033 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020034 desret_xmlNodePtr(ret_val);
20035 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020036 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020037 xmlResetLastError();
20038 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020039 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020041 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020042 printf(" %d", n_content);
20043 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020044 }
20045 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020046 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020047
Daniel Veillard42595322004-11-08 10:52:06 +000020048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020049}
20050
20051
20052static int
20053test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020055
20056 int mem_base;
20057 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020058 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020059 int n_version;
20060
20061 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020063 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020064
William M. Brackf13f77f2004-11-12 16:03:48 +000020065 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020066 desret_xmlDocPtr(ret_val);
20067 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020068 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069 xmlResetLastError();
20070 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020071 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020073 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020074 printf(" %d", n_version);
20075 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020076 }
20077 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020078 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020079
Daniel Veillard42595322004-11-08 10:52:06 +000020080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020081}
20082
20083
20084static int
20085test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020087
20088 int mem_base;
20089 xmlNodePtr ret_val;
20090 xmlDocPtr doc; /* the document */
20091 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020092 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020093 int n_content;
20094
20095 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20096 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020098 doc = gen_xmlDocPtr(n_doc, 0);
20099 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100
William M. Brackf13f77f2004-11-12 16:03:48 +000020101 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020102 desret_xmlNodePtr(ret_val);
20103 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020104 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020105 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106 xmlResetLastError();
20107 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020108 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020110 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020111 printf(" %d", n_doc);
20112 printf(" %d", n_content);
20113 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020114 }
20115 }
20116 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020117 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020118
Daniel Veillard42595322004-11-08 10:52:06 +000020119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020120}
20121
20122
20123static int
20124test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020126
William M. Brack21e4ef22005-01-02 09:53:13 +000020127#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000020128 int mem_base;
20129 xmlNodePtr ret_val;
20130 xmlDocPtr doc; /* the document owning the fragment */
20131 int n_doc;
20132
20133 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20134 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020135 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020136
20137 ret_val = xmlNewDocFragment(doc);
20138 desret_xmlNodePtr(ret_val);
20139 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020140 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020141 xmlResetLastError();
20142 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020143 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020145 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020146 printf(" %d", n_doc);
20147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020148 }
20149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020150 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020151#endif
20152
Daniel Veillard42595322004-11-08 10:52:06 +000020153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020154}
20155
20156
20157static int
20158test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020160
Daniel Veillard27f20102004-11-05 11:50:11 +000020161 int mem_base;
20162 xmlNodePtr ret_val;
20163 xmlDocPtr doc; /* the document */
20164 int n_doc;
20165 xmlNsPtr ns; /* namespace if any */
20166 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020167 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020168 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020169 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020170 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020171
Daniel Veillard27f20102004-11-05 11:50:11 +000020172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20173 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20174 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20175 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20176 mem_base = xmlMemBlocks();
20177 doc = gen_xmlDocPtr(n_doc, 0);
20178 ns = gen_xmlNsPtr(n_ns, 1);
20179 name = gen_const_xmlChar_ptr(n_name, 2);
20180 content = gen_const_xmlChar_ptr(n_content, 3);
20181
William M. Brackf13f77f2004-11-12 16:03:48 +000020182 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020183 desret_xmlNodePtr(ret_val);
20184 call_tests++;
20185 des_xmlDocPtr(n_doc, doc, 0);
20186 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020187 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20188 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020189 xmlResetLastError();
20190 if (mem_base != xmlMemBlocks()) {
20191 printf("Leak of %d blocks found in xmlNewDocNode",
20192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020193 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020194 printf(" %d", n_doc);
20195 printf(" %d", n_ns);
20196 printf(" %d", n_name);
20197 printf(" %d", n_content);
20198 printf("\n");
20199 }
20200 }
20201 }
20202 }
20203 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020204 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020205
Daniel Veillard42595322004-11-08 10:52:06 +000020206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020207}
20208
20209
20210static int
20211test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020213
Daniel Veillard27f20102004-11-05 11:50:11 +000020214 int mem_base;
20215 xmlNodePtr ret_val;
20216 xmlDocPtr doc; /* the document */
20217 int n_doc;
20218 xmlNsPtr ns; /* namespace if any */
20219 int n_ns;
20220 xmlChar * name; /* the node name */
20221 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020222 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020223 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020224
Daniel Veillard27f20102004-11-05 11:50:11 +000020225 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20226 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20227 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20228 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20229 mem_base = xmlMemBlocks();
20230 doc = gen_xmlDocPtr(n_doc, 0);
20231 ns = gen_xmlNsPtr(n_ns, 1);
20232 name = gen_eaten_name(n_name, 2);
20233 content = gen_const_xmlChar_ptr(n_content, 3);
20234
William M. Brackf13f77f2004-11-12 16:03:48 +000020235 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020236 desret_xmlNodePtr(ret_val);
20237 call_tests++;
20238 des_xmlDocPtr(n_doc, doc, 0);
20239 des_xmlNsPtr(n_ns, ns, 1);
20240 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020241 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020242 xmlResetLastError();
20243 if (mem_base != xmlMemBlocks()) {
20244 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020246 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020247 printf(" %d", n_doc);
20248 printf(" %d", n_ns);
20249 printf(" %d", n_name);
20250 printf(" %d", n_content);
20251 printf("\n");
20252 }
20253 }
20254 }
20255 }
20256 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020257 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020258
Daniel Veillard42595322004-11-08 10:52:06 +000020259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020260}
20261
20262
20263static int
20264test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020266
20267 int mem_base;
20268 xmlNodePtr ret_val;
20269 xmlDocPtr doc; /* the target document */
20270 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020271 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020272 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020273 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020274 int n_content;
20275
20276 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20277 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20278 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20279 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020280 doc = gen_xmlDocPtr(n_doc, 0);
20281 name = gen_const_xmlChar_ptr(n_name, 1);
20282 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020283
William M. Brackf13f77f2004-11-12 16:03:48 +000020284 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020285 desret_xmlNodePtr(ret_val);
20286 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020287 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020288 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20289 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290 xmlResetLastError();
20291 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020292 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020294 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020295 printf(" %d", n_doc);
20296 printf(" %d", n_name);
20297 printf(" %d", n_content);
20298 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020299 }
20300 }
20301 }
20302 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020303 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020304
Daniel Veillard42595322004-11-08 10:52:06 +000020305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020306}
20307
20308
20309static int
20310test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020312
Daniel Veillard57b25162004-11-06 14:50:18 +000020313 int mem_base;
20314 xmlAttrPtr ret_val;
20315 xmlDocPtr doc; /* the document */
20316 int n_doc;
20317 xmlChar * name; /* the name of the attribute */
20318 int n_name;
20319 xmlChar * value; /* the value of the attribute */
20320 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020321
Daniel Veillard57b25162004-11-06 14:50:18 +000020322 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20323 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20324 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20325 mem_base = xmlMemBlocks();
20326 doc = gen_xmlDocPtr(n_doc, 0);
20327 name = gen_const_xmlChar_ptr(n_name, 1);
20328 value = gen_const_xmlChar_ptr(n_value, 2);
20329
William M. Brackf13f77f2004-11-12 16:03:48 +000020330 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020331 desret_xmlAttrPtr(ret_val);
20332 call_tests++;
20333 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020334 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20335 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020336 xmlResetLastError();
20337 if (mem_base != xmlMemBlocks()) {
20338 printf("Leak of %d blocks found in xmlNewDocProp",
20339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020340 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020341 printf(" %d", n_doc);
20342 printf(" %d", n_name);
20343 printf(" %d", n_value);
20344 printf("\n");
20345 }
20346 }
20347 }
20348 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020349 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020350
Daniel Veillard42595322004-11-08 10:52:06 +000020351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020352}
20353
20354
20355static int
20356test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020358
William M. Brack21e4ef22005-01-02 09:53:13 +000020359#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020360#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020361 int mem_base;
20362 xmlNodePtr ret_val;
20363 xmlDocPtr doc; /* the document */
20364 int n_doc;
20365 xmlNsPtr ns; /* namespace if any */
20366 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020367 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020368 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020369 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020370 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020371
Daniel Veillard27f20102004-11-05 11:50:11 +000020372 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20373 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20374 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20375 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20376 mem_base = xmlMemBlocks();
20377 doc = gen_xmlDocPtr(n_doc, 0);
20378 ns = gen_xmlNsPtr(n_ns, 1);
20379 name = gen_const_xmlChar_ptr(n_name, 2);
20380 content = gen_const_xmlChar_ptr(n_content, 3);
20381
William M. Brackf13f77f2004-11-12 16:03:48 +000020382 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020383 desret_xmlNodePtr(ret_val);
20384 call_tests++;
20385 des_xmlDocPtr(n_doc, doc, 0);
20386 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020387 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20388 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020389 xmlResetLastError();
20390 if (mem_base != xmlMemBlocks()) {
20391 printf("Leak of %d blocks found in xmlNewDocRawNode",
20392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020393 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020394 printf(" %d", n_doc);
20395 printf(" %d", n_ns);
20396 printf(" %d", n_name);
20397 printf(" %d", n_content);
20398 printf("\n");
20399 }
20400 }
20401 }
20402 }
20403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020404 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020405#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020406#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020407
Daniel Veillard42595322004-11-08 10:52:06 +000020408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020409}
20410
20411
20412static int
20413test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020415
20416 int mem_base;
20417 xmlNodePtr ret_val;
20418 xmlDocPtr doc; /* the document */
20419 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020420 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020421 int n_content;
20422
20423 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20424 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020426 doc = gen_xmlDocPtr(n_doc, 0);
20427 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020428
William M. Brackf13f77f2004-11-12 16:03:48 +000020429 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020430 desret_xmlNodePtr(ret_val);
20431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020432 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020433 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020434 xmlResetLastError();
20435 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020436 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020438 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020439 printf(" %d", n_doc);
20440 printf(" %d", n_content);
20441 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020442 }
20443 }
20444 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020446
Daniel Veillard42595322004-11-08 10:52:06 +000020447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020448}
20449
20450
20451static int
20452test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020454
20455 int mem_base;
20456 xmlNodePtr ret_val;
20457 xmlDocPtr doc; /* the document */
20458 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020459 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020460 int n_content;
20461 int len; /* the text len. */
20462 int n_len;
20463
20464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20465 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20466 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020468 doc = gen_xmlDocPtr(n_doc, 0);
20469 content = gen_const_xmlChar_ptr(n_content, 1);
20470 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020471
William M. Brackf13f77f2004-11-12 16:03:48 +000020472 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020473 desret_xmlNodePtr(ret_val);
20474 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020475 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020476 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020477 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020478 xmlResetLastError();
20479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020480 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020483 printf(" %d", n_doc);
20484 printf(" %d", n_content);
20485 printf(" %d", n_len);
20486 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020487 }
20488 }
20489 }
20490 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020491 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020492
Daniel Veillard42595322004-11-08 10:52:06 +000020493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020494}
20495
20496
20497static int
20498test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020500
Daniel Veillard34099b42004-11-04 17:34:35 +000020501 int mem_base;
20502 xmlDtdPtr ret_val;
20503 xmlDocPtr doc; /* the document pointer */
20504 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020505 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020506 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020507 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020508 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020509 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020510 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020511
Daniel Veillard34099b42004-11-04 17:34:35 +000020512 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20513 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20514 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20515 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20516 mem_base = xmlMemBlocks();
20517 doc = gen_xmlDocPtr(n_doc, 0);
20518 name = gen_const_xmlChar_ptr(n_name, 1);
20519 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20520 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20521
William M. Brackf13f77f2004-11-12 16:03:48 +000020522 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020523 desret_xmlDtdPtr(ret_val);
20524 call_tests++;
20525 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020526 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20527 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20528 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020529 xmlResetLastError();
20530 if (mem_base != xmlMemBlocks()) {
20531 printf("Leak of %d blocks found in xmlNewDtd",
20532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020533 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020534 printf(" %d", n_doc);
20535 printf(" %d", n_name);
20536 printf(" %d", n_ExternalID);
20537 printf(" %d", n_SystemID);
20538 printf("\n");
20539 }
20540 }
20541 }
20542 }
20543 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020545
Daniel Veillard42595322004-11-08 10:52:06 +000020546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020547}
20548
20549
20550static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020551test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020553
Daniel Veillard27f20102004-11-05 11:50:11 +000020554 int mem_base;
20555 xmlNodePtr ret_val;
20556 xmlNsPtr ns; /* namespace if any */
20557 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020558 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020559 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020560
Daniel Veillard27f20102004-11-05 11:50:11 +000020561 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20563 mem_base = xmlMemBlocks();
20564 ns = gen_xmlNsPtr(n_ns, 0);
20565 name = gen_const_xmlChar_ptr(n_name, 1);
20566
William M. Brackf13f77f2004-11-12 16:03:48 +000020567 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020568 desret_xmlNodePtr(ret_val);
20569 call_tests++;
20570 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020571 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020572 xmlResetLastError();
20573 if (mem_base != xmlMemBlocks()) {
20574 printf("Leak of %d blocks found in xmlNewNode",
20575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020576 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020577 printf(" %d", n_ns);
20578 printf(" %d", n_name);
20579 printf("\n");
20580 }
20581 }
20582 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020584
Daniel Veillard42595322004-11-08 10:52:06 +000020585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020586}
20587
20588
20589static int
20590test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020592
Daniel Veillard27f20102004-11-05 11:50:11 +000020593 int mem_base;
20594 xmlNodePtr ret_val;
20595 xmlNsPtr ns; /* namespace if any */
20596 int n_ns;
20597 xmlChar * name; /* the node name */
20598 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020599
Daniel Veillard27f20102004-11-05 11:50:11 +000020600 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20601 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20602 mem_base = xmlMemBlocks();
20603 ns = gen_xmlNsPtr(n_ns, 0);
20604 name = gen_eaten_name(n_name, 1);
20605
20606 ret_val = xmlNewNodeEatName(ns, name);
20607 desret_xmlNodePtr(ret_val);
20608 call_tests++;
20609 des_xmlNsPtr(n_ns, ns, 0);
20610 des_eaten_name(n_name, name, 1);
20611 xmlResetLastError();
20612 if (mem_base != xmlMemBlocks()) {
20613 printf("Leak of %d blocks found in xmlNewNodeEatName",
20614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020615 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020616 printf(" %d", n_ns);
20617 printf(" %d", n_name);
20618 printf("\n");
20619 }
20620 }
20621 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020622 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020623
Daniel Veillard42595322004-11-08 10:52:06 +000020624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020625}
20626
20627
20628static int
20629test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020631
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020632 int mem_base;
20633 xmlNsPtr ret_val;
20634 xmlNodePtr node; /* the element carrying the namespace */
20635 int n_node;
20636 xmlChar * href; /* the URI associated */
20637 int n_href;
20638 xmlChar * prefix; /* the prefix for the namespace */
20639 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020640
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020641 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20642 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20643 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20644 mem_base = xmlMemBlocks();
20645 node = gen_xmlNodePtr(n_node, 0);
20646 href = gen_const_xmlChar_ptr(n_href, 1);
20647 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20648
William M. Brackf13f77f2004-11-12 16:03:48 +000020649 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020650 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20651 desret_xmlNsPtr(ret_val);
20652 call_tests++;
20653 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020654 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20655 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020656 xmlResetLastError();
20657 if (mem_base != xmlMemBlocks()) {
20658 printf("Leak of %d blocks found in xmlNewNs",
20659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020660 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020661 printf(" %d", n_node);
20662 printf(" %d", n_href);
20663 printf(" %d", n_prefix);
20664 printf("\n");
20665 }
20666 }
20667 }
20668 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020669 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020670
Daniel Veillard42595322004-11-08 10:52:06 +000020671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020672}
20673
20674
20675static int
20676test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020678
Daniel Veillard57b25162004-11-06 14:50:18 +000020679 int mem_base;
20680 xmlAttrPtr ret_val;
20681 xmlNodePtr node; /* the holding node */
20682 int n_node;
20683 xmlNsPtr ns; /* the namespace */
20684 int n_ns;
20685 xmlChar * name; /* the name of the attribute */
20686 int n_name;
20687 xmlChar * value; /* the value of the attribute */
20688 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020689
Daniel Veillard57b25162004-11-06 14:50:18 +000020690 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20691 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20692 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20693 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20694 mem_base = xmlMemBlocks();
20695 node = gen_xmlNodePtr(n_node, 0);
20696 ns = gen_xmlNsPtr(n_ns, 1);
20697 name = gen_const_xmlChar_ptr(n_name, 2);
20698 value = gen_const_xmlChar_ptr(n_value, 3);
20699
William M. Brackf13f77f2004-11-12 16:03:48 +000020700 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020701 desret_xmlAttrPtr(ret_val);
20702 call_tests++;
20703 des_xmlNodePtr(n_node, node, 0);
20704 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020705 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20706 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020707 xmlResetLastError();
20708 if (mem_base != xmlMemBlocks()) {
20709 printf("Leak of %d blocks found in xmlNewNsProp",
20710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020711 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020712 printf(" %d", n_node);
20713 printf(" %d", n_ns);
20714 printf(" %d", n_name);
20715 printf(" %d", n_value);
20716 printf("\n");
20717 }
20718 }
20719 }
20720 }
20721 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020722 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020723
Daniel Veillard42595322004-11-08 10:52:06 +000020724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020725}
20726
20727
20728static int
20729test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020731
Daniel Veillard57b25162004-11-06 14:50:18 +000020732 int mem_base;
20733 xmlAttrPtr ret_val;
20734 xmlNodePtr node; /* the holding node */
20735 int n_node;
20736 xmlNsPtr ns; /* the namespace */
20737 int n_ns;
20738 xmlChar * name; /* the name of the attribute */
20739 int n_name;
20740 xmlChar * value; /* the value of the attribute */
20741 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020742
Daniel Veillard57b25162004-11-06 14:50:18 +000020743 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20744 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20745 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20746 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20747 mem_base = xmlMemBlocks();
20748 node = gen_xmlNodePtr(n_node, 0);
20749 ns = gen_xmlNsPtr(n_ns, 1);
20750 name = gen_eaten_name(n_name, 2);
20751 value = gen_const_xmlChar_ptr(n_value, 3);
20752
William M. Brackf13f77f2004-11-12 16:03:48 +000020753 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020754 desret_xmlAttrPtr(ret_val);
20755 call_tests++;
20756 des_xmlNodePtr(n_node, node, 0);
20757 des_xmlNsPtr(n_ns, ns, 1);
20758 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020759 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020760 xmlResetLastError();
20761 if (mem_base != xmlMemBlocks()) {
20762 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020764 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020765 printf(" %d", n_node);
20766 printf(" %d", n_ns);
20767 printf(" %d", n_name);
20768 printf(" %d", n_value);
20769 printf("\n");
20770 }
20771 }
20772 }
20773 }
20774 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020776
Daniel Veillard42595322004-11-08 10:52:06 +000020777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020778}
20779
20780
20781static int
20782test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020784
20785 int mem_base;
20786 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020787 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020788 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020789 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020790 int n_content;
20791
20792 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20793 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20794 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020795 name = gen_const_xmlChar_ptr(n_name, 0);
20796 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020797
William M. Brackf13f77f2004-11-12 16:03:48 +000020798 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020799 desret_xmlNodePtr(ret_val);
20800 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020801 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20802 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020803 xmlResetLastError();
20804 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020805 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020807 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020808 printf(" %d", n_name);
20809 printf(" %d", n_content);
20810 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020811 }
20812 }
20813 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020815
Daniel Veillard42595322004-11-08 10:52:06 +000020816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020817}
20818
20819
20820static int
20821test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020823
William M. Brack21e4ef22005-01-02 09:53:13 +000020824#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020825#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020826 int mem_base;
20827 xmlAttrPtr ret_val;
20828 xmlNodePtr node; /* the holding node */
20829 int n_node;
20830 xmlChar * name; /* the name of the attribute */
20831 int n_name;
20832 xmlChar * value; /* the value of the attribute */
20833 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020834
Daniel Veillard57b25162004-11-06 14:50:18 +000020835 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20836 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20837 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20838 mem_base = xmlMemBlocks();
20839 node = gen_xmlNodePtr(n_node, 0);
20840 name = gen_const_xmlChar_ptr(n_name, 1);
20841 value = gen_const_xmlChar_ptr(n_value, 2);
20842
William M. Brackf13f77f2004-11-12 16:03:48 +000020843 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020844 desret_xmlAttrPtr(ret_val);
20845 call_tests++;
20846 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020847 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20848 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020849 xmlResetLastError();
20850 if (mem_base != xmlMemBlocks()) {
20851 printf("Leak of %d blocks found in xmlNewProp",
20852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020853 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020854 printf(" %d", n_node);
20855 printf(" %d", n_name);
20856 printf(" %d", n_value);
20857 printf("\n");
20858 }
20859 }
20860 }
20861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020862 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020863#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020864#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020865
Daniel Veillard42595322004-11-08 10:52:06 +000020866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020867}
20868
20869
20870static int
20871test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020873
20874 int mem_base;
20875 xmlNodePtr ret_val;
20876 xmlDocPtr doc; /* the document */
20877 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020878 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020879 int n_name;
20880
20881 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20882 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20883 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020884 doc = gen_xmlDocPtr(n_doc, 0);
20885 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020886
William M. Brackf13f77f2004-11-12 16:03:48 +000020887 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020888 desret_xmlNodePtr(ret_val);
20889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020890 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020891 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020892 xmlResetLastError();
20893 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020894 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020896 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020897 printf(" %d", n_doc);
20898 printf(" %d", n_name);
20899 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020900 }
20901 }
20902 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020903 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020904
Daniel Veillard42595322004-11-08 10:52:06 +000020905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020906}
20907
20908
20909static int
20910test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020912
20913 int mem_base;
20914 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020915 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020916 int n_content;
20917
20918 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020920 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020921
William M. Brackf13f77f2004-11-12 16:03:48 +000020922 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020923 desret_xmlNodePtr(ret_val);
20924 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020925 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020926 xmlResetLastError();
20927 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020928 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020930 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020931 printf(" %d", n_content);
20932 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020933 }
20934 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020935 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020936
Daniel Veillard42595322004-11-08 10:52:06 +000020937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020938}
20939
20940
20941static int
20942test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020944
William M. Brack21e4ef22005-01-02 09:53:13 +000020945#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020946#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020947 int mem_base;
20948 xmlNodePtr ret_val;
20949 xmlNodePtr parent; /* the parent node */
20950 int n_parent;
20951 xmlNsPtr ns; /* a namespace if any */
20952 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020953 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020954 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020955 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020956 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020957
Daniel Veillard27f20102004-11-05 11:50:11 +000020958 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20959 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20960 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20961 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20962 mem_base = xmlMemBlocks();
20963 parent = gen_xmlNodePtr(n_parent, 0);
20964 ns = gen_xmlNsPtr(n_ns, 1);
20965 name = gen_const_xmlChar_ptr(n_name, 2);
20966 content = gen_const_xmlChar_ptr(n_content, 3);
20967
William M. Brackf13f77f2004-11-12 16:03:48 +000020968 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020969 desret_xmlNodePtr(ret_val);
20970 call_tests++;
20971 des_xmlNodePtr(n_parent, parent, 0);
20972 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020973 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20974 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020975 xmlResetLastError();
20976 if (mem_base != xmlMemBlocks()) {
20977 printf("Leak of %d blocks found in xmlNewTextChild",
20978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020979 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020980 printf(" %d", n_parent);
20981 printf(" %d", n_ns);
20982 printf(" %d", n_name);
20983 printf(" %d", n_content);
20984 printf("\n");
20985 }
20986 }
20987 }
20988 }
20989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020990 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020991#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020992#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020993
Daniel Veillard42595322004-11-08 10:52:06 +000020994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020995}
20996
20997
20998static int
20999test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021001
21002 int mem_base;
21003 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021004 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021005 int n_content;
21006 int len; /* the text len. */
21007 int n_len;
21008
21009 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21010 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21011 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021012 content = gen_const_xmlChar_ptr(n_content, 0);
21013 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021014
William M. Brackf13f77f2004-11-12 16:03:48 +000021015 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021016 desret_xmlNodePtr(ret_val);
21017 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021018 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021019 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021020 xmlResetLastError();
21021 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021022 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021024 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021025 printf(" %d", n_content);
21026 printf(" %d", n_len);
21027 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021028 }
21029 }
21030 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021031 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021032
Daniel Veillard42595322004-11-08 10:52:06 +000021033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021034}
21035
21036
21037static int
21038test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021040
21041 int mem_base;
21042 xmlNodePtr cur; /* the node being modified */
21043 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021044 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021045 int n_content;
21046
21047 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21048 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021050 cur = gen_xmlNodePtr(n_cur, 0);
21051 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021052
William M. Brackf13f77f2004-11-12 16:03:48 +000021053 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021054 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021055 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021056 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021057 xmlResetLastError();
21058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021059 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021062 printf(" %d", n_cur);
21063 printf(" %d", n_content);
21064 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021065 }
21066 }
21067 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021069
Daniel Veillard42595322004-11-08 10:52:06 +000021070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021071}
21072
21073
21074static int
21075test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021077
21078 int mem_base;
21079 xmlNodePtr cur; /* the node being modified */
21080 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021081 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021082 int n_content;
21083 int len; /* the size of @content */
21084 int n_len;
21085
21086 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21087 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21088 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021090 cur = gen_xmlNodePtr(n_cur, 0);
21091 content = gen_const_xmlChar_ptr(n_content, 1);
21092 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021093
William M. Brackf13f77f2004-11-12 16:03:48 +000021094 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021095 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021096 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021097 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021098 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021099 xmlResetLastError();
21100 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021101 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021103 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021104 printf(" %d", n_cur);
21105 printf(" %d", n_content);
21106 printf(" %d", n_len);
21107 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021108 }
21109 }
21110 }
21111 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021112 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021113
Daniel Veillard42595322004-11-08 10:52:06 +000021114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021115}
21116
21117
21118static int
21119test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021121
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021122 int mem_base;
21123 int ret_val;
21124 xmlBufferPtr buffer; /* a buffer */
21125 int n_buffer;
21126 xmlNodePtr cur; /* the node being read */
21127 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021128
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021129 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21130 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021132 buffer = gen_xmlBufferPtr(n_buffer, 0);
21133 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021134
21135 ret_val = xmlNodeBufGetContent(buffer, cur);
21136 desret_int(ret_val);
21137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021138 des_xmlBufferPtr(n_buffer, buffer, 0);
21139 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021140 xmlResetLastError();
21141 if (mem_base != xmlMemBlocks()) {
21142 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021144 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021145 printf(" %d", n_buffer);
21146 printf(" %d", n_cur);
21147 printf("\n");
21148 }
21149 }
21150 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021151 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021152
Daniel Veillard42595322004-11-08 10:52:06 +000021153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021154}
21155
21156
21157static int
21158test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021160
William M. Brack21e4ef22005-01-02 09:53:13 +000021161#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021162 int mem_base;
21163 int ret_val;
21164 xmlBufferPtr buf; /* the XML buffer output */
21165 int n_buf;
21166 xmlDocPtr doc; /* the document */
21167 int n_doc;
21168 xmlNodePtr cur; /* the current node */
21169 int n_cur;
21170 int level; /* the imbrication level for indenting */
21171 int n_level;
21172 int format; /* is formatting allowed */
21173 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021174
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021175 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21176 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21177 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21178 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21179 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021181 buf = gen_xmlBufferPtr(n_buf, 0);
21182 doc = gen_xmlDocPtr(n_doc, 1);
21183 cur = gen_xmlNodePtr(n_cur, 2);
21184 level = gen_int(n_level, 3);
21185 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021186
21187 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21188 desret_int(ret_val);
21189 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021190 des_xmlBufferPtr(n_buf, buf, 0);
21191 des_xmlDocPtr(n_doc, doc, 1);
21192 des_xmlNodePtr(n_cur, cur, 2);
21193 des_int(n_level, level, 3);
21194 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021195 xmlResetLastError();
21196 if (mem_base != xmlMemBlocks()) {
21197 printf("Leak of %d blocks found in xmlNodeDump",
21198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021199 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021200 printf(" %d", n_buf);
21201 printf(" %d", n_doc);
21202 printf(" %d", n_cur);
21203 printf(" %d", n_level);
21204 printf(" %d", n_format);
21205 printf("\n");
21206 }
21207 }
21208 }
21209 }
21210 }
21211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021212 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021213#endif
21214
Daniel Veillard42595322004-11-08 10:52:06 +000021215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021216}
21217
21218
21219static int
21220test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021222
William M. Brack21e4ef22005-01-02 09:53:13 +000021223#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021224 int mem_base;
21225 xmlOutputBufferPtr buf; /* the XML buffer output */
21226 int n_buf;
21227 xmlDocPtr doc; /* the document */
21228 int n_doc;
21229 xmlNodePtr cur; /* the current node */
21230 int n_cur;
21231 int level; /* the imbrication level for indenting */
21232 int n_level;
21233 int format; /* is formatting allowed */
21234 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021235 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021236 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021237
Daniel Veillard3d97e662004-11-04 10:49:00 +000021238 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21239 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21240 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21241 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21242 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21243 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21244 mem_base = xmlMemBlocks();
21245 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21246 doc = gen_xmlDocPtr(n_doc, 1);
21247 cur = gen_xmlNodePtr(n_cur, 2);
21248 level = gen_int(n_level, 3);
21249 format = gen_int(n_format, 4);
21250 encoding = gen_const_char_ptr(n_encoding, 5);
21251
William M. Brackf13f77f2004-11-12 16:03:48 +000021252 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021253 call_tests++;
21254 des_xmlOutputBufferPtr(n_buf, buf, 0);
21255 des_xmlDocPtr(n_doc, doc, 1);
21256 des_xmlNodePtr(n_cur, cur, 2);
21257 des_int(n_level, level, 3);
21258 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021259 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021260 xmlResetLastError();
21261 if (mem_base != xmlMemBlocks()) {
21262 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021264 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021265 printf(" %d", n_buf);
21266 printf(" %d", n_doc);
21267 printf(" %d", n_cur);
21268 printf(" %d", n_level);
21269 printf(" %d", n_format);
21270 printf(" %d", n_encoding);
21271 printf("\n");
21272 }
21273 }
21274 }
21275 }
21276 }
21277 }
21278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021279 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021280#endif
21281
Daniel Veillard42595322004-11-08 10:52:06 +000021282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021283}
21284
21285
21286static int
21287test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021289
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021290 int mem_base;
21291 xmlChar * ret_val;
21292 xmlDocPtr doc; /* the document the node pertains to */
21293 int n_doc;
21294 xmlNodePtr cur; /* the node being checked */
21295 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021296
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21298 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021300 doc = gen_xmlDocPtr(n_doc, 0);
21301 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021302
21303 ret_val = xmlNodeGetBase(doc, cur);
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_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021308 xmlResetLastError();
21309 if (mem_base != xmlMemBlocks()) {
21310 printf("Leak of %d blocks found in xmlNodeGetBase",
21311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021312 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021313 printf(" %d", n_doc);
21314 printf(" %d", n_cur);
21315 printf("\n");
21316 }
21317 }
21318 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021319 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021320
Daniel Veillard42595322004-11-08 10:52:06 +000021321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021322}
21323
21324
21325static int
21326test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021328
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021329 int mem_base;
21330 xmlChar * ret_val;
21331 xmlNodePtr cur; /* the node being read */
21332 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021333
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021334 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021336 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021337
21338 ret_val = xmlNodeGetContent(cur);
21339 desret_xmlChar_ptr(ret_val);
21340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021341 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021342 xmlResetLastError();
21343 if (mem_base != xmlMemBlocks()) {
21344 printf("Leak of %d blocks found in xmlNodeGetContent",
21345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021346 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021347 printf(" %d", n_cur);
21348 printf("\n");
21349 }
21350 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021351 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021352
Daniel Veillard42595322004-11-08 10:52:06 +000021353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021354}
21355
21356
21357static int
21358test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021360
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021361 int mem_base;
21362 xmlChar * ret_val;
21363 xmlNodePtr cur; /* the node being checked */
21364 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021365
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021366 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021368 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021369
21370 ret_val = xmlNodeGetLang(cur);
21371 desret_xmlChar_ptr(ret_val);
21372 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021373 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021374 xmlResetLastError();
21375 if (mem_base != xmlMemBlocks()) {
21376 printf("Leak of %d blocks found in xmlNodeGetLang",
21377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021378 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021379 printf(" %d", n_cur);
21380 printf("\n");
21381 }
21382 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021383 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021384
Daniel Veillard42595322004-11-08 10:52:06 +000021385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021386}
21387
21388
21389static int
21390test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021392
21393 int mem_base;
21394 int ret_val;
21395 xmlNodePtr cur; /* the node being checked */
21396 int n_cur;
21397
21398 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21399 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021400 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021401
21402 ret_val = xmlNodeGetSpacePreserve(cur);
21403 desret_int(ret_val);
21404 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021405 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406 xmlResetLastError();
21407 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021408 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021410 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021411 printf(" %d", n_cur);
21412 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021413 }
21414 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021415 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021416
Daniel Veillard42595322004-11-08 10:52:06 +000021417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021418}
21419
21420
21421static int
21422test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021424
21425 int mem_base;
21426 int ret_val;
21427 xmlNodePtr node; /* the node */
21428 int n_node;
21429
21430 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21431 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021432 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021433
21434 ret_val = xmlNodeIsText(node);
21435 desret_int(ret_val);
21436 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021437 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438 xmlResetLastError();
21439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021440 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021443 printf(" %d", n_node);
21444 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021445 }
21446 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021448
Daniel Veillard42595322004-11-08 10:52:06 +000021449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021450}
21451
21452
21453static int
21454test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021456
William M. Brack21e4ef22005-01-02 09:53:13 +000021457#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021458 int mem_base;
21459 xmlChar * ret_val;
21460 xmlDocPtr doc; /* the document */
21461 int n_doc;
21462 xmlNodePtr list; /* a Node list */
21463 int n_list;
21464 int inLine; /* should we replace entity contents or show their external form */
21465 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021466
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021467 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21468 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21469 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021471 doc = gen_xmlDocPtr(n_doc, 0);
21472 list = gen_xmlNodePtr(n_list, 1);
21473 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021474
21475 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21476 desret_xmlChar_ptr(ret_val);
21477 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021478 des_xmlDocPtr(n_doc, doc, 0);
21479 des_xmlNodePtr(n_list, list, 1);
21480 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021481 xmlResetLastError();
21482 if (mem_base != xmlMemBlocks()) {
21483 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021485 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021486 printf(" %d", n_doc);
21487 printf(" %d", n_list);
21488 printf(" %d", n_inLine);
21489 printf("\n");
21490 }
21491 }
21492 }
21493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021494 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021495#endif
21496
Daniel Veillard42595322004-11-08 10:52:06 +000021497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021498}
21499
21500
21501static int
21502test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021504
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021505 int mem_base;
21506 xmlChar * ret_val;
21507 xmlDocPtr doc; /* the document */
21508 int n_doc;
21509 xmlNodePtr list; /* a Node list */
21510 int n_list;
21511 int inLine; /* should we replace entity contents or show their external form */
21512 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021514 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21515 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21516 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21517 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021518 doc = gen_xmlDocPtr(n_doc, 0);
21519 list = gen_xmlNodePtr(n_list, 1);
21520 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021521
21522 ret_val = xmlNodeListGetString(doc, list, inLine);
21523 desret_xmlChar_ptr(ret_val);
21524 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021525 des_xmlDocPtr(n_doc, doc, 0);
21526 des_xmlNodePtr(n_list, list, 1);
21527 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021528 xmlResetLastError();
21529 if (mem_base != xmlMemBlocks()) {
21530 printf("Leak of %d blocks found in xmlNodeListGetString",
21531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021532 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021533 printf(" %d", n_doc);
21534 printf(" %d", n_list);
21535 printf(" %d", n_inLine);
21536 printf("\n");
21537 }
21538 }
21539 }
21540 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021542
Daniel Veillard42595322004-11-08 10:52:06 +000021543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021544}
21545
21546
21547static int
21548test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021550
William M. Brack21e4ef22005-01-02 09:53:13 +000021551#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552 int mem_base;
21553 xmlNodePtr cur; /* the node being changed */
21554 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021555 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021556 int n_uri;
21557
21558 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21559 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21560 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021561 cur = gen_xmlNodePtr(n_cur, 0);
21562 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021563
William M. Brackf13f77f2004-11-12 16:03:48 +000021564 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021566 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021567 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021568 xmlResetLastError();
21569 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021570 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021572 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021573 printf(" %d", n_cur);
21574 printf(" %d", n_uri);
21575 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021576 }
21577 }
21578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021579 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021580#endif
21581
Daniel Veillard42595322004-11-08 10:52:06 +000021582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583}
21584
21585
21586static int
21587test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021589
21590 int mem_base;
21591 xmlNodePtr cur; /* the node being modified */
21592 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021593 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021594 int n_content;
21595
21596 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21597 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21598 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021599 cur = gen_xmlNodePtr(n_cur, 0);
21600 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021601
William M. Brackf13f77f2004-11-12 16:03:48 +000021602 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021603 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021604 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021605 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606 xmlResetLastError();
21607 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021608 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021610 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021611 printf(" %d", n_cur);
21612 printf(" %d", n_content);
21613 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021614 }
21615 }
21616 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021618
Daniel Veillard42595322004-11-08 10:52:06 +000021619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021620}
21621
21622
21623static int
21624test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021626
William M. Brack21e4ef22005-01-02 09:53:13 +000021627#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021628 int mem_base;
21629 xmlNodePtr cur; /* the node being modified */
21630 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021631 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021632 int n_content;
21633 int len; /* the size of @content */
21634 int n_len;
21635
21636 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21637 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21638 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021640 cur = gen_xmlNodePtr(n_cur, 0);
21641 content = gen_const_xmlChar_ptr(n_content, 1);
21642 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021643
William M. Brackf13f77f2004-11-12 16:03:48 +000021644 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021646 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021647 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021648 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021649 xmlResetLastError();
21650 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021651 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021653 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021654 printf(" %d", n_cur);
21655 printf(" %d", n_content);
21656 printf(" %d", n_len);
21657 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021658 }
21659 }
21660 }
21661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021662 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021663#endif
21664
Daniel Veillard42595322004-11-08 10:52:06 +000021665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021666}
21667
21668
21669static int
21670test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021672
William M. Brack21e4ef22005-01-02 09:53:13 +000021673#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021674 int mem_base;
21675 xmlNodePtr cur; /* the node being changed */
21676 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021677 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021678 int n_lang;
21679
21680 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21681 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21682 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021683 cur = gen_xmlNodePtr(n_cur, 0);
21684 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021685
William M. Brackf13f77f2004-11-12 16:03:48 +000021686 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021688 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021689 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021690 xmlResetLastError();
21691 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021692 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021694 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021695 printf(" %d", n_cur);
21696 printf(" %d", n_lang);
21697 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021698 }
21699 }
21700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021701 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021702#endif
21703
Daniel Veillard42595322004-11-08 10:52:06 +000021704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021705}
21706
21707
21708static int
21709test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021711
William M. Brack21e4ef22005-01-02 09:53:13 +000021712#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021713 int mem_base;
21714 xmlNodePtr cur; /* the node being changed */
21715 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021716 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021717 int n_name;
21718
21719 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21720 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021722 cur = gen_xmlNodePtr(n_cur, 0);
21723 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021724
William M. Brackf13f77f2004-11-12 16:03:48 +000021725 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021726 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021727 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021728 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729 xmlResetLastError();
21730 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021731 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021733 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021734 printf(" %d", n_cur);
21735 printf(" %d", n_name);
21736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021737 }
21738 }
21739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021740 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741#endif
21742
Daniel Veillard42595322004-11-08 10:52:06 +000021743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021744}
21745
21746
21747static int
21748test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021750
William M. Brack21e4ef22005-01-02 09:53:13 +000021751#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021752 int mem_base;
21753 xmlNodePtr cur; /* the node being changed */
21754 int n_cur;
21755 int val; /* the xml:space value ("0": default, 1: "preserve") */
21756 int n_val;
21757
21758 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21759 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021761 cur = gen_xmlNodePtr(n_cur, 0);
21762 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021763
21764 xmlNodeSetSpacePreserve(cur, val);
21765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021766 des_xmlNodePtr(n_cur, cur, 0);
21767 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021768 xmlResetLastError();
21769 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021770 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021772 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021773 printf(" %d", n_cur);
21774 printf(" %d", n_val);
21775 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776 }
21777 }
21778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021779 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021780#endif
21781
Daniel Veillard42595322004-11-08 10:52:06 +000021782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021783}
21784
21785
21786static int
21787test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021789
William M. Brack21e4ef22005-01-02 09:53:13 +000021790#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021791#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021792 int mem_base;
21793 int ret_val;
21794 xmlDocPtr doc; /* the document */
21795 int n_doc;
21796 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21797 int n_tree;
21798
21799 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21800 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21801 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021802 doc = gen_xmlDocPtr(n_doc, 0);
21803 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021804
21805 ret_val = xmlReconciliateNs(doc, tree);
21806 desret_int(ret_val);
21807 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021808 des_xmlDocPtr(n_doc, doc, 0);
21809 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021810 xmlResetLastError();
21811 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021812 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021814 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021815 printf(" %d", n_doc);
21816 printf(" %d", n_tree);
21817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021818 }
21819 }
21820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021821 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021822#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021823#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021824
Daniel Veillard42595322004-11-08 10:52:06 +000021825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021826}
21827
21828
21829static int
21830test_xmlRemoveProp(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_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021834 int mem_base;
21835 int ret_val;
21836 xmlAttrPtr cur; /* an attribute */
21837 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021838
Daniel Veillardce244ad2004-11-05 10:03:46 +000021839 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21840 mem_base = xmlMemBlocks();
21841 cur = gen_xmlAttrPtr(n_cur, 0);
21842
21843 ret_val = xmlRemoveProp(cur);
21844 cur = NULL;
21845 desret_int(ret_val);
21846 call_tests++;
21847 des_xmlAttrPtr(n_cur, cur, 0);
21848 xmlResetLastError();
21849 if (mem_base != xmlMemBlocks()) {
21850 printf("Leak of %d blocks found in xmlRemoveProp",
21851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021852 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021853 printf(" %d", n_cur);
21854 printf("\n");
21855 }
21856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021857 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021858#endif
21859
Daniel Veillard42595322004-11-08 10:52:06 +000021860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021861}
21862
21863
21864static int
21865test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021867
William M. Brack21e4ef22005-01-02 09:53:13 +000021868#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021869 int mem_base;
21870 xmlNodePtr ret_val;
21871 xmlNodePtr old; /* the old node */
21872 int n_old;
21873 xmlNodePtr cur; /* the node */
21874 int n_cur;
21875
21876 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021877 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021879 old = gen_xmlNodePtr(n_old, 0);
21880 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021881
21882 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021883 if (cur != NULL) {
21884 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021885 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021886 if (old != NULL) {
21887 xmlUnlinkNode(old);
21888 xmlFreeNode(old) ; old = NULL ; }
21889 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021890 desret_xmlNodePtr(ret_val);
21891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021892 des_xmlNodePtr(n_old, old, 0);
21893 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021894 xmlResetLastError();
21895 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021896 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021898 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021899 printf(" %d", n_old);
21900 printf(" %d", n_cur);
21901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021902 }
21903 }
21904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021905 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021906#endif
21907
Daniel Veillard42595322004-11-08 10:52:06 +000021908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021909}
21910
21911
21912static int
21913test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021915
William M. Brack21e4ef22005-01-02 09:53:13 +000021916#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021917 int mem_base;
21918 int ret_val;
21919 const char * filename; /* the filename (or URL) */
21920 int n_filename;
21921 xmlDocPtr cur; /* the document */
21922 int n_cur;
21923
21924 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21925 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021927 filename = gen_fileoutput(n_filename, 0);
21928 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929
21930 ret_val = xmlSaveFile(filename, cur);
21931 desret_int(ret_val);
21932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021933 des_fileoutput(n_filename, filename, 0);
21934 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021935 xmlResetLastError();
21936 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021937 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021939 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021940 printf(" %d", n_filename);
21941 printf(" %d", n_cur);
21942 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021943 }
21944 }
21945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021946 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947#endif
21948
Daniel Veillard42595322004-11-08 10:52:06 +000021949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021950}
21951
21952
21953static int
21954test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021956
William M. Brack21e4ef22005-01-02 09:53:13 +000021957#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021958 int mem_base;
21959 int ret_val;
21960 const char * filename; /* the filename (or URL) */
21961 int n_filename;
21962 xmlDocPtr cur; /* the document */
21963 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021964 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021965 int n_encoding;
21966
21967 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21968 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21969 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21970 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021971 filename = gen_fileoutput(n_filename, 0);
21972 cur = gen_xmlDocPtr(n_cur, 1);
21973 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021974
William M. Brackf13f77f2004-11-12 16:03:48 +000021975 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021976 desret_int(ret_val);
21977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021978 des_fileoutput(n_filename, filename, 0);
21979 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021980 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021981 xmlResetLastError();
21982 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021983 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021985 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021986 printf(" %d", n_filename);
21987 printf(" %d", n_cur);
21988 printf(" %d", n_encoding);
21989 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021990 }
21991 }
21992 }
21993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021994 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021995#endif
21996
Daniel Veillard42595322004-11-08 10:52:06 +000021997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021998}
21999
22000
22001static int
22002test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022004
William M. Brack21e4ef22005-01-02 09:53:13 +000022005#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022006 int mem_base;
22007 int ret_val;
22008 xmlOutputBufferPtr buf; /* an output I/O buffer */
22009 int n_buf;
22010 xmlDocPtr cur; /* the document */
22011 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022012 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022013 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022014
Daniel Veillard3d97e662004-11-04 10:49:00 +000022015 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22016 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22017 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22018 mem_base = xmlMemBlocks();
22019 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22020 cur = gen_xmlDocPtr(n_cur, 1);
22021 encoding = gen_const_char_ptr(n_encoding, 2);
22022
William M. Brackf13f77f2004-11-12 16:03:48 +000022023 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022024 buf = NULL;
22025 desret_int(ret_val);
22026 call_tests++;
22027 des_xmlOutputBufferPtr(n_buf, buf, 0);
22028 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022029 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022030 xmlResetLastError();
22031 if (mem_base != xmlMemBlocks()) {
22032 printf("Leak of %d blocks found in xmlSaveFileTo",
22033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022034 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022035 printf(" %d", n_buf);
22036 printf(" %d", n_cur);
22037 printf(" %d", n_encoding);
22038 printf("\n");
22039 }
22040 }
22041 }
22042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022043 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022044#endif
22045
Daniel Veillard42595322004-11-08 10:52:06 +000022046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022047}
22048
22049
22050static int
22051test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022053
William M. Brack21e4ef22005-01-02 09:53:13 +000022054#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022055 int mem_base;
22056 int ret_val;
22057 const char * filename; /* the filename (or URL) */
22058 int n_filename;
22059 xmlDocPtr cur; /* the document */
22060 int n_cur;
22061 int format; /* should formatting spaces been added */
22062 int n_format;
22063
22064 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22065 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22066 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22067 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022068 filename = gen_fileoutput(n_filename, 0);
22069 cur = gen_xmlDocPtr(n_cur, 1);
22070 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022071
22072 ret_val = xmlSaveFormatFile(filename, cur, format);
22073 desret_int(ret_val);
22074 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022075 des_fileoutput(n_filename, filename, 0);
22076 des_xmlDocPtr(n_cur, cur, 1);
22077 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022078 xmlResetLastError();
22079 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022080 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022082 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022083 printf(" %d", n_filename);
22084 printf(" %d", n_cur);
22085 printf(" %d", n_format);
22086 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022087 }
22088 }
22089 }
22090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022091 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022092#endif
22093
Daniel Veillard42595322004-11-08 10:52:06 +000022094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022095}
22096
22097
22098static int
22099test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022101
William M. Brack21e4ef22005-01-02 09:53:13 +000022102#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022103 int mem_base;
22104 int ret_val;
22105 const char * filename; /* the filename or URL to output */
22106 int n_filename;
22107 xmlDocPtr cur; /* the document being saved */
22108 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022109 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022110 int n_encoding;
22111 int format; /* should formatting spaces be added. */
22112 int n_format;
22113
22114 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22115 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22116 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22117 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022119 filename = gen_fileoutput(n_filename, 0);
22120 cur = gen_xmlDocPtr(n_cur, 1);
22121 encoding = gen_const_char_ptr(n_encoding, 2);
22122 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022123
William M. Brackf13f77f2004-11-12 16:03:48 +000022124 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022125 desret_int(ret_val);
22126 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022127 des_fileoutput(n_filename, filename, 0);
22128 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022129 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022130 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131 xmlResetLastError();
22132 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022133 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022135 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022136 printf(" %d", n_filename);
22137 printf(" %d", n_cur);
22138 printf(" %d", n_encoding);
22139 printf(" %d", n_format);
22140 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022141 }
22142 }
22143 }
22144 }
22145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022146 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022147#endif
22148
Daniel Veillard42595322004-11-08 10:52:06 +000022149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022150}
22151
22152
22153static int
22154test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022156
William M. Brack21e4ef22005-01-02 09:53:13 +000022157#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022158 int mem_base;
22159 int ret_val;
22160 xmlOutputBufferPtr buf; /* an output I/O buffer */
22161 int n_buf;
22162 xmlDocPtr cur; /* the document */
22163 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022164 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022165 int n_encoding;
22166 int format; /* should formatting spaces been added */
22167 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022168
Daniel Veillard3d97e662004-11-04 10:49:00 +000022169 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22170 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22171 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22172 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22173 mem_base = xmlMemBlocks();
22174 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22175 cur = gen_xmlDocPtr(n_cur, 1);
22176 encoding = gen_const_char_ptr(n_encoding, 2);
22177 format = gen_int(n_format, 3);
22178
William M. Brackf13f77f2004-11-12 16:03:48 +000022179 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022180 buf = NULL;
22181 desret_int(ret_val);
22182 call_tests++;
22183 des_xmlOutputBufferPtr(n_buf, buf, 0);
22184 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022185 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022186 des_int(n_format, format, 3);
22187 xmlResetLastError();
22188 if (mem_base != xmlMemBlocks()) {
22189 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022191 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022192 printf(" %d", n_buf);
22193 printf(" %d", n_cur);
22194 printf(" %d", n_encoding);
22195 printf(" %d", n_format);
22196 printf("\n");
22197 }
22198 }
22199 }
22200 }
22201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022202 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022203#endif
22204
Daniel Veillard42595322004-11-08 10:52:06 +000022205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022206}
22207
22208
22209static int
22210test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022212
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022213 int mem_base;
22214 xmlNsPtr ret_val;
22215 xmlDocPtr doc; /* the document */
22216 int n_doc;
22217 xmlNodePtr node; /* the current node */
22218 int n_node;
22219 xmlChar * nameSpace; /* the namespace prefix */
22220 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022221
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022222 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22223 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22224 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22225 mem_base = xmlMemBlocks();
22226 doc = gen_xmlDocPtr(n_doc, 0);
22227 node = gen_xmlNodePtr(n_node, 1);
22228 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22229
William M. Brackf13f77f2004-11-12 16:03:48 +000022230 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022231 desret_xmlNsPtr(ret_val);
22232 call_tests++;
22233 des_xmlDocPtr(n_doc, doc, 0);
22234 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022235 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022236 xmlResetLastError();
22237 if (mem_base != xmlMemBlocks()) {
22238 printf("Leak of %d blocks found in xmlSearchNs",
22239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022240 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022241 printf(" %d", n_doc);
22242 printf(" %d", n_node);
22243 printf(" %d", n_nameSpace);
22244 printf("\n");
22245 }
22246 }
22247 }
22248 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022249 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022250
Daniel Veillard42595322004-11-08 10:52:06 +000022251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022252}
22253
22254
22255static int
22256test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022258
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022259 int mem_base;
22260 xmlNsPtr ret_val;
22261 xmlDocPtr doc; /* the document */
22262 int n_doc;
22263 xmlNodePtr node; /* the current node */
22264 int n_node;
22265 xmlChar * href; /* the namespace value */
22266 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022267
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022268 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22269 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22270 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22271 mem_base = xmlMemBlocks();
22272 doc = gen_xmlDocPtr(n_doc, 0);
22273 node = gen_xmlNodePtr(n_node, 1);
22274 href = gen_const_xmlChar_ptr(n_href, 2);
22275
William M. Brackf13f77f2004-11-12 16:03:48 +000022276 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022277 desret_xmlNsPtr(ret_val);
22278 call_tests++;
22279 des_xmlDocPtr(n_doc, doc, 0);
22280 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022281 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022282 xmlResetLastError();
22283 if (mem_base != xmlMemBlocks()) {
22284 printf("Leak of %d blocks found in xmlSearchNsByHref",
22285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022286 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022287 printf(" %d", n_doc);
22288 printf(" %d", n_node);
22289 printf(" %d", n_href);
22290 printf("\n");
22291 }
22292 }
22293 }
22294 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022295 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022296
Daniel Veillard42595322004-11-08 10:52:06 +000022297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022298}
22299
22300
22301static int
22302test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022304
Daniel Veillard57b25162004-11-06 14:50:18 +000022305 int mem_base;
22306 xmlBufferAllocationScheme scheme; /* allocation method to use */
22307 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022308
Daniel Veillard57b25162004-11-06 14:50:18 +000022309 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22310 mem_base = xmlMemBlocks();
22311 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22312
22313 xmlSetBufferAllocationScheme(scheme);
22314 call_tests++;
22315 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22316 xmlResetLastError();
22317 if (mem_base != xmlMemBlocks()) {
22318 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022320 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022321 printf(" %d", n_scheme);
22322 printf("\n");
22323 }
22324 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022326
Daniel Veillard42595322004-11-08 10:52:06 +000022327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022328}
22329
22330
22331static int
22332test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022334
22335 int mem_base;
22336 int mode; /* the compression ratio */
22337 int n_mode;
22338
22339 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022341 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022342
22343 xmlSetCompressMode(mode);
22344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022345 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022346 xmlResetLastError();
22347 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022348 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022350 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022351 printf(" %d", n_mode);
22352 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022353 }
22354 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022355 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022356
Daniel Veillard42595322004-11-08 10:52:06 +000022357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022358}
22359
22360
22361static int
22362test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022364
22365 int mem_base;
22366 xmlDocPtr doc; /* the document */
22367 int n_doc;
22368 int mode; /* the compression ratio */
22369 int n_mode;
22370
22371 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22372 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022374 doc = gen_xmlDocPtr(n_doc, 0);
22375 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022376
22377 xmlSetDocCompressMode(doc, mode);
22378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022379 des_xmlDocPtr(n_doc, doc, 0);
22380 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022381 xmlResetLastError();
22382 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022383 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022385 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022386 printf(" %d", n_doc);
22387 printf(" %d", n_mode);
22388 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022389 }
22390 }
22391 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022393
Daniel Veillard42595322004-11-08 10:52:06 +000022394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022395}
22396
22397
22398static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022399test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022401
Daniel Veillard27f20102004-11-05 11:50:11 +000022402 int mem_base;
22403 xmlNodePtr node; /* a node in the document */
22404 int n_node;
22405 xmlNsPtr ns; /* a namespace pointer */
22406 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022407
Daniel Veillard27f20102004-11-05 11:50:11 +000022408 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22409 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22410 mem_base = xmlMemBlocks();
22411 node = gen_xmlNodePtr(n_node, 0);
22412 ns = gen_xmlNsPtr(n_ns, 1);
22413
22414 xmlSetNs(node, ns);
22415 call_tests++;
22416 des_xmlNodePtr(n_node, node, 0);
22417 des_xmlNsPtr(n_ns, ns, 1);
22418 xmlResetLastError();
22419 if (mem_base != xmlMemBlocks()) {
22420 printf("Leak of %d blocks found in xmlSetNs",
22421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022422 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022423 printf(" %d", n_node);
22424 printf(" %d", n_ns);
22425 printf("\n");
22426 }
22427 }
22428 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022429 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022430
Daniel Veillard42595322004-11-08 10:52:06 +000022431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022432}
22433
22434
22435static int
22436test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022438
William M. Brack21e4ef22005-01-02 09:53:13 +000022439#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022440 int mem_base;
22441 xmlAttrPtr ret_val;
22442 xmlNodePtr node; /* the node */
22443 int n_node;
22444 xmlNsPtr ns; /* the namespace definition */
22445 int n_ns;
22446 xmlChar * name; /* the attribute name */
22447 int n_name;
22448 xmlChar * value; /* the attribute value */
22449 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022450
Daniel Veillard57b25162004-11-06 14:50:18 +000022451 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22452 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22453 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22454 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22455 mem_base = xmlMemBlocks();
22456 node = gen_xmlNodePtr(n_node, 0);
22457 ns = gen_xmlNsPtr(n_ns, 1);
22458 name = gen_const_xmlChar_ptr(n_name, 2);
22459 value = gen_const_xmlChar_ptr(n_value, 3);
22460
William M. Brackf13f77f2004-11-12 16:03:48 +000022461 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022462 desret_xmlAttrPtr(ret_val);
22463 call_tests++;
22464 des_xmlNodePtr(n_node, node, 0);
22465 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022466 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22467 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022468 xmlResetLastError();
22469 if (mem_base != xmlMemBlocks()) {
22470 printf("Leak of %d blocks found in xmlSetNsProp",
22471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022472 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022473 printf(" %d", n_node);
22474 printf(" %d", n_ns);
22475 printf(" %d", n_name);
22476 printf(" %d", n_value);
22477 printf("\n");
22478 }
22479 }
22480 }
22481 }
22482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022483 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022484#endif
22485
Daniel Veillard42595322004-11-08 10:52:06 +000022486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022487}
22488
22489
22490static int
22491test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022493
William M. Brack21e4ef22005-01-02 09:53:13 +000022494#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022495 int mem_base;
22496 xmlAttrPtr ret_val;
22497 xmlNodePtr node; /* the node */
22498 int n_node;
22499 xmlChar * name; /* the attribute name */
22500 int n_name;
22501 xmlChar * value; /* the attribute value */
22502 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022503
Daniel Veillard57b25162004-11-06 14:50:18 +000022504 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22505 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22506 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22507 mem_base = xmlMemBlocks();
22508 node = gen_xmlNodePtr(n_node, 0);
22509 name = gen_const_xmlChar_ptr(n_name, 1);
22510 value = gen_const_xmlChar_ptr(n_value, 2);
22511
William M. Brackf13f77f2004-11-12 16:03:48 +000022512 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022513 desret_xmlAttrPtr(ret_val);
22514 call_tests++;
22515 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022516 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22517 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022518 xmlResetLastError();
22519 if (mem_base != xmlMemBlocks()) {
22520 printf("Leak of %d blocks found in xmlSetProp",
22521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022522 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022523 printf(" %d", n_node);
22524 printf(" %d", n_name);
22525 printf(" %d", n_value);
22526 printf("\n");
22527 }
22528 }
22529 }
22530 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022531 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022532#endif
22533
Daniel Veillard42595322004-11-08 10:52:06 +000022534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022535}
22536
22537
22538static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022539test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022541
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022542 int mem_base;
22543 xmlChar * ret_val;
22544 xmlChar * name; /* the full QName */
22545 int n_name;
22546 xmlChar ** prefix; /* a xmlChar ** */
22547 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022548
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022549 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22550 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22551 mem_base = xmlMemBlocks();
22552 name = gen_const_xmlChar_ptr(n_name, 0);
22553 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22554
William M. Brackf13f77f2004-11-12 16:03:48 +000022555 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022556 desret_xmlChar_ptr(ret_val);
22557 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022558 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022559 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22560 xmlResetLastError();
22561 if (mem_base != xmlMemBlocks()) {
22562 printf("Leak of %d blocks found in xmlSplitQName2",
22563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022564 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022565 printf(" %d", n_name);
22566 printf(" %d", n_prefix);
22567 printf("\n");
22568 }
22569 }
22570 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022571 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022572
Daniel Veillard42595322004-11-08 10:52:06 +000022573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022574}
22575
22576
22577static int
22578test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022580
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022581 int mem_base;
22582 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022583 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022584 int n_name;
22585 int * len; /* an int * */
22586 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022587
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022588 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22589 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22590 mem_base = xmlMemBlocks();
22591 name = gen_const_xmlChar_ptr(n_name, 0);
22592 len = gen_int_ptr(n_len, 1);
22593
William M. Brackf13f77f2004-11-12 16:03:48 +000022594 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022595 desret_const_xmlChar_ptr(ret_val);
22596 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022597 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022598 des_int_ptr(n_len, len, 1);
22599 xmlResetLastError();
22600 if (mem_base != xmlMemBlocks()) {
22601 printf("Leak of %d blocks found in xmlSplitQName3",
22602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022603 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022604 printf(" %d", n_name);
22605 printf(" %d", n_len);
22606 printf("\n");
22607 }
22608 }
22609 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022610 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022611
Daniel Veillard42595322004-11-08 10:52:06 +000022612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022613}
22614
22615
22616static int
22617test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022619
22620 int mem_base;
22621 xmlNodePtr ret_val;
22622 xmlDocPtr doc; /* the document */
22623 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022624 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022625 int n_value;
22626
22627 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22628 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22629 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022630 doc = gen_xmlDocPtr(n_doc, 0);
22631 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022632
William M. Brackf13f77f2004-11-12 16:03:48 +000022633 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022634 desret_xmlNodePtr(ret_val);
22635 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022636 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022637 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638 xmlResetLastError();
22639 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022640 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022642 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022643 printf(" %d", n_doc);
22644 printf(" %d", n_value);
22645 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022646 }
22647 }
22648 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022649 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022650
Daniel Veillard42595322004-11-08 10:52:06 +000022651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022652}
22653
22654
22655static int
22656test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022658
22659 int mem_base;
22660 xmlNodePtr ret_val;
22661 xmlDocPtr doc; /* the document */
22662 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022663 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022664 int n_value;
22665 int len; /* the length of the string value */
22666 int n_len;
22667
22668 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22669 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22670 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22671 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022672 doc = gen_xmlDocPtr(n_doc, 0);
22673 value = gen_const_xmlChar_ptr(n_value, 1);
22674 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022675
William M. Brackf13f77f2004-11-12 16:03:48 +000022676 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022677 desret_xmlNodePtr(ret_val);
22678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022679 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022680 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022681 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682 xmlResetLastError();
22683 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022684 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022686 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022687 printf(" %d", n_doc);
22688 printf(" %d", n_value);
22689 printf(" %d", n_len);
22690 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022691 }
22692 }
22693 }
22694 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022696
Daniel Veillard42595322004-11-08 10:52:06 +000022697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022698}
22699
22700
22701static int
22702test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022704
22705 int mem_base;
22706 int ret_val;
22707 xmlNodePtr node; /* the node */
22708 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022709 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710 int n_content;
22711 int len; /* @content length */
22712 int n_len;
22713
22714 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22715 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22716 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022718 node = gen_xmlNodePtr(n_node, 0);
22719 content = gen_const_xmlChar_ptr(n_content, 1);
22720 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022721
William M. Brackf13f77f2004-11-12 16:03:48 +000022722 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022723 desret_int(ret_val);
22724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022725 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022726 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022727 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 xmlResetLastError();
22729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022733 printf(" %d", n_node);
22734 printf(" %d", n_content);
22735 printf(" %d", n_len);
22736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022737 }
22738 }
22739 }
22740 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022742
Daniel Veillard42595322004-11-08 10:52:06 +000022743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744}
22745
22746
22747static int
22748test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022750
22751 int mem_base;
22752 xmlNodePtr ret_val;
22753 xmlNodePtr first; /* the first text node */
22754 int n_first;
22755 xmlNodePtr second; /* the second text node being merged */
22756 int n_second;
22757
Daniel Veillarda03e3652004-11-02 18:45:30 +000022758 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22759 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022761 first = gen_xmlNodePtr_in(n_first, 0);
22762 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022763
22764 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022765 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022766 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022767 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022768 desret_xmlNodePtr(ret_val);
22769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022770 des_xmlNodePtr_in(n_first, first, 0);
22771 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022772 xmlResetLastError();
22773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022774 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022777 printf(" %d", n_first);
22778 printf(" %d", n_second);
22779 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022780 }
22781 }
22782 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022783 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022784
Daniel Veillard42595322004-11-08 10:52:06 +000022785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022786}
22787
22788
22789static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022790test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022792
William M. Brack21e4ef22005-01-02 09:53:13 +000022793#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022794 int mem_base;
22795 int ret_val;
22796 xmlNodePtr node; /* the node */
22797 int n_node;
22798 xmlNsPtr ns; /* the namespace definition */
22799 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022800 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022801 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022802
Daniel Veillard27f20102004-11-05 11:50:11 +000022803 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22804 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22805 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22806 mem_base = xmlMemBlocks();
22807 node = gen_xmlNodePtr(n_node, 0);
22808 ns = gen_xmlNsPtr(n_ns, 1);
22809 name = gen_const_xmlChar_ptr(n_name, 2);
22810
William M. Brackf13f77f2004-11-12 16:03:48 +000022811 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022812 desret_int(ret_val);
22813 call_tests++;
22814 des_xmlNodePtr(n_node, node, 0);
22815 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022816 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022817 xmlResetLastError();
22818 if (mem_base != xmlMemBlocks()) {
22819 printf("Leak of %d blocks found in xmlUnsetNsProp",
22820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022821 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022822 printf(" %d", n_node);
22823 printf(" %d", n_ns);
22824 printf(" %d", n_name);
22825 printf("\n");
22826 }
22827 }
22828 }
22829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022830 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022831#endif
22832
Daniel Veillard42595322004-11-08 10:52:06 +000022833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022834}
22835
22836
22837static int
22838test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022840
William M. Brack21e4ef22005-01-02 09:53:13 +000022841#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022842 int mem_base;
22843 int ret_val;
22844 xmlNodePtr node; /* the node */
22845 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022846 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022847 int n_name;
22848
22849 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22850 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022852 node = gen_xmlNodePtr(n_node, 0);
22853 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022854
William M. Brackf13f77f2004-11-12 16:03:48 +000022855 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022856 desret_int(ret_val);
22857 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022858 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022859 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022860 xmlResetLastError();
22861 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022862 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022864 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022865 printf(" %d", n_node);
22866 printf(" %d", n_name);
22867 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022868 }
22869 }
22870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022871 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022872#endif
22873
Daniel Veillard42595322004-11-08 10:52:06 +000022874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022875}
22876
22877
22878static int
22879test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022881
William M. Brack21e4ef22005-01-02 09:53:13 +000022882#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022883#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022884 int mem_base;
22885 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022886 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022887 int n_value;
22888 int space; /* allow spaces in front and end of the string */
22889 int n_space;
22890
22891 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22892 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022894 value = gen_const_xmlChar_ptr(n_value, 0);
22895 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022896
William M. Brackf13f77f2004-11-12 16:03:48 +000022897 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022898 desret_int(ret_val);
22899 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022900 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022901 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022902 xmlResetLastError();
22903 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022904 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022906 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022907 printf(" %d", n_value);
22908 printf(" %d", n_space);
22909 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022910 }
22911 }
22912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022913 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022914#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022915#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022916
Daniel Veillard42595322004-11-08 10:52:06 +000022917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022918}
22919
22920
22921static int
22922test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022924
William M. Brack21e4ef22005-01-02 09:53:13 +000022925#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022926#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022927 int mem_base;
22928 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022929 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022930 int n_value;
22931 int space; /* allow spaces in front and end of the string */
22932 int n_space;
22933
22934 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22935 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022937 value = gen_const_xmlChar_ptr(n_value, 0);
22938 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022939
William M. Brackf13f77f2004-11-12 16:03:48 +000022940 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022941 desret_int(ret_val);
22942 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022943 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022944 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022945 xmlResetLastError();
22946 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022947 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022949 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022950 printf(" %d", n_value);
22951 printf(" %d", n_space);
22952 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022953 }
22954 }
22955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022956 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022957#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022958#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022959
Daniel Veillard42595322004-11-08 10:52:06 +000022960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022961}
22962
22963
22964static int
22965test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022967
William M. Brack21e4ef22005-01-02 09:53:13 +000022968#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022969#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022970 int mem_base;
22971 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022972 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022973 int n_value;
22974 int space; /* allow spaces in front and end of the string */
22975 int n_space;
22976
22977 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22978 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22979 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022980 value = gen_const_xmlChar_ptr(n_value, 0);
22981 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022982
William M. Brackf13f77f2004-11-12 16:03:48 +000022983 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022984 desret_int(ret_val);
22985 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022986 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022987 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022988 xmlResetLastError();
22989 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022990 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022992 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022993 printf(" %d", n_value);
22994 printf(" %d", n_space);
22995 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022996 }
22997 }
22998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022999 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023000#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023001#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023002
Daniel Veillard42595322004-11-08 10:52:06 +000023003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023004}
23005
23006
23007static int
23008test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023010
William M. Brack21e4ef22005-01-02 09:53:13 +000023011#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023012#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023013 int mem_base;
23014 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023015 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023016 int n_value;
23017 int space; /* allow spaces in front and end of the string */
23018 int n_space;
23019
23020 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23021 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23022 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023023 value = gen_const_xmlChar_ptr(n_value, 0);
23024 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023025
William M. Brackf13f77f2004-11-12 16:03:48 +000023026 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023027 desret_int(ret_val);
23028 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023029 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023030 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023031 xmlResetLastError();
23032 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023033 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023035 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023036 printf(" %d", n_value);
23037 printf(" %d", n_space);
23038 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023039 }
23040 }
23041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023042 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023043#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023044#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023045
Daniel Veillard42595322004-11-08 10:52:06 +000023046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023047}
23048
23049static int
23050test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023052
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023053 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023054 test_ret += test_xmlAddChild();
23055 test_ret += test_xmlAddChildList();
23056 test_ret += test_xmlAddNextSibling();
23057 test_ret += test_xmlAddPrevSibling();
23058 test_ret += test_xmlAddSibling();
23059 test_ret += test_xmlAttrSerializeTxtContent();
23060 test_ret += test_xmlBufferAdd();
23061 test_ret += test_xmlBufferAddHead();
23062 test_ret += test_xmlBufferCCat();
23063 test_ret += test_xmlBufferCat();
23064 test_ret += test_xmlBufferContent();
23065 test_ret += test_xmlBufferCreate();
23066 test_ret += test_xmlBufferCreateSize();
23067 test_ret += test_xmlBufferCreateStatic();
23068 test_ret += test_xmlBufferEmpty();
23069 test_ret += test_xmlBufferGrow();
23070 test_ret += test_xmlBufferLength();
23071 test_ret += test_xmlBufferResize();
23072 test_ret += test_xmlBufferSetAllocationScheme();
23073 test_ret += test_xmlBufferShrink();
23074 test_ret += test_xmlBufferWriteCHAR();
23075 test_ret += test_xmlBufferWriteChar();
23076 test_ret += test_xmlBufferWriteQuotedString();
23077 test_ret += test_xmlBuildQName();
23078 test_ret += test_xmlCopyDoc();
23079 test_ret += test_xmlCopyDtd();
23080 test_ret += test_xmlCopyNamespace();
23081 test_ret += test_xmlCopyNamespaceList();
23082 test_ret += test_xmlCopyNode();
23083 test_ret += test_xmlCopyNodeList();
23084 test_ret += test_xmlCopyProp();
23085 test_ret += test_xmlCopyPropList();
23086 test_ret += test_xmlCreateIntSubset();
23087 test_ret += test_xmlDocCopyNode();
23088 test_ret += test_xmlDocCopyNodeList();
23089 test_ret += test_xmlDocDump();
23090 test_ret += test_xmlDocDumpFormatMemory();
23091 test_ret += test_xmlDocDumpFormatMemoryEnc();
23092 test_ret += test_xmlDocDumpMemory();
23093 test_ret += test_xmlDocDumpMemoryEnc();
23094 test_ret += test_xmlDocFormatDump();
23095 test_ret += test_xmlDocGetRootElement();
23096 test_ret += test_xmlDocSetRootElement();
23097 test_ret += test_xmlElemDump();
23098 test_ret += test_xmlGetBufferAllocationScheme();
23099 test_ret += test_xmlGetCompressMode();
23100 test_ret += test_xmlGetDocCompressMode();
23101 test_ret += test_xmlGetIntSubset();
23102 test_ret += test_xmlGetLastChild();
23103 test_ret += test_xmlGetLineNo();
23104 test_ret += test_xmlGetNoNsProp();
23105 test_ret += test_xmlGetNodePath();
23106 test_ret += test_xmlGetNsList();
23107 test_ret += test_xmlGetNsProp();
23108 test_ret += test_xmlGetProp();
23109 test_ret += test_xmlHasNsProp();
23110 test_ret += test_xmlHasProp();
23111 test_ret += test_xmlIsBlankNode();
23112 test_ret += test_xmlIsXHTML();
23113 test_ret += test_xmlNewCDataBlock();
23114 test_ret += test_xmlNewCharRef();
23115 test_ret += test_xmlNewChild();
23116 test_ret += test_xmlNewComment();
23117 test_ret += test_xmlNewDoc();
23118 test_ret += test_xmlNewDocComment();
23119 test_ret += test_xmlNewDocFragment();
23120 test_ret += test_xmlNewDocNode();
23121 test_ret += test_xmlNewDocNodeEatName();
23122 test_ret += test_xmlNewDocPI();
23123 test_ret += test_xmlNewDocProp();
23124 test_ret += test_xmlNewDocRawNode();
23125 test_ret += test_xmlNewDocText();
23126 test_ret += test_xmlNewDocTextLen();
23127 test_ret += test_xmlNewDtd();
23128 test_ret += test_xmlNewNode();
23129 test_ret += test_xmlNewNodeEatName();
23130 test_ret += test_xmlNewNs();
23131 test_ret += test_xmlNewNsProp();
23132 test_ret += test_xmlNewNsPropEatName();
23133 test_ret += test_xmlNewPI();
23134 test_ret += test_xmlNewProp();
23135 test_ret += test_xmlNewReference();
23136 test_ret += test_xmlNewText();
23137 test_ret += test_xmlNewTextChild();
23138 test_ret += test_xmlNewTextLen();
23139 test_ret += test_xmlNodeAddContent();
23140 test_ret += test_xmlNodeAddContentLen();
23141 test_ret += test_xmlNodeBufGetContent();
23142 test_ret += test_xmlNodeDump();
23143 test_ret += test_xmlNodeDumpOutput();
23144 test_ret += test_xmlNodeGetBase();
23145 test_ret += test_xmlNodeGetContent();
23146 test_ret += test_xmlNodeGetLang();
23147 test_ret += test_xmlNodeGetSpacePreserve();
23148 test_ret += test_xmlNodeIsText();
23149 test_ret += test_xmlNodeListGetRawString();
23150 test_ret += test_xmlNodeListGetString();
23151 test_ret += test_xmlNodeSetBase();
23152 test_ret += test_xmlNodeSetContent();
23153 test_ret += test_xmlNodeSetContentLen();
23154 test_ret += test_xmlNodeSetLang();
23155 test_ret += test_xmlNodeSetName();
23156 test_ret += test_xmlNodeSetSpacePreserve();
23157 test_ret += test_xmlReconciliateNs();
23158 test_ret += test_xmlRemoveProp();
23159 test_ret += test_xmlReplaceNode();
23160 test_ret += test_xmlSaveFile();
23161 test_ret += test_xmlSaveFileEnc();
23162 test_ret += test_xmlSaveFileTo();
23163 test_ret += test_xmlSaveFormatFile();
23164 test_ret += test_xmlSaveFormatFileEnc();
23165 test_ret += test_xmlSaveFormatFileTo();
23166 test_ret += test_xmlSearchNs();
23167 test_ret += test_xmlSearchNsByHref();
23168 test_ret += test_xmlSetBufferAllocationScheme();
23169 test_ret += test_xmlSetCompressMode();
23170 test_ret += test_xmlSetDocCompressMode();
23171 test_ret += test_xmlSetNs();
23172 test_ret += test_xmlSetNsProp();
23173 test_ret += test_xmlSetProp();
23174 test_ret += test_xmlSplitQName2();
23175 test_ret += test_xmlSplitQName3();
23176 test_ret += test_xmlStringGetNodeList();
23177 test_ret += test_xmlStringLenGetNodeList();
23178 test_ret += test_xmlTextConcat();
23179 test_ret += test_xmlTextMerge();
23180 test_ret += test_xmlUnsetNsProp();
23181 test_ret += test_xmlUnsetProp();
23182 test_ret += test_xmlValidateNCName();
23183 test_ret += test_xmlValidateNMToken();
23184 test_ret += test_xmlValidateName();
23185 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023186
Daniel Veillard42595322004-11-08 10:52:06 +000023187 if (test_ret != 0)
23188 printf("Module tree: %d errors\n", test_ret);
23189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023190}
23191
23192static int
23193test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023195
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023196 int mem_base;
23197 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023198 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023199 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023200 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023201 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023202
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023203 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23204 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23205 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023206 URI = gen_const_xmlChar_ptr(n_URI, 0);
23207 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023208
William M. Brackf13f77f2004-11-12 16:03:48 +000023209 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023210 desret_xmlChar_ptr(ret_val);
23211 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023212 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23213 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023214 xmlResetLastError();
23215 if (mem_base != xmlMemBlocks()) {
23216 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023218 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023219 printf(" %d", n_URI);
23220 printf(" %d", n_base);
23221 printf("\n");
23222 }
23223 }
23224 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023225 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023226
Daniel Veillard42595322004-11-08 10:52:06 +000023227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023228}
23229
23230
23231static int
23232test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023234
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023235 int mem_base;
23236 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023237 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023238 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023239 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023240 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023241
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023242 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23243 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023245 URI = gen_const_xmlChar_ptr(n_URI, 0);
23246 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023247
William M. Brackf13f77f2004-11-12 16:03:48 +000023248 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023249 desret_xmlChar_ptr(ret_val);
23250 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023251 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23252 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023253 xmlResetLastError();
23254 if (mem_base != xmlMemBlocks()) {
23255 printf("Leak of %d blocks found in xmlBuildURI",
23256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023257 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023258 printf(" %d", n_URI);
23259 printf(" %d", n_base);
23260 printf("\n");
23261 }
23262 }
23263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023265
Daniel Veillard42595322004-11-08 10:52:06 +000023266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023267}
23268
23269
23270static int
23271test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023273
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023274 int mem_base;
23275 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023276 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023277 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023278
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023279 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023281 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023282
William M. Brackf13f77f2004-11-12 16:03:48 +000023283 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023284 desret_xmlChar_ptr(ret_val);
23285 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023286 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023287 xmlResetLastError();
23288 if (mem_base != xmlMemBlocks()) {
23289 printf("Leak of %d blocks found in xmlCanonicPath",
23290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023291 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023292 printf(" %d", n_path);
23293 printf("\n");
23294 }
23295 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023296 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023297
Daniel Veillard42595322004-11-08 10:52:06 +000023298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023299}
23300
23301
23302static int
23303test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023305
23306
23307 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023309}
23310
23311
23312static int
23313test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023315
Daniel Veillardce682bc2004-11-05 17:22:25 +000023316 int mem_base;
23317 int ret_val;
23318 char * path; /* pointer to the path string */
23319 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023320
Daniel Veillardce682bc2004-11-05 17:22:25 +000023321 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23322 mem_base = xmlMemBlocks();
23323 path = gen_char_ptr(n_path, 0);
23324
23325 ret_val = xmlNormalizeURIPath(path);
23326 desret_int(ret_val);
23327 call_tests++;
23328 des_char_ptr(n_path, path, 0);
23329 xmlResetLastError();
23330 if (mem_base != xmlMemBlocks()) {
23331 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023333 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023334 printf(" %d", n_path);
23335 printf("\n");
23336 }
23337 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023339
Daniel Veillard42595322004-11-08 10:52:06 +000023340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023341}
23342
23343
23344static int
23345test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023347
23348
23349 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023351}
23352
23353
Daniel Veillardce682bc2004-11-05 17:22:25 +000023354#define gen_nb_xmlURIPtr 1
23355static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23356 return(NULL);
23357}
23358static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23359}
23360
Daniel Veillardd93f6252004-11-02 15:53:51 +000023361static int
23362test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023364
Daniel Veillardce682bc2004-11-05 17:22:25 +000023365 int mem_base;
23366 int ret_val;
23367 xmlURIPtr uri; /* pointer to an URI structure */
23368 int n_uri;
23369 char * str; /* the string to analyze */
23370 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023371
Daniel Veillardce682bc2004-11-05 17:22:25 +000023372 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23373 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23374 mem_base = xmlMemBlocks();
23375 uri = gen_xmlURIPtr(n_uri, 0);
23376 str = gen_const_char_ptr(n_str, 1);
23377
William M. Brackf13f77f2004-11-12 16:03:48 +000023378 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023379 desret_int(ret_val);
23380 call_tests++;
23381 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023382 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023383 xmlResetLastError();
23384 if (mem_base != xmlMemBlocks()) {
23385 printf("Leak of %d blocks found in xmlParseURIReference",
23386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023387 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023388 printf(" %d", n_uri);
23389 printf(" %d", n_str);
23390 printf("\n");
23391 }
23392 }
23393 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023395
Daniel Veillard42595322004-11-08 10:52:06 +000023396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023397}
23398
23399
23400static int
23401test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023403
Daniel Veillardce682bc2004-11-05 17:22:25 +000023404 int mem_base;
23405 FILE * stream; /* a FILE* for the output */
23406 int n_stream;
23407 xmlURIPtr uri; /* pointer to an xmlURI */
23408 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023409
Daniel Veillardce682bc2004-11-05 17:22:25 +000023410 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23411 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23412 mem_base = xmlMemBlocks();
23413 stream = gen_FILE_ptr(n_stream, 0);
23414 uri = gen_xmlURIPtr(n_uri, 1);
23415
23416 xmlPrintURI(stream, uri);
23417 call_tests++;
23418 des_FILE_ptr(n_stream, stream, 0);
23419 des_xmlURIPtr(n_uri, uri, 1);
23420 xmlResetLastError();
23421 if (mem_base != xmlMemBlocks()) {
23422 printf("Leak of %d blocks found in xmlPrintURI",
23423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023424 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023425 printf(" %d", n_stream);
23426 printf(" %d", n_uri);
23427 printf("\n");
23428 }
23429 }
23430 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023431 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023432
Daniel Veillard42595322004-11-08 10:52:06 +000023433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023434}
23435
23436
23437static int
23438test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023440
Daniel Veillardce682bc2004-11-05 17:22:25 +000023441 int mem_base;
23442 xmlChar * ret_val;
23443 xmlURIPtr uri; /* pointer to an xmlURI */
23444 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023445
Daniel Veillardce682bc2004-11-05 17:22:25 +000023446 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23447 mem_base = xmlMemBlocks();
23448 uri = gen_xmlURIPtr(n_uri, 0);
23449
23450 ret_val = xmlSaveUri(uri);
23451 desret_xmlChar_ptr(ret_val);
23452 call_tests++;
23453 des_xmlURIPtr(n_uri, uri, 0);
23454 xmlResetLastError();
23455 if (mem_base != xmlMemBlocks()) {
23456 printf("Leak of %d blocks found in xmlSaveUri",
23457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023458 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023459 printf(" %d", n_uri);
23460 printf("\n");
23461 }
23462 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023463 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023464
Daniel Veillard42595322004-11-08 10:52:06 +000023465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023466}
23467
23468
23469static int
23470test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023472
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023473 int mem_base;
23474 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023475 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023476 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023477
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023478 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023480 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023481
William M. Brackf13f77f2004-11-12 16:03:48 +000023482 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023483 desret_xmlChar_ptr(ret_val);
23484 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023485 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023486 xmlResetLastError();
23487 if (mem_base != xmlMemBlocks()) {
23488 printf("Leak of %d blocks found in xmlURIEscape",
23489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023490 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023491 printf(" %d", n_str);
23492 printf("\n");
23493 }
23494 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023495 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023496
Daniel Veillard42595322004-11-08 10:52:06 +000023497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023498}
23499
23500
23501static int
23502test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023504
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023505 int mem_base;
23506 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023507 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023508 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023509 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023510 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023511
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023512 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23513 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023515 str = gen_const_xmlChar_ptr(n_str, 0);
23516 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023517
William M. Brackf13f77f2004-11-12 16:03:48 +000023518 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023519 desret_xmlChar_ptr(ret_val);
23520 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023521 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23522 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023523 xmlResetLastError();
23524 if (mem_base != xmlMemBlocks()) {
23525 printf("Leak of %d blocks found in xmlURIEscapeStr",
23526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023527 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023528 printf(" %d", n_str);
23529 printf(" %d", n_list);
23530 printf("\n");
23531 }
23532 }
23533 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023534 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023535
Daniel Veillard42595322004-11-08 10:52:06 +000023536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023537}
23538
23539
23540static int
23541test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023543
23544
23545 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023547}
23548
23549static int
23550test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023552
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023553 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023554 test_ret += test_xmlBuildRelativeURI();
23555 test_ret += test_xmlBuildURI();
23556 test_ret += test_xmlCanonicPath();
23557 test_ret += test_xmlCreateURI();
23558 test_ret += test_xmlNormalizeURIPath();
23559 test_ret += test_xmlParseURI();
23560 test_ret += test_xmlParseURIReference();
23561 test_ret += test_xmlPrintURI();
23562 test_ret += test_xmlSaveUri();
23563 test_ret += test_xmlURIEscape();
23564 test_ret += test_xmlURIEscapeStr();
23565 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023566
Daniel Veillard42595322004-11-08 10:52:06 +000023567 if (test_ret != 0)
23568 printf("Module uri: %d errors\n", test_ret);
23569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023570}
23571
23572static int
23573test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023575
Daniel Veillard42595322004-11-08 10:52:06 +000023576 int mem_base;
23577 xmlAttributePtr ret_val;
23578 xmlValidCtxtPtr ctxt; /* the validation context */
23579 int n_ctxt;
23580 xmlDtdPtr dtd; /* pointer to the DTD */
23581 int n_dtd;
23582 xmlChar * elem; /* the element name */
23583 int n_elem;
23584 xmlChar * name; /* the attribute name */
23585 int n_name;
23586 xmlChar * ns; /* the attribute namespace prefix */
23587 int n_ns;
23588 xmlAttributeType type; /* the attribute type */
23589 int n_type;
23590 xmlAttributeDefault def; /* the attribute default type */
23591 int n_def;
23592 xmlChar * defaultValue; /* the attribute default value */
23593 int n_defaultValue;
23594 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23595 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023596
Daniel Veillard42595322004-11-08 10:52:06 +000023597 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23598 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23599 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23600 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23601 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23602 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23603 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23604 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23605 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23606 mem_base = xmlMemBlocks();
23607 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23608 dtd = gen_xmlDtdPtr(n_dtd, 1);
23609 elem = gen_const_xmlChar_ptr(n_elem, 2);
23610 name = gen_const_xmlChar_ptr(n_name, 3);
23611 ns = gen_const_xmlChar_ptr(n_ns, 4);
23612 type = gen_xmlAttributeType(n_type, 5);
23613 def = gen_xmlAttributeDefault(n_def, 6);
23614 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23615 tree = gen_xmlEnumerationPtr(n_tree, 8);
23616
William M. Brackf13f77f2004-11-12 16:03:48 +000023617 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 +000023618 desret_xmlAttributePtr(ret_val);
23619 call_tests++;
23620 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23621 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023622 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23623 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23624 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023625 des_xmlAttributeType(n_type, type, 5);
23626 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023627 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023628 des_xmlEnumerationPtr(n_tree, tree, 8);
23629 xmlResetLastError();
23630 if (mem_base != xmlMemBlocks()) {
23631 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23632 xmlMemBlocks() - mem_base);
23633 test_ret++;
23634 printf(" %d", n_ctxt);
23635 printf(" %d", n_dtd);
23636 printf(" %d", n_elem);
23637 printf(" %d", n_name);
23638 printf(" %d", n_ns);
23639 printf(" %d", n_type);
23640 printf(" %d", n_def);
23641 printf(" %d", n_defaultValue);
23642 printf(" %d", n_tree);
23643 printf("\n");
23644 }
23645 }
23646 }
23647 }
23648 }
23649 }
23650 }
23651 }
23652 }
23653 }
Daniel Veillard42595322004-11-08 10:52:06 +000023654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023655
Daniel Veillard42595322004-11-08 10:52:06 +000023656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023657}
23658
23659
23660static int
23661test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023663
Daniel Veillard42595322004-11-08 10:52:06 +000023664 int mem_base;
23665 xmlElementPtr ret_val;
23666 xmlValidCtxtPtr ctxt; /* the validation context */
23667 int n_ctxt;
23668 xmlDtdPtr dtd; /* pointer to the DTD */
23669 int n_dtd;
23670 xmlChar * name; /* the entity name */
23671 int n_name;
23672 xmlElementTypeVal type; /* the element type */
23673 int n_type;
23674 xmlElementContentPtr content; /* the element content tree or NULL */
23675 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023676
Daniel Veillard42595322004-11-08 10:52:06 +000023677 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23678 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23679 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23680 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23681 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23682 mem_base = xmlMemBlocks();
23683 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23684 dtd = gen_xmlDtdPtr(n_dtd, 1);
23685 name = gen_const_xmlChar_ptr(n_name, 2);
23686 type = gen_xmlElementTypeVal(n_type, 3);
23687 content = gen_xmlElementContentPtr(n_content, 4);
23688
William M. Brackf13f77f2004-11-12 16:03:48 +000023689 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023690 desret_xmlElementPtr(ret_val);
23691 call_tests++;
23692 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23693 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023694 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023695 des_xmlElementTypeVal(n_type, type, 3);
23696 des_xmlElementContentPtr(n_content, content, 4);
23697 xmlResetLastError();
23698 if (mem_base != xmlMemBlocks()) {
23699 printf("Leak of %d blocks found in xmlAddElementDecl",
23700 xmlMemBlocks() - mem_base);
23701 test_ret++;
23702 printf(" %d", n_ctxt);
23703 printf(" %d", n_dtd);
23704 printf(" %d", n_name);
23705 printf(" %d", n_type);
23706 printf(" %d", n_content);
23707 printf("\n");
23708 }
23709 }
23710 }
23711 }
23712 }
23713 }
Daniel Veillard42595322004-11-08 10:52:06 +000023714 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023715
Daniel Veillard42595322004-11-08 10:52:06 +000023716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023717}
23718
23719
23720static int
23721test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023723
23724
23725 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023727}
23728
23729
23730static int
23731test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023733
23734
23735 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023737}
23738
23739
23740static int
23741test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023743
23744
23745 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023747}
23748
23749
Daniel Veillardce682bc2004-11-05 17:22:25 +000023750#define gen_nb_xmlAttributeTablePtr 1
23751static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23752 return(NULL);
23753}
23754static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23755}
23756
Daniel Veillardd93f6252004-11-02 15:53:51 +000023757static int
23758test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023760
23761
23762 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023764}
23765
23766
23767static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023768test_xmlCopyDocElementContent(void) {
23769 int test_ret = 0;
23770
23771 int mem_base;
23772 xmlElementContentPtr ret_val;
23773 xmlDocPtr doc; /* the document owning the element declaration */
23774 int n_doc;
23775 xmlElementContentPtr cur; /* An element content pointer. */
23776 int n_cur;
23777
23778 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23779 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23780 mem_base = xmlMemBlocks();
23781 doc = gen_xmlDocPtr(n_doc, 0);
23782 cur = gen_xmlElementContentPtr(n_cur, 1);
23783
23784 ret_val = xmlCopyDocElementContent(doc, cur);
23785 desret_xmlElementContentPtr(ret_val);
23786 call_tests++;
23787 des_xmlDocPtr(n_doc, doc, 0);
23788 des_xmlElementContentPtr(n_cur, cur, 1);
23789 xmlResetLastError();
23790 if (mem_base != xmlMemBlocks()) {
23791 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23792 xmlMemBlocks() - mem_base);
23793 test_ret++;
23794 printf(" %d", n_doc);
23795 printf(" %d", n_cur);
23796 printf("\n");
23797 }
23798 }
23799 }
23800 function_tests++;
23801
23802 return(test_ret);
23803}
23804
23805
23806static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023807test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023809
William M. Brack094dd862004-11-14 14:28:34 +000023810 int mem_base;
23811 xmlElementContentPtr ret_val;
23812 xmlElementContentPtr cur; /* An element content pointer. */
23813 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023814
William M. Brack094dd862004-11-14 14:28:34 +000023815 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23816 mem_base = xmlMemBlocks();
23817 cur = gen_xmlElementContentPtr(n_cur, 0);
23818
23819 ret_val = xmlCopyElementContent(cur);
23820 desret_xmlElementContentPtr(ret_val);
23821 call_tests++;
23822 des_xmlElementContentPtr(n_cur, cur, 0);
23823 xmlResetLastError();
23824 if (mem_base != xmlMemBlocks()) {
23825 printf("Leak of %d blocks found in xmlCopyElementContent",
23826 xmlMemBlocks() - mem_base);
23827 test_ret++;
23828 printf(" %d", n_cur);
23829 printf("\n");
23830 }
23831 }
23832 function_tests++;
23833
Daniel Veillard42595322004-11-08 10:52:06 +000023834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023835}
23836
23837
Daniel Veillardce682bc2004-11-05 17:22:25 +000023838#define gen_nb_xmlElementTablePtr 1
23839static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23840 return(NULL);
23841}
23842static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23843}
23844
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845static int
23846test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848
23849
23850 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023852}
23853
23854
23855static int
23856test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023858
23859
23860 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023862}
23863
23864
Daniel Veillardce682bc2004-11-05 17:22:25 +000023865#define gen_nb_xmlNotationTablePtr 1
23866static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23867 return(NULL);
23868}
23869static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23870}
23871
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872static int
23873test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023875
23876
23877 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023879}
23880
23881
23882static int
23883test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023885
23886
23887 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023889}
23890
23891
Daniel Veillardce682bc2004-11-05 17:22:25 +000023892#define gen_nb_xmlAttributePtr 1
23893static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23894 return(NULL);
23895}
23896static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23897}
23898
Daniel Veillardd93f6252004-11-02 15:53:51 +000023899static int
23900test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023902
William M. Brack21e4ef22005-01-02 09:53:13 +000023903#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023904 int mem_base;
23905 xmlBufferPtr buf; /* the XML buffer output */
23906 int n_buf;
23907 xmlAttributePtr attr; /* An attribute declaration */
23908 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023909
Daniel Veillardce682bc2004-11-05 17:22:25 +000023910 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23911 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23912 mem_base = xmlMemBlocks();
23913 buf = gen_xmlBufferPtr(n_buf, 0);
23914 attr = gen_xmlAttributePtr(n_attr, 1);
23915
23916 xmlDumpAttributeDecl(buf, attr);
23917 call_tests++;
23918 des_xmlBufferPtr(n_buf, buf, 0);
23919 des_xmlAttributePtr(n_attr, attr, 1);
23920 xmlResetLastError();
23921 if (mem_base != xmlMemBlocks()) {
23922 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023924 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023925 printf(" %d", n_buf);
23926 printf(" %d", n_attr);
23927 printf("\n");
23928 }
23929 }
23930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023931 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023932#endif
23933
Daniel Veillard42595322004-11-08 10:52:06 +000023934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023935}
23936
23937
23938static int
23939test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023941
William M. Brack21e4ef22005-01-02 09:53:13 +000023942#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023943 int mem_base;
23944 xmlBufferPtr buf; /* the XML buffer output */
23945 int n_buf;
23946 xmlAttributeTablePtr table; /* An attribute table */
23947 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023948
Daniel Veillardce682bc2004-11-05 17:22:25 +000023949 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23950 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23951 mem_base = xmlMemBlocks();
23952 buf = gen_xmlBufferPtr(n_buf, 0);
23953 table = gen_xmlAttributeTablePtr(n_table, 1);
23954
23955 xmlDumpAttributeTable(buf, table);
23956 call_tests++;
23957 des_xmlBufferPtr(n_buf, buf, 0);
23958 des_xmlAttributeTablePtr(n_table, table, 1);
23959 xmlResetLastError();
23960 if (mem_base != xmlMemBlocks()) {
23961 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023963 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023964 printf(" %d", n_buf);
23965 printf(" %d", n_table);
23966 printf("\n");
23967 }
23968 }
23969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023970 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023971#endif
23972
Daniel Veillard42595322004-11-08 10:52:06 +000023973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023974}
23975
23976
Daniel Veillardce682bc2004-11-05 17:22:25 +000023977#define gen_nb_xmlElementPtr 1
23978static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23979 return(NULL);
23980}
23981static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23982}
23983
Daniel Veillardd93f6252004-11-02 15:53:51 +000023984static int
23985test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023987
William M. Brack21e4ef22005-01-02 09:53:13 +000023988#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023989 int mem_base;
23990 xmlBufferPtr buf; /* the XML buffer output */
23991 int n_buf;
23992 xmlElementPtr elem; /* An element table */
23993 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023994
Daniel Veillardce682bc2004-11-05 17:22:25 +000023995 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23996 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23997 mem_base = xmlMemBlocks();
23998 buf = gen_xmlBufferPtr(n_buf, 0);
23999 elem = gen_xmlElementPtr(n_elem, 1);
24000
24001 xmlDumpElementDecl(buf, elem);
24002 call_tests++;
24003 des_xmlBufferPtr(n_buf, buf, 0);
24004 des_xmlElementPtr(n_elem, elem, 1);
24005 xmlResetLastError();
24006 if (mem_base != xmlMemBlocks()) {
24007 printf("Leak of %d blocks found in xmlDumpElementDecl",
24008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024009 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024010 printf(" %d", n_buf);
24011 printf(" %d", n_elem);
24012 printf("\n");
24013 }
24014 }
24015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024016 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024017#endif
24018
Daniel Veillard42595322004-11-08 10:52:06 +000024019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024020}
24021
24022
24023static int
24024test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024026
William M. Brack21e4ef22005-01-02 09:53:13 +000024027#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024028 int mem_base;
24029 xmlBufferPtr buf; /* the XML buffer output */
24030 int n_buf;
24031 xmlElementTablePtr table; /* An element table */
24032 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024033
Daniel Veillardce682bc2004-11-05 17:22:25 +000024034 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24035 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24036 mem_base = xmlMemBlocks();
24037 buf = gen_xmlBufferPtr(n_buf, 0);
24038 table = gen_xmlElementTablePtr(n_table, 1);
24039
24040 xmlDumpElementTable(buf, table);
24041 call_tests++;
24042 des_xmlBufferPtr(n_buf, buf, 0);
24043 des_xmlElementTablePtr(n_table, table, 1);
24044 xmlResetLastError();
24045 if (mem_base != xmlMemBlocks()) {
24046 printf("Leak of %d blocks found in xmlDumpElementTable",
24047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024048 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024049 printf(" %d", n_buf);
24050 printf(" %d", n_table);
24051 printf("\n");
24052 }
24053 }
24054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024055 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024056#endif
24057
Daniel Veillard42595322004-11-08 10:52:06 +000024058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024059}
24060
24061
Daniel Veillardce682bc2004-11-05 17:22:25 +000024062#define gen_nb_xmlNotationPtr 1
24063static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24064 return(NULL);
24065}
24066static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24067}
24068
Daniel Veillardd93f6252004-11-02 15:53:51 +000024069static int
24070test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024072
William M. Brack21e4ef22005-01-02 09:53:13 +000024073#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024074 int mem_base;
24075 xmlBufferPtr buf; /* the XML buffer output */
24076 int n_buf;
24077 xmlNotationPtr nota; /* A notation declaration */
24078 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024079
Daniel Veillardce682bc2004-11-05 17:22:25 +000024080 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24081 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24082 mem_base = xmlMemBlocks();
24083 buf = gen_xmlBufferPtr(n_buf, 0);
24084 nota = gen_xmlNotationPtr(n_nota, 1);
24085
24086 xmlDumpNotationDecl(buf, nota);
24087 call_tests++;
24088 des_xmlBufferPtr(n_buf, buf, 0);
24089 des_xmlNotationPtr(n_nota, nota, 1);
24090 xmlResetLastError();
24091 if (mem_base != xmlMemBlocks()) {
24092 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024094 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024095 printf(" %d", n_buf);
24096 printf(" %d", n_nota);
24097 printf("\n");
24098 }
24099 }
24100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024101 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024102#endif
24103
Daniel Veillard42595322004-11-08 10:52:06 +000024104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024105}
24106
24107
24108static int
24109test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024111
William M. Brack21e4ef22005-01-02 09:53:13 +000024112#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024113 int mem_base;
24114 xmlBufferPtr buf; /* the XML buffer output */
24115 int n_buf;
24116 xmlNotationTablePtr table; /* A notation table */
24117 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024118
Daniel Veillardce682bc2004-11-05 17:22:25 +000024119 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24120 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24121 mem_base = xmlMemBlocks();
24122 buf = gen_xmlBufferPtr(n_buf, 0);
24123 table = gen_xmlNotationTablePtr(n_table, 1);
24124
24125 xmlDumpNotationTable(buf, table);
24126 call_tests++;
24127 des_xmlBufferPtr(n_buf, buf, 0);
24128 des_xmlNotationTablePtr(n_table, table, 1);
24129 xmlResetLastError();
24130 if (mem_base != xmlMemBlocks()) {
24131 printf("Leak of %d blocks found in xmlDumpNotationTable",
24132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024134 printf(" %d", n_buf);
24135 printf(" %d", n_table);
24136 printf("\n");
24137 }
24138 }
24139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024140 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024141#endif
24142
Daniel Veillard42595322004-11-08 10:52:06 +000024143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024144}
24145
24146
24147static int
24148test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024150
Daniel Veillard42595322004-11-08 10:52:06 +000024151 int mem_base;
24152 xmlAttributePtr ret_val;
24153 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24154 int n_dtd;
24155 xmlChar * elem; /* the element name */
24156 int n_elem;
24157 xmlChar * name; /* the attribute name */
24158 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024159
Daniel Veillard42595322004-11-08 10:52:06 +000024160 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24161 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24162 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24163 mem_base = xmlMemBlocks();
24164 dtd = gen_xmlDtdPtr(n_dtd, 0);
24165 elem = gen_const_xmlChar_ptr(n_elem, 1);
24166 name = gen_const_xmlChar_ptr(n_name, 2);
24167
William M. Brackf13f77f2004-11-12 16:03:48 +000024168 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024169 desret_xmlAttributePtr(ret_val);
24170 call_tests++;
24171 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024172 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24173 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024174 xmlResetLastError();
24175 if (mem_base != xmlMemBlocks()) {
24176 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24177 xmlMemBlocks() - mem_base);
24178 test_ret++;
24179 printf(" %d", n_dtd);
24180 printf(" %d", n_elem);
24181 printf(" %d", n_name);
24182 printf("\n");
24183 }
24184 }
24185 }
24186 }
Daniel Veillard42595322004-11-08 10:52:06 +000024187 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024188
Daniel Veillard42595322004-11-08 10:52:06 +000024189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024190}
24191
24192
24193static int
24194test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024196
Daniel Veillard42595322004-11-08 10:52:06 +000024197 int mem_base;
24198 xmlElementPtr ret_val;
24199 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24200 int n_dtd;
24201 xmlChar * name; /* the element name */
24202 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024203
Daniel Veillard42595322004-11-08 10:52:06 +000024204 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24205 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24206 mem_base = xmlMemBlocks();
24207 dtd = gen_xmlDtdPtr(n_dtd, 0);
24208 name = gen_const_xmlChar_ptr(n_name, 1);
24209
William M. Brackf13f77f2004-11-12 16:03:48 +000024210 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024211 desret_xmlElementPtr(ret_val);
24212 call_tests++;
24213 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024214 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024215 xmlResetLastError();
24216 if (mem_base != xmlMemBlocks()) {
24217 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24218 xmlMemBlocks() - mem_base);
24219 test_ret++;
24220 printf(" %d", n_dtd);
24221 printf(" %d", n_name);
24222 printf("\n");
24223 }
24224 }
24225 }
Daniel Veillard42595322004-11-08 10:52:06 +000024226 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024227
Daniel Veillard42595322004-11-08 10:52:06 +000024228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024229}
24230
24231
24232static int
24233test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024235
24236
24237 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024239}
24240
24241
24242static int
24243test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024245
Daniel Veillard42595322004-11-08 10:52:06 +000024246 int mem_base;
24247 xmlAttributePtr ret_val;
24248 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24249 int n_dtd;
24250 xmlChar * elem; /* the element name */
24251 int n_elem;
24252 xmlChar * name; /* the attribute name */
24253 int n_name;
24254 xmlChar * prefix; /* the attribute namespace prefix */
24255 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024256
Daniel Veillard42595322004-11-08 10:52:06 +000024257 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24258 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24259 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24260 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24261 mem_base = xmlMemBlocks();
24262 dtd = gen_xmlDtdPtr(n_dtd, 0);
24263 elem = gen_const_xmlChar_ptr(n_elem, 1);
24264 name = gen_const_xmlChar_ptr(n_name, 2);
24265 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24266
William M. Brackf13f77f2004-11-12 16:03:48 +000024267 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024268 desret_xmlAttributePtr(ret_val);
24269 call_tests++;
24270 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024271 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24272 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24273 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024274 xmlResetLastError();
24275 if (mem_base != xmlMemBlocks()) {
24276 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24277 xmlMemBlocks() - mem_base);
24278 test_ret++;
24279 printf(" %d", n_dtd);
24280 printf(" %d", n_elem);
24281 printf(" %d", n_name);
24282 printf(" %d", n_prefix);
24283 printf("\n");
24284 }
24285 }
24286 }
24287 }
24288 }
Daniel Veillard42595322004-11-08 10:52:06 +000024289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024290
Daniel Veillard42595322004-11-08 10:52:06 +000024291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024292}
24293
24294
24295static int
24296test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024298
Daniel Veillard42595322004-11-08 10:52:06 +000024299 int mem_base;
24300 xmlElementPtr ret_val;
24301 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24302 int n_dtd;
24303 xmlChar * name; /* the element name */
24304 int n_name;
24305 xmlChar * prefix; /* the element namespace prefix */
24306 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024307
Daniel Veillard42595322004-11-08 10:52:06 +000024308 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24310 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24311 mem_base = xmlMemBlocks();
24312 dtd = gen_xmlDtdPtr(n_dtd, 0);
24313 name = gen_const_xmlChar_ptr(n_name, 1);
24314 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24315
William M. Brackf13f77f2004-11-12 16:03:48 +000024316 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024317 desret_xmlElementPtr(ret_val);
24318 call_tests++;
24319 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024320 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24321 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024322 xmlResetLastError();
24323 if (mem_base != xmlMemBlocks()) {
24324 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24325 xmlMemBlocks() - mem_base);
24326 test_ret++;
24327 printf(" %d", n_dtd);
24328 printf(" %d", n_name);
24329 printf(" %d", n_prefix);
24330 printf("\n");
24331 }
24332 }
24333 }
24334 }
Daniel Veillard42595322004-11-08 10:52:06 +000024335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024336
Daniel Veillard42595322004-11-08 10:52:06 +000024337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024338}
24339
24340
24341static int
24342test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024344
Daniel Veillard57b25162004-11-06 14:50:18 +000024345 int mem_base;
24346 xmlAttrPtr ret_val;
24347 xmlDocPtr doc; /* pointer to the document */
24348 int n_doc;
24349 xmlChar * ID; /* the ID value */
24350 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024351
Daniel Veillard57b25162004-11-06 14:50:18 +000024352 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24353 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24354 mem_base = xmlMemBlocks();
24355 doc = gen_xmlDocPtr(n_doc, 0);
24356 ID = gen_const_xmlChar_ptr(n_ID, 1);
24357
William M. Brackf13f77f2004-11-12 16:03:48 +000024358 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024359 desret_xmlAttrPtr(ret_val);
24360 call_tests++;
24361 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024362 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024363 xmlResetLastError();
24364 if (mem_base != xmlMemBlocks()) {
24365 printf("Leak of %d blocks found in xmlGetID",
24366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024367 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024368 printf(" %d", n_doc);
24369 printf(" %d", n_ID);
24370 printf("\n");
24371 }
24372 }
24373 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024375
Daniel Veillard42595322004-11-08 10:52:06 +000024376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024377}
24378
24379
24380static int
24381test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024383
24384
24385 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024387}
24388
24389
24390static int
24391test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024393
Daniel Veillardce244ad2004-11-05 10:03:46 +000024394 int mem_base;
24395 int ret_val;
24396 xmlDocPtr doc; /* the document */
24397 int n_doc;
24398 xmlNodePtr elem; /* the element carrying the attribute */
24399 int n_elem;
24400 xmlAttrPtr attr; /* the attribute */
24401 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024402
Daniel Veillardce244ad2004-11-05 10:03:46 +000024403 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24404 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24405 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24406 mem_base = xmlMemBlocks();
24407 doc = gen_xmlDocPtr(n_doc, 0);
24408 elem = gen_xmlNodePtr(n_elem, 1);
24409 attr = gen_xmlAttrPtr(n_attr, 2);
24410
24411 ret_val = xmlIsID(doc, elem, attr);
24412 desret_int(ret_val);
24413 call_tests++;
24414 des_xmlDocPtr(n_doc, doc, 0);
24415 des_xmlNodePtr(n_elem, elem, 1);
24416 des_xmlAttrPtr(n_attr, attr, 2);
24417 xmlResetLastError();
24418 if (mem_base != xmlMemBlocks()) {
24419 printf("Leak of %d blocks found in xmlIsID",
24420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024421 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024422 printf(" %d", n_doc);
24423 printf(" %d", n_elem);
24424 printf(" %d", n_attr);
24425 printf("\n");
24426 }
24427 }
24428 }
24429 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024431
Daniel Veillard42595322004-11-08 10:52:06 +000024432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024433}
24434
24435
24436static int
24437test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024439
24440 int mem_base;
24441 int ret_val;
24442 xmlDocPtr doc; /* the document */
24443 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024444 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024445 int n_name;
24446
24447 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24448 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24449 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024450 doc = gen_xmlDocPtr(n_doc, 0);
24451 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024452
William M. Brackf13f77f2004-11-12 16:03:48 +000024453 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024454 desret_int(ret_val);
24455 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024456 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024457 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024458 xmlResetLastError();
24459 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024460 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024462 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024463 printf(" %d", n_doc);
24464 printf(" %d", n_name);
24465 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024466 }
24467 }
24468 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024470
Daniel Veillard42595322004-11-08 10:52:06 +000024471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024472}
24473
24474
24475static int
24476test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024478
Daniel Veillardce244ad2004-11-05 10:03:46 +000024479 int mem_base;
24480 int ret_val;
24481 xmlDocPtr doc; /* the document */
24482 int n_doc;
24483 xmlNodePtr elem; /* the element carrying the attribute */
24484 int n_elem;
24485 xmlAttrPtr attr; /* the attribute */
24486 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024487
Daniel Veillardce244ad2004-11-05 10:03:46 +000024488 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24489 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24490 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24491 mem_base = xmlMemBlocks();
24492 doc = gen_xmlDocPtr(n_doc, 0);
24493 elem = gen_xmlNodePtr(n_elem, 1);
24494 attr = gen_xmlAttrPtr(n_attr, 2);
24495
24496 ret_val = xmlIsRef(doc, elem, attr);
24497 desret_int(ret_val);
24498 call_tests++;
24499 des_xmlDocPtr(n_doc, doc, 0);
24500 des_xmlNodePtr(n_elem, elem, 1);
24501 des_xmlAttrPtr(n_attr, attr, 2);
24502 xmlResetLastError();
24503 if (mem_base != xmlMemBlocks()) {
24504 printf("Leak of %d blocks found in xmlIsRef",
24505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024506 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024507 printf(" %d", n_doc);
24508 printf(" %d", n_elem);
24509 printf(" %d", n_attr);
24510 printf("\n");
24511 }
24512 }
24513 }
24514 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024516
Daniel Veillard42595322004-11-08 10:52:06 +000024517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024518}
24519
24520
24521static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024522test_xmlNewDocElementContent(void) {
24523 int test_ret = 0;
24524
24525 int mem_base;
24526 xmlElementContentPtr ret_val;
24527 xmlDocPtr doc; /* the document */
24528 int n_doc;
24529 xmlChar * name; /* the subelement name or NULL */
24530 int n_name;
24531 xmlElementContentType type; /* the type of element content decl */
24532 int n_type;
24533
24534 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24535 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24536 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24537 mem_base = xmlMemBlocks();
24538 doc = gen_xmlDocPtr(n_doc, 0);
24539 name = gen_const_xmlChar_ptr(n_name, 1);
24540 type = gen_xmlElementContentType(n_type, 2);
24541
24542 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024543 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024544 desret_xmlElementContentPtr(ret_val);
24545 call_tests++;
24546 des_xmlDocPtr(n_doc, doc, 0);
24547 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24548 des_xmlElementContentType(n_type, type, 2);
24549 xmlResetLastError();
24550 if (mem_base != xmlMemBlocks()) {
24551 printf("Leak of %d blocks found in xmlNewDocElementContent",
24552 xmlMemBlocks() - mem_base);
24553 test_ret++;
24554 printf(" %d", n_doc);
24555 printf(" %d", n_name);
24556 printf(" %d", n_type);
24557 printf("\n");
24558 }
24559 }
24560 }
24561 }
24562 function_tests++;
24563
24564 return(test_ret);
24565}
24566
24567
24568static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024569test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024571
William M. Brack094dd862004-11-14 14:28:34 +000024572 int mem_base;
24573 xmlElementContentPtr ret_val;
24574 xmlChar * name; /* the subelement name or NULL */
24575 int n_name;
24576 xmlElementContentType type; /* the type of element content decl */
24577 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024578
William M. Brack094dd862004-11-14 14:28:34 +000024579 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24580 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24581 mem_base = xmlMemBlocks();
24582 name = gen_const_xmlChar_ptr(n_name, 0);
24583 type = gen_xmlElementContentType(n_type, 1);
24584
24585 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24586 desret_xmlElementContentPtr(ret_val);
24587 call_tests++;
24588 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24589 des_xmlElementContentType(n_type, type, 1);
24590 xmlResetLastError();
24591 if (mem_base != xmlMemBlocks()) {
24592 printf("Leak of %d blocks found in xmlNewElementContent",
24593 xmlMemBlocks() - mem_base);
24594 test_ret++;
24595 printf(" %d", n_name);
24596 printf(" %d", n_type);
24597 printf("\n");
24598 }
24599 }
24600 }
24601 function_tests++;
24602
Daniel Veillard42595322004-11-08 10:52:06 +000024603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024604}
24605
24606
24607static int
24608test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024610
24611
24612 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024614}
24615
24616
24617static int
24618test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024620
Daniel Veillardce244ad2004-11-05 10:03:46 +000024621 int mem_base;
24622 int ret_val;
24623 xmlDocPtr doc; /* the document */
24624 int n_doc;
24625 xmlAttrPtr attr; /* the attribute */
24626 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024627
Daniel Veillardce244ad2004-11-05 10:03:46 +000024628 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24629 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24630 mem_base = xmlMemBlocks();
24631 doc = gen_xmlDocPtr(n_doc, 0);
24632 attr = gen_xmlAttrPtr(n_attr, 1);
24633
24634 ret_val = xmlRemoveID(doc, attr);
24635 desret_int(ret_val);
24636 call_tests++;
24637 des_xmlDocPtr(n_doc, doc, 0);
24638 des_xmlAttrPtr(n_attr, attr, 1);
24639 xmlResetLastError();
24640 if (mem_base != xmlMemBlocks()) {
24641 printf("Leak of %d blocks found in xmlRemoveID",
24642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024643 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024644 printf(" %d", n_doc);
24645 printf(" %d", n_attr);
24646 printf("\n");
24647 }
24648 }
24649 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024651
Daniel Veillard42595322004-11-08 10:52:06 +000024652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024653}
24654
24655
24656static int
24657test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024659
Daniel Veillardce244ad2004-11-05 10:03:46 +000024660 int mem_base;
24661 int ret_val;
24662 xmlDocPtr doc; /* the document */
24663 int n_doc;
24664 xmlAttrPtr attr; /* the attribute */
24665 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024666
Daniel Veillardce244ad2004-11-05 10:03:46 +000024667 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24668 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24669 mem_base = xmlMemBlocks();
24670 doc = gen_xmlDocPtr(n_doc, 0);
24671 attr = gen_xmlAttrPtr(n_attr, 1);
24672
24673 ret_val = xmlRemoveRef(doc, attr);
24674 desret_int(ret_val);
24675 call_tests++;
24676 des_xmlDocPtr(n_doc, doc, 0);
24677 des_xmlAttrPtr(n_attr, attr, 1);
24678 xmlResetLastError();
24679 if (mem_base != xmlMemBlocks()) {
24680 printf("Leak of %d blocks found in xmlRemoveRef",
24681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024682 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024683 printf(" %d", n_doc);
24684 printf(" %d", n_attr);
24685 printf("\n");
24686 }
24687 }
24688 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024689 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024690
Daniel Veillard42595322004-11-08 10:52:06 +000024691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024692}
24693
24694
24695static int
24696test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024698
Daniel Veillardce682bc2004-11-05 17:22:25 +000024699 int mem_base;
24700 char * buf; /* an output buffer */
24701 int n_buf;
24702 int size; /* the buffer size */
24703 int n_size;
24704 xmlElementContentPtr content; /* An element table */
24705 int n_content;
24706 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24707 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024708
Daniel Veillardce682bc2004-11-05 17:22:25 +000024709 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24710 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24711 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24712 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24713 mem_base = xmlMemBlocks();
24714 buf = gen_char_ptr(n_buf, 0);
24715 size = gen_int(n_size, 1);
24716 content = gen_xmlElementContentPtr(n_content, 2);
24717 glob = gen_int(n_glob, 3);
24718
24719 xmlSnprintfElementContent(buf, size, content, glob);
24720 call_tests++;
24721 des_char_ptr(n_buf, buf, 0);
24722 des_int(n_size, size, 1);
24723 des_xmlElementContentPtr(n_content, content, 2);
24724 des_int(n_glob, glob, 3);
24725 xmlResetLastError();
24726 if (mem_base != xmlMemBlocks()) {
24727 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024730 printf(" %d", n_buf);
24731 printf(" %d", n_size);
24732 printf(" %d", n_content);
24733 printf(" %d", n_glob);
24734 printf("\n");
24735 }
24736 }
24737 }
24738 }
24739 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024740 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024741
Daniel Veillard42595322004-11-08 10:52:06 +000024742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024743}
24744
24745
24746static int
24747test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024749
William M. Brack21e4ef22005-01-02 09:53:13 +000024750#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024751#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024752 int mem_base;
24753 char * buf; /* an output buffer */
24754 int n_buf;
24755 xmlElementContentPtr content; /* An element table */
24756 int n_content;
24757 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24758 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024759
Daniel Veillardce682bc2004-11-05 17:22:25 +000024760 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24761 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24762 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24763 mem_base = xmlMemBlocks();
24764 buf = gen_char_ptr(n_buf, 0);
24765 content = gen_xmlElementContentPtr(n_content, 1);
24766 glob = gen_int(n_glob, 2);
24767
24768 xmlSprintfElementContent(buf, content, glob);
24769 call_tests++;
24770 des_char_ptr(n_buf, buf, 0);
24771 des_xmlElementContentPtr(n_content, content, 1);
24772 des_int(n_glob, glob, 2);
24773 xmlResetLastError();
24774 if (mem_base != xmlMemBlocks()) {
24775 printf("Leak of %d blocks found in xmlSprintfElementContent",
24776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024777 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024778 printf(" %d", n_buf);
24779 printf(" %d", n_content);
24780 printf(" %d", n_glob);
24781 printf("\n");
24782 }
24783 }
24784 }
24785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024786 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024787#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024788#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024789
Daniel Veillard42595322004-11-08 10:52:06 +000024790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024791}
24792
24793
24794static int
24795test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024797
William M. Brack21e4ef22005-01-02 09:53:13 +000024798#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024799 int mem_base;
24800 int ret_val;
24801 xmlValidCtxtPtr ctxt; /* a validation context */
24802 int n_ctxt;
24803 xmlElementPtr elem; /* an element declaration node */
24804 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024805
Daniel Veillardce682bc2004-11-05 17:22:25 +000024806 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24807 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24808 mem_base = xmlMemBlocks();
24809 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24810 elem = gen_xmlElementPtr(n_elem, 1);
24811
24812 ret_val = xmlValidBuildContentModel(ctxt, elem);
24813 desret_int(ret_val);
24814 call_tests++;
24815 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24816 des_xmlElementPtr(n_elem, elem, 1);
24817 xmlResetLastError();
24818 if (mem_base != xmlMemBlocks()) {
24819 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024821 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024822 printf(" %d", n_ctxt);
24823 printf(" %d", n_elem);
24824 printf("\n");
24825 }
24826 }
24827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024828 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024829#endif
24830
Daniel Veillard42595322004-11-08 10:52:06 +000024831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024832}
24833
24834
24835static int
24836test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024838
William M. Brack21e4ef22005-01-02 09:53:13 +000024839#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024840 int mem_base;
24841 xmlChar * ret_val;
24842 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24843 int n_ctxt;
24844 xmlDocPtr doc; /* the document */
24845 int n_doc;
24846 xmlNodePtr elem; /* the parent */
24847 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024848 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024849 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024850 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024851 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024852
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24854 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24855 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24856 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24857 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24858 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024859 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24860 doc = gen_xmlDocPtr(n_doc, 1);
24861 elem = gen_xmlNodePtr(n_elem, 2);
24862 name = gen_const_xmlChar_ptr(n_name, 3);
24863 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024864
William M. Brackf13f77f2004-11-12 16:03:48 +000024865 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024866 desret_xmlChar_ptr(ret_val);
24867 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024868 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24869 des_xmlDocPtr(n_doc, doc, 1);
24870 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024871 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24872 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024873 xmlResetLastError();
24874 if (mem_base != xmlMemBlocks()) {
24875 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024877 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024878 printf(" %d", n_ctxt);
24879 printf(" %d", n_doc);
24880 printf(" %d", n_elem);
24881 printf(" %d", n_name);
24882 printf(" %d", n_value);
24883 printf("\n");
24884 }
24885 }
24886 }
24887 }
24888 }
24889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024890 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024891#endif
24892
Daniel Veillard42595322004-11-08 10:52:06 +000024893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024894}
24895
24896
Daniel Veillardce682bc2004-11-05 17:22:25 +000024897#define gen_nb_xmlElementContent_ptr 1
24898static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24899 return(NULL);
24900}
24901static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24902}
24903
Daniel Veillardd93f6252004-11-02 15:53:51 +000024904static int
24905test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024907
William M. Brack21e4ef22005-01-02 09:53:13 +000024908#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024909#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024910 int mem_base;
24911 int ret_val;
24912 xmlElementContent * ctree; /* an element content tree */
24913 int n_ctree;
24914 xmlChar ** list; /* an array to store the list of child names */
24915 int n_list;
24916 int * len; /* a pointer to the number of element in the list */
24917 int n_len;
24918 int max; /* the size of the array */
24919 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024920
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024921 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24922 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24923 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24924 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24925 mem_base = xmlMemBlocks();
24926 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24927 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24928 len = gen_int_ptr(n_len, 2);
24929 max = gen_int(n_max, 3);
24930
William M. Brackf13f77f2004-11-12 16:03:48 +000024931 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024932 desret_int(ret_val);
24933 call_tests++;
24934 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024935 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024936 des_int_ptr(n_len, len, 2);
24937 des_int(n_max, max, 3);
24938 xmlResetLastError();
24939 if (mem_base != xmlMemBlocks()) {
24940 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024942 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024943 printf(" %d", n_ctree);
24944 printf(" %d", n_list);
24945 printf(" %d", n_len);
24946 printf(" %d", n_max);
24947 printf("\n");
24948 }
24949 }
24950 }
24951 }
24952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024953 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024954#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024955#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024956
Daniel Veillard42595322004-11-08 10:52:06 +000024957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024958}
24959
24960
24961static int
24962test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024964
William M. Brack21e4ef22005-01-02 09:53:13 +000024965#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024966#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024967 int mem_base;
24968 int ret_val;
24969 xmlNode * prev; /* an element to insert after */
24970 int n_prev;
24971 xmlNode * next; /* an element to insert next */
24972 int n_next;
24973 xmlChar ** names; /* an array to store the list of child names */
24974 int n_names;
24975 int max; /* the size of the array */
24976 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024978 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24979 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24980 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24981 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24982 mem_base = xmlMemBlocks();
24983 prev = gen_xmlNodePtr(n_prev, 0);
24984 next = gen_xmlNodePtr(n_next, 1);
24985 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24986 max = gen_int(n_max, 3);
24987
William M. Brackf13f77f2004-11-12 16:03:48 +000024988 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024989 desret_int(ret_val);
24990 call_tests++;
24991 des_xmlNodePtr(n_prev, prev, 0);
24992 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024993 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024994 des_int(n_max, max, 3);
24995 xmlResetLastError();
24996 if (mem_base != xmlMemBlocks()) {
24997 printf("Leak of %d blocks found in xmlValidGetValidElements",
24998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024999 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025000 printf(" %d", n_prev);
25001 printf(" %d", n_next);
25002 printf(" %d", n_names);
25003 printf(" %d", n_max);
25004 printf("\n");
25005 }
25006 }
25007 }
25008 }
25009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025010 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000025011#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000025012#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025013
Daniel Veillard42595322004-11-08 10:52:06 +000025014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025015}
25016
25017
25018static int
25019test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025021
William M. Brack21e4ef22005-01-02 09:53:13 +000025022#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025023 int mem_base;
25024 xmlChar * ret_val;
25025 xmlDocPtr doc; /* the document */
25026 int n_doc;
25027 xmlNodePtr elem; /* the parent */
25028 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025029 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025030 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025031 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025032 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025033
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025034 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25035 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25036 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25037 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025039 doc = gen_xmlDocPtr(n_doc, 0);
25040 elem = gen_xmlNodePtr(n_elem, 1);
25041 name = gen_const_xmlChar_ptr(n_name, 2);
25042 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025043
William M. Brackf13f77f2004-11-12 16:03:48 +000025044 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025045 desret_xmlChar_ptr(ret_val);
25046 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025047 des_xmlDocPtr(n_doc, doc, 0);
25048 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025049 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
25050 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025051 xmlResetLastError();
25052 if (mem_base != xmlMemBlocks()) {
25053 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
25054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025055 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025056 printf(" %d", n_doc);
25057 printf(" %d", n_elem);
25058 printf(" %d", n_name);
25059 printf(" %d", n_value);
25060 printf("\n");
25061 }
25062 }
25063 }
25064 }
25065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025066 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025067#endif
25068
Daniel Veillard42595322004-11-08 10:52:06 +000025069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025070}
25071
25072
25073static int
25074test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025076
William M. Brack21e4ef22005-01-02 09:53:13 +000025077#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025078 int mem_base;
25079 int ret_val;
25080 xmlValidCtxtPtr ctxt; /* the validation context */
25081 int n_ctxt;
25082 xmlDocPtr doc; /* a document instance */
25083 int n_doc;
25084 xmlAttributePtr attr; /* an attribute definition */
25085 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025086
Daniel Veillardce682bc2004-11-05 17:22:25 +000025087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25089 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25090 mem_base = xmlMemBlocks();
25091 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25092 doc = gen_xmlDocPtr(n_doc, 1);
25093 attr = gen_xmlAttributePtr(n_attr, 2);
25094
25095 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25096 desret_int(ret_val);
25097 call_tests++;
25098 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25099 des_xmlDocPtr(n_doc, doc, 1);
25100 des_xmlAttributePtr(n_attr, attr, 2);
25101 xmlResetLastError();
25102 if (mem_base != xmlMemBlocks()) {
25103 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025105 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025106 printf(" %d", n_ctxt);
25107 printf(" %d", n_doc);
25108 printf(" %d", n_attr);
25109 printf("\n");
25110 }
25111 }
25112 }
25113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025114 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025115#endif
25116
Daniel Veillard42595322004-11-08 10:52:06 +000025117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025118}
25119
25120
25121static int
25122test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025124
William M. Brack21e4ef22005-01-02 09:53:13 +000025125#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000025126 int mem_base;
25127 int ret_val;
25128 xmlAttributeType type; /* an attribute type */
25129 int n_type;
25130 xmlChar * value; /* an attribute value */
25131 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025132
Daniel Veillard57b25162004-11-06 14:50:18 +000025133 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25134 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25135 mem_base = xmlMemBlocks();
25136 type = gen_xmlAttributeType(n_type, 0);
25137 value = gen_const_xmlChar_ptr(n_value, 1);
25138
William M. Brackf13f77f2004-11-12 16:03:48 +000025139 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025140 desret_int(ret_val);
25141 call_tests++;
25142 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025143 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025144 xmlResetLastError();
25145 if (mem_base != xmlMemBlocks()) {
25146 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025148 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025149 printf(" %d", n_type);
25150 printf(" %d", n_value);
25151 printf("\n");
25152 }
25153 }
25154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025155 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025156#endif
25157
Daniel Veillard42595322004-11-08 10:52:06 +000025158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025159}
25160
25161
25162static int
25163test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025165
William M. Brack21e4ef22005-01-02 09:53:13 +000025166#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025167 int mem_base;
25168 int ret_val;
25169 xmlValidCtxtPtr ctxt; /* the validation context */
25170 int n_ctxt;
25171 xmlDocPtr doc; /* a document instance */
25172 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025173
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025174 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25175 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025177 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25178 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025179
25180 ret_val = xmlValidateDocument(ctxt, doc);
25181 desret_int(ret_val);
25182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025183 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25184 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025185 xmlResetLastError();
25186 if (mem_base != xmlMemBlocks()) {
25187 printf("Leak of %d blocks found in xmlValidateDocument",
25188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025189 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025190 printf(" %d", n_ctxt);
25191 printf(" %d", n_doc);
25192 printf("\n");
25193 }
25194 }
25195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025196 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025197#endif
25198
Daniel Veillard42595322004-11-08 10:52:06 +000025199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025200}
25201
25202
25203static int
25204test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025206
William M. Brack21e4ef22005-01-02 09:53:13 +000025207#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025208 int mem_base;
25209 int ret_val;
25210 xmlValidCtxtPtr ctxt; /* the validation context */
25211 int n_ctxt;
25212 xmlDocPtr doc; /* a document instance */
25213 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025214
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25216 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025218 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25219 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025220
25221 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25222 desret_int(ret_val);
25223 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025224 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25225 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025226 xmlResetLastError();
25227 if (mem_base != xmlMemBlocks()) {
25228 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025230 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025231 printf(" %d", n_ctxt);
25232 printf(" %d", n_doc);
25233 printf("\n");
25234 }
25235 }
25236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025237 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025238#endif
25239
Daniel Veillard42595322004-11-08 10:52:06 +000025240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025241}
25242
25243
25244static int
25245test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025247
William M. Brack21e4ef22005-01-02 09:53:13 +000025248#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025249 int mem_base;
25250 int ret_val;
25251 xmlValidCtxtPtr ctxt; /* the validation context */
25252 int n_ctxt;
25253 xmlDocPtr doc; /* a document instance */
25254 int n_doc;
25255 xmlDtdPtr dtd; /* a dtd instance */
25256 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025257
Daniel Veillard27f20102004-11-05 11:50:11 +000025258 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25259 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25260 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25261 mem_base = xmlMemBlocks();
25262 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25263 doc = gen_xmlDocPtr(n_doc, 1);
25264 dtd = gen_xmlDtdPtr(n_dtd, 2);
25265
25266 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25267 desret_int(ret_val);
25268 call_tests++;
25269 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25270 des_xmlDocPtr(n_doc, doc, 1);
25271 des_xmlDtdPtr(n_dtd, dtd, 2);
25272 xmlResetLastError();
25273 if (mem_base != xmlMemBlocks()) {
25274 printf("Leak of %d blocks found in xmlValidateDtd",
25275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025276 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025277 printf(" %d", n_ctxt);
25278 printf(" %d", n_doc);
25279 printf(" %d", n_dtd);
25280 printf("\n");
25281 }
25282 }
25283 }
25284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025285 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025286#endif
25287
Daniel Veillard42595322004-11-08 10:52:06 +000025288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025289}
25290
25291
25292static int
25293test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025295
William M. Brack21e4ef22005-01-02 09:53:13 +000025296#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025297 int mem_base;
25298 int ret_val;
25299 xmlValidCtxtPtr ctxt; /* the validation context */
25300 int n_ctxt;
25301 xmlDocPtr doc; /* a document instance */
25302 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025303
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025304 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25305 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025307 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25308 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025309
25310 ret_val = xmlValidateDtdFinal(ctxt, doc);
25311 desret_int(ret_val);
25312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025313 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25314 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025315 xmlResetLastError();
25316 if (mem_base != xmlMemBlocks()) {
25317 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025319 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025320 printf(" %d", n_ctxt);
25321 printf(" %d", n_doc);
25322 printf("\n");
25323 }
25324 }
25325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025326 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025327#endif
25328
Daniel Veillard42595322004-11-08 10:52:06 +000025329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025330}
25331
25332
25333static int
25334test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025336
William M. Brack21e4ef22005-01-02 09:53:13 +000025337#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025338 int mem_base;
25339 int ret_val;
25340 xmlValidCtxtPtr ctxt; /* the validation context */
25341 int n_ctxt;
25342 xmlDocPtr doc; /* a document instance */
25343 int n_doc;
25344 xmlNodePtr elem; /* an element instance */
25345 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025346
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025347 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25348 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25349 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25350 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025351 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25352 doc = gen_xmlDocPtr(n_doc, 1);
25353 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025354
25355 ret_val = xmlValidateElement(ctxt, doc, elem);
25356 desret_int(ret_val);
25357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025358 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25359 des_xmlDocPtr(n_doc, doc, 1);
25360 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025361 xmlResetLastError();
25362 if (mem_base != xmlMemBlocks()) {
25363 printf("Leak of %d blocks found in xmlValidateElement",
25364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025365 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025366 printf(" %d", n_ctxt);
25367 printf(" %d", n_doc);
25368 printf(" %d", n_elem);
25369 printf("\n");
25370 }
25371 }
25372 }
25373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025374 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025375#endif
25376
Daniel Veillard42595322004-11-08 10:52:06 +000025377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025378}
25379
25380
25381static int
25382test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025384
William M. Brack21e4ef22005-01-02 09:53:13 +000025385#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025386 int mem_base;
25387 int ret_val;
25388 xmlValidCtxtPtr ctxt; /* the validation context */
25389 int n_ctxt;
25390 xmlDocPtr doc; /* a document instance */
25391 int n_doc;
25392 xmlElementPtr elem; /* an element definition */
25393 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025394
Daniel Veillardce682bc2004-11-05 17:22:25 +000025395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25396 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25397 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25398 mem_base = xmlMemBlocks();
25399 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25400 doc = gen_xmlDocPtr(n_doc, 1);
25401 elem = gen_xmlElementPtr(n_elem, 2);
25402
25403 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25404 desret_int(ret_val);
25405 call_tests++;
25406 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25407 des_xmlDocPtr(n_doc, doc, 1);
25408 des_xmlElementPtr(n_elem, elem, 2);
25409 xmlResetLastError();
25410 if (mem_base != xmlMemBlocks()) {
25411 printf("Leak of %d blocks found in xmlValidateElementDecl",
25412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025413 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025414 printf(" %d", n_ctxt);
25415 printf(" %d", n_doc);
25416 printf(" %d", n_elem);
25417 printf("\n");
25418 }
25419 }
25420 }
25421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025422 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025423#endif
25424
Daniel Veillard42595322004-11-08 10:52:06 +000025425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025426}
25427
25428
25429static int
25430test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025432
William M. Brack21e4ef22005-01-02 09:53:13 +000025433#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025434 int mem_base;
25435 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025436 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025437 int n_value;
25438
25439 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25440 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025441 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025442
William M. Brackf13f77f2004-11-12 16:03:48 +000025443 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025444 desret_int(ret_val);
25445 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025446 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025447 xmlResetLastError();
25448 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025449 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025451 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025452 printf(" %d", n_value);
25453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025454 }
25455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025456 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025457#endif
25458
Daniel Veillard42595322004-11-08 10:52:06 +000025459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025460}
25461
25462
25463static int
25464test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025466
William M. Brack21e4ef22005-01-02 09:53:13 +000025467#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025468 int mem_base;
25469 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025470 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025471 int n_value;
25472
25473 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025475 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025476
William M. Brackf13f77f2004-11-12 16:03:48 +000025477 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025478 desret_int(ret_val);
25479 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025480 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025481 xmlResetLastError();
25482 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025483 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025485 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025486 printf(" %d", n_value);
25487 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025488 }
25489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025490 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025491#endif
25492
Daniel Veillard42595322004-11-08 10:52:06 +000025493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025494}
25495
25496
25497static int
25498test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025500
William M. Brack21e4ef22005-01-02 09:53:13 +000025501#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025502 int mem_base;
25503 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025504 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025505 int n_value;
25506
25507 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025509 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025510
William M. Brackf13f77f2004-11-12 16:03:48 +000025511 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025512 desret_int(ret_val);
25513 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025514 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025515 xmlResetLastError();
25516 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025517 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025519 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025520 printf(" %d", n_value);
25521 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025522 }
25523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025524 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025525#endif
25526
Daniel Veillard42595322004-11-08 10:52:06 +000025527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025528}
25529
25530
25531static int
25532test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025534
William M. Brack21e4ef22005-01-02 09:53:13 +000025535#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025536 int mem_base;
25537 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025538 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025539 int n_value;
25540
25541 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025543 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025544
William M. Brackf13f77f2004-11-12 16:03:48 +000025545 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025546 desret_int(ret_val);
25547 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025548 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025549 xmlResetLastError();
25550 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025551 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025553 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025554 printf(" %d", n_value);
25555 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025556 }
25557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025558 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025559#endif
25560
Daniel Veillard42595322004-11-08 10:52:06 +000025561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025562}
25563
25564
25565static int
25566test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025568
William M. Brack21e4ef22005-01-02 09:53:13 +000025569#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025570 int mem_base;
25571 int ret_val;
25572 xmlValidCtxtPtr ctxt; /* the validation context */
25573 int n_ctxt;
25574 xmlDocPtr doc; /* a document instance */
25575 int n_doc;
25576 xmlNotationPtr nota; /* a notation definition */
25577 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025578
Daniel Veillardce682bc2004-11-05 17:22:25 +000025579 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25580 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25581 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25582 mem_base = xmlMemBlocks();
25583 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25584 doc = gen_xmlDocPtr(n_doc, 1);
25585 nota = gen_xmlNotationPtr(n_nota, 2);
25586
25587 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25588 desret_int(ret_val);
25589 call_tests++;
25590 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25591 des_xmlDocPtr(n_doc, doc, 1);
25592 des_xmlNotationPtr(n_nota, nota, 2);
25593 xmlResetLastError();
25594 if (mem_base != xmlMemBlocks()) {
25595 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025597 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025598 printf(" %d", n_ctxt);
25599 printf(" %d", n_doc);
25600 printf(" %d", n_nota);
25601 printf("\n");
25602 }
25603 }
25604 }
25605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025606 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025607#endif
25608
Daniel Veillard42595322004-11-08 10:52:06 +000025609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025610}
25611
25612
25613static int
25614test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025616
William M. Brack21e4ef22005-01-02 09:53:13 +000025617#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025618 int mem_base;
25619 int ret_val;
25620 xmlValidCtxtPtr ctxt; /* the validation context */
25621 int n_ctxt;
25622 xmlDocPtr doc; /* the document */
25623 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025624 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025625 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025626
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025627 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25628 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25629 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25630 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025631 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25632 doc = gen_xmlDocPtr(n_doc, 1);
25633 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025634
William M. Brackf13f77f2004-11-12 16:03:48 +000025635 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025636 desret_int(ret_val);
25637 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025638 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25639 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025640 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025641 xmlResetLastError();
25642 if (mem_base != xmlMemBlocks()) {
25643 printf("Leak of %d blocks found in xmlValidateNotationUse",
25644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025645 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025646 printf(" %d", n_ctxt);
25647 printf(" %d", n_doc);
25648 printf(" %d", n_notationName);
25649 printf("\n");
25650 }
25651 }
25652 }
25653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025654 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025655#endif
25656
Daniel Veillard42595322004-11-08 10:52:06 +000025657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025658}
25659
25660
25661static int
25662test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025664
William M. Brack21e4ef22005-01-02 09:53:13 +000025665#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025666 int mem_base;
25667 int ret_val;
25668 xmlValidCtxtPtr ctxt; /* the validation context */
25669 int n_ctxt;
25670 xmlDocPtr doc; /* a document instance */
25671 int n_doc;
25672 xmlNodePtr elem; /* an element instance */
25673 int n_elem;
25674 xmlAttrPtr attr; /* an attribute instance */
25675 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025676 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025677 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025678
Daniel Veillardce244ad2004-11-05 10:03:46 +000025679 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25680 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25681 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25682 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25683 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25684 mem_base = xmlMemBlocks();
25685 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25686 doc = gen_xmlDocPtr(n_doc, 1);
25687 elem = gen_xmlNodePtr(n_elem, 2);
25688 attr = gen_xmlAttrPtr(n_attr, 3);
25689 value = gen_const_xmlChar_ptr(n_value, 4);
25690
William M. Brackf13f77f2004-11-12 16:03:48 +000025691 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025692 desret_int(ret_val);
25693 call_tests++;
25694 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25695 des_xmlDocPtr(n_doc, doc, 1);
25696 des_xmlNodePtr(n_elem, elem, 2);
25697 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025698 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025699 xmlResetLastError();
25700 if (mem_base != xmlMemBlocks()) {
25701 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025703 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025704 printf(" %d", n_ctxt);
25705 printf(" %d", n_doc);
25706 printf(" %d", n_elem);
25707 printf(" %d", n_attr);
25708 printf(" %d", n_value);
25709 printf("\n");
25710 }
25711 }
25712 }
25713 }
25714 }
25715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025716 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +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_xmlValidateOneElement(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)
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;
25732 xmlDocPtr doc; /* a document instance */
25733 int n_doc;
25734 xmlNodePtr elem; /* an element instance */
25735 int n_elem;
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_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25739 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025741 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25742 doc = gen_xmlDocPtr(n_doc, 1);
25743 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025744
25745 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25746 desret_int(ret_val);
25747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025748 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25749 des_xmlDocPtr(n_doc, doc, 1);
25750 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025751 xmlResetLastError();
25752 if (mem_base != xmlMemBlocks()) {
25753 printf("Leak of %d blocks found in xmlValidateOneElement",
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_doc);
25758 printf(" %d", n_elem);
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_xmlValidateOneNamespace(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)
Daniel Veillard27f20102004-11-05 11:50:11 +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 * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025785 int n_prefix;
25786 xmlNsPtr ns; /* an namespace declaration instance */
25787 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025788 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025789 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025790
Daniel Veillard27f20102004-11-05 11:50:11 +000025791 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25792 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25793 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25794 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25795 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25796 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25797 mem_base = xmlMemBlocks();
25798 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25799 doc = gen_xmlDocPtr(n_doc, 1);
25800 elem = gen_xmlNodePtr(n_elem, 2);
25801 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25802 ns = gen_xmlNsPtr(n_ns, 4);
25803 value = gen_const_xmlChar_ptr(n_value, 5);
25804
William M. Brackf13f77f2004-11-12 16:03:48 +000025805 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025806 desret_int(ret_val);
25807 call_tests++;
25808 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25809 des_xmlDocPtr(n_doc, doc, 1);
25810 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025811 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025812 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025813 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025814 xmlResetLastError();
25815 if (mem_base != xmlMemBlocks()) {
25816 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025818 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025819 printf(" %d", n_ctxt);
25820 printf(" %d", n_doc);
25821 printf(" %d", n_elem);
25822 printf(" %d", n_prefix);
25823 printf(" %d", n_ns);
25824 printf(" %d", n_value);
25825 printf("\n");
25826 }
25827 }
25828 }
25829 }
25830 }
25831 }
25832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025833 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025834#endif
25835
Daniel Veillard42595322004-11-08 10:52:06 +000025836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025837}
25838
25839
25840static int
25841test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025843
William M. Brack21e4ef22005-01-02 09:53:13 +000025844#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025845 int mem_base;
25846 int ret_val;
25847 xmlValidCtxtPtr ctxt; /* the validation context */
25848 int n_ctxt;
25849 xmlDocPtr doc; /* a document instance */
25850 int n_doc;
25851 xmlNodePtr elem; /* an element instance */
25852 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025853 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025854 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025855
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025856 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25857 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25858 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25859 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025861 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25862 doc = gen_xmlDocPtr(n_doc, 1);
25863 elem = gen_xmlNodePtr(n_elem, 2);
25864 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025865
William M. Brackf13f77f2004-11-12 16:03:48 +000025866 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025867 desret_int(ret_val);
25868 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025869 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25870 des_xmlDocPtr(n_doc, doc, 1);
25871 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025872 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025873 xmlResetLastError();
25874 if (mem_base != xmlMemBlocks()) {
25875 printf("Leak of %d blocks found in xmlValidatePopElement",
25876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025877 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025878 printf(" %d", n_ctxt);
25879 printf(" %d", n_doc);
25880 printf(" %d", n_elem);
25881 printf(" %d", n_qname);
25882 printf("\n");
25883 }
25884 }
25885 }
25886 }
25887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025888 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025889#endif
25890
Daniel Veillard42595322004-11-08 10:52:06 +000025891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025892}
25893
25894
25895static int
25896test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025898
William M. Brack21e4ef22005-01-02 09:53:13 +000025899#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025900 int mem_base;
25901 int ret_val;
25902 xmlValidCtxtPtr ctxt; /* the validation context */
25903 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025904 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025905 int n_data;
25906 int len; /* the lenght of the data */
25907 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025908
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025909 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25910 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25911 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025913 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25914 data = gen_const_xmlChar_ptr(n_data, 1);
25915 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025916
William M. Brackf13f77f2004-11-12 16:03:48 +000025917 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025918 desret_int(ret_val);
25919 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025920 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025921 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025922 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025923 xmlResetLastError();
25924 if (mem_base != xmlMemBlocks()) {
25925 printf("Leak of %d blocks found in xmlValidatePushCData",
25926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025927 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025928 printf(" %d", n_ctxt);
25929 printf(" %d", n_data);
25930 printf(" %d", n_len);
25931 printf("\n");
25932 }
25933 }
25934 }
25935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025936 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025937#endif
25938
Daniel Veillard42595322004-11-08 10:52:06 +000025939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025940}
25941
25942
25943static int
25944test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025946
William M. Brack21e4ef22005-01-02 09:53:13 +000025947#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025948 int mem_base;
25949 int ret_val;
25950 xmlValidCtxtPtr ctxt; /* the validation context */
25951 int n_ctxt;
25952 xmlDocPtr doc; /* a document instance */
25953 int n_doc;
25954 xmlNodePtr elem; /* an element instance */
25955 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025956 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025957 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025958
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025959 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25960 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25961 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25962 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25963 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025964 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25965 doc = gen_xmlDocPtr(n_doc, 1);
25966 elem = gen_xmlNodePtr(n_elem, 2);
25967 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025968
William M. Brackf13f77f2004-11-12 16:03:48 +000025969 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025970 desret_int(ret_val);
25971 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025972 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25973 des_xmlDocPtr(n_doc, doc, 1);
25974 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025975 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025976 xmlResetLastError();
25977 if (mem_base != xmlMemBlocks()) {
25978 printf("Leak of %d blocks found in xmlValidatePushElement",
25979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025980 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025981 printf(" %d", n_ctxt);
25982 printf(" %d", n_doc);
25983 printf(" %d", n_elem);
25984 printf(" %d", n_qname);
25985 printf("\n");
25986 }
25987 }
25988 }
25989 }
25990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025991 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025992#endif
25993
Daniel Veillard42595322004-11-08 10:52:06 +000025994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025995}
25996
25997
25998static int
25999test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026001
William M. Brack21e4ef22005-01-02 09:53:13 +000026002#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026003 int mem_base;
26004 int ret_val;
26005 xmlValidCtxtPtr ctxt; /* the validation context */
26006 int n_ctxt;
26007 xmlDocPtr doc; /* a document instance */
26008 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026010 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26011 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26012 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026013 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26014 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026015
26016 ret_val = xmlValidateRoot(ctxt, doc);
26017 desret_int(ret_val);
26018 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026019 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26020 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026021 xmlResetLastError();
26022 if (mem_base != xmlMemBlocks()) {
26023 printf("Leak of %d blocks found in xmlValidateRoot",
26024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026025 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026026 printf(" %d", n_ctxt);
26027 printf(" %d", n_doc);
26028 printf("\n");
26029 }
26030 }
26031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026032 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026033#endif
26034
Daniel Veillard42595322004-11-08 10:52:06 +000026035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026036}
26037
26038static int
26039test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026041
Daniel Veillard2ae13382005-01-25 23:45:06 +000026042 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026043 test_ret += test_xmlAddAttributeDecl();
26044 test_ret += test_xmlAddElementDecl();
26045 test_ret += test_xmlAddID();
26046 test_ret += test_xmlAddNotationDecl();
26047 test_ret += test_xmlAddRef();
26048 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026049 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026050 test_ret += test_xmlCopyElementContent();
26051 test_ret += test_xmlCopyElementTable();
26052 test_ret += test_xmlCopyEnumeration();
26053 test_ret += test_xmlCopyNotationTable();
26054 test_ret += test_xmlCreateEnumeration();
26055 test_ret += test_xmlDumpAttributeDecl();
26056 test_ret += test_xmlDumpAttributeTable();
26057 test_ret += test_xmlDumpElementDecl();
26058 test_ret += test_xmlDumpElementTable();
26059 test_ret += test_xmlDumpNotationDecl();
26060 test_ret += test_xmlDumpNotationTable();
26061 test_ret += test_xmlGetDtdAttrDesc();
26062 test_ret += test_xmlGetDtdElementDesc();
26063 test_ret += test_xmlGetDtdNotationDesc();
26064 test_ret += test_xmlGetDtdQAttrDesc();
26065 test_ret += test_xmlGetDtdQElementDesc();
26066 test_ret += test_xmlGetID();
26067 test_ret += test_xmlGetRefs();
26068 test_ret += test_xmlIsID();
26069 test_ret += test_xmlIsMixedElement();
26070 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026071 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026072 test_ret += test_xmlNewElementContent();
26073 test_ret += test_xmlNewValidCtxt();
26074 test_ret += test_xmlRemoveID();
26075 test_ret += test_xmlRemoveRef();
26076 test_ret += test_xmlSnprintfElementContent();
26077 test_ret += test_xmlSprintfElementContent();
26078 test_ret += test_xmlValidBuildContentModel();
26079 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26080 test_ret += test_xmlValidGetPotentialChildren();
26081 test_ret += test_xmlValidGetValidElements();
26082 test_ret += test_xmlValidNormalizeAttributeValue();
26083 test_ret += test_xmlValidateAttributeDecl();
26084 test_ret += test_xmlValidateAttributeValue();
26085 test_ret += test_xmlValidateDocument();
26086 test_ret += test_xmlValidateDocumentFinal();
26087 test_ret += test_xmlValidateDtd();
26088 test_ret += test_xmlValidateDtdFinal();
26089 test_ret += test_xmlValidateElement();
26090 test_ret += test_xmlValidateElementDecl();
26091 test_ret += test_xmlValidateNameValue();
26092 test_ret += test_xmlValidateNamesValue();
26093 test_ret += test_xmlValidateNmtokenValue();
26094 test_ret += test_xmlValidateNmtokensValue();
26095 test_ret += test_xmlValidateNotationDecl();
26096 test_ret += test_xmlValidateNotationUse();
26097 test_ret += test_xmlValidateOneAttribute();
26098 test_ret += test_xmlValidateOneElement();
26099 test_ret += test_xmlValidateOneNamespace();
26100 test_ret += test_xmlValidatePopElement();
26101 test_ret += test_xmlValidatePushCData();
26102 test_ret += test_xmlValidatePushElement();
26103 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026104
Daniel Veillard42595322004-11-08 10:52:06 +000026105 if (test_ret != 0)
26106 printf("Module valid: %d errors\n", test_ret);
26107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026108}
26109
26110static int
26111test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026113
26114
26115 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026117}
26118
26119
26120static int
26121test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026123
William M. Brack21e4ef22005-01-02 09:53:13 +000026124#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026125 int mem_base;
26126 int ret_val;
26127 xmlDocPtr doc; /* an XML document */
26128 int n_doc;
26129
26130 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026132 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026133
26134 ret_val = xmlXIncludeProcess(doc);
26135 desret_int(ret_val);
26136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026137 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026138 xmlResetLastError();
26139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026140 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026143 printf(" %d", n_doc);
26144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026145 }
26146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026147 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026148#endif
26149
Daniel Veillard42595322004-11-08 10:52:06 +000026150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026151}
26152
26153
26154static int
26155test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026157
William M. Brack21e4ef22005-01-02 09:53:13 +000026158#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026159 int mem_base;
26160 int ret_val;
26161 xmlDocPtr doc; /* an XML document */
26162 int n_doc;
26163 int flags; /* a set of xmlParserOption used for parsing XML includes */
26164 int n_flags;
26165
26166 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26167 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026169 doc = gen_xmlDocPtr(n_doc, 0);
26170 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026171
26172 ret_val = xmlXIncludeProcessFlags(doc, flags);
26173 desret_int(ret_val);
26174 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026175 des_xmlDocPtr(n_doc, doc, 0);
26176 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026177 xmlResetLastError();
26178 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026179 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026181 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026182 printf(" %d", n_doc);
26183 printf(" %d", n_flags);
26184 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026185 }
26186 }
26187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026188 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026189#endif
26190
Daniel Veillard42595322004-11-08 10:52:06 +000026191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026192}
26193
Daniel Veillarda521d282004-11-09 14:59:59 +000026194#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026195
Daniel Veillardce682bc2004-11-05 17:22:25 +000026196#define gen_nb_xmlXIncludeCtxtPtr 1
26197static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26198 return(NULL);
26199}
26200static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26201}
Daniel Veillarda521d282004-11-09 14:59:59 +000026202#endif
26203
Daniel Veillardce682bc2004-11-05 17:22:25 +000026204
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205static int
26206test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026208
William M. Brack21e4ef22005-01-02 09:53:13 +000026209#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026210 int mem_base;
26211 int ret_val;
26212 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26213 int n_ctxt;
26214 xmlNodePtr node; /* a node in an XML document */
26215 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026216
Daniel Veillardce682bc2004-11-05 17:22:25 +000026217 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26218 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26219 mem_base = xmlMemBlocks();
26220 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26221 node = gen_xmlNodePtr(n_node, 1);
26222
26223 ret_val = xmlXIncludeProcessNode(ctxt, node);
26224 desret_int(ret_val);
26225 call_tests++;
26226 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26227 des_xmlNodePtr(n_node, node, 1);
26228 xmlResetLastError();
26229 if (mem_base != xmlMemBlocks()) {
26230 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026232 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026233 printf(" %d", n_ctxt);
26234 printf(" %d", n_node);
26235 printf("\n");
26236 }
26237 }
26238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026239 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026240#endif
26241
Daniel Veillard42595322004-11-08 10:52:06 +000026242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026243}
26244
26245
26246static int
26247test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026249
William M. Brack21e4ef22005-01-02 09:53:13 +000026250#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026251 int mem_base;
26252 int ret_val;
26253 xmlNodePtr tree; /* a node in an XML document */
26254 int n_tree;
26255
26256 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026258 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026259
26260 ret_val = xmlXIncludeProcessTree(tree);
26261 desret_int(ret_val);
26262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026263 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026264 xmlResetLastError();
26265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026269 printf(" %d", n_tree);
26270 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026271 }
26272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026273 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026274#endif
26275
Daniel Veillard42595322004-11-08 10:52:06 +000026276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026277}
26278
26279
26280static int
26281test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026283
William M. Brack21e4ef22005-01-02 09:53:13 +000026284#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026285 int mem_base;
26286 int ret_val;
26287 xmlNodePtr tree; /* a node in an XML document */
26288 int n_tree;
26289 int flags; /* a set of xmlParserOption used for parsing XML includes */
26290 int n_flags;
26291
26292 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26293 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026295 tree = gen_xmlNodePtr(n_tree, 0);
26296 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026297
26298 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26299 desret_int(ret_val);
26300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026301 des_xmlNodePtr(n_tree, tree, 0);
26302 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026303 xmlResetLastError();
26304 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026305 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026307 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026308 printf(" %d", n_tree);
26309 printf(" %d", n_flags);
26310 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026311 }
26312 }
26313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026314 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026315#endif
26316
Daniel Veillard42595322004-11-08 10:52:06 +000026317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026318}
26319
26320
26321static int
26322test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026324
William M. Brack21e4ef22005-01-02 09:53:13 +000026325#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026326 int mem_base;
26327 int ret_val;
26328 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26329 int n_ctxt;
26330 int flags; /* a set of xmlParserOption used for parsing XML includes */
26331 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026332
Daniel Veillardce682bc2004-11-05 17:22:25 +000026333 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26334 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26335 mem_base = xmlMemBlocks();
26336 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26337 flags = gen_int(n_flags, 1);
26338
26339 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26340 desret_int(ret_val);
26341 call_tests++;
26342 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26343 des_int(n_flags, flags, 1);
26344 xmlResetLastError();
26345 if (mem_base != xmlMemBlocks()) {
26346 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026348 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026349 printf(" %d", n_ctxt);
26350 printf(" %d", n_flags);
26351 printf("\n");
26352 }
26353 }
26354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026355 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026356#endif
26357
Daniel Veillard42595322004-11-08 10:52:06 +000026358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026359}
26360
26361static int
26362test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026364
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026365 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026366 test_ret += test_xmlXIncludeNewContext();
26367 test_ret += test_xmlXIncludeProcess();
26368 test_ret += test_xmlXIncludeProcessFlags();
26369 test_ret += test_xmlXIncludeProcessNode();
26370 test_ret += test_xmlXIncludeProcessTree();
26371 test_ret += test_xmlXIncludeProcessTreeFlags();
26372 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026373
Daniel Veillard42595322004-11-08 10:52:06 +000026374 if (test_ret != 0)
26375 printf("Module xinclude: %d errors\n", test_ret);
26376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026377}
26378
26379static int
26380test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026382
William M. Brack21e4ef22005-01-02 09:53:13 +000026383#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026384 int mem_base;
26385 xmlOutputBufferPtr ret_val;
26386 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26387 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026388
Daniel Veillard3d95c732004-11-06 22:25:14 +000026389 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26390 mem_base = xmlMemBlocks();
26391 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26392
26393 ret_val = xmlAllocOutputBuffer(encoder);
26394 desret_xmlOutputBufferPtr(ret_val);
26395 call_tests++;
26396 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26397 xmlResetLastError();
26398 if (mem_base != xmlMemBlocks()) {
26399 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026401 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026402 printf(" %d", n_encoder);
26403 printf("\n");
26404 }
26405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026406 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026407#endif
26408
Daniel Veillard42595322004-11-08 10:52:06 +000026409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026410}
26411
26412
26413static int
26414test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026416
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026417 int mem_base;
26418 xmlParserInputBufferPtr ret_val;
26419 xmlCharEncoding enc; /* the charset encoding if known */
26420 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026421
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026422 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26423 mem_base = xmlMemBlocks();
26424 enc = gen_xmlCharEncoding(n_enc, 0);
26425
26426 ret_val = xmlAllocParserInputBuffer(enc);
26427 desret_xmlParserInputBufferPtr(ret_val);
26428 call_tests++;
26429 des_xmlCharEncoding(n_enc, enc, 0);
26430 xmlResetLastError();
26431 if (mem_base != xmlMemBlocks()) {
26432 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026434 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026435 printf(" %d", n_enc);
26436 printf("\n");
26437 }
26438 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026440
Daniel Veillard42595322004-11-08 10:52:06 +000026441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026442}
26443
26444
26445static int
26446test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026448
26449 int mem_base;
26450 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026451 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026452 int n_path;
26453
26454 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026456 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026457
William M. Brackf13f77f2004-11-12 16:03:48 +000026458 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026459 desret_int(ret_val);
26460 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026461 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026462 xmlResetLastError();
26463 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026464 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026466 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026467 printf(" %d", n_path);
26468 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026469 }
26470 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026471 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026472
Daniel Veillard42595322004-11-08 10:52:06 +000026473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026474}
26475
26476
26477static int
26478test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026480
Daniel Veillard42595322004-11-08 10:52:06 +000026481 int mem_base;
26482 xmlParserInputPtr ret_val;
26483 xmlParserCtxtPtr ctxt; /* an XML parser context */
26484 int n_ctxt;
26485 xmlParserInputPtr ret; /* an XML parser input */
26486 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026487
Daniel Veillard42595322004-11-08 10:52:06 +000026488 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26489 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26490 mem_base = xmlMemBlocks();
26491 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26492 ret = gen_xmlParserInputPtr(n_ret, 1);
26493
26494 ret_val = xmlCheckHTTPInput(ctxt, ret);
26495 desret_xmlParserInputPtr(ret_val);
26496 call_tests++;
26497 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26498 des_xmlParserInputPtr(n_ret, ret, 1);
26499 xmlResetLastError();
26500 if (mem_base != xmlMemBlocks()) {
26501 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26502 xmlMemBlocks() - mem_base);
26503 test_ret++;
26504 printf(" %d", n_ctxt);
26505 printf(" %d", n_ret);
26506 printf("\n");
26507 }
26508 }
26509 }
Daniel Veillard42595322004-11-08 10:52:06 +000026510 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026511
Daniel Veillard42595322004-11-08 10:52:06 +000026512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026513}
26514
26515
26516static int
26517test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026519
26520 int mem_base;
26521
26522 mem_base = xmlMemBlocks();
26523
26524 xmlCleanupInputCallbacks();
26525 call_tests++;
26526 xmlResetLastError();
26527 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026528 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026530 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026531 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026532 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026533 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026534
Daniel Veillard42595322004-11-08 10:52:06 +000026535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026536}
26537
26538
26539static int
26540test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026542
William M. Brack21e4ef22005-01-02 09:53:13 +000026543#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026544 int mem_base;
26545
26546 mem_base = xmlMemBlocks();
26547
26548 xmlCleanupOutputCallbacks();
26549 call_tests++;
26550 xmlResetLastError();
26551 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026552 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026555 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026556 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026557 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026558#endif
26559
Daniel Veillard42595322004-11-08 10:52:06 +000026560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026561}
26562
26563
26564static int
26565test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026567
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026568 int mem_base;
26569 int ret_val;
26570 void * context; /* the I/O context */
26571 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026572
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026573 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26574 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026575 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026576
26577 ret_val = xmlFileClose(context);
26578 desret_int(ret_val);
26579 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026580 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026581 xmlResetLastError();
26582 if (mem_base != xmlMemBlocks()) {
26583 printf("Leak of %d blocks found in xmlFileClose",
26584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026585 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026586 printf(" %d", n_context);
26587 printf("\n");
26588 }
26589 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026590 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026591
Daniel Veillard42595322004-11-08 10:52:06 +000026592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026593}
26594
26595
26596static int
26597test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026599
26600 int mem_base;
26601 int ret_val;
26602 const char * filename; /* the URI for matching */
26603 int n_filename;
26604
26605 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26606 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026607 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026608
26609 ret_val = xmlFileMatch(filename);
26610 desret_int(ret_val);
26611 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026612 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026613 xmlResetLastError();
26614 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026615 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026617 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026618 printf(" %d", n_filename);
26619 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026620 }
26621 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026622 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026623
Daniel Veillard42595322004-11-08 10:52:06 +000026624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625}
26626
26627
26628static int
26629test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026631
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026632 int mem_base;
26633 void * ret_val;
26634 const char * filename; /* the URI for matching */
26635 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026636
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026637 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26638 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026639 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026640
26641 ret_val = xmlFileOpen(filename);
26642 desret_void_ptr(ret_val);
26643 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026644 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026645 xmlResetLastError();
26646 if (mem_base != xmlMemBlocks()) {
26647 printf("Leak of %d blocks found in xmlFileOpen",
26648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026649 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026650 printf(" %d", n_filename);
26651 printf("\n");
26652 }
26653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026655
Daniel Veillard42595322004-11-08 10:52:06 +000026656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026657}
26658
26659
26660static int
26661test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026663
Daniel Veillardce682bc2004-11-05 17:22:25 +000026664 int mem_base;
26665 int ret_val;
26666 void * context; /* the I/O context */
26667 int n_context;
26668 char * buffer; /* where to drop data */
26669 int n_buffer;
26670 int len; /* number of bytes to write */
26671 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026672
Daniel Veillardce682bc2004-11-05 17:22:25 +000026673 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26674 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26675 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26676 mem_base = xmlMemBlocks();
26677 context = gen_void_ptr(n_context, 0);
26678 buffer = gen_char_ptr(n_buffer, 1);
26679 len = gen_int(n_len, 2);
26680
26681 ret_val = xmlFileRead(context, buffer, len);
26682 desret_int(ret_val);
26683 call_tests++;
26684 des_void_ptr(n_context, context, 0);
26685 des_char_ptr(n_buffer, buffer, 1);
26686 des_int(n_len, len, 2);
26687 xmlResetLastError();
26688 if (mem_base != xmlMemBlocks()) {
26689 printf("Leak of %d blocks found in xmlFileRead",
26690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026691 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026692 printf(" %d", n_context);
26693 printf(" %d", n_buffer);
26694 printf(" %d", n_len);
26695 printf("\n");
26696 }
26697 }
26698 }
26699 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026701
Daniel Veillard42595322004-11-08 10:52:06 +000026702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026703}
26704
26705
26706static int
26707test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026709
William M. Brack21e4ef22005-01-02 09:53:13 +000026710#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026711 int mem_base;
26712 int ret_val;
26713 void * context; /* the I/O context */
26714 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026715
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026716 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026718 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026719
26720 ret_val = xmlIOFTPClose(context);
26721 desret_int(ret_val);
26722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026723 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026724 xmlResetLastError();
26725 if (mem_base != xmlMemBlocks()) {
26726 printf("Leak of %d blocks found in xmlIOFTPClose",
26727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026728 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026729 printf(" %d", n_context);
26730 printf("\n");
26731 }
26732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026733 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026734#endif
26735
Daniel Veillard42595322004-11-08 10:52:06 +000026736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026737}
26738
26739
26740static int
26741test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026743
William M. Brack21e4ef22005-01-02 09:53:13 +000026744#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026745 int mem_base;
26746 int ret_val;
26747 const char * filename; /* the URI for matching */
26748 int n_filename;
26749
26750 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26751 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026752 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026753
26754 ret_val = xmlIOFTPMatch(filename);
26755 desret_int(ret_val);
26756 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026757 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026758 xmlResetLastError();
26759 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026760 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026762 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026763 printf(" %d", n_filename);
26764 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026765 }
26766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026767 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026768#endif
26769
Daniel Veillard42595322004-11-08 10:52:06 +000026770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026771}
26772
26773
26774static int
26775test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026777
William M. Brack21e4ef22005-01-02 09:53:13 +000026778#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026779 int mem_base;
26780 void * ret_val;
26781 const char * filename; /* the URI for matching */
26782 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026783
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026784 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26785 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026786 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026787
26788 ret_val = xmlIOFTPOpen(filename);
26789 desret_void_ptr(ret_val);
26790 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026791 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026792 xmlResetLastError();
26793 if (mem_base != xmlMemBlocks()) {
26794 printf("Leak of %d blocks found in xmlIOFTPOpen",
26795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026796 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026797 printf(" %d", n_filename);
26798 printf("\n");
26799 }
26800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026801 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026802#endif
26803
Daniel Veillard42595322004-11-08 10:52:06 +000026804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026805}
26806
26807
26808static int
26809test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026811
William M. Brack21e4ef22005-01-02 09:53:13 +000026812#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026813 int mem_base;
26814 int ret_val;
26815 void * context; /* the I/O context */
26816 int n_context;
26817 char * buffer; /* where to drop data */
26818 int n_buffer;
26819 int len; /* number of bytes to write */
26820 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026821
Daniel Veillardce682bc2004-11-05 17:22:25 +000026822 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26823 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26824 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26825 mem_base = xmlMemBlocks();
26826 context = gen_void_ptr(n_context, 0);
26827 buffer = gen_char_ptr(n_buffer, 1);
26828 len = gen_int(n_len, 2);
26829
26830 ret_val = xmlIOFTPRead(context, buffer, len);
26831 desret_int(ret_val);
26832 call_tests++;
26833 des_void_ptr(n_context, context, 0);
26834 des_char_ptr(n_buffer, buffer, 1);
26835 des_int(n_len, len, 2);
26836 xmlResetLastError();
26837 if (mem_base != xmlMemBlocks()) {
26838 printf("Leak of %d blocks found in xmlIOFTPRead",
26839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026840 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026841 printf(" %d", n_context);
26842 printf(" %d", n_buffer);
26843 printf(" %d", n_len);
26844 printf("\n");
26845 }
26846 }
26847 }
26848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026849 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026850#endif
26851
Daniel Veillard42595322004-11-08 10:52:06 +000026852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026853}
26854
26855
26856static int
26857test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026859
William M. Brack21e4ef22005-01-02 09:53:13 +000026860#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026861 int mem_base;
26862 int ret_val;
26863 void * context; /* the I/O context */
26864 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026865
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026866 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26867 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026868 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026869
26870 ret_val = xmlIOHTTPClose(context);
26871 desret_int(ret_val);
26872 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026873 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026874 xmlResetLastError();
26875 if (mem_base != xmlMemBlocks()) {
26876 printf("Leak of %d blocks found in xmlIOHTTPClose",
26877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026878 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026879 printf(" %d", n_context);
26880 printf("\n");
26881 }
26882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026883 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026884#endif
26885
Daniel Veillard42595322004-11-08 10:52:06 +000026886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026887}
26888
26889
26890static int
26891test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026893
William M. Brack21e4ef22005-01-02 09:53:13 +000026894#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026895 int mem_base;
26896 int ret_val;
26897 const char * filename; /* the URI for matching */
26898 int n_filename;
26899
26900 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26901 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026902 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026903
26904 ret_val = xmlIOHTTPMatch(filename);
26905 desret_int(ret_val);
26906 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026907 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026908 xmlResetLastError();
26909 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026910 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026912 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026913 printf(" %d", n_filename);
26914 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026915 }
26916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026917 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026918#endif
26919
Daniel Veillard42595322004-11-08 10:52:06 +000026920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026921}
26922
26923
26924static int
26925test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026927
William M. Brack21e4ef22005-01-02 09:53:13 +000026928#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026929 int mem_base;
26930 void * ret_val;
26931 const char * filename; /* the URI for matching */
26932 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026933
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026934 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26935 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026936 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026937
26938 ret_val = xmlIOHTTPOpen(filename);
William M. Brack015ccb22005-02-13 08:18:52 +000026939 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026941 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026942 xmlResetLastError();
26943 if (mem_base != xmlMemBlocks()) {
26944 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026946 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026947 printf(" %d", n_filename);
26948 printf("\n");
26949 }
26950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026951 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026952#endif
26953
Daniel Veillard42595322004-11-08 10:52:06 +000026954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026955}
26956
26957
26958static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000026959test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026961
William M. Brack21e4ef22005-01-02 09:53:13 +000026962#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026963 int mem_base;
26964 int ret_val;
26965 void * context; /* the I/O context */
26966 int n_context;
26967 char * buffer; /* where to drop data */
26968 int n_buffer;
26969 int len; /* number of bytes to write */
26970 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026971
Daniel Veillardce682bc2004-11-05 17:22:25 +000026972 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26973 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26974 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26975 mem_base = xmlMemBlocks();
26976 context = gen_void_ptr(n_context, 0);
26977 buffer = gen_char_ptr(n_buffer, 1);
26978 len = gen_int(n_len, 2);
26979
26980 ret_val = xmlIOHTTPRead(context, buffer, len);
26981 desret_int(ret_val);
26982 call_tests++;
26983 des_void_ptr(n_context, context, 0);
26984 des_char_ptr(n_buffer, buffer, 1);
26985 des_int(n_len, len, 2);
26986 xmlResetLastError();
26987 if (mem_base != xmlMemBlocks()) {
26988 printf("Leak of %d blocks found in xmlIOHTTPRead",
26989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026990 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026991 printf(" %d", n_context);
26992 printf(" %d", n_buffer);
26993 printf(" %d", n_len);
26994 printf("\n");
26995 }
26996 }
26997 }
26998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026999 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027000#endif
27001
Daniel Veillard42595322004-11-08 10:52:06 +000027002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027003}
27004
27005
27006static int
27007test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027009
Daniel Veillard42595322004-11-08 10:52:06 +000027010 int mem_base;
27011 xmlParserInputPtr ret_val;
27012 const char * URL; /* the URL for the entity to load */
27013 int n_URL;
27014 char * ID; /* the System ID for the entity to load */
27015 int n_ID;
27016 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
27017 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027018
Daniel Veillard42595322004-11-08 10:52:06 +000027019 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
27020 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
27021 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
27022 mem_base = xmlMemBlocks();
27023 URL = gen_filepath(n_URL, 0);
27024 ID = gen_const_char_ptr(n_ID, 1);
27025 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
27026
William M. Brackf13f77f2004-11-12 16:03:48 +000027027 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000027028 desret_xmlParserInputPtr(ret_val);
27029 call_tests++;
27030 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027031 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000027032 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
27033 xmlResetLastError();
27034 if (mem_base != xmlMemBlocks()) {
27035 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
27036 xmlMemBlocks() - mem_base);
27037 test_ret++;
27038 printf(" %d", n_URL);
27039 printf(" %d", n_ID);
27040 printf(" %d", n_ctxt);
27041 printf("\n");
27042 }
27043 }
27044 }
27045 }
Daniel Veillard42595322004-11-08 10:52:06 +000027046 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027047
Daniel Veillard42595322004-11-08 10:52:06 +000027048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027049}
27050
27051
27052static int
27053test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027055
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027056 int mem_base;
27057 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027058 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027059 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027060
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027061 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
27062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027063 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027064
William M. Brackf13f77f2004-11-12 16:03:48 +000027065 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027066 desret_xmlChar_ptr(ret_val);
27067 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027068 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027069 xmlResetLastError();
27070 if (mem_base != xmlMemBlocks()) {
27071 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027073 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027074 printf(" %d", n_path);
27075 printf("\n");
27076 }
27077 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027078 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027079
Daniel Veillard42595322004-11-08 10:52:06 +000027080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027081}
27082
27083
27084static int
27085test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027087
William M. Brack21e4ef22005-01-02 09:53:13 +000027088#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027089 int mem_base;
27090 xmlOutputBufferPtr ret_val;
27091 int fd; /* a file descriptor number */
27092 int n_fd;
27093 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27094 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027095
Daniel Veillard3d95c732004-11-06 22:25:14 +000027096 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27097 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27098 mem_base = xmlMemBlocks();
27099 fd = gen_int(n_fd, 0);
27100 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27101
27102 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27103 desret_xmlOutputBufferPtr(ret_val);
27104 call_tests++;
27105 des_int(n_fd, fd, 0);
27106 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27107 xmlResetLastError();
27108 if (mem_base != xmlMemBlocks()) {
27109 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027111 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027112 printf(" %d", n_fd);
27113 printf(" %d", n_encoder);
27114 printf("\n");
27115 }
27116 }
27117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027118 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027119#endif
27120
Daniel Veillard42595322004-11-08 10:52:06 +000027121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027122}
27123
27124
27125static int
27126test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027128
William M. Brack21e4ef22005-01-02 09:53:13 +000027129#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027130 int mem_base;
27131 xmlOutputBufferPtr ret_val;
27132 FILE * file; /* a FILE* */
27133 int n_file;
27134 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27135 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027136
Daniel Veillard3d95c732004-11-06 22:25:14 +000027137 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27138 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27139 mem_base = xmlMemBlocks();
27140 file = gen_FILE_ptr(n_file, 0);
27141 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27142
27143 ret_val = xmlOutputBufferCreateFile(file, encoder);
27144 desret_xmlOutputBufferPtr(ret_val);
27145 call_tests++;
27146 des_FILE_ptr(n_file, file, 0);
27147 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27148 xmlResetLastError();
27149 if (mem_base != xmlMemBlocks()) {
27150 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027152 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027153 printf(" %d", n_file);
27154 printf(" %d", n_encoder);
27155 printf("\n");
27156 }
27157 }
27158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027159 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027160#endif
27161
Daniel Veillard42595322004-11-08 10:52:06 +000027162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027163}
27164
27165
27166static int
27167test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027169
William M. Brack21e4ef22005-01-02 09:53:13 +000027170#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027171 int mem_base;
27172 xmlOutputBufferPtr ret_val;
27173 const char * URI; /* a C string containing the URI or filename */
27174 int n_URI;
27175 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27176 int n_encoder;
27177 int compression; /* the compression ration (0 none, 9 max). */
27178 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027179
Daniel Veillard42595322004-11-08 10:52:06 +000027180 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027181 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27182 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27183 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027184 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027185 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27186 compression = gen_int(n_compression, 2);
27187
27188 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27189 desret_xmlOutputBufferPtr(ret_val);
27190 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027191 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027192 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27193 des_int(n_compression, compression, 2);
27194 xmlResetLastError();
27195 if (mem_base != xmlMemBlocks()) {
27196 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027198 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027199 printf(" %d", n_URI);
27200 printf(" %d", n_encoder);
27201 printf(" %d", n_compression);
27202 printf("\n");
27203 }
27204 }
27205 }
27206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027207 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027208#endif
27209
Daniel Veillard42595322004-11-08 10:52:06 +000027210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027211}
27212
27213
27214static int
27215test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027217
William M. Brack21e4ef22005-01-02 09:53:13 +000027218#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027219 int mem_base;
27220 int ret_val;
27221 xmlOutputBufferPtr out; /* a buffered output */
27222 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027223
Daniel Veillard3d97e662004-11-04 10:49:00 +000027224 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27225 mem_base = xmlMemBlocks();
27226 out = gen_xmlOutputBufferPtr(n_out, 0);
27227
27228 ret_val = xmlOutputBufferFlush(out);
27229 desret_int(ret_val);
27230 call_tests++;
27231 des_xmlOutputBufferPtr(n_out, out, 0);
27232 xmlResetLastError();
27233 if (mem_base != xmlMemBlocks()) {
27234 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027236 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027237 printf(" %d", n_out);
27238 printf("\n");
27239 }
27240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027241 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027242#endif
27243
Daniel Veillard42595322004-11-08 10:52:06 +000027244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027245}
27246
27247
27248static int
27249test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027251
William M. Brack21e4ef22005-01-02 09:53:13 +000027252#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027253 int mem_base;
27254 int ret_val;
27255 xmlOutputBufferPtr out; /* a buffered parser output */
27256 int n_out;
27257 int len; /* the size in bytes of the array. */
27258 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027259 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027260 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027261
Daniel Veillard3d97e662004-11-04 10:49:00 +000027262 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27263 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27264 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27265 mem_base = xmlMemBlocks();
27266 out = gen_xmlOutputBufferPtr(n_out, 0);
27267 len = gen_int(n_len, 1);
27268 buf = gen_const_char_ptr(n_buf, 2);
27269
William M. Brackf13f77f2004-11-12 16:03:48 +000027270 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027271 desret_int(ret_val);
27272 call_tests++;
27273 des_xmlOutputBufferPtr(n_out, out, 0);
27274 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027275 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027276 xmlResetLastError();
27277 if (mem_base != xmlMemBlocks()) {
27278 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027280 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027281 printf(" %d", n_out);
27282 printf(" %d", n_len);
27283 printf(" %d", n_buf);
27284 printf("\n");
27285 }
27286 }
27287 }
27288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027289 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027290#endif
27291
Daniel Veillard42595322004-11-08 10:52:06 +000027292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027293}
27294
27295
27296static int
27297test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027299
27300
27301 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027303}
27304
27305
27306static int
27307test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027309
William M. Brack21e4ef22005-01-02 09:53:13 +000027310#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027311 int mem_base;
27312 int ret_val;
27313 xmlOutputBufferPtr out; /* a buffered parser output */
27314 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027315 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027316 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027317
Daniel Veillard3d97e662004-11-04 10:49:00 +000027318 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27319 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27320 mem_base = xmlMemBlocks();
27321 out = gen_xmlOutputBufferPtr(n_out, 0);
27322 str = gen_const_char_ptr(n_str, 1);
27323
William M. Brackf13f77f2004-11-12 16:03:48 +000027324 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027325 desret_int(ret_val);
27326 call_tests++;
27327 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027328 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027329 xmlResetLastError();
27330 if (mem_base != xmlMemBlocks()) {
27331 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027333 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027334 printf(" %d", n_out);
27335 printf(" %d", n_str);
27336 printf("\n");
27337 }
27338 }
27339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027340 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027341#endif
27342
Daniel Veillard42595322004-11-08 10:52:06 +000027343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027344}
27345
27346
27347static int
27348test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027350
27351
27352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027354}
27355
27356
27357static int
27358test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027360
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027361 int mem_base;
27362 xmlParserInputBufferPtr ret_val;
27363 int fd; /* a file descriptor number */
27364 int n_fd;
27365 xmlCharEncoding enc; /* the charset encoding if known */
27366 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027367
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027368 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27369 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27370 mem_base = xmlMemBlocks();
27371 fd = gen_int(n_fd, 0);
27372 enc = gen_xmlCharEncoding(n_enc, 1);
27373 if (fd >= 0) fd = -1;
27374
27375 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27376 desret_xmlParserInputBufferPtr(ret_val);
27377 call_tests++;
27378 des_int(n_fd, fd, 0);
27379 des_xmlCharEncoding(n_enc, enc, 1);
27380 xmlResetLastError();
27381 if (mem_base != xmlMemBlocks()) {
27382 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027384 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027385 printf(" %d", n_fd);
27386 printf(" %d", n_enc);
27387 printf("\n");
27388 }
27389 }
27390 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027391 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027392
Daniel Veillard42595322004-11-08 10:52:06 +000027393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027394}
27395
27396
27397static int
27398test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027400
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027401 int mem_base;
27402 xmlParserInputBufferPtr ret_val;
27403 FILE * file; /* a FILE* */
27404 int n_file;
27405 xmlCharEncoding enc; /* the charset encoding if known */
27406 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027407
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027408 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27409 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27410 mem_base = xmlMemBlocks();
27411 file = gen_FILE_ptr(n_file, 0);
27412 enc = gen_xmlCharEncoding(n_enc, 1);
27413
27414 ret_val = xmlParserInputBufferCreateFile(file, enc);
27415 desret_xmlParserInputBufferPtr(ret_val);
27416 call_tests++;
27417 des_FILE_ptr(n_file, file, 0);
27418 des_xmlCharEncoding(n_enc, enc, 1);
27419 xmlResetLastError();
27420 if (mem_base != xmlMemBlocks()) {
27421 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027423 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027424 printf(" %d", n_file);
27425 printf(" %d", n_enc);
27426 printf("\n");
27427 }
27428 }
27429 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027431
Daniel Veillard42595322004-11-08 10:52:06 +000027432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027433}
27434
27435
27436static int
27437test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027439
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027440 int mem_base;
27441 xmlParserInputBufferPtr ret_val;
27442 const char * URI; /* a C string containing the URI or filename */
27443 int n_URI;
27444 xmlCharEncoding enc; /* the charset encoding if known */
27445 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027446
Daniel Veillard42595322004-11-08 10:52:06 +000027447 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027448 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27449 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027450 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027451 enc = gen_xmlCharEncoding(n_enc, 1);
27452
27453 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27454 desret_xmlParserInputBufferPtr(ret_val);
27455 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027456 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027457 des_xmlCharEncoding(n_enc, enc, 1);
27458 xmlResetLastError();
27459 if (mem_base != xmlMemBlocks()) {
27460 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027462 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027463 printf(" %d", n_URI);
27464 printf(" %d", n_enc);
27465 printf("\n");
27466 }
27467 }
27468 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027470
Daniel Veillard42595322004-11-08 10:52:06 +000027471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027472}
27473
27474
27475static int
27476test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027478
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027479 int mem_base;
27480 xmlParserInputBufferPtr ret_val;
27481 char * mem; /* the memory input */
27482 int n_mem;
27483 int size; /* the length of the memory block */
27484 int n_size;
27485 xmlCharEncoding enc; /* the charset encoding if known */
27486 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027487
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027488 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27489 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27490 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27491 mem_base = xmlMemBlocks();
27492 mem = gen_const_char_ptr(n_mem, 0);
27493 size = gen_int(n_size, 1);
27494 enc = gen_xmlCharEncoding(n_enc, 2);
27495
William M. Brackf13f77f2004-11-12 16:03:48 +000027496 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027497 desret_xmlParserInputBufferPtr(ret_val);
27498 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027499 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027500 des_int(n_size, size, 1);
27501 des_xmlCharEncoding(n_enc, enc, 2);
27502 xmlResetLastError();
27503 if (mem_base != xmlMemBlocks()) {
27504 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027506 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027507 printf(" %d", n_mem);
27508 printf(" %d", n_size);
27509 printf(" %d", n_enc);
27510 printf("\n");
27511 }
27512 }
27513 }
27514 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027516
Daniel Veillard42595322004-11-08 10:52:06 +000027517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027518}
27519
27520
27521static int
27522test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027524
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027525 int mem_base;
27526 xmlParserInputBufferPtr ret_val;
27527 char * mem; /* the memory input */
27528 int n_mem;
27529 int size; /* the length of the memory block */
27530 int n_size;
27531 xmlCharEncoding enc; /* the charset encoding if known */
27532 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027533
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027534 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27535 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27536 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27537 mem_base = xmlMemBlocks();
27538 mem = gen_const_char_ptr(n_mem, 0);
27539 size = gen_int(n_size, 1);
27540 enc = gen_xmlCharEncoding(n_enc, 2);
27541
William M. Brackf13f77f2004-11-12 16:03:48 +000027542 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027543 desret_xmlParserInputBufferPtr(ret_val);
27544 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027545 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027546 des_int(n_size, size, 1);
27547 des_xmlCharEncoding(n_enc, enc, 2);
27548 xmlResetLastError();
27549 if (mem_base != xmlMemBlocks()) {
27550 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027552 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027553 printf(" %d", n_mem);
27554 printf(" %d", n_size);
27555 printf(" %d", n_enc);
27556 printf("\n");
27557 }
27558 }
27559 }
27560 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +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_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027570
Daniel Veillard34099b42004-11-04 17:34:35 +000027571 int mem_base;
27572 int ret_val;
27573 xmlParserInputBufferPtr in; /* a buffered parser input */
27574 int n_in;
27575 int len; /* indicative value of the amount of chars to read */
27576 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027577
Daniel Veillard34099b42004-11-04 17:34:35 +000027578 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27579 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27580 mem_base = xmlMemBlocks();
27581 in = gen_xmlParserInputBufferPtr(n_in, 0);
27582 len = gen_int(n_len, 1);
27583
27584 ret_val = xmlParserInputBufferGrow(in, len);
27585 desret_int(ret_val);
27586 call_tests++;
27587 des_xmlParserInputBufferPtr(n_in, in, 0);
27588 des_int(n_len, len, 1);
27589 xmlResetLastError();
27590 if (mem_base != xmlMemBlocks()) {
27591 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027593 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027594 printf(" %d", n_in);
27595 printf(" %d", n_len);
27596 printf("\n");
27597 }
27598 }
27599 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027601
Daniel Veillard42595322004-11-08 10:52:06 +000027602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027603}
27604
27605
27606static int
27607test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027609
Daniel Veillard34099b42004-11-04 17:34:35 +000027610 int mem_base;
27611 int ret_val;
27612 xmlParserInputBufferPtr in; /* a buffered parser input */
27613 int n_in;
27614 int len; /* the size in bytes of the array. */
27615 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027616 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027617 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027618
Daniel Veillard34099b42004-11-04 17:34:35 +000027619 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27620 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27621 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27622 mem_base = xmlMemBlocks();
27623 in = gen_xmlParserInputBufferPtr(n_in, 0);
27624 len = gen_int(n_len, 1);
27625 buf = gen_const_char_ptr(n_buf, 2);
27626
William M. Brackf13f77f2004-11-12 16:03:48 +000027627 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027628 desret_int(ret_val);
27629 call_tests++;
27630 des_xmlParserInputBufferPtr(n_in, in, 0);
27631 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027632 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027633 xmlResetLastError();
27634 if (mem_base != xmlMemBlocks()) {
27635 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027637 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027638 printf(" %d", n_in);
27639 printf(" %d", n_len);
27640 printf(" %d", n_buf);
27641 printf("\n");
27642 }
27643 }
27644 }
27645 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027647
Daniel Veillard42595322004-11-08 10:52:06 +000027648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027649}
27650
27651
27652static int
27653test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027655
Daniel Veillard34099b42004-11-04 17:34:35 +000027656 int mem_base;
27657 int ret_val;
27658 xmlParserInputBufferPtr in; /* a buffered parser input */
27659 int n_in;
27660 int len; /* indicative value of the amount of chars to read */
27661 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027662
Daniel Veillard34099b42004-11-04 17:34:35 +000027663 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27664 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27665 mem_base = xmlMemBlocks();
27666 in = gen_xmlParserInputBufferPtr(n_in, 0);
27667 len = gen_int(n_len, 1);
27668
27669 ret_val = xmlParserInputBufferRead(in, len);
27670 desret_int(ret_val);
27671 call_tests++;
27672 des_xmlParserInputBufferPtr(n_in, in, 0);
27673 des_int(n_len, len, 1);
27674 xmlResetLastError();
27675 if (mem_base != xmlMemBlocks()) {
27676 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027678 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027679 printf(" %d", n_in);
27680 printf(" %d", n_len);
27681 printf("\n");
27682 }
27683 }
27684 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027686
Daniel Veillard42595322004-11-08 10:52:06 +000027687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027688}
27689
27690
27691static int
27692test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027694
27695 int mem_base;
27696 int ret_val;
27697
27698 mem_base = xmlMemBlocks();
27699
27700 ret_val = xmlPopInputCallbacks();
27701 desret_int(ret_val);
27702 call_tests++;
27703 xmlResetLastError();
27704 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027705 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027707 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027708 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027709 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027710 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027711
Daniel Veillard42595322004-11-08 10:52:06 +000027712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027713}
27714
27715
27716static int
27717test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027719
27720 int mem_base;
27721
27722 mem_base = xmlMemBlocks();
27723
27724 xmlRegisterDefaultInputCallbacks();
27725 call_tests++;
27726 xmlResetLastError();
27727 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027728 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027730 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027731 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027732 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027734
Daniel Veillard42595322004-11-08 10:52:06 +000027735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027736}
27737
27738
27739static int
27740test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027742
William M. Brack21e4ef22005-01-02 09:53:13 +000027743#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027744 int mem_base;
27745
27746 mem_base = xmlMemBlocks();
27747
27748 xmlRegisterDefaultOutputCallbacks();
27749 call_tests++;
27750 xmlResetLastError();
27751 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027752 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027754 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027755 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027757 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027758#endif
27759
Daniel Veillard42595322004-11-08 10:52:06 +000027760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027761}
27762
27763
27764static int
27765test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027767
William M. Brack21e4ef22005-01-02 09:53:13 +000027768#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027769 int mem_base;
27770
27771 mem_base = xmlMemBlocks();
27772
27773 xmlRegisterHTTPPostCallbacks();
27774 call_tests++;
27775 xmlResetLastError();
27776 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027777 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027779 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027782 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027783#endif
27784
Daniel Veillard42595322004-11-08 10:52:06 +000027785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027786}
27787
27788static int
27789test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027791
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027792 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027793 test_ret += test_xmlAllocOutputBuffer();
27794 test_ret += test_xmlAllocParserInputBuffer();
27795 test_ret += test_xmlCheckFilename();
27796 test_ret += test_xmlCheckHTTPInput();
27797 test_ret += test_xmlCleanupInputCallbacks();
27798 test_ret += test_xmlCleanupOutputCallbacks();
27799 test_ret += test_xmlFileClose();
27800 test_ret += test_xmlFileMatch();
27801 test_ret += test_xmlFileOpen();
27802 test_ret += test_xmlFileRead();
27803 test_ret += test_xmlIOFTPClose();
27804 test_ret += test_xmlIOFTPMatch();
27805 test_ret += test_xmlIOFTPOpen();
27806 test_ret += test_xmlIOFTPRead();
27807 test_ret += test_xmlIOHTTPClose();
27808 test_ret += test_xmlIOHTTPMatch();
27809 test_ret += test_xmlIOHTTPOpen();
Daniel Veillard42595322004-11-08 10:52:06 +000027810 test_ret += test_xmlIOHTTPRead();
27811 test_ret += test_xmlNoNetExternalEntityLoader();
27812 test_ret += test_xmlNormalizeWindowsPath();
27813 test_ret += test_xmlOutputBufferCreateFd();
27814 test_ret += test_xmlOutputBufferCreateFile();
27815 test_ret += test_xmlOutputBufferCreateFilename();
27816 test_ret += test_xmlOutputBufferFlush();
27817 test_ret += test_xmlOutputBufferWrite();
27818 test_ret += test_xmlOutputBufferWriteEscape();
27819 test_ret += test_xmlOutputBufferWriteString();
27820 test_ret += test_xmlParserGetDirectory();
27821 test_ret += test_xmlParserInputBufferCreateFd();
27822 test_ret += test_xmlParserInputBufferCreateFile();
27823 test_ret += test_xmlParserInputBufferCreateFilename();
27824 test_ret += test_xmlParserInputBufferCreateMem();
27825 test_ret += test_xmlParserInputBufferCreateStatic();
27826 test_ret += test_xmlParserInputBufferGrow();
27827 test_ret += test_xmlParserInputBufferPush();
27828 test_ret += test_xmlParserInputBufferRead();
27829 test_ret += test_xmlPopInputCallbacks();
27830 test_ret += test_xmlRegisterDefaultInputCallbacks();
27831 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27832 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027833
Daniel Veillard42595322004-11-08 10:52:06 +000027834 if (test_ret != 0)
27835 printf("Module xmlIO: %d errors\n", test_ret);
27836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027837}
Daniel Veillarda521d282004-11-09 14:59:59 +000027838#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027839
Daniel Veillarda82b1822004-11-08 16:24:57 +000027840#define gen_nb_xmlAutomataPtr 1
27841static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27842 return(NULL);
27843}
27844static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27845}
Daniel Veillarda521d282004-11-09 14:59:59 +000027846#endif
27847
Daniel Veillarda82b1822004-11-08 16:24:57 +000027848
27849static int
27850test_xmlAutomataCompile(void) {
27851 int test_ret = 0;
27852
27853
27854 /* missing type support */
27855 return(test_ret);
27856}
27857
27858
27859static int
27860test_xmlAutomataGetInitState(void) {
27861 int test_ret = 0;
27862
27863
27864 /* missing type support */
27865 return(test_ret);
27866}
27867
27868
27869static int
27870test_xmlAutomataIsDeterminist(void) {
27871 int test_ret = 0;
27872
William M. Brack21e4ef22005-01-02 09:53:13 +000027873#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027874 int mem_base;
27875 int ret_val;
27876 xmlAutomataPtr am; /* an automata */
27877 int n_am;
27878
27879 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27880 mem_base = xmlMemBlocks();
27881 am = gen_xmlAutomataPtr(n_am, 0);
27882
27883 ret_val = xmlAutomataIsDeterminist(am);
27884 desret_int(ret_val);
27885 call_tests++;
27886 des_xmlAutomataPtr(n_am, am, 0);
27887 xmlResetLastError();
27888 if (mem_base != xmlMemBlocks()) {
27889 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27890 xmlMemBlocks() - mem_base);
27891 test_ret++;
27892 printf(" %d", n_am);
27893 printf("\n");
27894 }
27895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027896 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027897#endif
27898
Daniel Veillarda82b1822004-11-08 16:24:57 +000027899 return(test_ret);
27900}
27901
Daniel Veillarda521d282004-11-09 14:59:59 +000027902#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027903
27904#define gen_nb_xmlAutomataStatePtr 1
27905static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27906 return(NULL);
27907}
27908static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27909}
Daniel Veillarda521d282004-11-09 14:59:59 +000027910#endif
27911
Daniel Veillarda82b1822004-11-08 16:24:57 +000027912
27913static int
27914test_xmlAutomataNewAllTrans(void) {
27915 int test_ret = 0;
27916
27917
27918 /* missing type support */
27919 return(test_ret);
27920}
27921
27922
27923static int
27924test_xmlAutomataNewCountTrans(void) {
27925 int test_ret = 0;
27926
27927
27928 /* missing type support */
27929 return(test_ret);
27930}
27931
27932
27933static int
27934test_xmlAutomataNewCountTrans2(void) {
27935 int test_ret = 0;
27936
27937
27938 /* missing type support */
27939 return(test_ret);
27940}
27941
27942
27943static int
27944test_xmlAutomataNewCountedTrans(void) {
27945 int test_ret = 0;
27946
27947
27948 /* missing type support */
27949 return(test_ret);
27950}
27951
27952
27953static int
27954test_xmlAutomataNewCounter(void) {
27955 int test_ret = 0;
27956
William M. Brack21e4ef22005-01-02 09:53:13 +000027957#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027958 int mem_base;
27959 int ret_val;
27960 xmlAutomataPtr am; /* an automata */
27961 int n_am;
27962 int min; /* the minimal value on the counter */
27963 int n_min;
27964 int max; /* the maximal value on the counter */
27965 int n_max;
27966
27967 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27968 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27969 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27970 mem_base = xmlMemBlocks();
27971 am = gen_xmlAutomataPtr(n_am, 0);
27972 min = gen_int(n_min, 1);
27973 max = gen_int(n_max, 2);
27974
27975 ret_val = xmlAutomataNewCounter(am, min, max);
27976 desret_int(ret_val);
27977 call_tests++;
27978 des_xmlAutomataPtr(n_am, am, 0);
27979 des_int(n_min, min, 1);
27980 des_int(n_max, max, 2);
27981 xmlResetLastError();
27982 if (mem_base != xmlMemBlocks()) {
27983 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27984 xmlMemBlocks() - mem_base);
27985 test_ret++;
27986 printf(" %d", n_am);
27987 printf(" %d", n_min);
27988 printf(" %d", n_max);
27989 printf("\n");
27990 }
27991 }
27992 }
27993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027994 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027995#endif
27996
Daniel Veillarda82b1822004-11-08 16:24:57 +000027997 return(test_ret);
27998}
27999
28000
28001static int
28002test_xmlAutomataNewCounterTrans(void) {
28003 int test_ret = 0;
28004
28005
28006 /* missing type support */
28007 return(test_ret);
28008}
28009
28010
28011static int
28012test_xmlAutomataNewEpsilon(void) {
28013 int test_ret = 0;
28014
28015
28016 /* missing type support */
28017 return(test_ret);
28018}
28019
28020
28021static int
28022test_xmlAutomataNewOnceTrans(void) {
28023 int test_ret = 0;
28024
28025
28026 /* missing type support */
28027 return(test_ret);
28028}
28029
28030
28031static int
28032test_xmlAutomataNewOnceTrans2(void) {
28033 int test_ret = 0;
28034
28035
28036 /* missing type support */
28037 return(test_ret);
28038}
28039
28040
28041static int
28042test_xmlAutomataNewState(void) {
28043 int test_ret = 0;
28044
28045
28046 /* missing type support */
28047 return(test_ret);
28048}
28049
28050
28051static int
28052test_xmlAutomataNewTransition(void) {
28053 int test_ret = 0;
28054
28055
28056 /* missing type support */
28057 return(test_ret);
28058}
28059
28060
28061static int
28062test_xmlAutomataNewTransition2(void) {
28063 int test_ret = 0;
28064
28065
28066 /* missing type support */
28067 return(test_ret);
28068}
28069
28070
28071static int
28072test_xmlAutomataSetFinalState(void) {
28073 int test_ret = 0;
28074
William M. Brack21e4ef22005-01-02 09:53:13 +000028075#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028076 int mem_base;
28077 int ret_val;
28078 xmlAutomataPtr am; /* an automata */
28079 int n_am;
28080 xmlAutomataStatePtr state; /* a state in this automata */
28081 int n_state;
28082
28083 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28084 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28085 mem_base = xmlMemBlocks();
28086 am = gen_xmlAutomataPtr(n_am, 0);
28087 state = gen_xmlAutomataStatePtr(n_state, 1);
28088
28089 ret_val = xmlAutomataSetFinalState(am, state);
28090 desret_int(ret_val);
28091 call_tests++;
28092 des_xmlAutomataPtr(n_am, am, 0);
28093 des_xmlAutomataStatePtr(n_state, state, 1);
28094 xmlResetLastError();
28095 if (mem_base != xmlMemBlocks()) {
28096 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28097 xmlMemBlocks() - mem_base);
28098 test_ret++;
28099 printf(" %d", n_am);
28100 printf(" %d", n_state);
28101 printf("\n");
28102 }
28103 }
28104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028105 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028106#endif
28107
Daniel Veillarda82b1822004-11-08 16:24:57 +000028108 return(test_ret);
28109}
28110
28111
28112static int
28113test_xmlNewAutomata(void) {
28114 int test_ret = 0;
28115
28116
28117 /* missing type support */
28118 return(test_ret);
28119}
28120
28121static int
28122test_xmlautomata(void) {
28123 int test_ret = 0;
28124
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028125 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028126 test_ret += test_xmlAutomataCompile();
28127 test_ret += test_xmlAutomataGetInitState();
28128 test_ret += test_xmlAutomataIsDeterminist();
28129 test_ret += test_xmlAutomataNewAllTrans();
28130 test_ret += test_xmlAutomataNewCountTrans();
28131 test_ret += test_xmlAutomataNewCountTrans2();
28132 test_ret += test_xmlAutomataNewCountedTrans();
28133 test_ret += test_xmlAutomataNewCounter();
28134 test_ret += test_xmlAutomataNewCounterTrans();
28135 test_ret += test_xmlAutomataNewEpsilon();
28136 test_ret += test_xmlAutomataNewOnceTrans();
28137 test_ret += test_xmlAutomataNewOnceTrans2();
28138 test_ret += test_xmlAutomataNewState();
28139 test_ret += test_xmlAutomataNewTransition();
28140 test_ret += test_xmlAutomataNewTransition2();
28141 test_ret += test_xmlAutomataSetFinalState();
28142 test_ret += test_xmlNewAutomata();
28143
28144 if (test_ret != 0)
28145 printf("Module xmlautomata: %d errors\n", test_ret);
28146 return(test_ret);
28147}
28148
Daniel Veillardce682bc2004-11-05 17:22:25 +000028149#define gen_nb_xmlGenericErrorFunc_ptr 1
28150static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28151 return(NULL);
28152}
28153static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28154}
28155
Daniel Veillardd93f6252004-11-02 15:53:51 +000028156static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028157test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028159
Daniel Veillardce682bc2004-11-05 17:22:25 +000028160 int mem_base;
28161 xmlGenericErrorFunc * handler; /* the handler */
28162 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028163
Daniel Veillardce682bc2004-11-05 17:22:25 +000028164 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28165 mem_base = xmlMemBlocks();
28166 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28167
28168 initGenericErrorDefaultFunc(handler);
28169 call_tests++;
28170 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28171 xmlResetLastError();
28172 if (mem_base != xmlMemBlocks()) {
28173 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028175 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028176 printf(" %d", n_handler);
28177 printf("\n");
28178 }
28179 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028180 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028181
Daniel Veillard42595322004-11-08 10:52:06 +000028182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028183}
28184
28185
Daniel Veillardce682bc2004-11-05 17:22:25 +000028186#define gen_nb_xmlErrorPtr 1
28187static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28188 return(NULL);
28189}
28190static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28191}
28192
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193static int
28194test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028196
Daniel Veillardce682bc2004-11-05 17:22:25 +000028197 int mem_base;
28198 int ret_val;
28199 xmlErrorPtr from; /* a source error */
28200 int n_from;
28201 xmlErrorPtr to; /* a target error */
28202 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028203
Daniel Veillardce682bc2004-11-05 17:22:25 +000028204 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28205 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28206 mem_base = xmlMemBlocks();
28207 from = gen_xmlErrorPtr(n_from, 0);
28208 to = gen_xmlErrorPtr(n_to, 1);
28209
28210 ret_val = xmlCopyError(from, to);
28211 desret_int(ret_val);
28212 call_tests++;
28213 des_xmlErrorPtr(n_from, from, 0);
28214 des_xmlErrorPtr(n_to, to, 1);
28215 xmlResetLastError();
28216 if (mem_base != xmlMemBlocks()) {
28217 printf("Leak of %d blocks found in xmlCopyError",
28218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028219 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028220 printf(" %d", n_from);
28221 printf(" %d", n_to);
28222 printf("\n");
28223 }
28224 }
28225 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028226 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028227
Daniel Veillard42595322004-11-08 10:52:06 +000028228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028229}
28230
28231
28232static int
28233test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028235
28236
28237 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028239}
28240
28241
28242static int
28243test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028245
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028246 int mem_base;
28247 void * ctx; /* an XML parser context */
28248 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028249
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028250 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028252 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028253
28254 xmlCtxtResetLastError(ctx);
28255 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028256 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028257 xmlResetLastError();
28258 if (mem_base != xmlMemBlocks()) {
28259 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028261 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028262 printf(" %d", n_ctx);
28263 printf("\n");
28264 }
28265 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028266 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028267
Daniel Veillard42595322004-11-08 10:52:06 +000028268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028269}
28270
28271
28272static int
28273test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028275
28276
28277 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028279}
28280
28281
28282static int
28283test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028285
28286
28287 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028289}
28290
28291
28292static int
28293test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028295
Daniel Veillardce682bc2004-11-05 17:22:25 +000028296 int mem_base;
28297 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28298 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028299
Daniel Veillardce682bc2004-11-05 17:22:25 +000028300 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28301 mem_base = xmlMemBlocks();
28302 input = gen_xmlParserInputPtr(n_input, 0);
28303
28304 xmlParserPrintFileContext(input);
28305 call_tests++;
28306 des_xmlParserInputPtr(n_input, input, 0);
28307 xmlResetLastError();
28308 if (mem_base != xmlMemBlocks()) {
28309 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028311 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028312 printf(" %d", n_input);
28313 printf("\n");
28314 }
28315 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028316 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028317
Daniel Veillard42595322004-11-08 10:52:06 +000028318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028319}
28320
28321
28322static int
28323test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028325
Daniel Veillardce682bc2004-11-05 17:22:25 +000028326 int mem_base;
28327 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28328 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028329
Daniel Veillardce682bc2004-11-05 17:22:25 +000028330 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28331 mem_base = xmlMemBlocks();
28332 input = gen_xmlParserInputPtr(n_input, 0);
28333
28334 xmlParserPrintFileInfo(input);
28335 call_tests++;
28336 des_xmlParserInputPtr(n_input, input, 0);
28337 xmlResetLastError();
28338 if (mem_base != xmlMemBlocks()) {
28339 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028341 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028342 printf(" %d", n_input);
28343 printf("\n");
28344 }
28345 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028347
Daniel Veillard42595322004-11-08 10:52:06 +000028348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028349}
28350
28351
28352static int
28353test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028355
28356
28357 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028359}
28360
28361
28362static int
28363test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028365
28366
28367 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028369}
28370
28371
28372static int
28373test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028375
28376
28377 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028379}
28380
28381
28382static int
28383test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028385
Daniel Veillardce682bc2004-11-05 17:22:25 +000028386 int mem_base;
28387 xmlErrorPtr err; /* pointer to the error. */
28388 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028389
Daniel Veillardce682bc2004-11-05 17:22:25 +000028390 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28391 mem_base = xmlMemBlocks();
28392 err = gen_xmlErrorPtr(n_err, 0);
28393
28394 xmlResetError(err);
28395 call_tests++;
28396 des_xmlErrorPtr(n_err, err, 0);
28397 xmlResetLastError();
28398 if (mem_base != xmlMemBlocks()) {
28399 printf("Leak of %d blocks found in xmlResetError",
28400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028401 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028402 printf(" %d", n_err);
28403 printf("\n");
28404 }
28405 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028407
Daniel Veillard42595322004-11-08 10:52:06 +000028408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028409}
28410
28411
28412static int
28413test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028415
28416
28417
28418 xmlResetLastError();
28419 call_tests++;
28420 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028421 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028422
Daniel Veillard42595322004-11-08 10:52:06 +000028423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028424}
28425
28426
28427static int
28428test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028430
28431
28432 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028434}
28435
28436
28437static int
28438test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028440
28441
28442 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028444}
28445
28446static int
28447test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028449
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028450 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028451 test_ret += test_initGenericErrorDefaultFunc();
28452 test_ret += test_xmlCopyError();
28453 test_ret += test_xmlCtxtGetLastError();
28454 test_ret += test_xmlCtxtResetLastError();
28455 test_ret += test_xmlGetLastError();
28456 test_ret += test_xmlParserError();
28457 test_ret += test_xmlParserPrintFileContext();
28458 test_ret += test_xmlParserPrintFileInfo();
28459 test_ret += test_xmlParserValidityError();
28460 test_ret += test_xmlParserValidityWarning();
28461 test_ret += test_xmlParserWarning();
28462 test_ret += test_xmlResetError();
28463 test_ret += test_xmlResetLastError();
28464 test_ret += test_xmlSetGenericErrorFunc();
28465 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028466
Daniel Veillard42595322004-11-08 10:52:06 +000028467 if (test_ret != 0)
28468 printf("Module xmlerror: %d errors\n", test_ret);
28469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028470}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028471#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028472
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028473#define gen_nb_xmlModulePtr 1
28474static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28475 return(NULL);
28476}
28477static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28478}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028479#endif
28480
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028481
28482static int
28483test_xmlModuleClose(void) {
28484 int test_ret = 0;
28485
28486#if defined(LIBXML_MODULES_ENABLED)
28487 int mem_base;
28488 int ret_val;
28489 xmlModulePtr module; /* the module handle */
28490 int n_module;
28491
28492 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28493 mem_base = xmlMemBlocks();
28494 module = gen_xmlModulePtr(n_module, 0);
28495
28496 ret_val = xmlModuleClose(module);
28497 desret_int(ret_val);
28498 call_tests++;
28499 des_xmlModulePtr(n_module, module, 0);
28500 xmlResetLastError();
28501 if (mem_base != xmlMemBlocks()) {
28502 printf("Leak of %d blocks found in xmlModuleClose",
28503 xmlMemBlocks() - mem_base);
28504 test_ret++;
28505 printf(" %d", n_module);
28506 printf("\n");
28507 }
28508 }
28509 function_tests++;
28510#endif
28511
28512 return(test_ret);
28513}
28514
28515
28516static int
28517test_xmlModuleOpen(void) {
28518 int test_ret = 0;
28519
28520
28521 /* missing type support */
28522 return(test_ret);
28523}
28524
28525
28526static int
28527test_xmlModuleSymbol(void) {
28528 int test_ret = 0;
28529
28530#if defined(LIBXML_MODULES_ENABLED)
28531 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028532 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028533 xmlModulePtr module; /* the module */
28534 int n_module;
28535 char * name; /* the name of the symbol */
28536 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028537 void ** symbol; /* the resulting symbol address */
28538 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028539
28540 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28541 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028542 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028543 mem_base = xmlMemBlocks();
28544 module = gen_xmlModulePtr(n_module, 0);
28545 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028546 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028547
Daniel Veillardbe076e92005-01-04 20:18:14 +000028548 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28549 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028550 call_tests++;
28551 des_xmlModulePtr(n_module, module, 0);
28552 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028553 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028554 xmlResetLastError();
28555 if (mem_base != xmlMemBlocks()) {
28556 printf("Leak of %d blocks found in xmlModuleSymbol",
28557 xmlMemBlocks() - mem_base);
28558 test_ret++;
28559 printf(" %d", n_module);
28560 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028561 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028562 printf("\n");
28563 }
28564 }
28565 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028566 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028567 function_tests++;
28568#endif
28569
28570 return(test_ret);
28571}
28572
28573static int
28574test_xmlmodule(void) {
28575 int test_ret = 0;
28576
28577 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28578 test_ret += test_xmlModuleClose();
28579 test_ret += test_xmlModuleOpen();
28580 test_ret += test_xmlModuleSymbol();
28581
28582 if (test_ret != 0)
28583 printf("Module xmlmodule: %d errors\n", test_ret);
28584 return(test_ret);
28585}
28586
Daniel Veillardd93f6252004-11-02 15:53:51 +000028587static int
28588test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028590
William M. Brack21e4ef22005-01-02 09:53:13 +000028591#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028592 int mem_base;
28593 xmlTextReaderPtr ret_val;
28594 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28595 int n_input;
28596 const char * URI; /* the URI information for the source if available */
28597 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028598
Daniel Veillard34099b42004-11-04 17:34:35 +000028599 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28600 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28601 mem_base = xmlMemBlocks();
28602 input = gen_xmlParserInputBufferPtr(n_input, 0);
28603 URI = gen_filepath(n_URI, 1);
28604
28605 ret_val = xmlNewTextReader(input, URI);
28606 desret_xmlTextReaderPtr(ret_val);
28607 call_tests++;
28608 des_xmlParserInputBufferPtr(n_input, input, 0);
28609 des_filepath(n_URI, URI, 1);
28610 xmlResetLastError();
28611 if (mem_base != xmlMemBlocks()) {
28612 printf("Leak of %d blocks found in xmlNewTextReader",
28613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028614 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028615 printf(" %d", n_input);
28616 printf(" %d", n_URI);
28617 printf("\n");
28618 }
28619 }
28620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028621 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028622#endif
28623
Daniel Veillard42595322004-11-08 10:52:06 +000028624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028625}
28626
28627
28628static int
28629test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028631
William M. Brack21e4ef22005-01-02 09:53:13 +000028632#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028633 int mem_base;
28634 xmlTextReaderPtr ret_val;
28635 const char * URI; /* the URI of the resource to process */
28636 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028637
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028638 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28639 mem_base = xmlMemBlocks();
28640 URI = gen_filepath(n_URI, 0);
28641
28642 ret_val = xmlNewTextReaderFilename(URI);
28643 desret_xmlTextReaderPtr(ret_val);
28644 call_tests++;
28645 des_filepath(n_URI, URI, 0);
28646 xmlResetLastError();
28647 if (mem_base != xmlMemBlocks()) {
28648 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028650 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028651 printf(" %d", n_URI);
28652 printf("\n");
28653 }
28654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028655 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028656#endif
28657
Daniel Veillard42595322004-11-08 10:52:06 +000028658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028659}
28660
28661
28662static int
28663test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028665
William M. Brack21e4ef22005-01-02 09:53:13 +000028666#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028667 int mem_base;
28668 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028669 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028670 int n_cur;
28671 const char * URL; /* the base URL to use for the document */
28672 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028673 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028674 int n_encoding;
28675 int options; /* a combination of xmlParserOption */
28676 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028677
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028678 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28679 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28680 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028681 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028682 mem_base = xmlMemBlocks();
28683 cur = gen_const_xmlChar_ptr(n_cur, 0);
28684 URL = gen_filepath(n_URL, 1);
28685 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028686 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028687
William M. Brackf13f77f2004-11-12 16:03:48 +000028688 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028689 desret_xmlTextReaderPtr(ret_val);
28690 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028691 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028692 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028693 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028694 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028695 xmlResetLastError();
28696 if (mem_base != xmlMemBlocks()) {
28697 printf("Leak of %d blocks found in xmlReaderForDoc",
28698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028699 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028700 printf(" %d", n_cur);
28701 printf(" %d", n_URL);
28702 printf(" %d", n_encoding);
28703 printf(" %d", n_options);
28704 printf("\n");
28705 }
28706 }
28707 }
28708 }
28709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028710 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +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_xmlReaderForFile(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 Veillard1ba06bb2004-11-04 12:32:18 +000028722 int mem_base;
28723 xmlTextReaderPtr ret_val;
28724 const char * filename; /* a file or URL */
28725 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028726 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028727 int n_encoding;
28728 int options; /* a combination of xmlParserOption */
28729 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028730
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028731 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28732 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028733 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028734 mem_base = xmlMemBlocks();
28735 filename = gen_filepath(n_filename, 0);
28736 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028737 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028738
William M. Brackf13f77f2004-11-12 16:03:48 +000028739 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028740 desret_xmlTextReaderPtr(ret_val);
28741 call_tests++;
28742 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028743 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028744 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028745 xmlResetLastError();
28746 if (mem_base != xmlMemBlocks()) {
28747 printf("Leak of %d blocks found in xmlReaderForFile",
28748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028749 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028750 printf(" %d", n_filename);
28751 printf(" %d", n_encoding);
28752 printf(" %d", n_options);
28753 printf("\n");
28754 }
28755 }
28756 }
28757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028758 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028759#endif
28760
Daniel Veillard42595322004-11-08 10:52:06 +000028761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028762}
28763
28764
28765static int
28766test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028768
William M. Brack21e4ef22005-01-02 09:53:13 +000028769#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028770 int mem_base;
28771 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028772 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028773 int n_buffer;
28774 int size; /* the size of the array */
28775 int n_size;
28776 const char * URL; /* the base URL to use for the document */
28777 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028778 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028779 int n_encoding;
28780 int options; /* a combination of xmlParserOption */
28781 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028782
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028783 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28784 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28785 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28786 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028787 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028788 mem_base = xmlMemBlocks();
28789 buffer = gen_const_char_ptr(n_buffer, 0);
28790 size = gen_int(n_size, 1);
28791 URL = gen_filepath(n_URL, 2);
28792 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028793 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028794
William M. Brackf13f77f2004-11-12 16:03:48 +000028795 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028796 desret_xmlTextReaderPtr(ret_val);
28797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028798 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028799 des_int(n_size, size, 1);
28800 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028801 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028802 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028803 xmlResetLastError();
28804 if (mem_base != xmlMemBlocks()) {
28805 printf("Leak of %d blocks found in xmlReaderForMemory",
28806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028807 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028808 printf(" %d", n_buffer);
28809 printf(" %d", n_size);
28810 printf(" %d", n_URL);
28811 printf(" %d", n_encoding);
28812 printf(" %d", n_options);
28813 printf("\n");
28814 }
28815 }
28816 }
28817 }
28818 }
28819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028820 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028821#endif
28822
Daniel Veillard42595322004-11-08 10:52:06 +000028823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028824}
28825
28826
28827static int
28828test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028830
William M. Brack21e4ef22005-01-02 09:53:13 +000028831#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028832 int mem_base;
28833 int ret_val;
28834 xmlTextReaderPtr reader; /* an XML reader */
28835 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028836 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028837 int n_cur;
28838 const char * URL; /* the base URL to use for the document */
28839 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028840 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028841 int n_encoding;
28842 int options; /* a combination of xmlParserOption */
28843 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028844
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028845 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28846 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28847 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28848 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028849 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028851 reader = gen_xmlTextReaderPtr(n_reader, 0);
28852 cur = gen_const_xmlChar_ptr(n_cur, 1);
28853 URL = gen_filepath(n_URL, 2);
28854 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028855 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028856
William M. Brackf13f77f2004-11-12 16:03:48 +000028857 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028858 desret_int(ret_val);
28859 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028860 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028861 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028862 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028863 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028864 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028865 xmlResetLastError();
28866 if (mem_base != xmlMemBlocks()) {
28867 printf("Leak of %d blocks found in xmlReaderNewDoc",
28868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028869 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028870 printf(" %d", n_reader);
28871 printf(" %d", n_cur);
28872 printf(" %d", n_URL);
28873 printf(" %d", n_encoding);
28874 printf(" %d", n_options);
28875 printf("\n");
28876 }
28877 }
28878 }
28879 }
28880 }
28881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028882 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028883#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028884
Daniel Veillard42595322004-11-08 10:52:06 +000028885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028886}
28887
28888
28889static int
28890test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028892
William M. Brack21e4ef22005-01-02 09:53:13 +000028893#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028894 int mem_base;
28895 int ret_val;
28896 xmlTextReaderPtr reader; /* an XML reader */
28897 int n_reader;
28898 const char * filename; /* a file or URL */
28899 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028900 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028901 int n_encoding;
28902 int options; /* a combination of xmlParserOption */
28903 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028904
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028905 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28906 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28907 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028908 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028910 reader = gen_xmlTextReaderPtr(n_reader, 0);
28911 filename = gen_filepath(n_filename, 1);
28912 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028913 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028914
William M. Brackf13f77f2004-11-12 16:03:48 +000028915 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028916 desret_int(ret_val);
28917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028918 des_xmlTextReaderPtr(n_reader, reader, 0);
28919 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028920 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028921 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028922 xmlResetLastError();
28923 if (mem_base != xmlMemBlocks()) {
28924 printf("Leak of %d blocks found in xmlReaderNewFile",
28925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028926 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028927 printf(" %d", n_reader);
28928 printf(" %d", n_filename);
28929 printf(" %d", n_encoding);
28930 printf(" %d", n_options);
28931 printf("\n");
28932 }
28933 }
28934 }
28935 }
28936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028937 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028938#endif
28939
Daniel Veillard42595322004-11-08 10:52:06 +000028940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028941}
28942
28943
28944static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028945test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028947
William M. Brack21e4ef22005-01-02 09:53:13 +000028948#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028949 int mem_base;
28950 int ret_val;
28951 xmlTextReaderPtr reader; /* an XML reader */
28952 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028953 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028954 int n_buffer;
28955 int size; /* the size of the array */
28956 int n_size;
28957 const char * URL; /* the base URL to use for the document */
28958 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028959 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028960 int n_encoding;
28961 int options; /* a combination of xmlParserOption */
28962 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028963
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028964 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28965 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28966 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28967 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28968 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028969 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028970 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028971 reader = gen_xmlTextReaderPtr(n_reader, 0);
28972 buffer = gen_const_char_ptr(n_buffer, 1);
28973 size = gen_int(n_size, 2);
28974 URL = gen_filepath(n_URL, 3);
28975 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028976 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028977
William M. Brackf13f77f2004-11-12 16:03:48 +000028978 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028979 desret_int(ret_val);
28980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028981 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028982 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028983 des_int(n_size, size, 2);
28984 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028985 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028986 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028987 xmlResetLastError();
28988 if (mem_base != xmlMemBlocks()) {
28989 printf("Leak of %d blocks found in xmlReaderNewMemory",
28990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028991 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028992 printf(" %d", n_reader);
28993 printf(" %d", n_buffer);
28994 printf(" %d", n_size);
28995 printf(" %d", n_URL);
28996 printf(" %d", n_encoding);
28997 printf(" %d", n_options);
28998 printf("\n");
28999 }
29000 }
29001 }
29002 }
29003 }
29004 }
29005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029006 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029007#endif
29008
Daniel Veillard42595322004-11-08 10:52:06 +000029009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029010}
29011
29012
29013static int
29014test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029016
William M. Brack21e4ef22005-01-02 09:53:13 +000029017#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029018 int mem_base;
29019 int ret_val;
29020 xmlTextReaderPtr reader; /* an XML reader */
29021 int n_reader;
29022 xmlDocPtr doc; /* a preparsed document */
29023 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029024
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029025 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29026 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029028 reader = gen_xmlTextReaderPtr(n_reader, 0);
29029 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029030
29031 ret_val = xmlReaderNewWalker(reader, doc);
29032 desret_int(ret_val);
29033 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029034 des_xmlTextReaderPtr(n_reader, reader, 0);
29035 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029036 xmlResetLastError();
29037 if (mem_base != xmlMemBlocks()) {
29038 printf("Leak of %d blocks found in xmlReaderNewWalker",
29039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029040 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029041 printf(" %d", n_reader);
29042 printf(" %d", n_doc);
29043 printf("\n");
29044 }
29045 }
29046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029047 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029048#endif
29049
Daniel Veillard42595322004-11-08 10:52:06 +000029050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029051}
29052
29053
29054static int
29055test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029057
William M. Brack21e4ef22005-01-02 09:53:13 +000029058#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029059 int mem_base;
29060 xmlTextReaderPtr ret_val;
29061 xmlDocPtr doc; /* a preparsed document */
29062 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029063
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029064 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29065 mem_base = xmlMemBlocks();
29066 doc = gen_xmlDocPtr(n_doc, 0);
29067
29068 ret_val = xmlReaderWalker(doc);
29069 desret_xmlTextReaderPtr(ret_val);
29070 call_tests++;
29071 des_xmlDocPtr(n_doc, doc, 0);
29072 xmlResetLastError();
29073 if (mem_base != xmlMemBlocks()) {
29074 printf("Leak of %d blocks found in xmlReaderWalker",
29075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029076 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029077 printf(" %d", n_doc);
29078 printf("\n");
29079 }
29080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029081 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029082#endif
29083
Daniel Veillard42595322004-11-08 10:52:06 +000029084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029085}
29086
29087
29088static int
29089test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029091
William M. Brack21e4ef22005-01-02 09:53:13 +000029092#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029093 int mem_base;
29094 int ret_val;
29095 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29096 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029097
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029098 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29099 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029100 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029101
29102 ret_val = xmlTextReaderAttributeCount(reader);
29103 desret_int(ret_val);
29104 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029105 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029106 xmlResetLastError();
29107 if (mem_base != xmlMemBlocks()) {
29108 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
29109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029110 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029111 printf(" %d", n_reader);
29112 printf("\n");
29113 }
29114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029115 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029116#endif
29117
Daniel Veillard42595322004-11-08 10:52:06 +000029118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029119}
29120
29121
29122static int
29123test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029125
William M. Brack21e4ef22005-01-02 09:53:13 +000029126#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029127 int mem_base;
29128 xmlChar * ret_val;
29129 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29130 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029131
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029132 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29133 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029134 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029135
29136 ret_val = xmlTextReaderBaseUri(reader);
29137 desret_xmlChar_ptr(ret_val);
29138 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029139 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029140 xmlResetLastError();
29141 if (mem_base != xmlMemBlocks()) {
29142 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029144 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029145 printf(" %d", n_reader);
29146 printf("\n");
29147 }
29148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029149 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029150#endif
29151
Daniel Veillard42595322004-11-08 10:52:06 +000029152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029153}
29154
29155
29156static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000029157test_xmlTextReaderByteConsumed(void) {
29158 int test_ret = 0;
29159
29160#if defined(LIBXML_READER_ENABLED)
29161 int mem_base;
29162 long ret_val;
29163 xmlTextReaderPtr reader; /* an XML reader */
29164 int n_reader;
29165
29166 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29167 mem_base = xmlMemBlocks();
29168 reader = gen_xmlTextReaderPtr(n_reader, 0);
29169
29170 ret_val = xmlTextReaderByteConsumed(reader);
29171 desret_long(ret_val);
29172 call_tests++;
29173 des_xmlTextReaderPtr(n_reader, reader, 0);
29174 xmlResetLastError();
29175 if (mem_base != xmlMemBlocks()) {
29176 printf("Leak of %d blocks found in xmlTextReaderByteConsumed",
29177 xmlMemBlocks() - mem_base);
29178 test_ret++;
29179 printf(" %d", n_reader);
29180 printf("\n");
29181 }
29182 }
29183 function_tests++;
29184#endif
29185
29186 return(test_ret);
29187}
29188
29189
29190static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029191test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029193
William M. Brack21e4ef22005-01-02 09:53:13 +000029194#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029195 int mem_base;
29196 int ret_val;
29197 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29198 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029199
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029200 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29201 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029202 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029203
29204 ret_val = xmlTextReaderClose(reader);
29205 desret_int(ret_val);
29206 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029207 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029208 xmlResetLastError();
29209 if (mem_base != xmlMemBlocks()) {
29210 printf("Leak of %d blocks found in xmlTextReaderClose",
29211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029212 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029213 printf(" %d", n_reader);
29214 printf("\n");
29215 }
29216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029217 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029218#endif
29219
Daniel Veillard42595322004-11-08 10:52:06 +000029220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029221}
29222
29223
29224static int
29225test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029227
William M. Brack21e4ef22005-01-02 09:53:13 +000029228#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029229 int mem_base;
29230 const xmlChar * ret_val;
29231 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29232 int n_reader;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029236 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029237
29238 ret_val = xmlTextReaderConstBaseUri(reader);
29239 desret_const_xmlChar_ptr(ret_val);
29240 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029241 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029242 xmlResetLastError();
29243 if (mem_base != xmlMemBlocks()) {
29244 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029246 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029247 printf(" %d", n_reader);
29248 printf("\n");
29249 }
29250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029251 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029252#endif
29253
Daniel Veillard42595322004-11-08 10:52:06 +000029254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029255}
29256
29257
29258static int
29259test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029261
William M. Brack21e4ef22005-01-02 09:53:13 +000029262#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029263 int mem_base;
29264 const xmlChar * ret_val;
29265 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29266 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029267
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029268 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29269 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029270 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029271
29272 ret_val = xmlTextReaderConstEncoding(reader);
29273 desret_const_xmlChar_ptr(ret_val);
29274 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029275 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029276 xmlResetLastError();
29277 if (mem_base != xmlMemBlocks()) {
29278 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029280 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029281 printf(" %d", n_reader);
29282 printf("\n");
29283 }
29284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029285 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029286#endif
29287
Daniel Veillard42595322004-11-08 10:52:06 +000029288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029289}
29290
29291
29292static int
29293test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029295
William M. Brack21e4ef22005-01-02 09:53:13 +000029296#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029297 int mem_base;
29298 const xmlChar * ret_val;
29299 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29300 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029301
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029302 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29303 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029304 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029305
29306 ret_val = xmlTextReaderConstLocalName(reader);
29307 desret_const_xmlChar_ptr(ret_val);
29308 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029309 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029310 xmlResetLastError();
29311 if (mem_base != xmlMemBlocks()) {
29312 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029314 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029315 printf(" %d", n_reader);
29316 printf("\n");
29317 }
29318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029319 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029320#endif
29321
Daniel Veillard42595322004-11-08 10:52:06 +000029322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029323}
29324
29325
29326static int
29327test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029329
William M. Brack21e4ef22005-01-02 09:53:13 +000029330#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029331 int mem_base;
29332 const xmlChar * ret_val;
29333 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29334 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029335
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029336 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29337 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029338 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029339
29340 ret_val = xmlTextReaderConstName(reader);
29341 desret_const_xmlChar_ptr(ret_val);
29342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029343 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029344 xmlResetLastError();
29345 if (mem_base != xmlMemBlocks()) {
29346 printf("Leak of %d blocks found in xmlTextReaderConstName",
29347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029348 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029349 printf(" %d", n_reader);
29350 printf("\n");
29351 }
29352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029353 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029354#endif
29355
Daniel Veillard42595322004-11-08 10:52:06 +000029356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029357}
29358
29359
29360static int
29361test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029363
William M. Brack21e4ef22005-01-02 09:53:13 +000029364#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029365 int mem_base;
29366 const xmlChar * ret_val;
29367 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29368 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029369
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029370 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029372 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029373
29374 ret_val = xmlTextReaderConstNamespaceUri(reader);
29375 desret_const_xmlChar_ptr(ret_val);
29376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029377 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029378 xmlResetLastError();
29379 if (mem_base != xmlMemBlocks()) {
29380 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029382 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029383 printf(" %d", n_reader);
29384 printf("\n");
29385 }
29386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029387 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029388#endif
29389
Daniel Veillard42595322004-11-08 10:52:06 +000029390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029391}
29392
29393
29394static int
29395test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029397
William M. Brack21e4ef22005-01-02 09:53:13 +000029398#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029399 int mem_base;
29400 const xmlChar * ret_val;
29401 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29402 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029403
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029404 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29405 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029406 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029407
29408 ret_val = xmlTextReaderConstPrefix(reader);
29409 desret_const_xmlChar_ptr(ret_val);
29410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029411 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029412 xmlResetLastError();
29413 if (mem_base != xmlMemBlocks()) {
29414 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029416 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029417 printf(" %d", n_reader);
29418 printf("\n");
29419 }
29420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029421 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029422#endif
29423
Daniel Veillard42595322004-11-08 10:52:06 +000029424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029425}
29426
29427
29428static int
29429test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029431
William M. Brack21e4ef22005-01-02 09:53:13 +000029432#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029433 int mem_base;
29434 const xmlChar * ret_val;
29435 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29436 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029437 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029438 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029439
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029440 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29441 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029443 reader = gen_xmlTextReaderPtr(n_reader, 0);
29444 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029445
William M. Brackf13f77f2004-11-12 16:03:48 +000029446 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029447 desret_const_xmlChar_ptr(ret_val);
29448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029449 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029450 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029451 xmlResetLastError();
29452 if (mem_base != xmlMemBlocks()) {
29453 printf("Leak of %d blocks found in xmlTextReaderConstString",
29454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029455 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029456 printf(" %d", n_reader);
29457 printf(" %d", n_str);
29458 printf("\n");
29459 }
29460 }
29461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029462 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029463#endif
29464
Daniel Veillard42595322004-11-08 10:52:06 +000029465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029466}
29467
29468
29469static int
29470test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029472
William M. Brack21e4ef22005-01-02 09:53:13 +000029473#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029474 int mem_base;
29475 const xmlChar * ret_val;
29476 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29477 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029478
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029479 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029481 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029482
29483 ret_val = xmlTextReaderConstValue(reader);
29484 desret_const_xmlChar_ptr(ret_val);
29485 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029486 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029487 xmlResetLastError();
29488 if (mem_base != xmlMemBlocks()) {
29489 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029491 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029492 printf(" %d", n_reader);
29493 printf("\n");
29494 }
29495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029496 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029497#endif
29498
Daniel Veillard42595322004-11-08 10:52:06 +000029499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029500}
29501
29502
29503static int
29504test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029506
William M. Brack21e4ef22005-01-02 09:53:13 +000029507#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029508 int mem_base;
29509 const xmlChar * ret_val;
29510 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29511 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029512
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029513 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029515 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029516
29517 ret_val = xmlTextReaderConstXmlLang(reader);
29518 desret_const_xmlChar_ptr(ret_val);
29519 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029520 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029521 xmlResetLastError();
29522 if (mem_base != xmlMemBlocks()) {
29523 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029525 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029526 printf(" %d", n_reader);
29527 printf("\n");
29528 }
29529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029530 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029531#endif
29532
Daniel Veillard42595322004-11-08 10:52:06 +000029533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029534}
29535
29536
29537static int
29538test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029540
William M. Brack21e4ef22005-01-02 09:53:13 +000029541#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029542 int mem_base;
29543 const xmlChar * ret_val;
29544 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29545 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029546
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029547 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029549 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029550
29551 ret_val = xmlTextReaderConstXmlVersion(reader);
29552 desret_const_xmlChar_ptr(ret_val);
29553 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029554 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029555 xmlResetLastError();
29556 if (mem_base != xmlMemBlocks()) {
29557 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029559 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029560 printf(" %d", n_reader);
29561 printf("\n");
29562 }
29563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029564 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029565#endif
29566
Daniel Veillard42595322004-11-08 10:52:06 +000029567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029568}
29569
29570
29571static int
29572test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029574
William M. Brack21e4ef22005-01-02 09:53:13 +000029575#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029576 int mem_base;
29577 xmlDocPtr ret_val;
29578 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29579 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029580
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029581 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29582 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029583 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029584
29585 ret_val = xmlTextReaderCurrentDoc(reader);
29586 desret_xmlDocPtr(ret_val);
29587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029588 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029589 xmlResetLastError();
29590 if (mem_base != xmlMemBlocks()) {
29591 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029593 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029594 printf(" %d", n_reader);
29595 printf("\n");
29596 }
29597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029598 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029599#endif
29600
Daniel Veillard42595322004-11-08 10:52:06 +000029601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029602}
29603
29604
29605static int
29606test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029608
William M. Brack21e4ef22005-01-02 09:53:13 +000029609#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029610 int mem_base;
29611 xmlNodePtr ret_val;
29612 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29613 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029614
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029615 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29616 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029617 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029618
29619 ret_val = xmlTextReaderCurrentNode(reader);
29620 desret_xmlNodePtr(ret_val);
29621 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029622 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029623 xmlResetLastError();
29624 if (mem_base != xmlMemBlocks()) {
29625 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029627 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029628 printf(" %d", n_reader);
29629 printf("\n");
29630 }
29631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029632 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029633#endif
29634
Daniel Veillard42595322004-11-08 10:52:06 +000029635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029636}
29637
29638
29639static int
29640test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029642
William M. Brack21e4ef22005-01-02 09:53:13 +000029643#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029644 int mem_base;
29645 int ret_val;
29646 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29647 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029648
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029649 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029651 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029652
29653 ret_val = xmlTextReaderDepth(reader);
29654 desret_int(ret_val);
29655 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029656 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029657 xmlResetLastError();
29658 if (mem_base != xmlMemBlocks()) {
29659 printf("Leak of %d blocks found in xmlTextReaderDepth",
29660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029661 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029662 printf(" %d", n_reader);
29663 printf("\n");
29664 }
29665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029666 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029667#endif
29668
Daniel Veillard42595322004-11-08 10:52:06 +000029669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029670}
29671
29672
29673static int
29674test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029676
William M. Brack21e4ef22005-01-02 09:53:13 +000029677#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029678 int mem_base;
29679 xmlNodePtr ret_val;
29680 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29681 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029682
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029683 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29684 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029685 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029686
29687 ret_val = xmlTextReaderExpand(reader);
29688 desret_xmlNodePtr(ret_val);
29689 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029690 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029691 xmlResetLastError();
29692 if (mem_base != xmlMemBlocks()) {
29693 printf("Leak of %d blocks found in xmlTextReaderExpand",
29694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029695 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029696 printf(" %d", n_reader);
29697 printf("\n");
29698 }
29699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029700 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029701#endif
29702
Daniel Veillard42595322004-11-08 10:52:06 +000029703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029704}
29705
29706
29707static int
29708test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029710
William M. Brack21e4ef22005-01-02 09:53:13 +000029711#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029712 int mem_base;
29713 xmlChar * ret_val;
29714 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29715 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029716 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029717 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029718
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029719 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29720 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029722 reader = gen_xmlTextReaderPtr(n_reader, 0);
29723 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029724
William M. Brackf13f77f2004-11-12 16:03:48 +000029725 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029726 desret_xmlChar_ptr(ret_val);
29727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029728 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029729 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029730 xmlResetLastError();
29731 if (mem_base != xmlMemBlocks()) {
29732 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029734 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029735 printf(" %d", n_reader);
29736 printf(" %d", n_name);
29737 printf("\n");
29738 }
29739 }
29740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029741 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029742#endif
29743
Daniel Veillard42595322004-11-08 10:52:06 +000029744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029745}
29746
29747
29748static int
29749test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029751
William M. Brack21e4ef22005-01-02 09:53:13 +000029752#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029753 int mem_base;
29754 xmlChar * ret_val;
29755 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29756 int n_reader;
29757 int no; /* the zero-based index of the attribute relative to the containing element */
29758 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029759
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029760 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29761 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029763 reader = gen_xmlTextReaderPtr(n_reader, 0);
29764 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029765
29766 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29767 desret_xmlChar_ptr(ret_val);
29768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029769 des_xmlTextReaderPtr(n_reader, reader, 0);
29770 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029771 xmlResetLastError();
29772 if (mem_base != xmlMemBlocks()) {
29773 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029775 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029776 printf(" %d", n_reader);
29777 printf(" %d", n_no);
29778 printf("\n");
29779 }
29780 }
29781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029782 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029783#endif
29784
Daniel Veillard42595322004-11-08 10:52:06 +000029785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029786}
29787
29788
29789static int
29790test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029792
William M. Brack21e4ef22005-01-02 09:53:13 +000029793#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029794 int mem_base;
29795 xmlChar * ret_val;
29796 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29797 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029798 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029799 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029800 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029801 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029802
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29804 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29805 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29806 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029807 reader = gen_xmlTextReaderPtr(n_reader, 0);
29808 localName = gen_const_xmlChar_ptr(n_localName, 1);
29809 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029810
William M. Brackf13f77f2004-11-12 16:03:48 +000029811 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029812 desret_xmlChar_ptr(ret_val);
29813 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029814 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029815 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29816 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029817 xmlResetLastError();
29818 if (mem_base != xmlMemBlocks()) {
29819 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029821 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029822 printf(" %d", n_reader);
29823 printf(" %d", n_localName);
29824 printf(" %d", n_namespaceURI);
29825 printf("\n");
29826 }
29827 }
29828 }
29829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029830 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029831#endif
29832
Daniel Veillard42595322004-11-08 10:52:06 +000029833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029834}
29835
Daniel Veillarda521d282004-11-09 14:59:59 +000029836#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029837
Daniel Veillardce682bc2004-11-05 17:22:25 +000029838#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29839static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29840 return(NULL);
29841}
29842static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29843}
Daniel Veillarda521d282004-11-09 14:59:59 +000029844#endif
29845
Daniel Veillardce682bc2004-11-05 17:22:25 +000029846
Daniel Veillardd93f6252004-11-02 15:53:51 +000029847static int
29848test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029850
William M. Brack21e4ef22005-01-02 09:53:13 +000029851#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029852 int mem_base;
29853 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29854 int n_reader;
29855 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29856 int n_f;
29857 void ** arg; /* a user argument */
29858 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029859
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029860 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29861 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29862 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29863 mem_base = xmlMemBlocks();
29864 reader = gen_xmlTextReaderPtr(n_reader, 0);
29865 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29866 arg = gen_void_ptr_ptr(n_arg, 2);
29867
29868 xmlTextReaderGetErrorHandler(reader, f, arg);
29869 call_tests++;
29870 des_xmlTextReaderPtr(n_reader, reader, 0);
29871 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29872 des_void_ptr_ptr(n_arg, arg, 2);
29873 xmlResetLastError();
29874 if (mem_base != xmlMemBlocks()) {
29875 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029877 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029878 printf(" %d", n_reader);
29879 printf(" %d", n_f);
29880 printf(" %d", n_arg);
29881 printf("\n");
29882 }
29883 }
29884 }
29885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029886 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029887#endif
29888
Daniel Veillard42595322004-11-08 10:52:06 +000029889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029890}
29891
29892
29893static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029894test_xmlTextReaderGetParserColumnNumber(void) {
29895 int test_ret = 0;
29896
29897#if defined(LIBXML_READER_ENABLED)
29898 int mem_base;
29899 int ret_val;
29900 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29901 int n_reader;
29902
29903 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29904 mem_base = xmlMemBlocks();
29905 reader = gen_xmlTextReaderPtr(n_reader, 0);
29906
29907 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29908 desret_int(ret_val);
29909 call_tests++;
29910 des_xmlTextReaderPtr(n_reader, reader, 0);
29911 xmlResetLastError();
29912 if (mem_base != xmlMemBlocks()) {
29913 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29914 xmlMemBlocks() - mem_base);
29915 test_ret++;
29916 printf(" %d", n_reader);
29917 printf("\n");
29918 }
29919 }
29920 function_tests++;
29921#endif
29922
29923 return(test_ret);
29924}
29925
29926
29927static int
29928test_xmlTextReaderGetParserLineNumber(void) {
29929 int test_ret = 0;
29930
29931#if defined(LIBXML_READER_ENABLED)
29932 int mem_base;
29933 int ret_val;
29934 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29935 int n_reader;
29936
29937 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29938 mem_base = xmlMemBlocks();
29939 reader = gen_xmlTextReaderPtr(n_reader, 0);
29940
29941 ret_val = xmlTextReaderGetParserLineNumber(reader);
29942 desret_int(ret_val);
29943 call_tests++;
29944 des_xmlTextReaderPtr(n_reader, reader, 0);
29945 xmlResetLastError();
29946 if (mem_base != xmlMemBlocks()) {
29947 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29948 xmlMemBlocks() - mem_base);
29949 test_ret++;
29950 printf(" %d", n_reader);
29951 printf("\n");
29952 }
29953 }
29954 function_tests++;
29955#endif
29956
29957 return(test_ret);
29958}
29959
29960
29961static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029962test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029964
William M. Brack21e4ef22005-01-02 09:53:13 +000029965#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029966 int mem_base;
29967 int ret_val;
29968 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29969 int n_reader;
29970 int prop; /* the xmlParserProperties to get */
29971 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029972
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029973 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29974 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029976 reader = gen_xmlTextReaderPtr(n_reader, 0);
29977 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029978
29979 ret_val = xmlTextReaderGetParserProp(reader, prop);
29980 desret_int(ret_val);
29981 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029982 des_xmlTextReaderPtr(n_reader, reader, 0);
29983 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029984 xmlResetLastError();
29985 if (mem_base != xmlMemBlocks()) {
29986 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
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(" %d", n_prop);
29991 printf("\n");
29992 }
29993 }
29994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029995 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029996#endif
29997
Daniel Veillard42595322004-11-08 10:52:06 +000029998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029999}
30000
30001
30002static int
30003test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030005
William M. Brack21e4ef22005-01-02 09:53:13 +000030006#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030007 int mem_base;
30008 xmlParserInputBufferPtr ret_val;
30009 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30010 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030011
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030012 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30013 mem_base = xmlMemBlocks();
30014 reader = gen_xmlTextReaderPtr(n_reader, 0);
30015
30016 ret_val = xmlTextReaderGetRemainder(reader);
30017 desret_xmlParserInputBufferPtr(ret_val);
30018 call_tests++;
30019 des_xmlTextReaderPtr(n_reader, reader, 0);
30020 xmlResetLastError();
30021 if (mem_base != xmlMemBlocks()) {
30022 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
30023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030024 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030025 printf(" %d", n_reader);
30026 printf("\n");
30027 }
30028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030029 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030030#endif
30031
Daniel Veillard42595322004-11-08 10:52:06 +000030032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030033}
30034
30035
30036static int
30037test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030039
William M. Brack21e4ef22005-01-02 09:53:13 +000030040#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030041 int mem_base;
30042 int ret_val;
30043 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30044 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030045
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030046 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030048 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030049
30050 ret_val = xmlTextReaderHasAttributes(reader);
30051 desret_int(ret_val);
30052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030053 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030054 xmlResetLastError();
30055 if (mem_base != xmlMemBlocks()) {
30056 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
30057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030058 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030059 printf(" %d", n_reader);
30060 printf("\n");
30061 }
30062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030063 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030064#endif
30065
Daniel Veillard42595322004-11-08 10:52:06 +000030066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030067}
30068
30069
30070static int
30071test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030073
William M. Brack21e4ef22005-01-02 09:53:13 +000030074#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030075 int mem_base;
30076 int ret_val;
30077 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30078 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030079
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030082 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030083
30084 ret_val = xmlTextReaderHasValue(reader);
30085 desret_int(ret_val);
30086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030087 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030088 xmlResetLastError();
30089 if (mem_base != xmlMemBlocks()) {
30090 printf("Leak of %d blocks found in xmlTextReaderHasValue",
30091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030092 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030093 printf(" %d", n_reader);
30094 printf("\n");
30095 }
30096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030097 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030098#endif
30099
Daniel Veillard42595322004-11-08 10:52:06 +000030100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030101}
30102
30103
30104static int
30105test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030107
William M. Brack21e4ef22005-01-02 09:53:13 +000030108#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030109 int mem_base;
30110 int ret_val;
30111 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30112 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030113
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030116 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030117
30118 ret_val = xmlTextReaderIsDefault(reader);
30119 desret_int(ret_val);
30120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030121 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030122 xmlResetLastError();
30123 if (mem_base != xmlMemBlocks()) {
30124 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
30125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030126 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030127 printf(" %d", n_reader);
30128 printf("\n");
30129 }
30130 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030131 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030132#endif
30133
Daniel Veillard42595322004-11-08 10:52:06 +000030134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030135}
30136
30137
30138static int
30139test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030141
William M. Brack21e4ef22005-01-02 09:53:13 +000030142#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030143 int mem_base;
30144 int ret_val;
30145 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30146 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030147
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030150 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030151
30152 ret_val = xmlTextReaderIsEmptyElement(reader);
30153 desret_int(ret_val);
30154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030155 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030156 xmlResetLastError();
30157 if (mem_base != xmlMemBlocks()) {
30158 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
30159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030160 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030161 printf(" %d", n_reader);
30162 printf("\n");
30163 }
30164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030165 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030166#endif
30167
Daniel Veillard42595322004-11-08 10:52:06 +000030168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030169}
30170
30171
30172static int
30173test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030175
William M. Brack21e4ef22005-01-02 09:53:13 +000030176#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030177 int mem_base;
30178 int ret_val;
30179 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30180 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030181
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030184 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030185
30186 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30187 desret_int(ret_val);
30188 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030189 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030190 xmlResetLastError();
30191 if (mem_base != xmlMemBlocks()) {
30192 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030194 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030195 printf(" %d", n_reader);
30196 printf("\n");
30197 }
30198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030199 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030200#endif
30201
Daniel Veillard42595322004-11-08 10:52:06 +000030202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030203}
30204
30205
30206static int
30207test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030209
William M. Brack21e4ef22005-01-02 09:53:13 +000030210#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030211 int mem_base;
30212 int ret_val;
30213 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30214 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030215
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030216 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030218 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030219
30220 ret_val = xmlTextReaderIsValid(reader);
30221 desret_int(ret_val);
30222 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030223 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030224 xmlResetLastError();
30225 if (mem_base != xmlMemBlocks()) {
30226 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030228 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030229 printf(" %d", n_reader);
30230 printf("\n");
30231 }
30232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030233 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030234#endif
30235
Daniel Veillard42595322004-11-08 10:52:06 +000030236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030237}
30238
30239
30240static int
30241test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030243
William M. Brack21e4ef22005-01-02 09:53:13 +000030244#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030245 int mem_base;
30246 xmlChar * ret_val;
30247 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30248 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030249
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030252 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030253
30254 ret_val = xmlTextReaderLocalName(reader);
30255 desret_xmlChar_ptr(ret_val);
30256 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030257 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030258 xmlResetLastError();
30259 if (mem_base != xmlMemBlocks()) {
30260 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030262 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030263 printf(" %d", n_reader);
30264 printf("\n");
30265 }
30266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030267 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030268#endif
30269
Daniel Veillard42595322004-11-08 10:52:06 +000030270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030271}
30272
Daniel Veillarda521d282004-11-09 14:59:59 +000030273#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030274
Daniel Veillardce682bc2004-11-05 17:22:25 +000030275#define gen_nb_xmlTextReaderLocatorPtr 1
30276static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30277 return(NULL);
30278}
30279static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30280}
Daniel Veillarda521d282004-11-09 14:59:59 +000030281#endif
30282
Daniel Veillardce682bc2004-11-05 17:22:25 +000030283
Daniel Veillardd93f6252004-11-02 15:53:51 +000030284static int
30285test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030287
William M. Brack21e4ef22005-01-02 09:53:13 +000030288#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030289 int mem_base;
30290 xmlChar * ret_val;
30291 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30292 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030293
Daniel Veillardce682bc2004-11-05 17:22:25 +000030294 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30295 mem_base = xmlMemBlocks();
30296 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30297
30298 ret_val = xmlTextReaderLocatorBaseURI(locator);
30299 desret_xmlChar_ptr(ret_val);
30300 call_tests++;
30301 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30302 xmlResetLastError();
30303 if (mem_base != xmlMemBlocks()) {
30304 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030306 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030307 printf(" %d", n_locator);
30308 printf("\n");
30309 }
30310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030311 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030312#endif
30313
Daniel Veillard42595322004-11-08 10:52:06 +000030314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030315}
30316
30317
30318static int
30319test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030321
William M. Brack21e4ef22005-01-02 09:53:13 +000030322#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030323 int mem_base;
30324 int ret_val;
30325 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30326 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030327
Daniel Veillardce682bc2004-11-05 17:22:25 +000030328 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30329 mem_base = xmlMemBlocks();
30330 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30331
30332 ret_val = xmlTextReaderLocatorLineNumber(locator);
30333 desret_int(ret_val);
30334 call_tests++;
30335 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30336 xmlResetLastError();
30337 if (mem_base != xmlMemBlocks()) {
30338 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030340 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030341 printf(" %d", n_locator);
30342 printf("\n");
30343 }
30344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030345 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030346#endif
30347
Daniel Veillard42595322004-11-08 10:52:06 +000030348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030349}
30350
30351
30352static int
30353test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030355
William M. Brack21e4ef22005-01-02 09:53:13 +000030356#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030357 int mem_base;
30358 xmlChar * ret_val;
30359 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30360 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030361 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 +000030362 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030363
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030364 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30365 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30366 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030367 reader = gen_xmlTextReaderPtr(n_reader, 0);
30368 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030369
William M. Brackf13f77f2004-11-12 16:03:48 +000030370 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030371 desret_xmlChar_ptr(ret_val);
30372 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030373 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030374 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030375 xmlResetLastError();
30376 if (mem_base != xmlMemBlocks()) {
30377 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030379 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030380 printf(" %d", n_reader);
30381 printf(" %d", n_prefix);
30382 printf("\n");
30383 }
30384 }
30385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030386 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030387#endif
30388
Daniel Veillard42595322004-11-08 10:52:06 +000030389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030390}
30391
30392
30393static int
30394test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030396
William M. Brack21e4ef22005-01-02 09:53:13 +000030397#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030398 int mem_base;
30399 int ret_val;
30400 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30401 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030402 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030403 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030404
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030405 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30406 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30407 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030408 reader = gen_xmlTextReaderPtr(n_reader, 0);
30409 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030410
William M. Brackf13f77f2004-11-12 16:03:48 +000030411 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030412 desret_int(ret_val);
30413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030414 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030415 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030416 xmlResetLastError();
30417 if (mem_base != xmlMemBlocks()) {
30418 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030420 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421 printf(" %d", n_reader);
30422 printf(" %d", n_name);
30423 printf("\n");
30424 }
30425 }
30426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030427 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030428#endif
30429
Daniel Veillard42595322004-11-08 10:52:06 +000030430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030431}
30432
30433
30434static int
30435test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030437
William M. Brack21e4ef22005-01-02 09:53:13 +000030438#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030439 int mem_base;
30440 int ret_val;
30441 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30442 int n_reader;
30443 int no; /* the zero-based index of the attribute relative to the containing element. */
30444 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030445
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030446 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30447 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030449 reader = gen_xmlTextReaderPtr(n_reader, 0);
30450 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030451
30452 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30453 desret_int(ret_val);
30454 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030455 des_xmlTextReaderPtr(n_reader, reader, 0);
30456 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030457 xmlResetLastError();
30458 if (mem_base != xmlMemBlocks()) {
30459 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030461 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030462 printf(" %d", n_reader);
30463 printf(" %d", n_no);
30464 printf("\n");
30465 }
30466 }
30467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030468 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030469#endif
30470
Daniel Veillard42595322004-11-08 10:52:06 +000030471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030472}
30473
30474
30475static int
30476test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030478
William M. Brack21e4ef22005-01-02 09:53:13 +000030479#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030480 int mem_base;
30481 int ret_val;
30482 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30483 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030484 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030485 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030486 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030487 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030488
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30490 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30491 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30492 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030493 reader = gen_xmlTextReaderPtr(n_reader, 0);
30494 localName = gen_const_xmlChar_ptr(n_localName, 1);
30495 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030496
William M. Brackf13f77f2004-11-12 16:03:48 +000030497 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030498 desret_int(ret_val);
30499 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030500 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030501 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30502 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030503 xmlResetLastError();
30504 if (mem_base != xmlMemBlocks()) {
30505 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030507 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030508 printf(" %d", n_reader);
30509 printf(" %d", n_localName);
30510 printf(" %d", n_namespaceURI);
30511 printf("\n");
30512 }
30513 }
30514 }
30515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030516 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030517#endif
30518
Daniel Veillard42595322004-11-08 10:52:06 +000030519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030520}
30521
30522
30523static int
30524test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030526
William M. Brack21e4ef22005-01-02 09:53:13 +000030527#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030528 int mem_base;
30529 int ret_val;
30530 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30531 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030532
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030533 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030535 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030536
30537 ret_val = xmlTextReaderMoveToElement(reader);
30538 desret_int(ret_val);
30539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030540 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030541 xmlResetLastError();
30542 if (mem_base != xmlMemBlocks()) {
30543 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030545 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030546 printf(" %d", n_reader);
30547 printf("\n");
30548 }
30549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030550 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030551#endif
30552
Daniel Veillard42595322004-11-08 10:52:06 +000030553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030554}
30555
30556
30557static int
30558test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030560
William M. Brack21e4ef22005-01-02 09:53:13 +000030561#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030562 int mem_base;
30563 int ret_val;
30564 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30565 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030566
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030567 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030569 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030570
30571 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30572 desret_int(ret_val);
30573 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030574 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030575 xmlResetLastError();
30576 if (mem_base != xmlMemBlocks()) {
30577 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030579 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030580 printf(" %d", n_reader);
30581 printf("\n");
30582 }
30583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030584 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030585#endif
30586
Daniel Veillard42595322004-11-08 10:52:06 +000030587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030588}
30589
30590
30591static int
30592test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030594
William M. Brack21e4ef22005-01-02 09:53:13 +000030595#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030596 int mem_base;
30597 int ret_val;
30598 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30599 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030600
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030601 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030603 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030604
30605 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30606 desret_int(ret_val);
30607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030608 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030609 xmlResetLastError();
30610 if (mem_base != xmlMemBlocks()) {
30611 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030613 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030614 printf(" %d", n_reader);
30615 printf("\n");
30616 }
30617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030618 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030619#endif
30620
Daniel Veillard42595322004-11-08 10:52:06 +000030621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030622}
30623
30624
30625static int
30626test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030628
William M. Brack21e4ef22005-01-02 09:53:13 +000030629#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030630 int mem_base;
30631 xmlChar * ret_val;
30632 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30633 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030634
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030635 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030637 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030638
30639 ret_val = xmlTextReaderName(reader);
30640 desret_xmlChar_ptr(ret_val);
30641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030642 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030643 xmlResetLastError();
30644 if (mem_base != xmlMemBlocks()) {
30645 printf("Leak of %d blocks found in xmlTextReaderName",
30646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030647 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030648 printf(" %d", n_reader);
30649 printf("\n");
30650 }
30651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030652 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030653#endif
30654
Daniel Veillard42595322004-11-08 10:52:06 +000030655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030656}
30657
30658
30659static int
30660test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030662
William M. Brack21e4ef22005-01-02 09:53:13 +000030663#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030664 int mem_base;
30665 xmlChar * ret_val;
30666 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30667 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030668
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030669 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030671 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030672
30673 ret_val = xmlTextReaderNamespaceUri(reader);
30674 desret_xmlChar_ptr(ret_val);
30675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030676 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030677 xmlResetLastError();
30678 if (mem_base != xmlMemBlocks()) {
30679 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030681 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030682 printf(" %d", n_reader);
30683 printf("\n");
30684 }
30685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030686 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030687#endif
30688
Daniel Veillard42595322004-11-08 10:52:06 +000030689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030690}
30691
30692
30693static int
30694test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030696
William M. Brack21e4ef22005-01-02 09:53:13 +000030697#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030698 int mem_base;
30699 int ret_val;
30700 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30701 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030702
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030703 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030705 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030706
30707 ret_val = xmlTextReaderNext(reader);
30708 desret_int(ret_val);
30709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030710 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030711 xmlResetLastError();
30712 if (mem_base != xmlMemBlocks()) {
30713 printf("Leak of %d blocks found in xmlTextReaderNext",
30714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030715 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030716 printf(" %d", n_reader);
30717 printf("\n");
30718 }
30719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030720 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030721#endif
30722
Daniel Veillard42595322004-11-08 10:52:06 +000030723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030724}
30725
30726
30727static int
30728test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030730
William M. Brack21e4ef22005-01-02 09:53:13 +000030731#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030732 int mem_base;
30733 int ret_val;
30734 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30735 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030736
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030739 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030740
30741 ret_val = xmlTextReaderNextSibling(reader);
30742 desret_int(ret_val);
30743 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030744 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030745 xmlResetLastError();
30746 if (mem_base != xmlMemBlocks()) {
30747 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030749 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030750 printf(" %d", n_reader);
30751 printf("\n");
30752 }
30753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030754 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030755#endif
30756
Daniel Veillard42595322004-11-08 10:52:06 +000030757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030758}
30759
30760
30761static int
30762test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030764
William M. Brack21e4ef22005-01-02 09:53:13 +000030765#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030766 int mem_base;
30767 int ret_val;
30768 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30769 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030770
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030771 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030773 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030774
30775 ret_val = xmlTextReaderNodeType(reader);
30776 desret_int(ret_val);
30777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030778 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030779 xmlResetLastError();
30780 if (mem_base != xmlMemBlocks()) {
30781 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030783 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030784 printf(" %d", n_reader);
30785 printf("\n");
30786 }
30787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030788 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030789#endif
30790
Daniel Veillard42595322004-11-08 10:52:06 +000030791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030792}
30793
30794
30795static int
30796test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030798
William M. Brack21e4ef22005-01-02 09:53:13 +000030799#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030800 int mem_base;
30801 int ret_val;
30802 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30803 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030804
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030805 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30806 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030807 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030808
30809 ret_val = xmlTextReaderNormalization(reader);
30810 desret_int(ret_val);
30811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030812 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030813 xmlResetLastError();
30814 if (mem_base != xmlMemBlocks()) {
30815 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030817 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030818 printf(" %d", n_reader);
30819 printf("\n");
30820 }
30821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030822 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030823#endif
30824
Daniel Veillard42595322004-11-08 10:52:06 +000030825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030826}
30827
30828
30829static int
30830test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030832
William M. Brack21e4ef22005-01-02 09:53:13 +000030833#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030834 int mem_base;
30835 xmlChar * ret_val;
30836 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30837 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030838
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030839 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30840 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030841 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030842
30843 ret_val = xmlTextReaderPrefix(reader);
30844 desret_xmlChar_ptr(ret_val);
30845 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030846 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030847 xmlResetLastError();
30848 if (mem_base != xmlMemBlocks()) {
30849 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030851 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030852 printf(" %d", n_reader);
30853 printf("\n");
30854 }
30855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030856 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030857#endif
30858
Daniel Veillard42595322004-11-08 10:52:06 +000030859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030860}
30861
30862
30863static int
30864test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030866
William M. Brack21e4ef22005-01-02 09:53:13 +000030867#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030868 int mem_base;
30869 xmlNodePtr ret_val;
30870 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30871 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030872
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030873 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30874 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030875 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030876
30877 ret_val = xmlTextReaderPreserve(reader);
30878 desret_xmlNodePtr(ret_val);
30879 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030880 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030881 xmlResetLastError();
30882 if (mem_base != xmlMemBlocks()) {
30883 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030885 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030886 printf(" %d", n_reader);
30887 printf("\n");
30888 }
30889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030890 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030891#endif
30892
Daniel Veillard42595322004-11-08 10:52:06 +000030893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030894}
30895
30896
30897static int
30898test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030900
William M. Brack21e4ef22005-01-02 09:53:13 +000030901#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030902#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030903 int mem_base;
30904 int ret_val;
30905 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30906 int n_reader;
30907 xmlChar * pattern; /* an XPath subset pattern */
30908 int n_pattern;
30909 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30910 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030911
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030912 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30913 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30914 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30915 mem_base = xmlMemBlocks();
30916 reader = gen_xmlTextReaderPtr(n_reader, 0);
30917 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30918 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30919
William M. Brackf13f77f2004-11-12 16:03:48 +000030920 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030921 desret_int(ret_val);
30922 call_tests++;
30923 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030924 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30925 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030926 xmlResetLastError();
30927 if (mem_base != xmlMemBlocks()) {
30928 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030930 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030931 printf(" %d", n_reader);
30932 printf(" %d", n_pattern);
30933 printf(" %d", n_namespaces);
30934 printf("\n");
30935 }
30936 }
30937 }
30938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030939 function_tests++;
30940#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030941#endif
30942
Daniel Veillard42595322004-11-08 10:52:06 +000030943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030944}
30945
30946
30947static int
30948test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030950
William M. Brack21e4ef22005-01-02 09:53:13 +000030951#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030952 int mem_base;
30953 int ret_val;
30954 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30955 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030956
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030957 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030959 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030960
30961 ret_val = xmlTextReaderQuoteChar(reader);
30962 desret_int(ret_val);
30963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030964 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030965 xmlResetLastError();
30966 if (mem_base != xmlMemBlocks()) {
30967 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030969 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030970 printf(" %d", n_reader);
30971 printf("\n");
30972 }
30973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030974 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030975#endif
30976
Daniel Veillard42595322004-11-08 10:52:06 +000030977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030978}
30979
30980
30981static int
30982test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030984
William M. Brack21e4ef22005-01-02 09:53:13 +000030985#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030986 int mem_base;
30987 int ret_val;
30988 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30989 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030990
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030991 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030993 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030994
30995 ret_val = xmlTextReaderRead(reader);
30996 desret_int(ret_val);
30997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030998 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030999 xmlResetLastError();
31000 if (mem_base != xmlMemBlocks()) {
31001 printf("Leak of %d blocks found in xmlTextReaderRead",
31002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031003 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031004 printf(" %d", n_reader);
31005 printf("\n");
31006 }
31007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031008 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031009#endif
31010
Daniel Veillard42595322004-11-08 10:52:06 +000031011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031012}
31013
31014
31015static int
31016test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031018
William M. Brack21e4ef22005-01-02 09:53:13 +000031019#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031020 int mem_base;
31021 int ret_val;
31022 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31023 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031024
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031025 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031027 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031028
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031029 ret_val = xmlTextReaderReadAttributeValue(reader);
31030 desret_int(ret_val);
31031 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031032 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031033 xmlResetLastError();
31034 if (mem_base != xmlMemBlocks()) {
31035 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
31036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031037 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031038 printf(" %d", n_reader);
31039 printf("\n");
31040 }
31041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031042 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031043#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031044
Daniel Veillard42595322004-11-08 10:52:06 +000031045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031046}
31047
31048
31049static int
31050test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031052
William M. Brack21e4ef22005-01-02 09:53:13 +000031053#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031054 int mem_base;
31055 int ret_val;
31056 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31057 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031058
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031059 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31060 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031061 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031062
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031063 ret_val = xmlTextReaderReadState(reader);
31064 desret_int(ret_val);
31065 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031066 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031067 xmlResetLastError();
31068 if (mem_base != xmlMemBlocks()) {
31069 printf("Leak of %d blocks found in xmlTextReaderReadState",
31070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031071 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031072 printf(" %d", n_reader);
31073 printf("\n");
31074 }
31075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031076 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031077#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031078
Daniel Veillard42595322004-11-08 10:52:06 +000031079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031080}
31081
31082
31083static int
31084test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031086
William M. Brack21e4ef22005-01-02 09:53:13 +000031087#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031088 int mem_base;
31089 int ret_val;
31090 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31091 int n_reader;
31092 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
31093 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031094
Daniel Veillardce682bc2004-11-05 17:22:25 +000031095 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31096 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
31097 mem_base = xmlMemBlocks();
31098 reader = gen_xmlTextReaderPtr(n_reader, 0);
31099 schema = gen_xmlRelaxNGPtr(n_schema, 1);
31100
31101 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
31102 desret_int(ret_val);
31103 call_tests++;
31104 des_xmlTextReaderPtr(n_reader, reader, 0);
31105 des_xmlRelaxNGPtr(n_schema, schema, 1);
31106 xmlResetLastError();
31107 if (mem_base != xmlMemBlocks()) {
31108 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
31109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031110 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031111 printf(" %d", n_reader);
31112 printf(" %d", n_schema);
31113 printf("\n");
31114 }
31115 }
31116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031117 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031118#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031119
Daniel Veillard42595322004-11-08 10:52:06 +000031120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031121}
31122
31123
31124static int
31125test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031127
William M. Brack21e4ef22005-01-02 09:53:13 +000031128#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031129 int mem_base;
31130 int ret_val;
31131 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31132 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031133 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031134 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031135
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031136 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31137 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
31138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031139 reader = gen_xmlTextReaderPtr(n_reader, 0);
31140 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031141
William M. Brackf13f77f2004-11-12 16:03:48 +000031142 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031143 desret_int(ret_val);
31144 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031145 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031146 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031147 xmlResetLastError();
31148 if (mem_base != xmlMemBlocks()) {
31149 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
31150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031151 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031152 printf(" %d", n_reader);
31153 printf(" %d", n_rng);
31154 printf("\n");
31155 }
31156 }
31157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031158 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031159#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031160
Daniel Veillard42595322004-11-08 10:52:06 +000031161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031162}
31163
31164
31165static int
31166test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031168
31169
31170 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031172}
31173
31174
31175static int
31176test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031178
William M. Brack21e4ef22005-01-02 09:53:13 +000031179#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031180 int mem_base;
31181 int ret_val;
31182 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31183 int n_reader;
31184 int prop; /* the xmlParserProperties to set */
31185 int n_prop;
31186 int value; /* usually 0 or 1 to (de)activate it */
31187 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031188
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031189 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31190 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31191 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31192 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031193 reader = gen_xmlTextReaderPtr(n_reader, 0);
31194 prop = gen_int(n_prop, 1);
31195 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031196
31197 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31198 desret_int(ret_val);
31199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031200 des_xmlTextReaderPtr(n_reader, reader, 0);
31201 des_int(n_prop, prop, 1);
31202 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031203 xmlResetLastError();
31204 if (mem_base != xmlMemBlocks()) {
31205 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031207 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031208 printf(" %d", n_reader);
31209 printf(" %d", n_prop);
31210 printf(" %d", n_value);
31211 printf("\n");
31212 }
31213 }
31214 }
31215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031216 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031217#endif
31218
Daniel Veillard42595322004-11-08 10:52:06 +000031219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031220}
31221
31222
31223static int
31224test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031226
31227
31228 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031230}
31231
31232
31233static int
31234test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031236
William M. Brack21e4ef22005-01-02 09:53:13 +000031237#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031238 int mem_base;
31239 int ret_val;
31240 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31241 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031242
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031243 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031245 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031246
31247 ret_val = xmlTextReaderStandalone(reader);
31248 desret_int(ret_val);
31249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031250 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031251 xmlResetLastError();
31252 if (mem_base != xmlMemBlocks()) {
31253 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031255 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031256 printf(" %d", n_reader);
31257 printf("\n");
31258 }
31259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031260 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031261#endif
31262
Daniel Veillard42595322004-11-08 10:52:06 +000031263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031264}
31265
31266
31267static int
31268test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031270
William M. Brack21e4ef22005-01-02 09:53:13 +000031271#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031272 int mem_base;
31273 xmlChar * ret_val;
31274 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31275 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031276
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031277 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31278 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031279 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031280
31281 ret_val = xmlTextReaderValue(reader);
31282 desret_xmlChar_ptr(ret_val);
31283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031284 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031285 xmlResetLastError();
31286 if (mem_base != xmlMemBlocks()) {
31287 printf("Leak of %d blocks found in xmlTextReaderValue",
31288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031289 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031290 printf(" %d", n_reader);
31291 printf("\n");
31292 }
31293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031294 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031295#endif
31296
Daniel Veillard42595322004-11-08 10:52:06 +000031297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031298}
31299
31300
31301static int
31302test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031304
William M. Brack21e4ef22005-01-02 09:53:13 +000031305#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031306 int mem_base;
31307 xmlChar * ret_val;
31308 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31309 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031310
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031311 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031313 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031314
31315 ret_val = xmlTextReaderXmlLang(reader);
31316 desret_xmlChar_ptr(ret_val);
31317 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031318 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031319 xmlResetLastError();
31320 if (mem_base != xmlMemBlocks()) {
31321 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031323 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031324 printf(" %d", n_reader);
31325 printf("\n");
31326 }
31327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031328 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031329#endif
31330
Daniel Veillard42595322004-11-08 10:52:06 +000031331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031332}
31333
31334static int
31335test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031337
Daniel Veillardb5839c32005-02-19 18:27:14 +000031338 if (quiet == 0) printf("Testing xmlreader : 71 of 81 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031339 test_ret += test_xmlNewTextReader();
31340 test_ret += test_xmlNewTextReaderFilename();
31341 test_ret += test_xmlReaderForDoc();
31342 test_ret += test_xmlReaderForFile();
31343 test_ret += test_xmlReaderForMemory();
31344 test_ret += test_xmlReaderNewDoc();
31345 test_ret += test_xmlReaderNewFile();
31346 test_ret += test_xmlReaderNewMemory();
31347 test_ret += test_xmlReaderNewWalker();
31348 test_ret += test_xmlReaderWalker();
31349 test_ret += test_xmlTextReaderAttributeCount();
31350 test_ret += test_xmlTextReaderBaseUri();
Daniel Veillardb5839c32005-02-19 18:27:14 +000031351 test_ret += test_xmlTextReaderByteConsumed();
Daniel Veillard42595322004-11-08 10:52:06 +000031352 test_ret += test_xmlTextReaderClose();
31353 test_ret += test_xmlTextReaderConstBaseUri();
31354 test_ret += test_xmlTextReaderConstEncoding();
31355 test_ret += test_xmlTextReaderConstLocalName();
31356 test_ret += test_xmlTextReaderConstName();
31357 test_ret += test_xmlTextReaderConstNamespaceUri();
31358 test_ret += test_xmlTextReaderConstPrefix();
31359 test_ret += test_xmlTextReaderConstString();
31360 test_ret += test_xmlTextReaderConstValue();
31361 test_ret += test_xmlTextReaderConstXmlLang();
31362 test_ret += test_xmlTextReaderConstXmlVersion();
31363 test_ret += test_xmlTextReaderCurrentDoc();
31364 test_ret += test_xmlTextReaderCurrentNode();
31365 test_ret += test_xmlTextReaderDepth();
31366 test_ret += test_xmlTextReaderExpand();
31367 test_ret += test_xmlTextReaderGetAttribute();
31368 test_ret += test_xmlTextReaderGetAttributeNo();
31369 test_ret += test_xmlTextReaderGetAttributeNs();
31370 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031371 test_ret += test_xmlTextReaderGetParserColumnNumber();
31372 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031373 test_ret += test_xmlTextReaderGetParserProp();
31374 test_ret += test_xmlTextReaderGetRemainder();
31375 test_ret += test_xmlTextReaderHasAttributes();
31376 test_ret += test_xmlTextReaderHasValue();
31377 test_ret += test_xmlTextReaderIsDefault();
31378 test_ret += test_xmlTextReaderIsEmptyElement();
31379 test_ret += test_xmlTextReaderIsNamespaceDecl();
31380 test_ret += test_xmlTextReaderIsValid();
31381 test_ret += test_xmlTextReaderLocalName();
31382 test_ret += test_xmlTextReaderLocatorBaseURI();
31383 test_ret += test_xmlTextReaderLocatorLineNumber();
31384 test_ret += test_xmlTextReaderLookupNamespace();
31385 test_ret += test_xmlTextReaderMoveToAttribute();
31386 test_ret += test_xmlTextReaderMoveToAttributeNo();
31387 test_ret += test_xmlTextReaderMoveToAttributeNs();
31388 test_ret += test_xmlTextReaderMoveToElement();
31389 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31390 test_ret += test_xmlTextReaderMoveToNextAttribute();
31391 test_ret += test_xmlTextReaderName();
31392 test_ret += test_xmlTextReaderNamespaceUri();
31393 test_ret += test_xmlTextReaderNext();
31394 test_ret += test_xmlTextReaderNextSibling();
31395 test_ret += test_xmlTextReaderNodeType();
31396 test_ret += test_xmlTextReaderNormalization();
31397 test_ret += test_xmlTextReaderPrefix();
31398 test_ret += test_xmlTextReaderPreserve();
31399 test_ret += test_xmlTextReaderPreservePattern();
31400 test_ret += test_xmlTextReaderQuoteChar();
31401 test_ret += test_xmlTextReaderRead();
31402 test_ret += test_xmlTextReaderReadAttributeValue();
31403 test_ret += test_xmlTextReaderReadState();
31404 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31405 test_ret += test_xmlTextReaderRelaxNGValidate();
31406 test_ret += test_xmlTextReaderSetErrorHandler();
31407 test_ret += test_xmlTextReaderSetParserProp();
31408 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31409 test_ret += test_xmlTextReaderStandalone();
31410 test_ret += test_xmlTextReaderValue();
31411 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031412
Daniel Veillard42595322004-11-08 10:52:06 +000031413 if (test_ret != 0)
31414 printf("Module xmlreader: %d errors\n", test_ret);
31415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031416}
Daniel Veillarda521d282004-11-09 14:59:59 +000031417#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031418
Daniel Veillarda82b1822004-11-08 16:24:57 +000031419#define gen_nb_xmlRegExecCtxtPtr 1
31420static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31421 return(NULL);
31422}
31423static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31424}
Daniel Veillarda521d282004-11-09 14:59:59 +000031425#endif
31426
Daniel Veillarda82b1822004-11-08 16:24:57 +000031427
31428static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031429test_xmlRegExecErrInfo(void) {
31430 int test_ret = 0;
31431
31432#if defined(LIBXML_REGEXP_ENABLED)
31433 int mem_base;
31434 int ret_val;
31435 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31436 int n_exec;
31437 xmlChar ** string; /* return value for the error string */
31438 int n_string;
31439 int * nbval; /* pointer to the number of accepted values IN/OUT */
31440 int n_nbval;
31441 int * nbneg; /* return number of negative transitions */
31442 int n_nbneg;
31443 xmlChar ** values; /* pointer to the array of acceptable values */
31444 int n_values;
31445 int * terminal; /* return value if this was a terminal state */
31446 int n_terminal;
31447
31448 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31449 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31450 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31451 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31452 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31453 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31454 mem_base = xmlMemBlocks();
31455 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31456 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31457 nbval = gen_int_ptr(n_nbval, 2);
31458 nbneg = gen_int_ptr(n_nbneg, 3);
31459 values = gen_xmlChar_ptr_ptr(n_values, 4);
31460 terminal = gen_int_ptr(n_terminal, 5);
31461
31462 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31463 desret_int(ret_val);
31464 call_tests++;
31465 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31466 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31467 des_int_ptr(n_nbval, nbval, 2);
31468 des_int_ptr(n_nbneg, nbneg, 3);
31469 des_xmlChar_ptr_ptr(n_values, values, 4);
31470 des_int_ptr(n_terminal, terminal, 5);
31471 xmlResetLastError();
31472 if (mem_base != xmlMemBlocks()) {
31473 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31474 xmlMemBlocks() - mem_base);
31475 test_ret++;
31476 printf(" %d", n_exec);
31477 printf(" %d", n_string);
31478 printf(" %d", n_nbval);
31479 printf(" %d", n_nbneg);
31480 printf(" %d", n_values);
31481 printf(" %d", n_terminal);
31482 printf("\n");
31483 }
31484 }
31485 }
31486 }
31487 }
31488 }
31489 }
31490 function_tests++;
31491#endif
31492
31493 return(test_ret);
31494}
31495
31496
31497static int
31498test_xmlRegExecNextValues(void) {
31499 int test_ret = 0;
31500
31501#if defined(LIBXML_REGEXP_ENABLED)
31502 int mem_base;
31503 int ret_val;
31504 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31505 int n_exec;
31506 int * nbval; /* pointer to the number of accepted values IN/OUT */
31507 int n_nbval;
31508 int * nbneg; /* return number of negative transitions */
31509 int n_nbneg;
31510 xmlChar ** values; /* pointer to the array of acceptable values */
31511 int n_values;
31512 int * terminal; /* return value if this was a terminal state */
31513 int n_terminal;
31514
31515 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31516 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31517 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31518 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31519 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31520 mem_base = xmlMemBlocks();
31521 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31522 nbval = gen_int_ptr(n_nbval, 1);
31523 nbneg = gen_int_ptr(n_nbneg, 2);
31524 values = gen_xmlChar_ptr_ptr(n_values, 3);
31525 terminal = gen_int_ptr(n_terminal, 4);
31526
31527 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31528 desret_int(ret_val);
31529 call_tests++;
31530 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31531 des_int_ptr(n_nbval, nbval, 1);
31532 des_int_ptr(n_nbneg, nbneg, 2);
31533 des_xmlChar_ptr_ptr(n_values, values, 3);
31534 des_int_ptr(n_terminal, terminal, 4);
31535 xmlResetLastError();
31536 if (mem_base != xmlMemBlocks()) {
31537 printf("Leak of %d blocks found in xmlRegExecNextValues",
31538 xmlMemBlocks() - mem_base);
31539 test_ret++;
31540 printf(" %d", n_exec);
31541 printf(" %d", n_nbval);
31542 printf(" %d", n_nbneg);
31543 printf(" %d", n_values);
31544 printf(" %d", n_terminal);
31545 printf("\n");
31546 }
31547 }
31548 }
31549 }
31550 }
31551 }
31552 function_tests++;
31553#endif
31554
31555 return(test_ret);
31556}
31557
31558
31559static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031560test_xmlRegExecPushString(void) {
31561 int test_ret = 0;
31562
William M. Brack21e4ef22005-01-02 09:53:13 +000031563#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031564 int mem_base;
31565 int ret_val;
31566 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31567 int n_exec;
31568 xmlChar * value; /* a string token input */
31569 int n_value;
31570 void * data; /* data associated to the token to reuse in callbacks */
31571 int n_data;
31572
31573 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31574 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31575 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31576 mem_base = xmlMemBlocks();
31577 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31578 value = gen_const_xmlChar_ptr(n_value, 1);
31579 data = gen_userdata(n_data, 2);
31580
William M. Brackf13f77f2004-11-12 16:03:48 +000031581 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031582 desret_int(ret_val);
31583 call_tests++;
31584 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031585 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031586 des_userdata(n_data, data, 2);
31587 xmlResetLastError();
31588 if (mem_base != xmlMemBlocks()) {
31589 printf("Leak of %d blocks found in xmlRegExecPushString",
31590 xmlMemBlocks() - mem_base);
31591 test_ret++;
31592 printf(" %d", n_exec);
31593 printf(" %d", n_value);
31594 printf(" %d", n_data);
31595 printf("\n");
31596 }
31597 }
31598 }
31599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031600 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031601#endif
31602
Daniel Veillarda82b1822004-11-08 16:24:57 +000031603 return(test_ret);
31604}
31605
31606
31607static int
31608test_xmlRegExecPushString2(void) {
31609 int test_ret = 0;
31610
William M. Brack21e4ef22005-01-02 09:53:13 +000031611#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031612 int mem_base;
31613 int ret_val;
31614 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31615 int n_exec;
31616 xmlChar * value; /* the first string token input */
31617 int n_value;
31618 xmlChar * value2; /* the second string token input */
31619 int n_value2;
31620 void * data; /* data associated to the token to reuse in callbacks */
31621 int n_data;
31622
31623 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31624 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31625 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31626 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31627 mem_base = xmlMemBlocks();
31628 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31629 value = gen_const_xmlChar_ptr(n_value, 1);
31630 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31631 data = gen_userdata(n_data, 3);
31632
William M. Brackf13f77f2004-11-12 16:03:48 +000031633 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031634 desret_int(ret_val);
31635 call_tests++;
31636 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031637 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31638 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031639 des_userdata(n_data, data, 3);
31640 xmlResetLastError();
31641 if (mem_base != xmlMemBlocks()) {
31642 printf("Leak of %d blocks found in xmlRegExecPushString2",
31643 xmlMemBlocks() - mem_base);
31644 test_ret++;
31645 printf(" %d", n_exec);
31646 printf(" %d", n_value);
31647 printf(" %d", n_value2);
31648 printf(" %d", n_data);
31649 printf("\n");
31650 }
31651 }
31652 }
31653 }
31654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031655 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031656#endif
31657
Daniel Veillarda82b1822004-11-08 16:24:57 +000031658 return(test_ret);
31659}
31660
Daniel Veillarda521d282004-11-09 14:59:59 +000031661#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031662
31663#define gen_nb_xmlRegexpPtr 1
31664static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31665 return(NULL);
31666}
31667static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31668}
Daniel Veillarda521d282004-11-09 14:59:59 +000031669#endif
31670
Daniel Veillarda82b1822004-11-08 16:24:57 +000031671
31672static int
31673test_xmlRegNewExecCtxt(void) {
31674 int test_ret = 0;
31675
31676
31677 /* missing type support */
31678 return(test_ret);
31679}
31680
31681
31682static int
31683test_xmlRegexpCompile(void) {
31684 int test_ret = 0;
31685
31686
31687 /* missing type support */
31688 return(test_ret);
31689}
31690
31691
31692static int
31693test_xmlRegexpExec(void) {
31694 int test_ret = 0;
31695
William M. Brack21e4ef22005-01-02 09:53:13 +000031696#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031697 int mem_base;
31698 int ret_val;
31699 xmlRegexpPtr comp; /* the compiled regular expression */
31700 int n_comp;
31701 xmlChar * content; /* the value to check against the regular expression */
31702 int n_content;
31703
31704 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31705 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31706 mem_base = xmlMemBlocks();
31707 comp = gen_xmlRegexpPtr(n_comp, 0);
31708 content = gen_const_xmlChar_ptr(n_content, 1);
31709
William M. Brackf13f77f2004-11-12 16:03:48 +000031710 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031711 desret_int(ret_val);
31712 call_tests++;
31713 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031714 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031715 xmlResetLastError();
31716 if (mem_base != xmlMemBlocks()) {
31717 printf("Leak of %d blocks found in xmlRegexpExec",
31718 xmlMemBlocks() - mem_base);
31719 test_ret++;
31720 printf(" %d", n_comp);
31721 printf(" %d", n_content);
31722 printf("\n");
31723 }
31724 }
31725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031726 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031727#endif
31728
Daniel Veillarda82b1822004-11-08 16:24:57 +000031729 return(test_ret);
31730}
31731
31732
31733static int
31734test_xmlRegexpIsDeterminist(void) {
31735 int test_ret = 0;
31736
William M. Brack21e4ef22005-01-02 09:53:13 +000031737#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031738 int mem_base;
31739 int ret_val;
31740 xmlRegexpPtr comp; /* the compiled regular expression */
31741 int n_comp;
31742
31743 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31744 mem_base = xmlMemBlocks();
31745 comp = gen_xmlRegexpPtr(n_comp, 0);
31746
31747 ret_val = xmlRegexpIsDeterminist(comp);
31748 desret_int(ret_val);
31749 call_tests++;
31750 des_xmlRegexpPtr(n_comp, comp, 0);
31751 xmlResetLastError();
31752 if (mem_base != xmlMemBlocks()) {
31753 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31754 xmlMemBlocks() - mem_base);
31755 test_ret++;
31756 printf(" %d", n_comp);
31757 printf("\n");
31758 }
31759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031760 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031761#endif
31762
Daniel Veillarda82b1822004-11-08 16:24:57 +000031763 return(test_ret);
31764}
31765
31766
31767static int
31768test_xmlRegexpPrint(void) {
31769 int test_ret = 0;
31770
William M. Brack21e4ef22005-01-02 09:53:13 +000031771#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031772 int mem_base;
31773 FILE * output; /* the file for the output debug */
31774 int n_output;
31775 xmlRegexpPtr regexp; /* the compiled regexp */
31776 int n_regexp;
31777
31778 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31779 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31780 mem_base = xmlMemBlocks();
31781 output = gen_FILE_ptr(n_output, 0);
31782 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31783
31784 xmlRegexpPrint(output, regexp);
31785 call_tests++;
31786 des_FILE_ptr(n_output, output, 0);
31787 des_xmlRegexpPtr(n_regexp, regexp, 1);
31788 xmlResetLastError();
31789 if (mem_base != xmlMemBlocks()) {
31790 printf("Leak of %d blocks found in xmlRegexpPrint",
31791 xmlMemBlocks() - mem_base);
31792 test_ret++;
31793 printf(" %d", n_output);
31794 printf(" %d", n_regexp);
31795 printf("\n");
31796 }
31797 }
31798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031799 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031800#endif
31801
Daniel Veillarda82b1822004-11-08 16:24:57 +000031802 return(test_ret);
31803}
31804
31805static int
31806test_xmlregexp(void) {
31807 int test_ret = 0;
31808
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031809 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31810 test_ret += test_xmlRegExecErrInfo();
31811 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031812 test_ret += test_xmlRegExecPushString();
31813 test_ret += test_xmlRegExecPushString2();
31814 test_ret += test_xmlRegNewExecCtxt();
31815 test_ret += test_xmlRegexpCompile();
31816 test_ret += test_xmlRegexpExec();
31817 test_ret += test_xmlRegexpIsDeterminist();
31818 test_ret += test_xmlRegexpPrint();
31819
31820 if (test_ret != 0)
31821 printf("Module xmlregexp: %d errors\n", test_ret);
31822 return(test_ret);
31823}
Daniel Veillarda521d282004-11-09 14:59:59 +000031824#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031825
Daniel Veillardce682bc2004-11-05 17:22:25 +000031826#define gen_nb_xmlSaveCtxtPtr 1
31827static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31828 return(NULL);
31829}
31830static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31831}
Daniel Veillarda521d282004-11-09 14:59:59 +000031832#endif
31833
Daniel Veillardce682bc2004-11-05 17:22:25 +000031834
Daniel Veillardd93f6252004-11-02 15:53:51 +000031835static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031836test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031838
William M. Brack21e4ef22005-01-02 09:53:13 +000031839#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031840 int mem_base;
31841 int ret_val;
31842 xmlSaveCtxtPtr ctxt; /* a document saving context */
31843 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031844
Daniel Veillardce682bc2004-11-05 17:22:25 +000031845 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31846 mem_base = xmlMemBlocks();
31847 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31848
31849 ret_val = xmlSaveClose(ctxt);
31850 desret_int(ret_val);
31851 call_tests++;
31852 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31853 xmlResetLastError();
31854 if (mem_base != xmlMemBlocks()) {
31855 printf("Leak of %d blocks found in xmlSaveClose",
31856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031857 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031858 printf(" %d", n_ctxt);
31859 printf("\n");
31860 }
31861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031862 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031863#endif
31864
Daniel Veillard42595322004-11-08 10:52:06 +000031865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031866}
31867
31868
31869static int
31870test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031872
William M. Brack21e4ef22005-01-02 09:53:13 +000031873#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031874 int mem_base;
31875 long ret_val;
31876 xmlSaveCtxtPtr ctxt; /* a document saving context */
31877 int n_ctxt;
31878 xmlDocPtr doc; /* a document */
31879 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031880
Daniel Veillardce682bc2004-11-05 17:22:25 +000031881 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31882 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31883 mem_base = xmlMemBlocks();
31884 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31885 doc = gen_xmlDocPtr(n_doc, 1);
31886
31887 ret_val = xmlSaveDoc(ctxt, doc);
31888 desret_long(ret_val);
31889 call_tests++;
31890 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31891 des_xmlDocPtr(n_doc, doc, 1);
31892 xmlResetLastError();
31893 if (mem_base != xmlMemBlocks()) {
31894 printf("Leak of %d blocks found in xmlSaveDoc",
31895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031896 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031897 printf(" %d", n_ctxt);
31898 printf(" %d", n_doc);
31899 printf("\n");
31900 }
31901 }
31902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031903 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031904#endif
31905
Daniel Veillard42595322004-11-08 10:52:06 +000031906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031907}
31908
31909
31910static int
31911test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031913
William M. Brack21e4ef22005-01-02 09:53:13 +000031914#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031915 int mem_base;
31916 int ret_val;
31917 xmlSaveCtxtPtr ctxt; /* a document saving context */
31918 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031919
Daniel Veillardce682bc2004-11-05 17:22:25 +000031920 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31921 mem_base = xmlMemBlocks();
31922 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31923
31924 ret_val = xmlSaveFlush(ctxt);
31925 desret_int(ret_val);
31926 call_tests++;
31927 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31928 xmlResetLastError();
31929 if (mem_base != xmlMemBlocks()) {
31930 printf("Leak of %d blocks found in xmlSaveFlush",
31931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031932 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031933 printf(" %d", n_ctxt);
31934 printf("\n");
31935 }
31936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031937 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031938#endif
31939
Daniel Veillard42595322004-11-08 10:52:06 +000031940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031941}
31942
31943
31944static int
31945test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031947
31948
31949 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031951}
31952
31953
31954static int
31955test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031957
31958
31959 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031961}
31962
31963
31964static int
31965test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031967
31968
31969 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031971}
31972
31973
31974static int
31975test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031977
31978
31979 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031981}
31982
31983
31984static int
31985test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031987
William M. Brack21e4ef22005-01-02 09:53:13 +000031988#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031989 int mem_base;
31990 long ret_val;
31991 xmlSaveCtxtPtr ctxt; /* a document saving context */
31992 int n_ctxt;
31993 xmlNodePtr node; /* a document */
31994 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031995
Daniel Veillardce682bc2004-11-05 17:22:25 +000031996 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31997 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31998 mem_base = xmlMemBlocks();
31999 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
32000 node = gen_xmlNodePtr(n_node, 1);
32001
32002 ret_val = xmlSaveTree(ctxt, node);
32003 desret_long(ret_val);
32004 call_tests++;
32005 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32006 des_xmlNodePtr(n_node, node, 1);
32007 xmlResetLastError();
32008 if (mem_base != xmlMemBlocks()) {
32009 printf("Leak of %d blocks found in xmlSaveTree",
32010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032011 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032012 printf(" %d", n_ctxt);
32013 printf(" %d", n_node);
32014 printf("\n");
32015 }
32016 }
32017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032018 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032019#endif
32020
Daniel Veillard42595322004-11-08 10:52:06 +000032021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032022}
32023
32024static int
32025test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032027
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032028 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032029 test_ret += test_xmlSaveClose();
32030 test_ret += test_xmlSaveDoc();
32031 test_ret += test_xmlSaveFlush();
32032 test_ret += test_xmlSaveSetAttrEscape();
32033 test_ret += test_xmlSaveSetEscape();
32034 test_ret += test_xmlSaveToFd();
32035 test_ret += test_xmlSaveToFilename();
32036 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032037
Daniel Veillard42595322004-11-08 10:52:06 +000032038 if (test_ret != 0)
32039 printf("Module xmlsave: %d errors\n", test_ret);
32040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032041}
Daniel Veillarda521d282004-11-09 14:59:59 +000032042#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032043
Daniel Veillardce682bc2004-11-05 17:22:25 +000032044#define gen_nb_xmlSchemaPtr 1
32045static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32046 return(NULL);
32047}
32048static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32049}
Daniel Veillarda521d282004-11-09 14:59:59 +000032050#endif
32051
Daniel Veillardce682bc2004-11-05 17:22:25 +000032052
Daniel Veillardd93f6252004-11-02 15:53:51 +000032053static int
32054test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032056
William M. Brack21e4ef22005-01-02 09:53:13 +000032057#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032058 int mem_base;
32059 FILE * output; /* the file output */
32060 int n_output;
32061 xmlSchemaPtr schema; /* a schema structure */
32062 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032063
Daniel Veillardce682bc2004-11-05 17:22:25 +000032064 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
32065 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
32066 mem_base = xmlMemBlocks();
32067 output = gen_FILE_ptr(n_output, 0);
32068 schema = gen_xmlSchemaPtr(n_schema, 1);
32069
32070 xmlSchemaDump(output, schema);
32071 call_tests++;
32072 des_FILE_ptr(n_output, output, 0);
32073 des_xmlSchemaPtr(n_schema, schema, 1);
32074 xmlResetLastError();
32075 if (mem_base != xmlMemBlocks()) {
32076 printf("Leak of %d blocks found in xmlSchemaDump",
32077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032078 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032079 printf(" %d", n_output);
32080 printf(" %d", n_schema);
32081 printf("\n");
32082 }
32083 }
32084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032085 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032086#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000032087
Daniel Veillard42595322004-11-08 10:52:06 +000032088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089}
32090
Daniel Veillarda521d282004-11-09 14:59:59 +000032091#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032092
Daniel Veillardce682bc2004-11-05 17:22:25 +000032093#define gen_nb_xmlSchemaParserCtxtPtr 1
32094static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32095 return(NULL);
32096}
32097static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32098}
Daniel Veillarda521d282004-11-09 14:59:59 +000032099#endif
32100
32101#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032102
32103#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
32104static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32105 return(NULL);
32106}
32107static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32108}
Daniel Veillarda521d282004-11-09 14:59:59 +000032109#endif
32110
32111#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032112
32113#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
32114static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32115 return(NULL);
32116}
32117static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32118}
Daniel Veillarda521d282004-11-09 14:59:59 +000032119#endif
32120
Daniel Veillardce682bc2004-11-05 17:22:25 +000032121
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122static int
32123test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032125
William M. Brack21e4ef22005-01-02 09:53:13 +000032126#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032127 int mem_base;
32128 int ret_val;
32129 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
32130 int n_ctxt;
32131 xmlSchemaValidityErrorFunc * err; /* the error callback result */
32132 int n_err;
32133 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
32134 int n_warn;
32135 void ** ctx; /* contextual data for the callbacks result */
32136 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032137
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032138 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32139 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32140 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32141 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32142 mem_base = xmlMemBlocks();
32143 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
32144 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32145 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32146 ctx = gen_void_ptr_ptr(n_ctx, 3);
32147
32148 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
32149 desret_int(ret_val);
32150 call_tests++;
32151 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
32152 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32153 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32154 des_void_ptr_ptr(n_ctx, ctx, 3);
32155 xmlResetLastError();
32156 if (mem_base != xmlMemBlocks()) {
32157 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
32158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032159 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032160 printf(" %d", n_ctxt);
32161 printf(" %d", n_err);
32162 printf(" %d", n_warn);
32163 printf(" %d", n_ctx);
32164 printf("\n");
32165 }
32166 }
32167 }
32168 }
32169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032170 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032171#endif
32172
Daniel Veillard42595322004-11-08 10:52:06 +000032173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032174}
32175
Daniel Veillarda521d282004-11-09 14:59:59 +000032176#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032177
Daniel Veillardce682bc2004-11-05 17:22:25 +000032178#define gen_nb_xmlSchemaValidCtxtPtr 1
32179static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32180 return(NULL);
32181}
32182static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32183}
Daniel Veillarda521d282004-11-09 14:59:59 +000032184#endif
32185
Daniel Veillardce682bc2004-11-05 17:22:25 +000032186
Daniel Veillardd93f6252004-11-02 15:53:51 +000032187static int
32188test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032190
William M. Brack21e4ef22005-01-02 09:53:13 +000032191#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032192 int mem_base;
32193 int ret_val;
32194 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32195 int n_ctxt;
32196 xmlSchemaValidityErrorFunc * err; /* the error function result */
32197 int n_err;
32198 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32199 int n_warn;
32200 void ** ctx; /* the functions context result */
32201 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032202
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032203 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32204 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32205 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32206 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32207 mem_base = xmlMemBlocks();
32208 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32209 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32210 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32211 ctx = gen_void_ptr_ptr(n_ctx, 3);
32212
32213 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32214 desret_int(ret_val);
32215 call_tests++;
32216 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32217 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32218 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32219 des_void_ptr_ptr(n_ctx, ctx, 3);
32220 xmlResetLastError();
32221 if (mem_base != xmlMemBlocks()) {
32222 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032224 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032225 printf(" %d", n_ctxt);
32226 printf(" %d", n_err);
32227 printf(" %d", n_warn);
32228 printf(" %d", n_ctx);
32229 printf("\n");
32230 }
32231 }
32232 }
32233 }
32234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032235 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032236#endif
32237
Daniel Veillard42595322004-11-08 10:52:06 +000032238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032239}
32240
32241
32242static int
32243test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032245
William M. Brack21e4ef22005-01-02 09:53:13 +000032246#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032247 int mem_base;
32248 xmlSchemaParserCtxtPtr ret_val;
32249 xmlDocPtr doc; /* a preparsed document tree */
32250 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032251
Daniel Veillard42595322004-11-08 10:52:06 +000032252 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32253 mem_base = xmlMemBlocks();
32254 doc = gen_xmlDocPtr(n_doc, 0);
32255
32256 ret_val = xmlSchemaNewDocParserCtxt(doc);
32257 desret_xmlSchemaParserCtxtPtr(ret_val);
32258 call_tests++;
32259 des_xmlDocPtr(n_doc, doc, 0);
32260 xmlResetLastError();
32261 if (mem_base != xmlMemBlocks()) {
32262 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32263 xmlMemBlocks() - mem_base);
32264 test_ret++;
32265 printf(" %d", n_doc);
32266 printf("\n");
32267 }
32268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032270#endif
32271
Daniel Veillard42595322004-11-08 10:52:06 +000032272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032273}
32274
32275
32276static int
32277test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032279
William M. Brack21e4ef22005-01-02 09:53:13 +000032280#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032281 int mem_base;
32282 xmlSchemaParserCtxtPtr ret_val;
32283 char * buffer; /* a pointer to a char array containing the schemas */
32284 int n_buffer;
32285 int size; /* the size of the array */
32286 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032287
Daniel Veillard42595322004-11-08 10:52:06 +000032288 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32289 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32290 mem_base = xmlMemBlocks();
32291 buffer = gen_const_char_ptr(n_buffer, 0);
32292 size = gen_int(n_size, 1);
32293
William M. Brackf13f77f2004-11-12 16:03:48 +000032294 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032295 desret_xmlSchemaParserCtxtPtr(ret_val);
32296 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032297 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032298 des_int(n_size, size, 1);
32299 xmlResetLastError();
32300 if (mem_base != xmlMemBlocks()) {
32301 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32302 xmlMemBlocks() - mem_base);
32303 test_ret++;
32304 printf(" %d", n_buffer);
32305 printf(" %d", n_size);
32306 printf("\n");
32307 }
32308 }
32309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032310 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032311#endif
32312
Daniel Veillard42595322004-11-08 10:52:06 +000032313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032314}
32315
32316
32317static int
32318test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032320
William M. Brack21e4ef22005-01-02 09:53:13 +000032321#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032322 int mem_base;
32323 xmlSchemaParserCtxtPtr ret_val;
32324 char * URL; /* the location of the schema */
32325 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032326
Daniel Veillard42595322004-11-08 10:52:06 +000032327 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32328 mem_base = xmlMemBlocks();
32329 URL = gen_const_char_ptr(n_URL, 0);
32330
William M. Brackf13f77f2004-11-12 16:03:48 +000032331 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032332 desret_xmlSchemaParserCtxtPtr(ret_val);
32333 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032334 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032335 xmlResetLastError();
32336 if (mem_base != xmlMemBlocks()) {
32337 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32338 xmlMemBlocks() - mem_base);
32339 test_ret++;
32340 printf(" %d", n_URL);
32341 printf("\n");
32342 }
32343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032345#endif
32346
Daniel Veillard42595322004-11-08 10:52:06 +000032347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032348}
32349
32350
32351static int
32352test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032354
32355
32356 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032358}
32359
32360
32361static int
32362test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032364
32365
32366 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032368}
32369
32370
32371static int
32372test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032374
32375
32376 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032378}
32379
32380
32381static int
32382test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032384
32385
32386 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032388}
32389
32390
32391static int
32392test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032394
William M. Brack21e4ef22005-01-02 09:53:13 +000032395#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032396 int mem_base;
32397 int ret_val;
32398 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32399 int n_ctxt;
32400 int options; /* a combination of xmlSchemaValidOption */
32401 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032402
Daniel Veillardce682bc2004-11-05 17:22:25 +000032403 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32404 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32405 mem_base = xmlMemBlocks();
32406 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32407 options = gen_int(n_options, 1);
32408
32409 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32410 desret_int(ret_val);
32411 call_tests++;
32412 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32413 des_int(n_options, options, 1);
32414 xmlResetLastError();
32415 if (mem_base != xmlMemBlocks()) {
32416 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032418 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032419 printf(" %d", n_ctxt);
32420 printf(" %d", n_options);
32421 printf("\n");
32422 }
32423 }
32424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032425 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032426#endif
32427
Daniel Veillard42595322004-11-08 10:52:06 +000032428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032429}
32430
32431
32432static int
32433test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032435
William M. Brack21e4ef22005-01-02 09:53:13 +000032436#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032437 int mem_base;
32438 int ret_val;
32439 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32440 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032441
Daniel Veillardce682bc2004-11-05 17:22:25 +000032442 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32443 mem_base = xmlMemBlocks();
32444 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32445
32446 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32447 desret_int(ret_val);
32448 call_tests++;
32449 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32450 xmlResetLastError();
32451 if (mem_base != xmlMemBlocks()) {
32452 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032454 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032455 printf(" %d", n_ctxt);
32456 printf("\n");
32457 }
32458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032459 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032460#endif
32461
Daniel Veillard42595322004-11-08 10:52:06 +000032462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032463}
32464
32465
32466static int
32467test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032469
William M. Brack21e4ef22005-01-02 09:53:13 +000032470#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032471 int mem_base;
32472 int ret_val;
32473 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32474 int n_ctxt;
32475 xmlDocPtr doc; /* a parsed document tree */
32476 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032477
Daniel Veillardce682bc2004-11-05 17:22:25 +000032478 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32479 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32480 mem_base = xmlMemBlocks();
32481 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32482 doc = gen_xmlDocPtr(n_doc, 1);
32483
32484 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32485 desret_int(ret_val);
32486 call_tests++;
32487 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32488 des_xmlDocPtr(n_doc, doc, 1);
32489 xmlResetLastError();
32490 if (mem_base != xmlMemBlocks()) {
32491 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032493 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032494 printf(" %d", n_ctxt);
32495 printf(" %d", n_doc);
32496 printf("\n");
32497 }
32498 }
32499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032500 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032501#endif
32502
Daniel Veillard42595322004-11-08 10:52:06 +000032503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032504}
32505
32506
32507static int
32508test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032510
William M. Brack21e4ef22005-01-02 09:53:13 +000032511#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032512 int mem_base;
32513 int ret_val;
32514 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32515 int n_ctxt;
32516 xmlNodePtr elem; /* an element node */
32517 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032518
Daniel Veillardce682bc2004-11-05 17:22:25 +000032519 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32520 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32521 mem_base = xmlMemBlocks();
32522 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32523 elem = gen_xmlNodePtr(n_elem, 1);
32524
32525 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32526 desret_int(ret_val);
32527 call_tests++;
32528 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32529 des_xmlNodePtr(n_elem, elem, 1);
32530 xmlResetLastError();
32531 if (mem_base != xmlMemBlocks()) {
32532 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032534 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032535 printf(" %d", n_ctxt);
32536 printf(" %d", n_elem);
32537 printf("\n");
32538 }
32539 }
32540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032541 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032542#endif
32543
Daniel Veillard42595322004-11-08 10:52:06 +000032544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032545}
32546
32547
32548static int
32549test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032551
William M. Brack21e4ef22005-01-02 09:53:13 +000032552#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032553 int mem_base;
32554 int ret_val;
32555 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32556 int n_ctxt;
32557 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32558 int n_input;
32559 xmlCharEncoding enc; /* an optional encoding information */
32560 int n_enc;
32561 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32562 int n_sax;
32563 void * user_data; /* the context to provide to the SAX handler. */
32564 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032565
Daniel Veillardce682bc2004-11-05 17:22:25 +000032566 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32567 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32568 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32569 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32570 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32571 mem_base = xmlMemBlocks();
32572 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32573 input = gen_xmlParserInputBufferPtr(n_input, 1);
32574 enc = gen_xmlCharEncoding(n_enc, 2);
32575 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32576 user_data = gen_userdata(n_user_data, 4);
32577
32578 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32579 desret_int(ret_val);
32580 call_tests++;
32581 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32582 des_xmlParserInputBufferPtr(n_input, input, 1);
32583 des_xmlCharEncoding(n_enc, enc, 2);
32584 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32585 des_userdata(n_user_data, user_data, 4);
32586 xmlResetLastError();
32587 if (mem_base != xmlMemBlocks()) {
32588 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032590 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032591 printf(" %d", n_ctxt);
32592 printf(" %d", n_input);
32593 printf(" %d", n_enc);
32594 printf(" %d", n_sax);
32595 printf(" %d", n_user_data);
32596 printf("\n");
32597 }
32598 }
32599 }
32600 }
32601 }
32602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032603 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032604#endif
32605
Daniel Veillard42595322004-11-08 10:52:06 +000032606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032607}
32608
32609static int
32610test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032612
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032613 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032614 test_ret += test_xmlSchemaDump();
32615 test_ret += test_xmlSchemaGetParserErrors();
32616 test_ret += test_xmlSchemaGetValidErrors();
32617 test_ret += test_xmlSchemaNewDocParserCtxt();
32618 test_ret += test_xmlSchemaNewMemParserCtxt();
32619 test_ret += test_xmlSchemaNewParserCtxt();
32620 test_ret += test_xmlSchemaNewValidCtxt();
32621 test_ret += test_xmlSchemaParse();
32622 test_ret += test_xmlSchemaSetParserErrors();
32623 test_ret += test_xmlSchemaSetValidErrors();
32624 test_ret += test_xmlSchemaSetValidOptions();
32625 test_ret += test_xmlSchemaValidCtxtGetOptions();
32626 test_ret += test_xmlSchemaValidateDoc();
32627 test_ret += test_xmlSchemaValidateOneElement();
32628 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032629
Daniel Veillard42595322004-11-08 10:52:06 +000032630 if (test_ret != 0)
32631 printf("Module xmlschemas: %d errors\n", test_ret);
32632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032633}
Daniel Veillarda521d282004-11-09 14:59:59 +000032634#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032635
Daniel Veillardce682bc2004-11-05 17:22:25 +000032636#define gen_nb_xmlSchemaFacetPtr 1
32637static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32638 return(NULL);
32639}
32640static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32641}
Daniel Veillarda521d282004-11-09 14:59:59 +000032642#endif
32643
32644#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032645
32646#define gen_nb_xmlSchemaTypePtr 1
32647static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32648 return(NULL);
32649}
32650static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32651}
Daniel Veillarda521d282004-11-09 14:59:59 +000032652#endif
32653
Daniel Veillardce682bc2004-11-05 17:22:25 +000032654
Daniel Veillardd93f6252004-11-02 15:53:51 +000032655static int
32656test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032658
William M. Brack21e4ef22005-01-02 09:53:13 +000032659#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032660 int mem_base;
32661 int ret_val;
32662 xmlSchemaFacetPtr facet; /* the facet */
32663 int n_facet;
32664 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32665 int n_typeDecl;
32666 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32667 int n_ctxt;
32668 xmlChar * name; /* name of the type */
32669 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032670
Daniel Veillardce682bc2004-11-05 17:22:25 +000032671 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32672 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32673 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32674 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32675 mem_base = xmlMemBlocks();
32676 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32677 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32678 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32679 name = gen_const_xmlChar_ptr(n_name, 3);
32680
William M. Brackf13f77f2004-11-12 16:03:48 +000032681 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032682 desret_int(ret_val);
32683 call_tests++;
32684 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32685 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32686 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032687 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032688 xmlResetLastError();
32689 if (mem_base != xmlMemBlocks()) {
32690 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032692 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032693 printf(" %d", n_facet);
32694 printf(" %d", n_typeDecl);
32695 printf(" %d", n_ctxt);
32696 printf(" %d", n_name);
32697 printf("\n");
32698 }
32699 }
32700 }
32701 }
32702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032703 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032704#endif
32705
Daniel Veillard42595322004-11-08 10:52:06 +000032706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032707}
32708
32709
32710static int
32711test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032713
William M. Brack21e4ef22005-01-02 09:53:13 +000032714#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032715 int mem_base;
32716
32717 mem_base = xmlMemBlocks();
32718
32719 xmlSchemaCleanupTypes();
32720 call_tests++;
32721 xmlResetLastError();
32722 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032723 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032725 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032726 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032728 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032729#endif
32730
Daniel Veillard42595322004-11-08 10:52:06 +000032731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032732}
32733
32734
32735static int
32736test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032738
William M. Brack21e4ef22005-01-02 09:53:13 +000032739#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032740 int mem_base;
32741 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032742 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032743 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032744
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032745 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032747 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032748
William M. Brackf13f77f2004-11-12 16:03:48 +000032749 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032750 desret_xmlChar_ptr(ret_val);
32751 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032752 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032753 xmlResetLastError();
32754 if (mem_base != xmlMemBlocks()) {
32755 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032757 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032758 printf(" %d", n_value);
32759 printf("\n");
32760 }
32761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032762 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032763#endif
32764
Daniel Veillard42595322004-11-08 10:52:06 +000032765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032766}
32767
Daniel Veillarda521d282004-11-09 14:59:59 +000032768#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032769
Daniel Veillardce682bc2004-11-05 17:22:25 +000032770#define gen_nb_xmlSchemaValPtr 1
32771static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32772 return(NULL);
32773}
32774static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32775}
Daniel Veillarda521d282004-11-09 14:59:59 +000032776#endif
32777
Daniel Veillardce682bc2004-11-05 17:22:25 +000032778
Daniel Veillardd93f6252004-11-02 15:53:51 +000032779static int
32780test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032782
William M. Brack21e4ef22005-01-02 09:53:13 +000032783#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032784 int mem_base;
32785 int ret_val;
32786 xmlSchemaValPtr x; /* a first value */
32787 int n_x;
32788 xmlSchemaValPtr y; /* a second value */
32789 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032790
Daniel Veillardce682bc2004-11-05 17:22:25 +000032791 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32792 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32793 mem_base = xmlMemBlocks();
32794 x = gen_xmlSchemaValPtr(n_x, 0);
32795 y = gen_xmlSchemaValPtr(n_y, 1);
32796
32797 ret_val = xmlSchemaCompareValues(x, y);
32798 desret_int(ret_val);
32799 call_tests++;
32800 des_xmlSchemaValPtr(n_x, x, 0);
32801 des_xmlSchemaValPtr(n_y, y, 1);
32802 xmlResetLastError();
32803 if (mem_base != xmlMemBlocks()) {
32804 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032806 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032807 printf(" %d", n_x);
32808 printf(" %d", n_y);
32809 printf("\n");
32810 }
32811 }
32812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032813 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032814#endif
32815
Daniel Veillard42595322004-11-08 10:52:06 +000032816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032817}
32818
32819
32820static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032821test_xmlSchemaCompareValuesWhtsp(void) {
32822 int test_ret = 0;
32823
32824#if defined(LIBXML_SCHEMAS_ENABLED)
32825 int mem_base;
32826 int ret_val;
32827 xmlSchemaValPtr x; /* a first value */
32828 int n_x;
32829 xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */
32830 int n_xws;
32831 xmlSchemaValPtr y; /* a second value */
32832 int n_y;
32833 xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */
32834 int n_yws;
32835
32836 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32837 for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) {
32838 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32839 for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) {
32840 mem_base = xmlMemBlocks();
32841 x = gen_xmlSchemaValPtr(n_x, 0);
32842 xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1);
32843 y = gen_xmlSchemaValPtr(n_y, 2);
32844 yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3);
32845
32846 ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws);
32847 desret_int(ret_val);
32848 call_tests++;
32849 des_xmlSchemaValPtr(n_x, x, 0);
32850 des_xmlSchemaWhitespaceValueType(n_xws, xws, 1);
32851 des_xmlSchemaValPtr(n_y, y, 2);
32852 des_xmlSchemaWhitespaceValueType(n_yws, yws, 3);
32853 xmlResetLastError();
32854 if (mem_base != xmlMemBlocks()) {
32855 printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp",
32856 xmlMemBlocks() - mem_base);
32857 test_ret++;
32858 printf(" %d", n_x);
32859 printf(" %d", n_xws);
32860 printf(" %d", n_y);
32861 printf(" %d", n_yws);
32862 printf("\n");
32863 }
32864 }
32865 }
32866 }
32867 }
32868 function_tests++;
32869#endif
32870
32871 return(test_ret);
32872}
32873
32874
32875static int
Daniel Veillard57c000e2005-03-13 18:34:29 +000032876test_xmlSchemaCopyValue(void) {
32877 int test_ret = 0;
32878
32879
32880 /* missing type support */
32881 return(test_ret);
32882}
32883
32884
32885static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032886test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032888
William M. Brack21e4ef22005-01-02 09:53:13 +000032889#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032890 int mem_base;
32891 xmlSchemaTypePtr ret_val;
32892 xmlSchemaTypePtr type; /* the built-in simple type. */
32893 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032894
Daniel Veillard42595322004-11-08 10:52:06 +000032895 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32896 mem_base = xmlMemBlocks();
32897 type = gen_xmlSchemaTypePtr(n_type, 0);
32898
32899 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32900 desret_xmlSchemaTypePtr(ret_val);
32901 call_tests++;
32902 des_xmlSchemaTypePtr(n_type, type, 0);
32903 xmlResetLastError();
32904 if (mem_base != xmlMemBlocks()) {
32905 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32906 xmlMemBlocks() - mem_base);
32907 test_ret++;
32908 printf(" %d", n_type);
32909 printf("\n");
32910 }
32911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032912 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032913#endif
32914
Daniel Veillard42595322004-11-08 10:52:06 +000032915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032916}
32917
32918
32919static int
32920test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032922
William M. Brack21e4ef22005-01-02 09:53:13 +000032923#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032924 xmlSchemaTypePtr ret_val;
32925 xmlSchemaValType type; /* the type of the built in type */
32926 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032927
Daniel Veillard42595322004-11-08 10:52:06 +000032928 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32929 type = gen_xmlSchemaValType(n_type, 0);
32930
32931 ret_val = xmlSchemaGetBuiltInType(type);
32932 desret_xmlSchemaTypePtr(ret_val);
32933 call_tests++;
32934 des_xmlSchemaValType(n_type, type, 0);
32935 xmlResetLastError();
32936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032937 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032938#endif
32939
Daniel Veillard42595322004-11-08 10:52:06 +000032940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032941}
32942
32943
32944static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032945test_xmlSchemaGetCanonValue(void) {
32946 int test_ret = 0;
32947
32948#if defined(LIBXML_SCHEMAS_ENABLED)
32949 int mem_base;
32950 int ret_val;
32951 xmlSchemaValPtr val; /* the precomputed value */
32952 int n_val;
32953 xmlChar ** retValue; /* the returned value */
32954 int n_retValue;
32955
32956 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32957 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
32958 mem_base = xmlMemBlocks();
32959 val = gen_xmlSchemaValPtr(n_val, 0);
32960 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
32961
32962 ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue);
32963 desret_int(ret_val);
32964 call_tests++;
32965 des_xmlSchemaValPtr(n_val, val, 0);
32966 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
32967 xmlResetLastError();
32968 if (mem_base != xmlMemBlocks()) {
32969 printf("Leak of %d blocks found in xmlSchemaGetCanonValue",
32970 xmlMemBlocks() - mem_base);
32971 test_ret++;
32972 printf(" %d", n_val);
32973 printf(" %d", n_retValue);
32974 printf("\n");
32975 }
32976 }
32977 }
32978 function_tests++;
32979#endif
32980
32981 return(test_ret);
32982}
32983
32984
32985static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032986test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032988
William M. Brack21e4ef22005-01-02 09:53:13 +000032989#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032990 int mem_base;
32991 unsigned long ret_val;
32992 xmlSchemaFacetPtr facet; /* an schemas type facet */
32993 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032994
William M. Brack094dd862004-11-14 14:28:34 +000032995 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32996 mem_base = xmlMemBlocks();
32997 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32998
32999 ret_val = xmlSchemaGetFacetValueAsULong(facet);
33000 desret_unsigned_long(ret_val);
33001 call_tests++;
33002 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33003 xmlResetLastError();
33004 if (mem_base != xmlMemBlocks()) {
33005 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
33006 xmlMemBlocks() - mem_base);
33007 test_ret++;
33008 printf(" %d", n_facet);
33009 printf("\n");
33010 }
33011 }
33012 function_tests++;
33013#endif
33014
Daniel Veillard42595322004-11-08 10:52:06 +000033015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033016}
33017
33018
33019static int
33020test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033022
William M. Brack21e4ef22005-01-02 09:53:13 +000033023#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033024 int mem_base;
33025 xmlSchemaTypePtr ret_val;
33026 xmlChar * name; /* the type name */
33027 int n_name;
33028 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
33029 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033030
Daniel Veillard42595322004-11-08 10:52:06 +000033031 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33032 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
33033 mem_base = xmlMemBlocks();
33034 name = gen_const_xmlChar_ptr(n_name, 0);
33035 ns = gen_const_xmlChar_ptr(n_ns, 1);
33036
William M. Brackf13f77f2004-11-12 16:03:48 +000033037 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000033038 desret_xmlSchemaTypePtr(ret_val);
33039 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033040 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
33041 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000033042 xmlResetLastError();
33043 if (mem_base != xmlMemBlocks()) {
33044 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
33045 xmlMemBlocks() - mem_base);
33046 test_ret++;
33047 printf(" %d", n_name);
33048 printf(" %d", n_ns);
33049 printf("\n");
33050 }
33051 }
33052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033053 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033054#endif
33055
Daniel Veillard42595322004-11-08 10:52:06 +000033056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033057}
33058
33059
33060static int
33061test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033063
William M. Brack21e4ef22005-01-02 09:53:13 +000033064#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000033065
33066
33067 xmlSchemaInitTypes();
33068 call_tests++;
33069 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033070 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033071#endif
33072
Daniel Veillard42595322004-11-08 10:52:06 +000033073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033074}
33075
33076
33077static int
33078test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033080
William M. Brack21e4ef22005-01-02 09:53:13 +000033081#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033082 int mem_base;
33083 int ret_val;
33084 xmlSchemaTypePtr type; /* the built-in type */
33085 int n_type;
33086 int facetType; /* the facet type */
33087 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033088
Daniel Veillardce682bc2004-11-05 17:22:25 +000033089 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33090 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
33091 mem_base = xmlMemBlocks();
33092 type = gen_xmlSchemaTypePtr(n_type, 0);
33093 facetType = gen_int(n_facetType, 1);
33094
33095 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
33096 desret_int(ret_val);
33097 call_tests++;
33098 des_xmlSchemaTypePtr(n_type, type, 0);
33099 des_int(n_facetType, facetType, 1);
33100 xmlResetLastError();
33101 if (mem_base != xmlMemBlocks()) {
33102 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
33103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033104 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033105 printf(" %d", n_type);
33106 printf(" %d", n_facetType);
33107 printf("\n");
33108 }
33109 }
33110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033111 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033112#endif
33113
Daniel Veillard42595322004-11-08 10:52:06 +000033114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033115}
33116
33117
33118static int
33119test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033121
33122
33123 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033125}
33126
Daniel Veillardb5839c32005-02-19 18:27:14 +000033127
33128static int
33129test_xmlSchemaNewNOTATIONValue(void) {
33130 int test_ret = 0;
33131
33132
33133 /* missing type support */
33134 return(test_ret);
33135}
33136
33137
33138static int
33139test_xmlSchemaNewStringValue(void) {
33140 int test_ret = 0;
33141
33142
33143 /* missing type support */
33144 return(test_ret);
33145}
33146
Daniel Veillarda521d282004-11-09 14:59:59 +000033147#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000033148
Daniel Veillardce682bc2004-11-05 17:22:25 +000033149#define gen_nb_xmlSchemaValPtr_ptr 1
33150static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33151 return(NULL);
33152}
33153static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33154}
Daniel Veillarda521d282004-11-09 14:59:59 +000033155#endif
33156
Daniel Veillardce682bc2004-11-05 17:22:25 +000033157
Daniel Veillardd93f6252004-11-02 15:53:51 +000033158static int
33159test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033161
William M. Brack21e4ef22005-01-02 09:53:13 +000033162#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033163 int mem_base;
33164 int ret_val;
33165 xmlSchemaTypePtr type; /* the predefined type */
33166 int n_type;
33167 xmlChar * value; /* the value to check */
33168 int n_value;
33169 xmlSchemaValPtr * val; /* the return computed value */
33170 int n_val;
33171 xmlNodePtr node; /* the node containing the value */
33172 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033173
Daniel Veillardce682bc2004-11-05 17:22:25 +000033174 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33175 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33176 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33177 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33178 mem_base = xmlMemBlocks();
33179 type = gen_xmlSchemaTypePtr(n_type, 0);
33180 value = gen_const_xmlChar_ptr(n_value, 1);
33181 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33182 node = gen_xmlNodePtr(n_node, 3);
33183
William M. Brackf13f77f2004-11-12 16:03:48 +000033184 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033185 desret_int(ret_val);
33186 call_tests++;
33187 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033188 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033189 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33190 des_xmlNodePtr(n_node, node, 3);
33191 xmlResetLastError();
33192 if (mem_base != xmlMemBlocks()) {
33193 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
33194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033195 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033196 printf(" %d", n_type);
33197 printf(" %d", n_value);
33198 printf(" %d", n_val);
33199 printf(" %d", n_node);
33200 printf("\n");
33201 }
33202 }
33203 }
33204 }
33205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033206 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033207#endif
33208
Daniel Veillard42595322004-11-08 10:52:06 +000033209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033210}
33211
33212
33213static int
33214test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033216
William M. Brack21e4ef22005-01-02 09:53:13 +000033217#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033218 int mem_base;
33219 int ret_val;
33220 xmlSchemaTypePtr type; /* the predefined type */
33221 int n_type;
33222 xmlChar * value; /* the value to check */
33223 int n_value;
33224 xmlSchemaValPtr * val; /* the return computed value */
33225 int n_val;
33226 xmlNodePtr node; /* the node containing the value */
33227 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033228
Daniel Veillardce682bc2004-11-05 17:22:25 +000033229 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33230 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33231 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33232 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33233 mem_base = xmlMemBlocks();
33234 type = gen_xmlSchemaTypePtr(n_type, 0);
33235 value = gen_const_xmlChar_ptr(n_value, 1);
33236 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33237 node = gen_xmlNodePtr(n_node, 3);
33238
William M. Brackf13f77f2004-11-12 16:03:48 +000033239 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033240 desret_int(ret_val);
33241 call_tests++;
33242 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033243 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033244 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33245 des_xmlNodePtr(n_node, node, 3);
33246 xmlResetLastError();
33247 if (mem_base != xmlMemBlocks()) {
33248 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
33249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033250 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033251 printf(" %d", n_type);
33252 printf(" %d", n_value);
33253 printf(" %d", n_val);
33254 printf(" %d", n_node);
33255 printf("\n");
33256 }
33257 }
33258 }
33259 }
33260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033261 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033262#endif
33263
Daniel Veillard42595322004-11-08 10:52:06 +000033264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033265}
33266
33267
33268static int
33269test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033271
William M. Brack21e4ef22005-01-02 09:53:13 +000033272#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033273 int mem_base;
33274 int ret_val;
33275 xmlSchemaTypePtr base; /* the base type */
33276 int n_base;
33277 xmlSchemaFacetPtr facet; /* the facet to check */
33278 int n_facet;
33279 xmlChar * value; /* the lexical repr of the value to validate */
33280 int n_value;
33281 xmlSchemaValPtr val; /* the precomputed value */
33282 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033283
Daniel Veillardce682bc2004-11-05 17:22:25 +000033284 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
33285 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33286 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33287 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33288 mem_base = xmlMemBlocks();
33289 base = gen_xmlSchemaTypePtr(n_base, 0);
33290 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33291 value = gen_const_xmlChar_ptr(n_value, 2);
33292 val = gen_xmlSchemaValPtr(n_val, 3);
33293
William M. Brackf13f77f2004-11-12 16:03:48 +000033294 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033295 desret_int(ret_val);
33296 call_tests++;
33297 des_xmlSchemaTypePtr(n_base, base, 0);
33298 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033299 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033300 des_xmlSchemaValPtr(n_val, val, 3);
33301 xmlResetLastError();
33302 if (mem_base != xmlMemBlocks()) {
33303 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033305 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033306 printf(" %d", n_base);
33307 printf(" %d", n_facet);
33308 printf(" %d", n_value);
33309 printf(" %d", n_val);
33310 printf("\n");
33311 }
33312 }
33313 }
33314 }
33315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033316 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033317#endif
33318
Daniel Veillard42595322004-11-08 10:52:06 +000033319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033320}
33321
33322
33323static int
33324test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033326
William M. Brack21e4ef22005-01-02 09:53:13 +000033327#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033328 int mem_base;
33329 int ret_val;
33330 xmlSchemaTypePtr type; /* the built-in type */
33331 int n_type;
33332 xmlSchemaFacetPtr facet; /* the facet to check */
33333 int n_facet;
33334 xmlChar * value; /* the lexical repr. of the value to be validated */
33335 int n_value;
33336 xmlSchemaValPtr val; /* the precomputed value */
33337 int n_val;
33338 unsigned long * length; /* the actual length of the value */
33339 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033340
Daniel Veillardce682bc2004-11-05 17:22:25 +000033341 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33342 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33343 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33344 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33345 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33346 mem_base = xmlMemBlocks();
33347 type = gen_xmlSchemaTypePtr(n_type, 0);
33348 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33349 value = gen_const_xmlChar_ptr(n_value, 2);
33350 val = gen_xmlSchemaValPtr(n_val, 3);
33351 length = gen_unsigned_long_ptr(n_length, 4);
33352
William M. Brackf13f77f2004-11-12 16:03:48 +000033353 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033354 desret_int(ret_val);
33355 call_tests++;
33356 des_xmlSchemaTypePtr(n_type, type, 0);
33357 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033358 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033359 des_xmlSchemaValPtr(n_val, val, 3);
33360 des_unsigned_long_ptr(n_length, length, 4);
33361 xmlResetLastError();
33362 if (mem_base != xmlMemBlocks()) {
33363 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033365 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033366 printf(" %d", n_type);
33367 printf(" %d", n_facet);
33368 printf(" %d", n_value);
33369 printf(" %d", n_val);
33370 printf(" %d", n_length);
33371 printf("\n");
33372 }
33373 }
33374 }
33375 }
33376 }
33377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033378 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033379#endif
33380
Daniel Veillard42595322004-11-08 10:52:06 +000033381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033382}
33383
33384
33385static int
33386test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033388
William M. Brack21e4ef22005-01-02 09:53:13 +000033389#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033390 int mem_base;
33391 int ret_val;
33392 xmlSchemaFacetPtr facet; /* the facet to check */
33393 int n_facet;
33394 xmlChar * value; /* the lexical repr of the value to validate */
33395 int n_value;
33396 unsigned long actualLen; /* the number of list items */
33397 int n_actualLen;
33398 unsigned long * expectedLen; /* the resulting expected number of list items */
33399 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033400
Daniel Veillardce682bc2004-11-05 17:22:25 +000033401 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33402 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33403 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33404 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33405 mem_base = xmlMemBlocks();
33406 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33407 value = gen_const_xmlChar_ptr(n_value, 1);
33408 actualLen = gen_unsigned_long(n_actualLen, 2);
33409 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33410
William M. Brackf13f77f2004-11-12 16:03:48 +000033411 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033412 desret_int(ret_val);
33413 call_tests++;
33414 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033415 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033416 des_unsigned_long(n_actualLen, actualLen, 2);
33417 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33418 xmlResetLastError();
33419 if (mem_base != xmlMemBlocks()) {
33420 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033422 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033423 printf(" %d", n_facet);
33424 printf(" %d", n_value);
33425 printf(" %d", n_actualLen);
33426 printf(" %d", n_expectedLen);
33427 printf("\n");
33428 }
33429 }
33430 }
33431 }
33432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033433 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033434#endif
33435
Daniel Veillard42595322004-11-08 10:52:06 +000033436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033437}
33438
33439
33440static int
33441test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033443
William M. Brack21e4ef22005-01-02 09:53:13 +000033444#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033445 int mem_base;
33446 int ret_val;
33447 xmlSchemaTypePtr type; /* the predefined type */
33448 int n_type;
33449 xmlChar * value; /* the value to check */
33450 int n_value;
33451 xmlSchemaValPtr * val; /* the return computed value */
33452 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033453
Daniel Veillardce682bc2004-11-05 17:22:25 +000033454 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33455 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33456 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33457 mem_base = xmlMemBlocks();
33458 type = gen_xmlSchemaTypePtr(n_type, 0);
33459 value = gen_const_xmlChar_ptr(n_value, 1);
33460 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33461
William M. Brackf13f77f2004-11-12 16:03:48 +000033462 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033463 desret_int(ret_val);
33464 call_tests++;
33465 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033466 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033467 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33468 xmlResetLastError();
33469 if (mem_base != xmlMemBlocks()) {
33470 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033472 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033473 printf(" %d", n_type);
33474 printf(" %d", n_value);
33475 printf(" %d", n_val);
33476 printf("\n");
33477 }
33478 }
33479 }
33480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033481 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033482#endif
33483
Daniel Veillard42595322004-11-08 10:52:06 +000033484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033485}
33486
Daniel Veillard91b955c2004-12-10 10:26:42 +000033487
33488static int
33489test_xmlSchemaWhiteSpaceReplace(void) {
33490 int test_ret = 0;
33491
William M. Brack21e4ef22005-01-02 09:53:13 +000033492#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033493 int mem_base;
33494 xmlChar * ret_val;
33495 xmlChar * value; /* a value */
33496 int n_value;
33497
33498 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33499 mem_base = xmlMemBlocks();
33500 value = gen_const_xmlChar_ptr(n_value, 0);
33501
33502 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33503 desret_xmlChar_ptr(ret_val);
33504 call_tests++;
33505 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33506 xmlResetLastError();
33507 if (mem_base != xmlMemBlocks()) {
33508 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33509 xmlMemBlocks() - mem_base);
33510 test_ret++;
33511 printf(" %d", n_value);
33512 printf("\n");
33513 }
33514 }
33515 function_tests++;
33516#endif
33517
33518 return(test_ret);
33519}
33520
Daniel Veillardd93f6252004-11-02 15:53:51 +000033521static int
33522test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033524
Daniel Veillard57c000e2005-03-13 18:34:29 +000033525 if (quiet == 0) printf("Testing xmlschemastypes : 19 of 25 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033526 test_ret += test_xmlSchemaCheckFacet();
33527 test_ret += test_xmlSchemaCleanupTypes();
33528 test_ret += test_xmlSchemaCollapseString();
33529 test_ret += test_xmlSchemaCompareValues();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033530 test_ret += test_xmlSchemaCompareValuesWhtsp();
Daniel Veillard57c000e2005-03-13 18:34:29 +000033531 test_ret += test_xmlSchemaCopyValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033532 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33533 test_ret += test_xmlSchemaGetBuiltInType();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033534 test_ret += test_xmlSchemaGetCanonValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033535 test_ret += test_xmlSchemaGetFacetValueAsULong();
33536 test_ret += test_xmlSchemaGetPredefinedType();
33537 test_ret += test_xmlSchemaInitTypes();
33538 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33539 test_ret += test_xmlSchemaNewFacet();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033540 test_ret += test_xmlSchemaNewNOTATIONValue();
33541 test_ret += test_xmlSchemaNewStringValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033542 test_ret += test_xmlSchemaValPredefTypeNode();
33543 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33544 test_ret += test_xmlSchemaValidateFacet();
33545 test_ret += test_xmlSchemaValidateLengthFacet();
33546 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33547 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033548 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033549
Daniel Veillard42595322004-11-08 10:52:06 +000033550 if (test_ret != 0)
33551 printf("Module xmlschemastypes: %d errors\n", test_ret);
33552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033553}
33554
33555static int
33556test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033558
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033559 int mem_base;
33560 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033561 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033562 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033563
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033564 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033566 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033567
William M. Brackf13f77f2004-11-12 16:03:48 +000033568 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033569 desret_xmlChar_ptr(ret_val);
33570 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033571 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033572 xmlResetLastError();
33573 if (mem_base != xmlMemBlocks()) {
33574 printf("Leak of %d blocks found in xmlCharStrdup",
33575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033576 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033577 printf(" %d", n_cur);
33578 printf("\n");
33579 }
33580 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033582
Daniel Veillard42595322004-11-08 10:52:06 +000033583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033584}
33585
33586
33587static int
33588test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033590
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033591 int mem_base;
33592 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033593 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033594 int n_cur;
33595 int len; /* the len of @cur */
33596 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033598 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33599 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033601 cur = gen_const_char_ptr(n_cur, 0);
33602 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033603
William M. Brackf13f77f2004-11-12 16:03:48 +000033604 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033605 desret_xmlChar_ptr(ret_val);
33606 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033607 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033608 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033609 xmlResetLastError();
33610 if (mem_base != xmlMemBlocks()) {
33611 printf("Leak of %d blocks found in xmlCharStrndup",
33612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033613 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033614 printf(" %d", n_cur);
33615 printf(" %d", n_len);
33616 printf("\n");
33617 }
33618 }
33619 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033620 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033621
Daniel Veillard42595322004-11-08 10:52:06 +000033622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033623}
33624
33625
33626static int
33627test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033629
Daniel Veillardce682bc2004-11-05 17:22:25 +000033630 int mem_base;
33631 int ret_val;
33632 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33633 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033634
Daniel Veillardce682bc2004-11-05 17:22:25 +000033635 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33636 mem_base = xmlMemBlocks();
33637 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33638
William M. Brackf13f77f2004-11-12 16:03:48 +000033639 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033640 desret_int(ret_val);
33641 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033642 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033643 xmlResetLastError();
33644 if (mem_base != xmlMemBlocks()) {
33645 printf("Leak of %d blocks found in xmlCheckUTF8",
33646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033647 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033648 printf(" %d", n_utf);
33649 printf("\n");
33650 }
33651 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033653
Daniel Veillard42595322004-11-08 10:52:06 +000033654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033655}
33656
33657
33658static int
33659test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033661
Daniel Veillardce682bc2004-11-05 17:22:25 +000033662 int mem_base;
33663 int ret_val;
33664 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33665 int n_utf;
33666 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. */
33667 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033668
Daniel Veillardce682bc2004-11-05 17:22:25 +000033669 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33670 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33671 mem_base = xmlMemBlocks();
33672 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33673 len = gen_int_ptr(n_len, 1);
33674
William M. Brackf13f77f2004-11-12 16:03:48 +000033675 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033676 desret_int(ret_val);
33677 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033678 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033679 des_int_ptr(n_len, len, 1);
33680 xmlResetLastError();
33681 if (mem_base != xmlMemBlocks()) {
33682 printf("Leak of %d blocks found in xmlGetUTF8Char",
33683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033684 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033685 printf(" %d", n_utf);
33686 printf(" %d", n_len);
33687 printf("\n");
33688 }
33689 }
33690 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033691 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033692
Daniel Veillard42595322004-11-08 10:52:06 +000033693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033694}
33695
33696
33697static int
33698test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033700
33701 int mem_base;
33702 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033703 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033704 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033705 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033706 int n_str2;
33707
33708 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33709 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33710 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033711 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33712 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033713
William M. Brackf13f77f2004-11-12 16:03:48 +000033714 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033715 desret_int(ret_val);
33716 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033717 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33718 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033719 xmlResetLastError();
33720 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033721 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033723 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033724 printf(" %d", n_str1);
33725 printf(" %d", n_str2);
33726 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033727 }
33728 }
33729 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033731
Daniel Veillard42595322004-11-08 10:52:06 +000033732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033733}
33734
33735
33736static int
33737test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033739
33740
33741 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033743}
33744
33745
33746static int
33747test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033749
33750 int mem_base;
33751 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033752 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033753 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033754 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033755 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033756 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033757 int n_str;
33758
33759 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33760 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33761 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033763 pref = gen_const_xmlChar_ptr(n_pref, 0);
33764 name = gen_const_xmlChar_ptr(n_name, 1);
33765 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033766
William M. Brackf13f77f2004-11-12 16:03:48 +000033767 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033768 desret_int(ret_val);
33769 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033770 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33771 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33772 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033773 xmlResetLastError();
33774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033775 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033778 printf(" %d", n_pref);
33779 printf(" %d", n_name);
33780 printf(" %d", n_str);
33781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033782 }
33783 }
33784 }
33785 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033786 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033787
Daniel Veillard42595322004-11-08 10:52:06 +000033788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033789}
33790
33791
33792static int
33793test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033795
33796
33797 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033799}
33800
33801
33802static int
33803test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033805
33806 int mem_base;
33807 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033808 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033809 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033810 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033811 int n_str2;
33812
33813 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33814 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033816 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33817 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033818
William M. Brackf13f77f2004-11-12 16:03:48 +000033819 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033820 desret_int(ret_val);
33821 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033822 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33823 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033824 xmlResetLastError();
33825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033826 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033829 printf(" %d", n_str1);
33830 printf(" %d", n_str2);
33831 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033832 }
33833 }
33834 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033836
Daniel Veillard42595322004-11-08 10:52:06 +000033837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033838}
33839
33840
33841static int
33842test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033844
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033845 int mem_base;
33846 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033847 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033848 int n_str;
33849 xmlChar * val; /* the xmlChar to search (needle) */
33850 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033851
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033852 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33853 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033855 str = gen_const_xmlChar_ptr(n_str, 0);
33856 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033857
William M. Brackf13f77f2004-11-12 16:03:48 +000033858 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033859 desret_const_xmlChar_ptr(ret_val);
33860 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033861 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033862 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033863 xmlResetLastError();
33864 if (mem_base != xmlMemBlocks()) {
33865 printf("Leak of %d blocks found in xmlStrcasestr",
33866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033867 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033868 printf(" %d", n_str);
33869 printf(" %d", n_val);
33870 printf("\n");
33871 }
33872 }
33873 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033874 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033875
Daniel Veillard42595322004-11-08 10:52:06 +000033876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033877}
33878
33879
33880static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033881test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033883
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033884 int mem_base;
33885 const xmlChar * ret_val;
33886 xmlChar * str; /* the xmlChar * array */
33887 int n_str;
33888 xmlChar val; /* the xmlChar to search */
33889 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033890
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033891 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33892 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33893 mem_base = xmlMemBlocks();
33894 str = gen_const_xmlChar_ptr(n_str, 0);
33895 val = gen_xmlChar(n_val, 1);
33896
William M. Brackf13f77f2004-11-12 16:03:48 +000033897 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033898 desret_const_xmlChar_ptr(ret_val);
33899 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033900 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033901 des_xmlChar(n_val, val, 1);
33902 xmlResetLastError();
33903 if (mem_base != xmlMemBlocks()) {
33904 printf("Leak of %d blocks found in xmlStrchr",
33905 xmlMemBlocks() - mem_base);
33906 test_ret++;
33907 printf(" %d", n_str);
33908 printf(" %d", n_val);
33909 printf("\n");
33910 }
33911 }
33912 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033913 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033914
Daniel Veillard42595322004-11-08 10:52:06 +000033915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033916}
33917
33918
33919static int
33920test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033922
33923 int mem_base;
33924 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033925 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033926 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033927 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033928 int n_str2;
33929
33930 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33931 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033933 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33934 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033935
William M. Brackf13f77f2004-11-12 16:03:48 +000033936 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033937 desret_int(ret_val);
33938 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033939 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33940 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033941 xmlResetLastError();
33942 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033943 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033945 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033946 printf(" %d", n_str1);
33947 printf(" %d", n_str2);
33948 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033949 }
33950 }
33951 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033952 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033953
Daniel Veillard42595322004-11-08 10:52:06 +000033954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033955}
33956
33957
33958static int
33959test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033961
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033962 int mem_base;
33963 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033964 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033965 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033966
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033967 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033969 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033970
William M. Brackf13f77f2004-11-12 16:03:48 +000033971 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033972 desret_xmlChar_ptr(ret_val);
33973 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033974 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033975 xmlResetLastError();
33976 if (mem_base != xmlMemBlocks()) {
33977 printf("Leak of %d blocks found in xmlStrdup",
33978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033979 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033980 printf(" %d", n_cur);
33981 printf("\n");
33982 }
33983 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033984 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033985
Daniel Veillard42595322004-11-08 10:52:06 +000033986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033987}
33988
33989
33990static int
33991test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033993
33994 int mem_base;
33995 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033996 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033997 int n_str;
33998
33999 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34000 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034001 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034002
William M. Brackf13f77f2004-11-12 16:03:48 +000034003 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034004 desret_int(ret_val);
34005 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034006 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034007 xmlResetLastError();
34008 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034009 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034011 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034012 printf(" %d", n_str);
34013 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034014 }
34015 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034016 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034017
Daniel Veillard42595322004-11-08 10:52:06 +000034018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034019}
34020
34021
34022static int
34023test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034025
34026 int mem_base;
34027 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034028 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034029 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034030 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034031 int n_str2;
34032 int len; /* the max comparison length */
34033 int n_len;
34034
34035 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34036 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34037 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034039 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34040 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34041 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034042
William M. Brackf13f77f2004-11-12 16:03:48 +000034043 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034044 desret_int(ret_val);
34045 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034046 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34047 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034048 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034049 xmlResetLastError();
34050 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034051 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034053 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034054 printf(" %d", n_str1);
34055 printf(" %d", n_str2);
34056 printf(" %d", n_len);
34057 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034058 }
34059 }
34060 }
34061 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034062 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034063
Daniel Veillard42595322004-11-08 10:52:06 +000034064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034065}
34066
34067
34068static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034069test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034071
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034072 int mem_base;
34073 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034074 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034075 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034076 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034077 int n_str2;
34078 int len; /* the len of @str2 */
34079 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034080
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034081 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34082 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34083 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34084 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034085 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34086 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34087 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034088
William M. Brackf13f77f2004-11-12 16:03:48 +000034089 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034090 desret_xmlChar_ptr(ret_val);
34091 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034092 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34093 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034094 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034095 xmlResetLastError();
34096 if (mem_base != xmlMemBlocks()) {
34097 printf("Leak of %d blocks found in xmlStrncatNew",
34098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034099 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034100 printf(" %d", n_str1);
34101 printf(" %d", n_str2);
34102 printf(" %d", n_len);
34103 printf("\n");
34104 }
34105 }
34106 }
34107 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034109
Daniel Veillard42595322004-11-08 10:52:06 +000034110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034111}
34112
34113
34114static int
34115test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034117
34118 int mem_base;
34119 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034120 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034121 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034122 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034123 int n_str2;
34124 int len; /* the max comparison length */
34125 int n_len;
34126
34127 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34128 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34129 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34130 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034131 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34132 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34133 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034134
William M. Brackf13f77f2004-11-12 16:03:48 +000034135 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034136 desret_int(ret_val);
34137 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034138 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34139 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034140 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034141 xmlResetLastError();
34142 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034143 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034145 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034146 printf(" %d", n_str1);
34147 printf(" %d", n_str2);
34148 printf(" %d", n_len);
34149 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034150 }
34151 }
34152 }
34153 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034154 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034155
Daniel Veillard42595322004-11-08 10:52:06 +000034156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034157}
34158
34159
34160static int
34161test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034163
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034164 int mem_base;
34165 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034166 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034167 int n_cur;
34168 int len; /* the len of @cur */
34169 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034170
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034171 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34172 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034174 cur = gen_const_xmlChar_ptr(n_cur, 0);
34175 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034176
William M. Brackf13f77f2004-11-12 16:03:48 +000034177 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034178 desret_xmlChar_ptr(ret_val);
34179 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034180 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034181 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034182 xmlResetLastError();
34183 if (mem_base != xmlMemBlocks()) {
34184 printf("Leak of %d blocks found in xmlStrndup",
34185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034186 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034187 printf(" %d", n_cur);
34188 printf(" %d", n_len);
34189 printf("\n");
34190 }
34191 }
34192 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034193 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034194
Daniel Veillard42595322004-11-08 10:52:06 +000034195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034196}
34197
34198
34199static int
34200test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034202
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034203 int mem_base;
34204 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034205 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034206 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034207 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034208 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034209
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034210 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34211 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
34212 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034213 str = gen_const_xmlChar_ptr(n_str, 0);
34214 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034215
William M. Brackf13f77f2004-11-12 16:03:48 +000034216 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034217 desret_const_xmlChar_ptr(ret_val);
34218 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034219 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
34220 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034221 xmlResetLastError();
34222 if (mem_base != xmlMemBlocks()) {
34223 printf("Leak of %d blocks found in xmlStrstr",
34224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034225 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034226 printf(" %d", n_str);
34227 printf(" %d", n_val);
34228 printf("\n");
34229 }
34230 }
34231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034233
Daniel Veillard42595322004-11-08 10:52:06 +000034234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034235}
34236
34237
34238static int
34239test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034241
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034242 int mem_base;
34243 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034244 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034245 int n_str;
34246 int start; /* the index of the first char (zero based) */
34247 int n_start;
34248 int len; /* the length of the substring */
34249 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034250
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034251 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34252 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34253 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034255 str = gen_const_xmlChar_ptr(n_str, 0);
34256 start = gen_int(n_start, 1);
34257 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034258
William M. Brackf13f77f2004-11-12 16:03:48 +000034259 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034260 desret_xmlChar_ptr(ret_val);
34261 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034262 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034263 des_int(n_start, start, 1);
34264 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034265 xmlResetLastError();
34266 if (mem_base != xmlMemBlocks()) {
34267 printf("Leak of %d blocks found in xmlStrsub",
34268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034269 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034270 printf(" %d", n_str);
34271 printf(" %d", n_start);
34272 printf(" %d", n_len);
34273 printf("\n");
34274 }
34275 }
34276 }
34277 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034279
Daniel Veillard42595322004-11-08 10:52:06 +000034280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034281}
34282
34283
34284static int
34285test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034287
34288 int mem_base;
34289 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034290 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034291 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034292 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034293 int n_utf2;
34294
34295 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34296 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034298 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34299 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034300
William M. Brackf13f77f2004-11-12 16:03:48 +000034301 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034302 desret_int(ret_val);
34303 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034304 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34305 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034306 xmlResetLastError();
34307 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034308 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034310 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034311 printf(" %d", n_utf1);
34312 printf(" %d", n_utf2);
34313 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034314 }
34315 }
34316 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034318
Daniel Veillard42595322004-11-08 10:52:06 +000034319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034320}
34321
34322
34323static int
34324test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034326
34327 int mem_base;
34328 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034329 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034330 int n_utf;
34331
34332 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34333 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034334 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034335
William M. Brackf13f77f2004-11-12 16:03:48 +000034336 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034337 desret_int(ret_val);
34338 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034339 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034340 xmlResetLastError();
34341 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034342 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034344 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034345 printf(" %d", n_utf);
34346 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034347 }
34348 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034349 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034350
Daniel Veillard42595322004-11-08 10:52:06 +000034351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034352}
34353
34354
34355static int
34356test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034358
34359 int mem_base;
34360 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034361 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034362 int n_utf;
34363
34364 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034366 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034367
William M. Brackf13f77f2004-11-12 16:03:48 +000034368 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034369 desret_int(ret_val);
34370 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034371 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034372 xmlResetLastError();
34373 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034374 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034376 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034377 printf(" %d", n_utf);
34378 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034379 }
34380 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034381 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034382
Daniel Veillard42595322004-11-08 10:52:06 +000034383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034384}
34385
34386
34387static int
34388test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034390
34391 int mem_base;
34392 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034393 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034394 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034395 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034396 int n_utfchar;
34397
34398 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34399 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34400 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034401 utf = gen_const_xmlChar_ptr(n_utf, 0);
34402 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034403
William M. Brackf13f77f2004-11-12 16:03:48 +000034404 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034405 desret_int(ret_val);
34406 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034407 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34408 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034409 xmlResetLastError();
34410 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034411 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034413 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034414 printf(" %d", n_utf);
34415 printf(" %d", n_utfchar);
34416 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034417 }
34418 }
34419 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034420 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034421
Daniel Veillard42595322004-11-08 10:52:06 +000034422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034423}
34424
34425
34426static int
34427test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034429
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034430 int mem_base;
34431 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034432 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034433 int n_utf;
34434 int len; /* the len of @utf (in chars) */
34435 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034436
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034437 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34438 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34439 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034440 utf = gen_const_xmlChar_ptr(n_utf, 0);
34441 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034442
William M. Brackf13f77f2004-11-12 16:03:48 +000034443 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034444 desret_xmlChar_ptr(ret_val);
34445 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034446 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034447 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034448 xmlResetLastError();
34449 if (mem_base != xmlMemBlocks()) {
34450 printf("Leak of %d blocks found in xmlUTF8Strndup",
34451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034452 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034453 printf(" %d", n_utf);
34454 printf(" %d", n_len);
34455 printf("\n");
34456 }
34457 }
34458 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034460
Daniel Veillard42595322004-11-08 10:52:06 +000034461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034462}
34463
34464
34465static int
34466test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034468
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034469 int mem_base;
34470 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034471 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034472 int n_utf;
34473 int pos; /* the position of the desired UTF8 char (in chars) */
34474 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034475
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034476 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34477 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34478 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034479 utf = gen_const_xmlChar_ptr(n_utf, 0);
34480 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034481
William M. Brackf13f77f2004-11-12 16:03:48 +000034482 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034483 desret_const_xmlChar_ptr(ret_val);
34484 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034485 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034486 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034487 xmlResetLastError();
34488 if (mem_base != xmlMemBlocks()) {
34489 printf("Leak of %d blocks found in xmlUTF8Strpos",
34490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034491 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034492 printf(" %d", n_utf);
34493 printf(" %d", n_pos);
34494 printf("\n");
34495 }
34496 }
34497 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034499
Daniel Veillard42595322004-11-08 10:52:06 +000034500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034501}
34502
34503
34504static int
34505test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034507
34508 int mem_base;
34509 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034510 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034511 int n_utf;
34512 int len; /* the number of characters in the array */
34513 int n_len;
34514
34515 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34516 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34517 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034518 utf = gen_const_xmlChar_ptr(n_utf, 0);
34519 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034520
William M. Brackf13f77f2004-11-12 16:03:48 +000034521 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034522 desret_int(ret_val);
34523 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034524 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034525 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034526 xmlResetLastError();
34527 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034528 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034530 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034531 printf(" %d", n_utf);
34532 printf(" %d", n_len);
34533 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034534 }
34535 }
34536 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034537 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034538
Daniel Veillard42595322004-11-08 10:52:06 +000034539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034540}
34541
34542
34543static int
34544test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034546
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034547 int mem_base;
34548 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034549 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034550 int n_utf;
34551 int start; /* relative pos of first char */
34552 int n_start;
34553 int len; /* total number to copy */
34554 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034555
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034556 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34557 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34558 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034560 utf = gen_const_xmlChar_ptr(n_utf, 0);
34561 start = gen_int(n_start, 1);
34562 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034563
William M. Brackf13f77f2004-11-12 16:03:48 +000034564 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034565 desret_xmlChar_ptr(ret_val);
34566 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034567 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034568 des_int(n_start, start, 1);
34569 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034570 xmlResetLastError();
34571 if (mem_base != xmlMemBlocks()) {
34572 printf("Leak of %d blocks found in xmlUTF8Strsub",
34573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034574 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034575 printf(" %d", n_utf);
34576 printf(" %d", n_start);
34577 printf(" %d", n_len);
34578 printf("\n");
34579 }
34580 }
34581 }
34582 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034584
Daniel Veillard42595322004-11-08 10:52:06 +000034585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034586}
34587
34588static int
34589test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034591
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034592 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034593 test_ret += test_xmlCharStrdup();
34594 test_ret += test_xmlCharStrndup();
34595 test_ret += test_xmlCheckUTF8();
34596 test_ret += test_xmlGetUTF8Char();
34597 test_ret += test_xmlStrEqual();
34598 test_ret += test_xmlStrPrintf();
34599 test_ret += test_xmlStrQEqual();
34600 test_ret += test_xmlStrVPrintf();
34601 test_ret += test_xmlStrcasecmp();
34602 test_ret += test_xmlStrcasestr();
34603 test_ret += test_xmlStrchr();
34604 test_ret += test_xmlStrcmp();
34605 test_ret += test_xmlStrdup();
34606 test_ret += test_xmlStrlen();
34607 test_ret += test_xmlStrncasecmp();
34608 test_ret += test_xmlStrncatNew();
34609 test_ret += test_xmlStrncmp();
34610 test_ret += test_xmlStrndup();
34611 test_ret += test_xmlStrstr();
34612 test_ret += test_xmlStrsub();
34613 test_ret += test_xmlUTF8Charcmp();
34614 test_ret += test_xmlUTF8Size();
34615 test_ret += test_xmlUTF8Strlen();
34616 test_ret += test_xmlUTF8Strloc();
34617 test_ret += test_xmlUTF8Strndup();
34618 test_ret += test_xmlUTF8Strpos();
34619 test_ret += test_xmlUTF8Strsize();
34620 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034621
Daniel Veillard42595322004-11-08 10:52:06 +000034622 if (test_ret != 0)
34623 printf("Module xmlstring: %d errors\n", test_ret);
34624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034625}
34626
34627static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034628test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034629 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034630
William M. Brack21e4ef22005-01-02 09:53:13 +000034631#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034632 int mem_base;
34633 int ret_val;
34634 int code; /* UCS code point */
34635 int n_code;
34636
34637 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34638 mem_base = xmlMemBlocks();
34639 code = gen_int(n_code, 0);
34640
34641 ret_val = xmlUCSIsAegeanNumbers(code);
34642 desret_int(ret_val);
34643 call_tests++;
34644 des_int(n_code, code, 0);
34645 xmlResetLastError();
34646 if (mem_base != xmlMemBlocks()) {
34647 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034649 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034650 printf(" %d", n_code);
34651 printf("\n");
34652 }
34653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034654 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034655#endif
34656
Daniel Veillard42595322004-11-08 10:52:06 +000034657 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034658}
34659
34660
34661static int
34662test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034663 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034664
William M. Brack21e4ef22005-01-02 09:53:13 +000034665#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034666 int mem_base;
34667 int ret_val;
34668 int code; /* UCS code point */
34669 int n_code;
34670
34671 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34672 mem_base = xmlMemBlocks();
34673 code = gen_int(n_code, 0);
34674
34675 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34676 desret_int(ret_val);
34677 call_tests++;
34678 des_int(n_code, code, 0);
34679 xmlResetLastError();
34680 if (mem_base != xmlMemBlocks()) {
34681 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034683 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034684 printf(" %d", n_code);
34685 printf("\n");
34686 }
34687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034688 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034689#endif
34690
Daniel Veillard42595322004-11-08 10:52:06 +000034691 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034692}
34693
34694
34695static int
34696test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034697 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034698
William M. Brack21e4ef22005-01-02 09:53:13 +000034699#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034700 int mem_base;
34701 int ret_val;
34702 int code; /* UCS code point */
34703 int n_code;
34704
34705 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34706 mem_base = xmlMemBlocks();
34707 code = gen_int(n_code, 0);
34708
34709 ret_val = xmlUCSIsArabic(code);
34710 desret_int(ret_val);
34711 call_tests++;
34712 des_int(n_code, code, 0);
34713 xmlResetLastError();
34714 if (mem_base != xmlMemBlocks()) {
34715 printf("Leak of %d blocks found in xmlUCSIsArabic",
34716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034717 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034718 printf(" %d", n_code);
34719 printf("\n");
34720 }
34721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034722 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034723#endif
34724
Daniel Veillard42595322004-11-08 10:52:06 +000034725 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034726}
34727
34728
34729static int
34730test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034731 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034732
William M. Brack21e4ef22005-01-02 09:53:13 +000034733#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034734 int mem_base;
34735 int ret_val;
34736 int code; /* UCS code point */
34737 int n_code;
34738
34739 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34740 mem_base = xmlMemBlocks();
34741 code = gen_int(n_code, 0);
34742
34743 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34744 desret_int(ret_val);
34745 call_tests++;
34746 des_int(n_code, code, 0);
34747 xmlResetLastError();
34748 if (mem_base != xmlMemBlocks()) {
34749 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034751 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034752 printf(" %d", n_code);
34753 printf("\n");
34754 }
34755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034756 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034757#endif
34758
Daniel Veillard42595322004-11-08 10:52:06 +000034759 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034760}
34761
34762
34763static int
34764test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034765 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034766
William M. Brack21e4ef22005-01-02 09:53:13 +000034767#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034768 int mem_base;
34769 int ret_val;
34770 int code; /* UCS code point */
34771 int n_code;
34772
34773 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34774 mem_base = xmlMemBlocks();
34775 code = gen_int(n_code, 0);
34776
34777 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34778 desret_int(ret_val);
34779 call_tests++;
34780 des_int(n_code, code, 0);
34781 xmlResetLastError();
34782 if (mem_base != xmlMemBlocks()) {
34783 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034785 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034786 printf(" %d", n_code);
34787 printf("\n");
34788 }
34789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034790 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034791#endif
34792
Daniel Veillard42595322004-11-08 10:52:06 +000034793 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034794}
34795
34796
34797static int
34798test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034799 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034800
William M. Brack21e4ef22005-01-02 09:53:13 +000034801#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034802 int mem_base;
34803 int ret_val;
34804 int code; /* UCS code point */
34805 int n_code;
34806
34807 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34808 mem_base = xmlMemBlocks();
34809 code = gen_int(n_code, 0);
34810
34811 ret_val = xmlUCSIsArmenian(code);
34812 desret_int(ret_val);
34813 call_tests++;
34814 des_int(n_code, code, 0);
34815 xmlResetLastError();
34816 if (mem_base != xmlMemBlocks()) {
34817 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034819 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034820 printf(" %d", n_code);
34821 printf("\n");
34822 }
34823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034824 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034825#endif
34826
Daniel Veillard42595322004-11-08 10:52:06 +000034827 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034828}
34829
34830
34831static int
34832test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034833 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034834
William M. Brack21e4ef22005-01-02 09:53:13 +000034835#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034836 int mem_base;
34837 int ret_val;
34838 int code; /* UCS code point */
34839 int n_code;
34840
34841 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34842 mem_base = xmlMemBlocks();
34843 code = gen_int(n_code, 0);
34844
34845 ret_val = xmlUCSIsArrows(code);
34846 desret_int(ret_val);
34847 call_tests++;
34848 des_int(n_code, code, 0);
34849 xmlResetLastError();
34850 if (mem_base != xmlMemBlocks()) {
34851 printf("Leak of %d blocks found in xmlUCSIsArrows",
34852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034853 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034854 printf(" %d", n_code);
34855 printf("\n");
34856 }
34857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034858 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034859#endif
34860
Daniel Veillard42595322004-11-08 10:52:06 +000034861 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034862}
34863
34864
34865static int
34866test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034867 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034868
William M. Brack21e4ef22005-01-02 09:53:13 +000034869#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034870 int mem_base;
34871 int ret_val;
34872 int code; /* UCS code point */
34873 int n_code;
34874
34875 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34876 mem_base = xmlMemBlocks();
34877 code = gen_int(n_code, 0);
34878
34879 ret_val = xmlUCSIsBasicLatin(code);
34880 desret_int(ret_val);
34881 call_tests++;
34882 des_int(n_code, code, 0);
34883 xmlResetLastError();
34884 if (mem_base != xmlMemBlocks()) {
34885 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034887 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034888 printf(" %d", n_code);
34889 printf("\n");
34890 }
34891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034892 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034893#endif
34894
Daniel Veillard42595322004-11-08 10:52:06 +000034895 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034896}
34897
34898
34899static int
34900test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034901 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034902
William M. Brack21e4ef22005-01-02 09:53:13 +000034903#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034904 int mem_base;
34905 int ret_val;
34906 int code; /* UCS code point */
34907 int n_code;
34908
34909 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34910 mem_base = xmlMemBlocks();
34911 code = gen_int(n_code, 0);
34912
34913 ret_val = xmlUCSIsBengali(code);
34914 desret_int(ret_val);
34915 call_tests++;
34916 des_int(n_code, code, 0);
34917 xmlResetLastError();
34918 if (mem_base != xmlMemBlocks()) {
34919 printf("Leak of %d blocks found in xmlUCSIsBengali",
34920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034921 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034922 printf(" %d", n_code);
34923 printf("\n");
34924 }
34925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034926 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034927#endif
34928
Daniel Veillard42595322004-11-08 10:52:06 +000034929 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034930}
34931
34932
34933static int
34934test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034935 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034936
William M. Brack21e4ef22005-01-02 09:53:13 +000034937#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034938 int mem_base;
34939 int ret_val;
34940 int code; /* UCS code point */
34941 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034942 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034943 int n_block;
34944
34945 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34946 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34947 mem_base = xmlMemBlocks();
34948 code = gen_int(n_code, 0);
34949 block = gen_const_char_ptr(n_block, 1);
34950
William M. Brackf13f77f2004-11-12 16:03:48 +000034951 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034952 desret_int(ret_val);
34953 call_tests++;
34954 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034955 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034956 xmlResetLastError();
34957 if (mem_base != xmlMemBlocks()) {
34958 printf("Leak of %d blocks found in xmlUCSIsBlock",
34959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034960 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034961 printf(" %d", n_code);
34962 printf(" %d", n_block);
34963 printf("\n");
34964 }
34965 }
34966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034967 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034968#endif
34969
Daniel Veillard42595322004-11-08 10:52:06 +000034970 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034971}
34972
34973
34974static int
34975test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034976 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034977
William M. Brack21e4ef22005-01-02 09:53:13 +000034978#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034979 int mem_base;
34980 int ret_val;
34981 int code; /* UCS code point */
34982 int n_code;
34983
34984 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34985 mem_base = xmlMemBlocks();
34986 code = gen_int(n_code, 0);
34987
34988 ret_val = xmlUCSIsBlockElements(code);
34989 desret_int(ret_val);
34990 call_tests++;
34991 des_int(n_code, code, 0);
34992 xmlResetLastError();
34993 if (mem_base != xmlMemBlocks()) {
34994 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034996 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034997 printf(" %d", n_code);
34998 printf("\n");
34999 }
35000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035001 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035002#endif
35003
Daniel Veillard42595322004-11-08 10:52:06 +000035004 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035005}
35006
35007
35008static int
35009test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035010 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035011
William M. Brack21e4ef22005-01-02 09:53:13 +000035012#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035013 int mem_base;
35014 int ret_val;
35015 int code; /* UCS code point */
35016 int n_code;
35017
35018 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35019 mem_base = xmlMemBlocks();
35020 code = gen_int(n_code, 0);
35021
35022 ret_val = xmlUCSIsBopomofo(code);
35023 desret_int(ret_val);
35024 call_tests++;
35025 des_int(n_code, code, 0);
35026 xmlResetLastError();
35027 if (mem_base != xmlMemBlocks()) {
35028 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
35029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035030 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035031 printf(" %d", n_code);
35032 printf("\n");
35033 }
35034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035035 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035036#endif
35037
Daniel Veillard42595322004-11-08 10:52:06 +000035038 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035039}
35040
35041
35042static int
35043test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035044 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035045
William M. Brack21e4ef22005-01-02 09:53:13 +000035046#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035047 int mem_base;
35048 int ret_val;
35049 int code; /* UCS code point */
35050 int n_code;
35051
35052 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35053 mem_base = xmlMemBlocks();
35054 code = gen_int(n_code, 0);
35055
35056 ret_val = xmlUCSIsBopomofoExtended(code);
35057 desret_int(ret_val);
35058 call_tests++;
35059 des_int(n_code, code, 0);
35060 xmlResetLastError();
35061 if (mem_base != xmlMemBlocks()) {
35062 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
35063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035064 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035065 printf(" %d", n_code);
35066 printf("\n");
35067 }
35068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035069 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035070#endif
35071
Daniel Veillard42595322004-11-08 10:52:06 +000035072 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035073}
35074
35075
35076static int
35077test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035078 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035079
William M. Brack21e4ef22005-01-02 09:53:13 +000035080#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035081 int mem_base;
35082 int ret_val;
35083 int code; /* UCS code point */
35084 int n_code;
35085
35086 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35087 mem_base = xmlMemBlocks();
35088 code = gen_int(n_code, 0);
35089
35090 ret_val = xmlUCSIsBoxDrawing(code);
35091 desret_int(ret_val);
35092 call_tests++;
35093 des_int(n_code, code, 0);
35094 xmlResetLastError();
35095 if (mem_base != xmlMemBlocks()) {
35096 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
35097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035098 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035099 printf(" %d", n_code);
35100 printf("\n");
35101 }
35102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035103 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035104#endif
35105
Daniel Veillard42595322004-11-08 10:52:06 +000035106 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035107}
35108
35109
35110static int
35111test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035112 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035113
William M. Brack21e4ef22005-01-02 09:53:13 +000035114#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035115 int mem_base;
35116 int ret_val;
35117 int code; /* UCS code point */
35118 int n_code;
35119
35120 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35121 mem_base = xmlMemBlocks();
35122 code = gen_int(n_code, 0);
35123
35124 ret_val = xmlUCSIsBraillePatterns(code);
35125 desret_int(ret_val);
35126 call_tests++;
35127 des_int(n_code, code, 0);
35128 xmlResetLastError();
35129 if (mem_base != xmlMemBlocks()) {
35130 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
35131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035132 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035133 printf(" %d", n_code);
35134 printf("\n");
35135 }
35136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035137 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035138#endif
35139
Daniel Veillard42595322004-11-08 10:52:06 +000035140 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035141}
35142
35143
35144static int
35145test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035146 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035147
William M. Brack21e4ef22005-01-02 09:53:13 +000035148#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035149 int mem_base;
35150 int ret_val;
35151 int code; /* UCS code point */
35152 int n_code;
35153
35154 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35155 mem_base = xmlMemBlocks();
35156 code = gen_int(n_code, 0);
35157
35158 ret_val = xmlUCSIsBuhid(code);
35159 desret_int(ret_val);
35160 call_tests++;
35161 des_int(n_code, code, 0);
35162 xmlResetLastError();
35163 if (mem_base != xmlMemBlocks()) {
35164 printf("Leak of %d blocks found in xmlUCSIsBuhid",
35165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035166 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035167 printf(" %d", n_code);
35168 printf("\n");
35169 }
35170 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035171 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035172#endif
35173
Daniel Veillard42595322004-11-08 10:52:06 +000035174 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035175}
35176
35177
35178static int
35179test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035180 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035181
William M. Brack21e4ef22005-01-02 09:53:13 +000035182#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035183 int mem_base;
35184 int ret_val;
35185 int code; /* UCS code point */
35186 int n_code;
35187
35188 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35189 mem_base = xmlMemBlocks();
35190 code = gen_int(n_code, 0);
35191
35192 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
35193 desret_int(ret_val);
35194 call_tests++;
35195 des_int(n_code, code, 0);
35196 xmlResetLastError();
35197 if (mem_base != xmlMemBlocks()) {
35198 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
35199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035200 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035201 printf(" %d", n_code);
35202 printf("\n");
35203 }
35204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035205 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035206#endif
35207
Daniel Veillard42595322004-11-08 10:52:06 +000035208 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035209}
35210
35211
35212static int
35213test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035214 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035215
William M. Brack21e4ef22005-01-02 09:53:13 +000035216#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035217 int mem_base;
35218 int ret_val;
35219 int code; /* UCS code point */
35220 int n_code;
35221
35222 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35223 mem_base = xmlMemBlocks();
35224 code = gen_int(n_code, 0);
35225
35226 ret_val = xmlUCSIsCJKCompatibility(code);
35227 desret_int(ret_val);
35228 call_tests++;
35229 des_int(n_code, code, 0);
35230 xmlResetLastError();
35231 if (mem_base != xmlMemBlocks()) {
35232 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
35233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035234 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035235 printf(" %d", n_code);
35236 printf("\n");
35237 }
35238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035239 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035240#endif
35241
Daniel Veillard42595322004-11-08 10:52:06 +000035242 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035243}
35244
35245
35246static int
35247test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035248 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035249
William M. Brack21e4ef22005-01-02 09:53:13 +000035250#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035251 int mem_base;
35252 int ret_val;
35253 int code; /* UCS code point */
35254 int n_code;
35255
35256 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35257 mem_base = xmlMemBlocks();
35258 code = gen_int(n_code, 0);
35259
35260 ret_val = xmlUCSIsCJKCompatibilityForms(code);
35261 desret_int(ret_val);
35262 call_tests++;
35263 des_int(n_code, code, 0);
35264 xmlResetLastError();
35265 if (mem_base != xmlMemBlocks()) {
35266 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
35267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035268 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035269 printf(" %d", n_code);
35270 printf("\n");
35271 }
35272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035273 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035274#endif
35275
Daniel Veillard42595322004-11-08 10:52:06 +000035276 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035277}
35278
35279
35280static int
35281test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035282 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035283
William M. Brack21e4ef22005-01-02 09:53:13 +000035284#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035285 int mem_base;
35286 int ret_val;
35287 int code; /* UCS code point */
35288 int n_code;
35289
35290 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35291 mem_base = xmlMemBlocks();
35292 code = gen_int(n_code, 0);
35293
35294 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
35295 desret_int(ret_val);
35296 call_tests++;
35297 des_int(n_code, code, 0);
35298 xmlResetLastError();
35299 if (mem_base != xmlMemBlocks()) {
35300 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
35301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035302 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035303 printf(" %d", n_code);
35304 printf("\n");
35305 }
35306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035307 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035308#endif
35309
Daniel Veillard42595322004-11-08 10:52:06 +000035310 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035311}
35312
35313
35314static int
35315test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035316 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035317
William M. Brack21e4ef22005-01-02 09:53:13 +000035318#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035319 int mem_base;
35320 int ret_val;
35321 int code; /* UCS code point */
35322 int n_code;
35323
35324 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35325 mem_base = xmlMemBlocks();
35326 code = gen_int(n_code, 0);
35327
35328 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
35329 desret_int(ret_val);
35330 call_tests++;
35331 des_int(n_code, code, 0);
35332 xmlResetLastError();
35333 if (mem_base != xmlMemBlocks()) {
35334 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
35335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035336 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035337 printf(" %d", n_code);
35338 printf("\n");
35339 }
35340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035341 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035342#endif
35343
Daniel Veillard42595322004-11-08 10:52:06 +000035344 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035345}
35346
35347
35348static int
35349test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035350 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035351
William M. Brack21e4ef22005-01-02 09:53:13 +000035352#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035353 int mem_base;
35354 int ret_val;
35355 int code; /* UCS code point */
35356 int n_code;
35357
35358 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35359 mem_base = xmlMemBlocks();
35360 code = gen_int(n_code, 0);
35361
35362 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35363 desret_int(ret_val);
35364 call_tests++;
35365 des_int(n_code, code, 0);
35366 xmlResetLastError();
35367 if (mem_base != xmlMemBlocks()) {
35368 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35369 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035370 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035371 printf(" %d", n_code);
35372 printf("\n");
35373 }
35374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035375 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035376#endif
35377
Daniel Veillard42595322004-11-08 10:52:06 +000035378 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035379}
35380
35381
35382static int
35383test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035384 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035385
William M. Brack21e4ef22005-01-02 09:53:13 +000035386#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035387 int mem_base;
35388 int ret_val;
35389 int code; /* UCS code point */
35390 int n_code;
35391
35392 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35393 mem_base = xmlMemBlocks();
35394 code = gen_int(n_code, 0);
35395
35396 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35397 desret_int(ret_val);
35398 call_tests++;
35399 des_int(n_code, code, 0);
35400 xmlResetLastError();
35401 if (mem_base != xmlMemBlocks()) {
35402 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035404 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035405 printf(" %d", n_code);
35406 printf("\n");
35407 }
35408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035409 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035410#endif
35411
Daniel Veillard42595322004-11-08 10:52:06 +000035412 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035413}
35414
35415
35416static int
35417test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035418 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035419
William M. Brack21e4ef22005-01-02 09:53:13 +000035420#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035421 int mem_base;
35422 int ret_val;
35423 int code; /* UCS code point */
35424 int n_code;
35425
35426 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35427 mem_base = xmlMemBlocks();
35428 code = gen_int(n_code, 0);
35429
35430 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35431 desret_int(ret_val);
35432 call_tests++;
35433 des_int(n_code, code, 0);
35434 xmlResetLastError();
35435 if (mem_base != xmlMemBlocks()) {
35436 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035438 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035439 printf(" %d", n_code);
35440 printf("\n");
35441 }
35442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035443 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035444#endif
35445
Daniel Veillard42595322004-11-08 10:52:06 +000035446 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035447}
35448
35449
35450static int
35451test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035452 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035453
William M. Brack21e4ef22005-01-02 09:53:13 +000035454#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035455 int mem_base;
35456 int ret_val;
35457 int code; /* UCS code point */
35458 int n_code;
35459
35460 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35461 mem_base = xmlMemBlocks();
35462 code = gen_int(n_code, 0);
35463
35464 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35465 desret_int(ret_val);
35466 call_tests++;
35467 des_int(n_code, code, 0);
35468 xmlResetLastError();
35469 if (mem_base != xmlMemBlocks()) {
35470 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035472 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035473 printf(" %d", n_code);
35474 printf("\n");
35475 }
35476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035477 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035478#endif
35479
Daniel Veillard42595322004-11-08 10:52:06 +000035480 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035481}
35482
35483
35484static int
35485test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035486 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035487
William M. Brack21e4ef22005-01-02 09:53:13 +000035488#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035489 int mem_base;
35490 int ret_val;
35491 int code; /* UCS code point */
35492 int n_code;
35493
35494 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35495 mem_base = xmlMemBlocks();
35496 code = gen_int(n_code, 0);
35497
35498 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35499 desret_int(ret_val);
35500 call_tests++;
35501 des_int(n_code, code, 0);
35502 xmlResetLastError();
35503 if (mem_base != xmlMemBlocks()) {
35504 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035506 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035507 printf(" %d", n_code);
35508 printf("\n");
35509 }
35510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035511 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035512#endif
35513
Daniel Veillard42595322004-11-08 10:52:06 +000035514 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035515}
35516
35517
35518static int
35519test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035520 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035521
William M. Brack21e4ef22005-01-02 09:53:13 +000035522#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035523 int mem_base;
35524 int ret_val;
35525 int code; /* UCS code point */
35526 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035527 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035528 int n_cat;
35529
35530 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35531 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35532 mem_base = xmlMemBlocks();
35533 code = gen_int(n_code, 0);
35534 cat = gen_const_char_ptr(n_cat, 1);
35535
William M. Brackf13f77f2004-11-12 16:03:48 +000035536 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035537 desret_int(ret_val);
35538 call_tests++;
35539 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035540 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035541 xmlResetLastError();
35542 if (mem_base != xmlMemBlocks()) {
35543 printf("Leak of %d blocks found in xmlUCSIsCat",
35544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035545 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035546 printf(" %d", n_code);
35547 printf(" %d", n_cat);
35548 printf("\n");
35549 }
35550 }
35551 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035552 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035553#endif
35554
Daniel Veillard42595322004-11-08 10:52:06 +000035555 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035556}
35557
35558
35559static int
35560test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035561 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035562
William M. Brack21e4ef22005-01-02 09:53:13 +000035563#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035564 int mem_base;
35565 int ret_val;
35566 int code; /* UCS code point */
35567 int n_code;
35568
35569 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35570 mem_base = xmlMemBlocks();
35571 code = gen_int(n_code, 0);
35572
35573 ret_val = xmlUCSIsCatC(code);
35574 desret_int(ret_val);
35575 call_tests++;
35576 des_int(n_code, code, 0);
35577 xmlResetLastError();
35578 if (mem_base != xmlMemBlocks()) {
35579 printf("Leak of %d blocks found in xmlUCSIsCatC",
35580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035581 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035582 printf(" %d", n_code);
35583 printf("\n");
35584 }
35585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035586 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035587#endif
35588
Daniel Veillard42595322004-11-08 10:52:06 +000035589 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035590}
35591
35592
35593static int
35594test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035595 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035596
William M. Brack21e4ef22005-01-02 09:53:13 +000035597#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035598 int mem_base;
35599 int ret_val;
35600 int code; /* UCS code point */
35601 int n_code;
35602
35603 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35604 mem_base = xmlMemBlocks();
35605 code = gen_int(n_code, 0);
35606
35607 ret_val = xmlUCSIsCatCc(code);
35608 desret_int(ret_val);
35609 call_tests++;
35610 des_int(n_code, code, 0);
35611 xmlResetLastError();
35612 if (mem_base != xmlMemBlocks()) {
35613 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035615 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035616 printf(" %d", n_code);
35617 printf("\n");
35618 }
35619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035620 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035621#endif
35622
Daniel Veillard42595322004-11-08 10:52:06 +000035623 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035624}
35625
35626
35627static int
35628test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035629 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035630
William M. Brack21e4ef22005-01-02 09:53:13 +000035631#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035632 int mem_base;
35633 int ret_val;
35634 int code; /* UCS code point */
35635 int n_code;
35636
35637 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35638 mem_base = xmlMemBlocks();
35639 code = gen_int(n_code, 0);
35640
35641 ret_val = xmlUCSIsCatCf(code);
35642 desret_int(ret_val);
35643 call_tests++;
35644 des_int(n_code, code, 0);
35645 xmlResetLastError();
35646 if (mem_base != xmlMemBlocks()) {
35647 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035649 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035650 printf(" %d", n_code);
35651 printf("\n");
35652 }
35653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035654 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035655#endif
35656
Daniel Veillard42595322004-11-08 10:52:06 +000035657 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035658}
35659
35660
35661static int
35662test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035663 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035664
William M. Brack21e4ef22005-01-02 09:53:13 +000035665#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035666 int mem_base;
35667 int ret_val;
35668 int code; /* UCS code point */
35669 int n_code;
35670
35671 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35672 mem_base = xmlMemBlocks();
35673 code = gen_int(n_code, 0);
35674
35675 ret_val = xmlUCSIsCatCo(code);
35676 desret_int(ret_val);
35677 call_tests++;
35678 des_int(n_code, code, 0);
35679 xmlResetLastError();
35680 if (mem_base != xmlMemBlocks()) {
35681 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035683 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035684 printf(" %d", n_code);
35685 printf("\n");
35686 }
35687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035688 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035689#endif
35690
Daniel Veillard42595322004-11-08 10:52:06 +000035691 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035692}
35693
35694
35695static int
35696test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035697 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035698
William M. Brack21e4ef22005-01-02 09:53:13 +000035699#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035700 int mem_base;
35701 int ret_val;
35702 int code; /* UCS code point */
35703 int n_code;
35704
35705 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35706 mem_base = xmlMemBlocks();
35707 code = gen_int(n_code, 0);
35708
35709 ret_val = xmlUCSIsCatCs(code);
35710 desret_int(ret_val);
35711 call_tests++;
35712 des_int(n_code, code, 0);
35713 xmlResetLastError();
35714 if (mem_base != xmlMemBlocks()) {
35715 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035717 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035718 printf(" %d", n_code);
35719 printf("\n");
35720 }
35721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035722 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035723#endif
35724
Daniel Veillard42595322004-11-08 10:52:06 +000035725 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035726}
35727
35728
35729static int
35730test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035731 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035732
William M. Brack21e4ef22005-01-02 09:53:13 +000035733#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035734 int mem_base;
35735 int ret_val;
35736 int code; /* UCS code point */
35737 int n_code;
35738
35739 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35740 mem_base = xmlMemBlocks();
35741 code = gen_int(n_code, 0);
35742
35743 ret_val = xmlUCSIsCatL(code);
35744 desret_int(ret_val);
35745 call_tests++;
35746 des_int(n_code, code, 0);
35747 xmlResetLastError();
35748 if (mem_base != xmlMemBlocks()) {
35749 printf("Leak of %d blocks found in xmlUCSIsCatL",
35750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035751 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035752 printf(" %d", n_code);
35753 printf("\n");
35754 }
35755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035756 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035757#endif
35758
Daniel Veillard42595322004-11-08 10:52:06 +000035759 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035760}
35761
35762
35763static int
35764test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035765 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035766
William M. Brack21e4ef22005-01-02 09:53:13 +000035767#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035768 int mem_base;
35769 int ret_val;
35770 int code; /* UCS code point */
35771 int n_code;
35772
35773 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35774 mem_base = xmlMemBlocks();
35775 code = gen_int(n_code, 0);
35776
35777 ret_val = xmlUCSIsCatLl(code);
35778 desret_int(ret_val);
35779 call_tests++;
35780 des_int(n_code, code, 0);
35781 xmlResetLastError();
35782 if (mem_base != xmlMemBlocks()) {
35783 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035785 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035786 printf(" %d", n_code);
35787 printf("\n");
35788 }
35789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035790 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035791#endif
35792
Daniel Veillard42595322004-11-08 10:52:06 +000035793 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035794}
35795
35796
35797static int
35798test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035799 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035800
William M. Brack21e4ef22005-01-02 09:53:13 +000035801#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035802 int mem_base;
35803 int ret_val;
35804 int code; /* UCS code point */
35805 int n_code;
35806
35807 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35808 mem_base = xmlMemBlocks();
35809 code = gen_int(n_code, 0);
35810
35811 ret_val = xmlUCSIsCatLm(code);
35812 desret_int(ret_val);
35813 call_tests++;
35814 des_int(n_code, code, 0);
35815 xmlResetLastError();
35816 if (mem_base != xmlMemBlocks()) {
35817 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035819 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035820 printf(" %d", n_code);
35821 printf("\n");
35822 }
35823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035824 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035825#endif
35826
Daniel Veillard42595322004-11-08 10:52:06 +000035827 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035828}
35829
35830
35831static int
35832test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035833 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035834
William M. Brack21e4ef22005-01-02 09:53:13 +000035835#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035836 int mem_base;
35837 int ret_val;
35838 int code; /* UCS code point */
35839 int n_code;
35840
35841 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35842 mem_base = xmlMemBlocks();
35843 code = gen_int(n_code, 0);
35844
35845 ret_val = xmlUCSIsCatLo(code);
35846 desret_int(ret_val);
35847 call_tests++;
35848 des_int(n_code, code, 0);
35849 xmlResetLastError();
35850 if (mem_base != xmlMemBlocks()) {
35851 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035853 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035854 printf(" %d", n_code);
35855 printf("\n");
35856 }
35857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035858 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035859#endif
35860
Daniel Veillard42595322004-11-08 10:52:06 +000035861 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035862}
35863
35864
35865static int
35866test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035867 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035868
William M. Brack21e4ef22005-01-02 09:53:13 +000035869#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035870 int mem_base;
35871 int ret_val;
35872 int code; /* UCS code point */
35873 int n_code;
35874
35875 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35876 mem_base = xmlMemBlocks();
35877 code = gen_int(n_code, 0);
35878
35879 ret_val = xmlUCSIsCatLt(code);
35880 desret_int(ret_val);
35881 call_tests++;
35882 des_int(n_code, code, 0);
35883 xmlResetLastError();
35884 if (mem_base != xmlMemBlocks()) {
35885 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035887 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035888 printf(" %d", n_code);
35889 printf("\n");
35890 }
35891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035892 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035893#endif
35894
Daniel Veillard42595322004-11-08 10:52:06 +000035895 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035896}
35897
35898
35899static int
35900test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035901 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035902
William M. Brack21e4ef22005-01-02 09:53:13 +000035903#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035904 int mem_base;
35905 int ret_val;
35906 int code; /* UCS code point */
35907 int n_code;
35908
35909 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35910 mem_base = xmlMemBlocks();
35911 code = gen_int(n_code, 0);
35912
35913 ret_val = xmlUCSIsCatLu(code);
35914 desret_int(ret_val);
35915 call_tests++;
35916 des_int(n_code, code, 0);
35917 xmlResetLastError();
35918 if (mem_base != xmlMemBlocks()) {
35919 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035921 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035922 printf(" %d", n_code);
35923 printf("\n");
35924 }
35925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035926 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035927#endif
35928
Daniel Veillard42595322004-11-08 10:52:06 +000035929 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035930}
35931
35932
35933static int
35934test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035935 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035936
William M. Brack21e4ef22005-01-02 09:53:13 +000035937#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035938 int mem_base;
35939 int ret_val;
35940 int code; /* UCS code point */
35941 int n_code;
35942
35943 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35944 mem_base = xmlMemBlocks();
35945 code = gen_int(n_code, 0);
35946
35947 ret_val = xmlUCSIsCatM(code);
35948 desret_int(ret_val);
35949 call_tests++;
35950 des_int(n_code, code, 0);
35951 xmlResetLastError();
35952 if (mem_base != xmlMemBlocks()) {
35953 printf("Leak of %d blocks found in xmlUCSIsCatM",
35954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035955 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035956 printf(" %d", n_code);
35957 printf("\n");
35958 }
35959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035960 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035961#endif
35962
Daniel Veillard42595322004-11-08 10:52:06 +000035963 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035964}
35965
35966
35967static int
35968test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035969 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035970
William M. Brack21e4ef22005-01-02 09:53:13 +000035971#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035972 int mem_base;
35973 int ret_val;
35974 int code; /* UCS code point */
35975 int n_code;
35976
35977 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35978 mem_base = xmlMemBlocks();
35979 code = gen_int(n_code, 0);
35980
35981 ret_val = xmlUCSIsCatMc(code);
35982 desret_int(ret_val);
35983 call_tests++;
35984 des_int(n_code, code, 0);
35985 xmlResetLastError();
35986 if (mem_base != xmlMemBlocks()) {
35987 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035989 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035990 printf(" %d", n_code);
35991 printf("\n");
35992 }
35993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035994 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035995#endif
35996
Daniel Veillard42595322004-11-08 10:52:06 +000035997 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035998}
35999
36000
36001static int
36002test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036003 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036004
William M. Brack21e4ef22005-01-02 09:53:13 +000036005#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036006 int mem_base;
36007 int ret_val;
36008 int code; /* UCS code point */
36009 int n_code;
36010
36011 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36012 mem_base = xmlMemBlocks();
36013 code = gen_int(n_code, 0);
36014
36015 ret_val = xmlUCSIsCatMe(code);
36016 desret_int(ret_val);
36017 call_tests++;
36018 des_int(n_code, code, 0);
36019 xmlResetLastError();
36020 if (mem_base != xmlMemBlocks()) {
36021 printf("Leak of %d blocks found in xmlUCSIsCatMe",
36022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036023 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036024 printf(" %d", n_code);
36025 printf("\n");
36026 }
36027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036028 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036029#endif
36030
Daniel Veillard42595322004-11-08 10:52:06 +000036031 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036032}
36033
36034
36035static int
36036test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036037 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036038
William M. Brack21e4ef22005-01-02 09:53:13 +000036039#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036040 int mem_base;
36041 int ret_val;
36042 int code; /* UCS code point */
36043 int n_code;
36044
36045 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36046 mem_base = xmlMemBlocks();
36047 code = gen_int(n_code, 0);
36048
36049 ret_val = xmlUCSIsCatMn(code);
36050 desret_int(ret_val);
36051 call_tests++;
36052 des_int(n_code, code, 0);
36053 xmlResetLastError();
36054 if (mem_base != xmlMemBlocks()) {
36055 printf("Leak of %d blocks found in xmlUCSIsCatMn",
36056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036057 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036058 printf(" %d", n_code);
36059 printf("\n");
36060 }
36061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036062 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036063#endif
36064
Daniel Veillard42595322004-11-08 10:52:06 +000036065 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036066}
36067
36068
36069static int
36070test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036071 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036072
William M. Brack21e4ef22005-01-02 09:53:13 +000036073#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036074 int mem_base;
36075 int ret_val;
36076 int code; /* UCS code point */
36077 int n_code;
36078
36079 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36080 mem_base = xmlMemBlocks();
36081 code = gen_int(n_code, 0);
36082
36083 ret_val = xmlUCSIsCatN(code);
36084 desret_int(ret_val);
36085 call_tests++;
36086 des_int(n_code, code, 0);
36087 xmlResetLastError();
36088 if (mem_base != xmlMemBlocks()) {
36089 printf("Leak of %d blocks found in xmlUCSIsCatN",
36090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036091 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036092 printf(" %d", n_code);
36093 printf("\n");
36094 }
36095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036096 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036097#endif
36098
Daniel Veillard42595322004-11-08 10:52:06 +000036099 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036100}
36101
36102
36103static int
36104test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036105 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036106
William M. Brack21e4ef22005-01-02 09:53:13 +000036107#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036108 int mem_base;
36109 int ret_val;
36110 int code; /* UCS code point */
36111 int n_code;
36112
36113 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36114 mem_base = xmlMemBlocks();
36115 code = gen_int(n_code, 0);
36116
36117 ret_val = xmlUCSIsCatNd(code);
36118 desret_int(ret_val);
36119 call_tests++;
36120 des_int(n_code, code, 0);
36121 xmlResetLastError();
36122 if (mem_base != xmlMemBlocks()) {
36123 printf("Leak of %d blocks found in xmlUCSIsCatNd",
36124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036125 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036126 printf(" %d", n_code);
36127 printf("\n");
36128 }
36129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036130 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036131#endif
36132
Daniel Veillard42595322004-11-08 10:52:06 +000036133 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036134}
36135
36136
36137static int
36138test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036139 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036140
William M. Brack21e4ef22005-01-02 09:53:13 +000036141#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036142 int mem_base;
36143 int ret_val;
36144 int code; /* UCS code point */
36145 int n_code;
36146
36147 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36148 mem_base = xmlMemBlocks();
36149 code = gen_int(n_code, 0);
36150
36151 ret_val = xmlUCSIsCatNl(code);
36152 desret_int(ret_val);
36153 call_tests++;
36154 des_int(n_code, code, 0);
36155 xmlResetLastError();
36156 if (mem_base != xmlMemBlocks()) {
36157 printf("Leak of %d blocks found in xmlUCSIsCatNl",
36158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036159 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036160 printf(" %d", n_code);
36161 printf("\n");
36162 }
36163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036164 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036165#endif
36166
Daniel Veillard42595322004-11-08 10:52:06 +000036167 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036168}
36169
36170
36171static int
36172test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036173 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036174
William M. Brack21e4ef22005-01-02 09:53:13 +000036175#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036176 int mem_base;
36177 int ret_val;
36178 int code; /* UCS code point */
36179 int n_code;
36180
36181 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36182 mem_base = xmlMemBlocks();
36183 code = gen_int(n_code, 0);
36184
36185 ret_val = xmlUCSIsCatNo(code);
36186 desret_int(ret_val);
36187 call_tests++;
36188 des_int(n_code, code, 0);
36189 xmlResetLastError();
36190 if (mem_base != xmlMemBlocks()) {
36191 printf("Leak of %d blocks found in xmlUCSIsCatNo",
36192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036193 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036194 printf(" %d", n_code);
36195 printf("\n");
36196 }
36197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036198 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036199#endif
36200
Daniel Veillard42595322004-11-08 10:52:06 +000036201 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036202}
36203
36204
36205static int
36206test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036207 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036208
William M. Brack21e4ef22005-01-02 09:53:13 +000036209#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036210 int mem_base;
36211 int ret_val;
36212 int code; /* UCS code point */
36213 int n_code;
36214
36215 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36216 mem_base = xmlMemBlocks();
36217 code = gen_int(n_code, 0);
36218
36219 ret_val = xmlUCSIsCatP(code);
36220 desret_int(ret_val);
36221 call_tests++;
36222 des_int(n_code, code, 0);
36223 xmlResetLastError();
36224 if (mem_base != xmlMemBlocks()) {
36225 printf("Leak of %d blocks found in xmlUCSIsCatP",
36226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036227 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036228 printf(" %d", n_code);
36229 printf("\n");
36230 }
36231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036232 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036233#endif
36234
Daniel Veillard42595322004-11-08 10:52:06 +000036235 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036236}
36237
36238
36239static int
36240test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036241 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036242
William M. Brack21e4ef22005-01-02 09:53:13 +000036243#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036244 int mem_base;
36245 int ret_val;
36246 int code; /* UCS code point */
36247 int n_code;
36248
36249 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36250 mem_base = xmlMemBlocks();
36251 code = gen_int(n_code, 0);
36252
36253 ret_val = xmlUCSIsCatPc(code);
36254 desret_int(ret_val);
36255 call_tests++;
36256 des_int(n_code, code, 0);
36257 xmlResetLastError();
36258 if (mem_base != xmlMemBlocks()) {
36259 printf("Leak of %d blocks found in xmlUCSIsCatPc",
36260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036261 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036262 printf(" %d", n_code);
36263 printf("\n");
36264 }
36265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036266 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036267#endif
36268
Daniel Veillard42595322004-11-08 10:52:06 +000036269 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036270}
36271
36272
36273static int
36274test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036275 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036276
William M. Brack21e4ef22005-01-02 09:53:13 +000036277#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036278 int mem_base;
36279 int ret_val;
36280 int code; /* UCS code point */
36281 int n_code;
36282
36283 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36284 mem_base = xmlMemBlocks();
36285 code = gen_int(n_code, 0);
36286
36287 ret_val = xmlUCSIsCatPd(code);
36288 desret_int(ret_val);
36289 call_tests++;
36290 des_int(n_code, code, 0);
36291 xmlResetLastError();
36292 if (mem_base != xmlMemBlocks()) {
36293 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036295 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036296 printf(" %d", n_code);
36297 printf("\n");
36298 }
36299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036300 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036301#endif
36302
Daniel Veillard42595322004-11-08 10:52:06 +000036303 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036304}
36305
36306
36307static int
36308test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036309 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036310
William M. Brack21e4ef22005-01-02 09:53:13 +000036311#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036312 int mem_base;
36313 int ret_val;
36314 int code; /* UCS code point */
36315 int n_code;
36316
36317 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36318 mem_base = xmlMemBlocks();
36319 code = gen_int(n_code, 0);
36320
36321 ret_val = xmlUCSIsCatPe(code);
36322 desret_int(ret_val);
36323 call_tests++;
36324 des_int(n_code, code, 0);
36325 xmlResetLastError();
36326 if (mem_base != xmlMemBlocks()) {
36327 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036329 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036330 printf(" %d", n_code);
36331 printf("\n");
36332 }
36333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036334 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036335#endif
36336
Daniel Veillard42595322004-11-08 10:52:06 +000036337 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036338}
36339
36340
36341static int
36342test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036343 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036344
William M. Brack21e4ef22005-01-02 09:53:13 +000036345#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036346 int mem_base;
36347 int ret_val;
36348 int code; /* UCS code point */
36349 int n_code;
36350
36351 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36352 mem_base = xmlMemBlocks();
36353 code = gen_int(n_code, 0);
36354
36355 ret_val = xmlUCSIsCatPf(code);
36356 desret_int(ret_val);
36357 call_tests++;
36358 des_int(n_code, code, 0);
36359 xmlResetLastError();
36360 if (mem_base != xmlMemBlocks()) {
36361 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036363 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036364 printf(" %d", n_code);
36365 printf("\n");
36366 }
36367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036368 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036369#endif
36370
Daniel Veillard42595322004-11-08 10:52:06 +000036371 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036372}
36373
36374
36375static int
36376test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036377 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036378
William M. Brack21e4ef22005-01-02 09:53:13 +000036379#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036380 int mem_base;
36381 int ret_val;
36382 int code; /* UCS code point */
36383 int n_code;
36384
36385 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36386 mem_base = xmlMemBlocks();
36387 code = gen_int(n_code, 0);
36388
36389 ret_val = xmlUCSIsCatPi(code);
36390 desret_int(ret_val);
36391 call_tests++;
36392 des_int(n_code, code, 0);
36393 xmlResetLastError();
36394 if (mem_base != xmlMemBlocks()) {
36395 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036397 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036398 printf(" %d", n_code);
36399 printf("\n");
36400 }
36401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036402 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036403#endif
36404
Daniel Veillard42595322004-11-08 10:52:06 +000036405 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036406}
36407
36408
36409static int
36410test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036411 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036412
William M. Brack21e4ef22005-01-02 09:53:13 +000036413#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036414 int mem_base;
36415 int ret_val;
36416 int code; /* UCS code point */
36417 int n_code;
36418
36419 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36420 mem_base = xmlMemBlocks();
36421 code = gen_int(n_code, 0);
36422
36423 ret_val = xmlUCSIsCatPo(code);
36424 desret_int(ret_val);
36425 call_tests++;
36426 des_int(n_code, code, 0);
36427 xmlResetLastError();
36428 if (mem_base != xmlMemBlocks()) {
36429 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036431 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036432 printf(" %d", n_code);
36433 printf("\n");
36434 }
36435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036436 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036437#endif
36438
Daniel Veillard42595322004-11-08 10:52:06 +000036439 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036440}
36441
36442
36443static int
36444test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036445 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036446
William M. Brack21e4ef22005-01-02 09:53:13 +000036447#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036448 int mem_base;
36449 int ret_val;
36450 int code; /* UCS code point */
36451 int n_code;
36452
36453 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36454 mem_base = xmlMemBlocks();
36455 code = gen_int(n_code, 0);
36456
36457 ret_val = xmlUCSIsCatPs(code);
36458 desret_int(ret_val);
36459 call_tests++;
36460 des_int(n_code, code, 0);
36461 xmlResetLastError();
36462 if (mem_base != xmlMemBlocks()) {
36463 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036465 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036466 printf(" %d", n_code);
36467 printf("\n");
36468 }
36469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036470 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036471#endif
36472
Daniel Veillard42595322004-11-08 10:52:06 +000036473 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036474}
36475
36476
36477static int
36478test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036479 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036480
William M. Brack21e4ef22005-01-02 09:53:13 +000036481#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036482 int mem_base;
36483 int ret_val;
36484 int code; /* UCS code point */
36485 int n_code;
36486
36487 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36488 mem_base = xmlMemBlocks();
36489 code = gen_int(n_code, 0);
36490
36491 ret_val = xmlUCSIsCatS(code);
36492 desret_int(ret_val);
36493 call_tests++;
36494 des_int(n_code, code, 0);
36495 xmlResetLastError();
36496 if (mem_base != xmlMemBlocks()) {
36497 printf("Leak of %d blocks found in xmlUCSIsCatS",
36498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036499 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036500 printf(" %d", n_code);
36501 printf("\n");
36502 }
36503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036504 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036505#endif
36506
Daniel Veillard42595322004-11-08 10:52:06 +000036507 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036508}
36509
36510
36511static int
36512test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036513 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036514
William M. Brack21e4ef22005-01-02 09:53:13 +000036515#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036516 int mem_base;
36517 int ret_val;
36518 int code; /* UCS code point */
36519 int n_code;
36520
36521 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36522 mem_base = xmlMemBlocks();
36523 code = gen_int(n_code, 0);
36524
36525 ret_val = xmlUCSIsCatSc(code);
36526 desret_int(ret_val);
36527 call_tests++;
36528 des_int(n_code, code, 0);
36529 xmlResetLastError();
36530 if (mem_base != xmlMemBlocks()) {
36531 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036533 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036534 printf(" %d", n_code);
36535 printf("\n");
36536 }
36537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036538 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036539#endif
36540
Daniel Veillard42595322004-11-08 10:52:06 +000036541 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036542}
36543
36544
36545static int
36546test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036547 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036548
William M. Brack21e4ef22005-01-02 09:53:13 +000036549#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036550 int mem_base;
36551 int ret_val;
36552 int code; /* UCS code point */
36553 int n_code;
36554
36555 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36556 mem_base = xmlMemBlocks();
36557 code = gen_int(n_code, 0);
36558
36559 ret_val = xmlUCSIsCatSk(code);
36560 desret_int(ret_val);
36561 call_tests++;
36562 des_int(n_code, code, 0);
36563 xmlResetLastError();
36564 if (mem_base != xmlMemBlocks()) {
36565 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036567 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036568 printf(" %d", n_code);
36569 printf("\n");
36570 }
36571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036572 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036573#endif
36574
Daniel Veillard42595322004-11-08 10:52:06 +000036575 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036576}
36577
36578
36579static int
36580test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036581 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036582
William M. Brack21e4ef22005-01-02 09:53:13 +000036583#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036584 int mem_base;
36585 int ret_val;
36586 int code; /* UCS code point */
36587 int n_code;
36588
36589 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36590 mem_base = xmlMemBlocks();
36591 code = gen_int(n_code, 0);
36592
36593 ret_val = xmlUCSIsCatSm(code);
36594 desret_int(ret_val);
36595 call_tests++;
36596 des_int(n_code, code, 0);
36597 xmlResetLastError();
36598 if (mem_base != xmlMemBlocks()) {
36599 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036601 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036602 printf(" %d", n_code);
36603 printf("\n");
36604 }
36605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036606 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036607#endif
36608
Daniel Veillard42595322004-11-08 10:52:06 +000036609 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036610}
36611
36612
36613static int
36614test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036616
William M. Brack21e4ef22005-01-02 09:53:13 +000036617#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036618 int mem_base;
36619 int ret_val;
36620 int code; /* UCS code point */
36621 int n_code;
36622
36623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36624 mem_base = xmlMemBlocks();
36625 code = gen_int(n_code, 0);
36626
36627 ret_val = xmlUCSIsCatSo(code);
36628 desret_int(ret_val);
36629 call_tests++;
36630 des_int(n_code, code, 0);
36631 xmlResetLastError();
36632 if (mem_base != xmlMemBlocks()) {
36633 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036636 printf(" %d", n_code);
36637 printf("\n");
36638 }
36639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036640 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036641#endif
36642
Daniel Veillard42595322004-11-08 10:52:06 +000036643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036644}
36645
36646
36647static int
36648test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036650
William M. Brack21e4ef22005-01-02 09:53:13 +000036651#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036652 int mem_base;
36653 int ret_val;
36654 int code; /* UCS code point */
36655 int n_code;
36656
36657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36658 mem_base = xmlMemBlocks();
36659 code = gen_int(n_code, 0);
36660
36661 ret_val = xmlUCSIsCatZ(code);
36662 desret_int(ret_val);
36663 call_tests++;
36664 des_int(n_code, code, 0);
36665 xmlResetLastError();
36666 if (mem_base != xmlMemBlocks()) {
36667 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036670 printf(" %d", n_code);
36671 printf("\n");
36672 }
36673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036674 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036675#endif
36676
Daniel Veillard42595322004-11-08 10:52:06 +000036677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036678}
36679
36680
36681static int
36682test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036683 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036684
William M. Brack21e4ef22005-01-02 09:53:13 +000036685#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036686 int mem_base;
36687 int ret_val;
36688 int code; /* UCS code point */
36689 int n_code;
36690
36691 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36692 mem_base = xmlMemBlocks();
36693 code = gen_int(n_code, 0);
36694
36695 ret_val = xmlUCSIsCatZl(code);
36696 desret_int(ret_val);
36697 call_tests++;
36698 des_int(n_code, code, 0);
36699 xmlResetLastError();
36700 if (mem_base != xmlMemBlocks()) {
36701 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036703 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036704 printf(" %d", n_code);
36705 printf("\n");
36706 }
36707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036708 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036709#endif
36710
Daniel Veillard42595322004-11-08 10:52:06 +000036711 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036712}
36713
36714
36715static int
36716test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036717 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036718
William M. Brack21e4ef22005-01-02 09:53:13 +000036719#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036720 int mem_base;
36721 int ret_val;
36722 int code; /* UCS code point */
36723 int n_code;
36724
36725 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36726 mem_base = xmlMemBlocks();
36727 code = gen_int(n_code, 0);
36728
36729 ret_val = xmlUCSIsCatZp(code);
36730 desret_int(ret_val);
36731 call_tests++;
36732 des_int(n_code, code, 0);
36733 xmlResetLastError();
36734 if (mem_base != xmlMemBlocks()) {
36735 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036737 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036738 printf(" %d", n_code);
36739 printf("\n");
36740 }
36741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036742 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036743#endif
36744
Daniel Veillard42595322004-11-08 10:52:06 +000036745 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036746}
36747
36748
36749static int
36750test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036751 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036752
William M. Brack21e4ef22005-01-02 09:53:13 +000036753#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036754 int mem_base;
36755 int ret_val;
36756 int code; /* UCS code point */
36757 int n_code;
36758
36759 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36760 mem_base = xmlMemBlocks();
36761 code = gen_int(n_code, 0);
36762
36763 ret_val = xmlUCSIsCatZs(code);
36764 desret_int(ret_val);
36765 call_tests++;
36766 des_int(n_code, code, 0);
36767 xmlResetLastError();
36768 if (mem_base != xmlMemBlocks()) {
36769 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036771 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036772 printf(" %d", n_code);
36773 printf("\n");
36774 }
36775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036776 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036777#endif
36778
Daniel Veillard42595322004-11-08 10:52:06 +000036779 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036780}
36781
36782
36783static int
36784test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036785 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036786
William M. Brack21e4ef22005-01-02 09:53:13 +000036787#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036788 int mem_base;
36789 int ret_val;
36790 int code; /* UCS code point */
36791 int n_code;
36792
36793 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36794 mem_base = xmlMemBlocks();
36795 code = gen_int(n_code, 0);
36796
36797 ret_val = xmlUCSIsCherokee(code);
36798 desret_int(ret_val);
36799 call_tests++;
36800 des_int(n_code, code, 0);
36801 xmlResetLastError();
36802 if (mem_base != xmlMemBlocks()) {
36803 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036805 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036806 printf(" %d", n_code);
36807 printf("\n");
36808 }
36809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036810 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036811#endif
36812
Daniel Veillard42595322004-11-08 10:52:06 +000036813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036814}
36815
36816
36817static int
36818test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036820
William M. Brack21e4ef22005-01-02 09:53:13 +000036821#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036822 int mem_base;
36823 int ret_val;
36824 int code; /* UCS code point */
36825 int n_code;
36826
36827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36828 mem_base = xmlMemBlocks();
36829 code = gen_int(n_code, 0);
36830
36831 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36832 desret_int(ret_val);
36833 call_tests++;
36834 des_int(n_code, code, 0);
36835 xmlResetLastError();
36836 if (mem_base != xmlMemBlocks()) {
36837 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036840 printf(" %d", n_code);
36841 printf("\n");
36842 }
36843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036844 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036845#endif
36846
Daniel Veillard42595322004-11-08 10:52:06 +000036847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036848}
36849
36850
36851static int
36852test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036854
William M. Brack21e4ef22005-01-02 09:53:13 +000036855#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036856 int mem_base;
36857 int ret_val;
36858 int code; /* UCS code point */
36859 int n_code;
36860
36861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36862 mem_base = xmlMemBlocks();
36863 code = gen_int(n_code, 0);
36864
36865 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36866 desret_int(ret_val);
36867 call_tests++;
36868 des_int(n_code, code, 0);
36869 xmlResetLastError();
36870 if (mem_base != xmlMemBlocks()) {
36871 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036874 printf(" %d", n_code);
36875 printf("\n");
36876 }
36877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036878 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036879#endif
36880
Daniel Veillard42595322004-11-08 10:52:06 +000036881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036882}
36883
36884
36885static int
36886test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036888
William M. Brack21e4ef22005-01-02 09:53:13 +000036889#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036890 int mem_base;
36891 int ret_val;
36892 int code; /* UCS code point */
36893 int n_code;
36894
36895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36896 mem_base = xmlMemBlocks();
36897 code = gen_int(n_code, 0);
36898
36899 ret_val = xmlUCSIsCombiningHalfMarks(code);
36900 desret_int(ret_val);
36901 call_tests++;
36902 des_int(n_code, code, 0);
36903 xmlResetLastError();
36904 if (mem_base != xmlMemBlocks()) {
36905 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036908 printf(" %d", n_code);
36909 printf("\n");
36910 }
36911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036912 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036913#endif
36914
Daniel Veillard42595322004-11-08 10:52:06 +000036915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036916}
36917
36918
36919static int
36920test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036922
William M. Brack21e4ef22005-01-02 09:53:13 +000036923#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036924 int mem_base;
36925 int ret_val;
36926 int code; /* UCS code point */
36927 int n_code;
36928
36929 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36930 mem_base = xmlMemBlocks();
36931 code = gen_int(n_code, 0);
36932
36933 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36934 desret_int(ret_val);
36935 call_tests++;
36936 des_int(n_code, code, 0);
36937 xmlResetLastError();
36938 if (mem_base != xmlMemBlocks()) {
36939 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036942 printf(" %d", n_code);
36943 printf("\n");
36944 }
36945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036946 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036947#endif
36948
Daniel Veillard42595322004-11-08 10:52:06 +000036949 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036950}
36951
36952
36953static int
36954test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036955 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036956
William M. Brack21e4ef22005-01-02 09:53:13 +000036957#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036958 int mem_base;
36959 int ret_val;
36960 int code; /* UCS code point */
36961 int n_code;
36962
36963 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36964 mem_base = xmlMemBlocks();
36965 code = gen_int(n_code, 0);
36966
36967 ret_val = xmlUCSIsControlPictures(code);
36968 desret_int(ret_val);
36969 call_tests++;
36970 des_int(n_code, code, 0);
36971 xmlResetLastError();
36972 if (mem_base != xmlMemBlocks()) {
36973 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036975 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036976 printf(" %d", n_code);
36977 printf("\n");
36978 }
36979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036980 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036981#endif
36982
Daniel Veillard42595322004-11-08 10:52:06 +000036983 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036984}
36985
36986
36987static int
36988test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036989 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036990
William M. Brack21e4ef22005-01-02 09:53:13 +000036991#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036992 int mem_base;
36993 int ret_val;
36994 int code; /* UCS code point */
36995 int n_code;
36996
36997 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36998 mem_base = xmlMemBlocks();
36999 code = gen_int(n_code, 0);
37000
37001 ret_val = xmlUCSIsCurrencySymbols(code);
37002 desret_int(ret_val);
37003 call_tests++;
37004 des_int(n_code, code, 0);
37005 xmlResetLastError();
37006 if (mem_base != xmlMemBlocks()) {
37007 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
37008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037009 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037010 printf(" %d", n_code);
37011 printf("\n");
37012 }
37013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037014 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037015#endif
37016
Daniel Veillard42595322004-11-08 10:52:06 +000037017 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037018}
37019
37020
37021static int
37022test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037023 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037024
William M. Brack21e4ef22005-01-02 09:53:13 +000037025#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037026 int mem_base;
37027 int ret_val;
37028 int code; /* UCS code point */
37029 int n_code;
37030
37031 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37032 mem_base = xmlMemBlocks();
37033 code = gen_int(n_code, 0);
37034
37035 ret_val = xmlUCSIsCypriotSyllabary(code);
37036 desret_int(ret_val);
37037 call_tests++;
37038 des_int(n_code, code, 0);
37039 xmlResetLastError();
37040 if (mem_base != xmlMemBlocks()) {
37041 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
37042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037043 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037044 printf(" %d", n_code);
37045 printf("\n");
37046 }
37047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037048 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037049#endif
37050
Daniel Veillard42595322004-11-08 10:52:06 +000037051 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037052}
37053
37054
37055static int
37056test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037057 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037058
William M. Brack21e4ef22005-01-02 09:53:13 +000037059#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037060 int mem_base;
37061 int ret_val;
37062 int code; /* UCS code point */
37063 int n_code;
37064
37065 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37066 mem_base = xmlMemBlocks();
37067 code = gen_int(n_code, 0);
37068
37069 ret_val = xmlUCSIsCyrillic(code);
37070 desret_int(ret_val);
37071 call_tests++;
37072 des_int(n_code, code, 0);
37073 xmlResetLastError();
37074 if (mem_base != xmlMemBlocks()) {
37075 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
37076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037077 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037078 printf(" %d", n_code);
37079 printf("\n");
37080 }
37081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037082 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037083#endif
37084
Daniel Veillard42595322004-11-08 10:52:06 +000037085 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037086}
37087
37088
37089static int
37090test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037091 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037092
William M. Brack21e4ef22005-01-02 09:53:13 +000037093#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037094 int mem_base;
37095 int ret_val;
37096 int code; /* UCS code point */
37097 int n_code;
37098
37099 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37100 mem_base = xmlMemBlocks();
37101 code = gen_int(n_code, 0);
37102
37103 ret_val = xmlUCSIsCyrillicSupplement(code);
37104 desret_int(ret_val);
37105 call_tests++;
37106 des_int(n_code, code, 0);
37107 xmlResetLastError();
37108 if (mem_base != xmlMemBlocks()) {
37109 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
37110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037111 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037112 printf(" %d", n_code);
37113 printf("\n");
37114 }
37115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037116 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037117#endif
37118
Daniel Veillard42595322004-11-08 10:52:06 +000037119 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037120}
37121
37122
37123static int
37124test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037125 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037126
William M. Brack21e4ef22005-01-02 09:53:13 +000037127#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037128 int mem_base;
37129 int ret_val;
37130 int code; /* UCS code point */
37131 int n_code;
37132
37133 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37134 mem_base = xmlMemBlocks();
37135 code = gen_int(n_code, 0);
37136
37137 ret_val = xmlUCSIsDeseret(code);
37138 desret_int(ret_val);
37139 call_tests++;
37140 des_int(n_code, code, 0);
37141 xmlResetLastError();
37142 if (mem_base != xmlMemBlocks()) {
37143 printf("Leak of %d blocks found in xmlUCSIsDeseret",
37144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037145 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037146 printf(" %d", n_code);
37147 printf("\n");
37148 }
37149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037150 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037151#endif
37152
Daniel Veillard42595322004-11-08 10:52:06 +000037153 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037154}
37155
37156
37157static int
37158test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037159 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037160
William M. Brack21e4ef22005-01-02 09:53:13 +000037161#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037162 int mem_base;
37163 int ret_val;
37164 int code; /* UCS code point */
37165 int n_code;
37166
37167 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37168 mem_base = xmlMemBlocks();
37169 code = gen_int(n_code, 0);
37170
37171 ret_val = xmlUCSIsDevanagari(code);
37172 desret_int(ret_val);
37173 call_tests++;
37174 des_int(n_code, code, 0);
37175 xmlResetLastError();
37176 if (mem_base != xmlMemBlocks()) {
37177 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
37178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037179 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037180 printf(" %d", n_code);
37181 printf("\n");
37182 }
37183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037184 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037185#endif
37186
Daniel Veillard42595322004-11-08 10:52:06 +000037187 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037188}
37189
37190
37191static int
37192test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037193 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037194
William M. Brack21e4ef22005-01-02 09:53:13 +000037195#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037196 int mem_base;
37197 int ret_val;
37198 int code; /* UCS code point */
37199 int n_code;
37200
37201 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37202 mem_base = xmlMemBlocks();
37203 code = gen_int(n_code, 0);
37204
37205 ret_val = xmlUCSIsDingbats(code);
37206 desret_int(ret_val);
37207 call_tests++;
37208 des_int(n_code, code, 0);
37209 xmlResetLastError();
37210 if (mem_base != xmlMemBlocks()) {
37211 printf("Leak of %d blocks found in xmlUCSIsDingbats",
37212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037213 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037214 printf(" %d", n_code);
37215 printf("\n");
37216 }
37217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037218 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037219#endif
37220
Daniel Veillard42595322004-11-08 10:52:06 +000037221 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037222}
37223
37224
37225static int
37226test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037227 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037228
William M. Brack21e4ef22005-01-02 09:53:13 +000037229#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037230 int mem_base;
37231 int ret_val;
37232 int code; /* UCS code point */
37233 int n_code;
37234
37235 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37236 mem_base = xmlMemBlocks();
37237 code = gen_int(n_code, 0);
37238
37239 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
37240 desret_int(ret_val);
37241 call_tests++;
37242 des_int(n_code, code, 0);
37243 xmlResetLastError();
37244 if (mem_base != xmlMemBlocks()) {
37245 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
37246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037247 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037248 printf(" %d", n_code);
37249 printf("\n");
37250 }
37251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037252 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037253#endif
37254
Daniel Veillard42595322004-11-08 10:52:06 +000037255 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037256}
37257
37258
37259static int
37260test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037261 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037262
William M. Brack21e4ef22005-01-02 09:53:13 +000037263#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037264 int mem_base;
37265 int ret_val;
37266 int code; /* UCS code point */
37267 int n_code;
37268
37269 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37270 mem_base = xmlMemBlocks();
37271 code = gen_int(n_code, 0);
37272
37273 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
37274 desret_int(ret_val);
37275 call_tests++;
37276 des_int(n_code, code, 0);
37277 xmlResetLastError();
37278 if (mem_base != xmlMemBlocks()) {
37279 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
37280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037281 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037282 printf(" %d", n_code);
37283 printf("\n");
37284 }
37285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037286 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037287#endif
37288
Daniel Veillard42595322004-11-08 10:52:06 +000037289 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037290}
37291
37292
37293static int
37294test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037295 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037296
William M. Brack21e4ef22005-01-02 09:53:13 +000037297#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037298 int mem_base;
37299 int ret_val;
37300 int code; /* UCS code point */
37301 int n_code;
37302
37303 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37304 mem_base = xmlMemBlocks();
37305 code = gen_int(n_code, 0);
37306
37307 ret_val = xmlUCSIsEthiopic(code);
37308 desret_int(ret_val);
37309 call_tests++;
37310 des_int(n_code, code, 0);
37311 xmlResetLastError();
37312 if (mem_base != xmlMemBlocks()) {
37313 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037315 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037316 printf(" %d", n_code);
37317 printf("\n");
37318 }
37319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037320 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037321#endif
37322
Daniel Veillard42595322004-11-08 10:52:06 +000037323 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037324}
37325
37326
37327static int
37328test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037329 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037330
William M. Brack21e4ef22005-01-02 09:53:13 +000037331#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037332 int mem_base;
37333 int ret_val;
37334 int code; /* UCS code point */
37335 int n_code;
37336
37337 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37338 mem_base = xmlMemBlocks();
37339 code = gen_int(n_code, 0);
37340
37341 ret_val = xmlUCSIsGeneralPunctuation(code);
37342 desret_int(ret_val);
37343 call_tests++;
37344 des_int(n_code, code, 0);
37345 xmlResetLastError();
37346 if (mem_base != xmlMemBlocks()) {
37347 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037349 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037350 printf(" %d", n_code);
37351 printf("\n");
37352 }
37353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037354 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037355#endif
37356
Daniel Veillard42595322004-11-08 10:52:06 +000037357 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037358}
37359
37360
37361static int
37362test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037363 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037364
William M. Brack21e4ef22005-01-02 09:53:13 +000037365#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037366 int mem_base;
37367 int ret_val;
37368 int code; /* UCS code point */
37369 int n_code;
37370
37371 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37372 mem_base = xmlMemBlocks();
37373 code = gen_int(n_code, 0);
37374
37375 ret_val = xmlUCSIsGeometricShapes(code);
37376 desret_int(ret_val);
37377 call_tests++;
37378 des_int(n_code, code, 0);
37379 xmlResetLastError();
37380 if (mem_base != xmlMemBlocks()) {
37381 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037383 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037384 printf(" %d", n_code);
37385 printf("\n");
37386 }
37387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037388 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037389#endif
37390
Daniel Veillard42595322004-11-08 10:52:06 +000037391 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037392}
37393
37394
37395static int
37396test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037397 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037398
William M. Brack21e4ef22005-01-02 09:53:13 +000037399#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037400 int mem_base;
37401 int ret_val;
37402 int code; /* UCS code point */
37403 int n_code;
37404
37405 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37406 mem_base = xmlMemBlocks();
37407 code = gen_int(n_code, 0);
37408
37409 ret_val = xmlUCSIsGeorgian(code);
37410 desret_int(ret_val);
37411 call_tests++;
37412 des_int(n_code, code, 0);
37413 xmlResetLastError();
37414 if (mem_base != xmlMemBlocks()) {
37415 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037417 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037418 printf(" %d", n_code);
37419 printf("\n");
37420 }
37421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037422 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037423#endif
37424
Daniel Veillard42595322004-11-08 10:52:06 +000037425 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037426}
37427
37428
37429static int
37430test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037431 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037432
William M. Brack21e4ef22005-01-02 09:53:13 +000037433#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037434 int mem_base;
37435 int ret_val;
37436 int code; /* UCS code point */
37437 int n_code;
37438
37439 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37440 mem_base = xmlMemBlocks();
37441 code = gen_int(n_code, 0);
37442
37443 ret_val = xmlUCSIsGothic(code);
37444 desret_int(ret_val);
37445 call_tests++;
37446 des_int(n_code, code, 0);
37447 xmlResetLastError();
37448 if (mem_base != xmlMemBlocks()) {
37449 printf("Leak of %d blocks found in xmlUCSIsGothic",
37450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037451 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037452 printf(" %d", n_code);
37453 printf("\n");
37454 }
37455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037456 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037457#endif
37458
Daniel Veillard42595322004-11-08 10:52:06 +000037459 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037460}
37461
37462
37463static int
37464test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037465 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037466
William M. Brack21e4ef22005-01-02 09:53:13 +000037467#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037468 int mem_base;
37469 int ret_val;
37470 int code; /* UCS code point */
37471 int n_code;
37472
37473 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37474 mem_base = xmlMemBlocks();
37475 code = gen_int(n_code, 0);
37476
37477 ret_val = xmlUCSIsGreek(code);
37478 desret_int(ret_val);
37479 call_tests++;
37480 des_int(n_code, code, 0);
37481 xmlResetLastError();
37482 if (mem_base != xmlMemBlocks()) {
37483 printf("Leak of %d blocks found in xmlUCSIsGreek",
37484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037485 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037486 printf(" %d", n_code);
37487 printf("\n");
37488 }
37489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037490 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037491#endif
37492
Daniel Veillard42595322004-11-08 10:52:06 +000037493 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037494}
37495
37496
37497static int
37498test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037499 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037500
William M. Brack21e4ef22005-01-02 09:53:13 +000037501#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037502 int mem_base;
37503 int ret_val;
37504 int code; /* UCS code point */
37505 int n_code;
37506
37507 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37508 mem_base = xmlMemBlocks();
37509 code = gen_int(n_code, 0);
37510
37511 ret_val = xmlUCSIsGreekExtended(code);
37512 desret_int(ret_val);
37513 call_tests++;
37514 des_int(n_code, code, 0);
37515 xmlResetLastError();
37516 if (mem_base != xmlMemBlocks()) {
37517 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037519 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037520 printf(" %d", n_code);
37521 printf("\n");
37522 }
37523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037524 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037525#endif
37526
Daniel Veillard42595322004-11-08 10:52:06 +000037527 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037528}
37529
37530
37531static int
37532test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037533 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037534
William M. Brack21e4ef22005-01-02 09:53:13 +000037535#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037536 int mem_base;
37537 int ret_val;
37538 int code; /* UCS code point */
37539 int n_code;
37540
37541 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37542 mem_base = xmlMemBlocks();
37543 code = gen_int(n_code, 0);
37544
37545 ret_val = xmlUCSIsGreekandCoptic(code);
37546 desret_int(ret_val);
37547 call_tests++;
37548 des_int(n_code, code, 0);
37549 xmlResetLastError();
37550 if (mem_base != xmlMemBlocks()) {
37551 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037553 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037554 printf(" %d", n_code);
37555 printf("\n");
37556 }
37557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037558 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037559#endif
37560
Daniel Veillard42595322004-11-08 10:52:06 +000037561 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037562}
37563
37564
37565static int
37566test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037567 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037568
William M. Brack21e4ef22005-01-02 09:53:13 +000037569#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037570 int mem_base;
37571 int ret_val;
37572 int code; /* UCS code point */
37573 int n_code;
37574
37575 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37576 mem_base = xmlMemBlocks();
37577 code = gen_int(n_code, 0);
37578
37579 ret_val = xmlUCSIsGujarati(code);
37580 desret_int(ret_val);
37581 call_tests++;
37582 des_int(n_code, code, 0);
37583 xmlResetLastError();
37584 if (mem_base != xmlMemBlocks()) {
37585 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037587 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037588 printf(" %d", n_code);
37589 printf("\n");
37590 }
37591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037592 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037593#endif
37594
Daniel Veillard42595322004-11-08 10:52:06 +000037595 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037596}
37597
37598
37599static int
37600test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037601 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037602
William M. Brack21e4ef22005-01-02 09:53:13 +000037603#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037604 int mem_base;
37605 int ret_val;
37606 int code; /* UCS code point */
37607 int n_code;
37608
37609 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37610 mem_base = xmlMemBlocks();
37611 code = gen_int(n_code, 0);
37612
37613 ret_val = xmlUCSIsGurmukhi(code);
37614 desret_int(ret_val);
37615 call_tests++;
37616 des_int(n_code, code, 0);
37617 xmlResetLastError();
37618 if (mem_base != xmlMemBlocks()) {
37619 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037621 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037622 printf(" %d", n_code);
37623 printf("\n");
37624 }
37625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037626 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037627#endif
37628
Daniel Veillard42595322004-11-08 10:52:06 +000037629 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037630}
37631
37632
37633static int
37634test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037635 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037636
William M. Brack21e4ef22005-01-02 09:53:13 +000037637#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037638 int mem_base;
37639 int ret_val;
37640 int code; /* UCS code point */
37641 int n_code;
37642
37643 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37644 mem_base = xmlMemBlocks();
37645 code = gen_int(n_code, 0);
37646
37647 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37648 desret_int(ret_val);
37649 call_tests++;
37650 des_int(n_code, code, 0);
37651 xmlResetLastError();
37652 if (mem_base != xmlMemBlocks()) {
37653 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037655 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037656 printf(" %d", n_code);
37657 printf("\n");
37658 }
37659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037660 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037661#endif
37662
Daniel Veillard42595322004-11-08 10:52:06 +000037663 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037664}
37665
37666
37667static int
37668test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037669 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037670
William M. Brack21e4ef22005-01-02 09:53:13 +000037671#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037672 int mem_base;
37673 int ret_val;
37674 int code; /* UCS code point */
37675 int n_code;
37676
37677 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37678 mem_base = xmlMemBlocks();
37679 code = gen_int(n_code, 0);
37680
37681 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37682 desret_int(ret_val);
37683 call_tests++;
37684 des_int(n_code, code, 0);
37685 xmlResetLastError();
37686 if (mem_base != xmlMemBlocks()) {
37687 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037689 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037690 printf(" %d", n_code);
37691 printf("\n");
37692 }
37693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037694 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037695#endif
37696
Daniel Veillard42595322004-11-08 10:52:06 +000037697 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037698}
37699
37700
37701static int
37702test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037703 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037704
William M. Brack21e4ef22005-01-02 09:53:13 +000037705#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037706 int mem_base;
37707 int ret_val;
37708 int code; /* UCS code point */
37709 int n_code;
37710
37711 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37712 mem_base = xmlMemBlocks();
37713 code = gen_int(n_code, 0);
37714
37715 ret_val = xmlUCSIsHangulJamo(code);
37716 desret_int(ret_val);
37717 call_tests++;
37718 des_int(n_code, code, 0);
37719 xmlResetLastError();
37720 if (mem_base != xmlMemBlocks()) {
37721 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037723 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037724 printf(" %d", n_code);
37725 printf("\n");
37726 }
37727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037728 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037729#endif
37730
Daniel Veillard42595322004-11-08 10:52:06 +000037731 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037732}
37733
37734
37735static int
37736test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037737 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037738
William M. Brack21e4ef22005-01-02 09:53:13 +000037739#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037740 int mem_base;
37741 int ret_val;
37742 int code; /* UCS code point */
37743 int n_code;
37744
37745 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37746 mem_base = xmlMemBlocks();
37747 code = gen_int(n_code, 0);
37748
37749 ret_val = xmlUCSIsHangulSyllables(code);
37750 desret_int(ret_val);
37751 call_tests++;
37752 des_int(n_code, code, 0);
37753 xmlResetLastError();
37754 if (mem_base != xmlMemBlocks()) {
37755 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037757 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037758 printf(" %d", n_code);
37759 printf("\n");
37760 }
37761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037762 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037763#endif
37764
Daniel Veillard42595322004-11-08 10:52:06 +000037765 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037766}
37767
37768
37769static int
37770test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037771 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037772
William M. Brack21e4ef22005-01-02 09:53:13 +000037773#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037774 int mem_base;
37775 int ret_val;
37776 int code; /* UCS code point */
37777 int n_code;
37778
37779 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37780 mem_base = xmlMemBlocks();
37781 code = gen_int(n_code, 0);
37782
37783 ret_val = xmlUCSIsHanunoo(code);
37784 desret_int(ret_val);
37785 call_tests++;
37786 des_int(n_code, code, 0);
37787 xmlResetLastError();
37788 if (mem_base != xmlMemBlocks()) {
37789 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037791 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037792 printf(" %d", n_code);
37793 printf("\n");
37794 }
37795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037796 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037797#endif
37798
Daniel Veillard42595322004-11-08 10:52:06 +000037799 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037800}
37801
37802
37803static int
37804test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037805 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037806
William M. Brack21e4ef22005-01-02 09:53:13 +000037807#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037808 int mem_base;
37809 int ret_val;
37810 int code; /* UCS code point */
37811 int n_code;
37812
37813 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37814 mem_base = xmlMemBlocks();
37815 code = gen_int(n_code, 0);
37816
37817 ret_val = xmlUCSIsHebrew(code);
37818 desret_int(ret_val);
37819 call_tests++;
37820 des_int(n_code, code, 0);
37821 xmlResetLastError();
37822 if (mem_base != xmlMemBlocks()) {
37823 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037825 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037826 printf(" %d", n_code);
37827 printf("\n");
37828 }
37829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037830 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037831#endif
37832
Daniel Veillard42595322004-11-08 10:52:06 +000037833 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037834}
37835
37836
37837static int
37838test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037839 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037840
William M. Brack21e4ef22005-01-02 09:53:13 +000037841#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037842 int mem_base;
37843 int ret_val;
37844 int code; /* UCS code point */
37845 int n_code;
37846
37847 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37848 mem_base = xmlMemBlocks();
37849 code = gen_int(n_code, 0);
37850
37851 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37852 desret_int(ret_val);
37853 call_tests++;
37854 des_int(n_code, code, 0);
37855 xmlResetLastError();
37856 if (mem_base != xmlMemBlocks()) {
37857 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037859 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037860 printf(" %d", n_code);
37861 printf("\n");
37862 }
37863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037864 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037865#endif
37866
Daniel Veillard42595322004-11-08 10:52:06 +000037867 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037868}
37869
37870
37871static int
37872test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037873 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037874
William M. Brack21e4ef22005-01-02 09:53:13 +000037875#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037876 int mem_base;
37877 int ret_val;
37878 int code; /* UCS code point */
37879 int n_code;
37880
37881 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37882 mem_base = xmlMemBlocks();
37883 code = gen_int(n_code, 0);
37884
37885 ret_val = xmlUCSIsHighSurrogates(code);
37886 desret_int(ret_val);
37887 call_tests++;
37888 des_int(n_code, code, 0);
37889 xmlResetLastError();
37890 if (mem_base != xmlMemBlocks()) {
37891 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037893 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037894 printf(" %d", n_code);
37895 printf("\n");
37896 }
37897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037898 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037899#endif
37900
Daniel Veillard42595322004-11-08 10:52:06 +000037901 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037902}
37903
37904
37905static int
37906test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037907 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037908
William M. Brack21e4ef22005-01-02 09:53:13 +000037909#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037910 int mem_base;
37911 int ret_val;
37912 int code; /* UCS code point */
37913 int n_code;
37914
37915 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37916 mem_base = xmlMemBlocks();
37917 code = gen_int(n_code, 0);
37918
37919 ret_val = xmlUCSIsHiragana(code);
37920 desret_int(ret_val);
37921 call_tests++;
37922 des_int(n_code, code, 0);
37923 xmlResetLastError();
37924 if (mem_base != xmlMemBlocks()) {
37925 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037927 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037928 printf(" %d", n_code);
37929 printf("\n");
37930 }
37931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037932 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037933#endif
37934
Daniel Veillard42595322004-11-08 10:52:06 +000037935 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037936}
37937
37938
37939static int
37940test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037941 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037942
William M. Brack21e4ef22005-01-02 09:53:13 +000037943#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037944 int mem_base;
37945 int ret_val;
37946 int code; /* UCS code point */
37947 int n_code;
37948
37949 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37950 mem_base = xmlMemBlocks();
37951 code = gen_int(n_code, 0);
37952
37953 ret_val = xmlUCSIsIPAExtensions(code);
37954 desret_int(ret_val);
37955 call_tests++;
37956 des_int(n_code, code, 0);
37957 xmlResetLastError();
37958 if (mem_base != xmlMemBlocks()) {
37959 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037961 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037962 printf(" %d", n_code);
37963 printf("\n");
37964 }
37965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037966 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037967#endif
37968
Daniel Veillard42595322004-11-08 10:52:06 +000037969 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037970}
37971
37972
37973static int
37974test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037975 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037976
William M. Brack21e4ef22005-01-02 09:53:13 +000037977#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037978 int mem_base;
37979 int ret_val;
37980 int code; /* UCS code point */
37981 int n_code;
37982
37983 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37984 mem_base = xmlMemBlocks();
37985 code = gen_int(n_code, 0);
37986
37987 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37988 desret_int(ret_val);
37989 call_tests++;
37990 des_int(n_code, code, 0);
37991 xmlResetLastError();
37992 if (mem_base != xmlMemBlocks()) {
37993 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037996 printf(" %d", n_code);
37997 printf("\n");
37998 }
37999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038000 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038001#endif
38002
Daniel Veillard42595322004-11-08 10:52:06 +000038003 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038004}
38005
38006
38007static int
38008test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038009 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038010
William M. Brack21e4ef22005-01-02 09:53:13 +000038011#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038012 int mem_base;
38013 int ret_val;
38014 int code; /* UCS code point */
38015 int n_code;
38016
38017 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38018 mem_base = xmlMemBlocks();
38019 code = gen_int(n_code, 0);
38020
38021 ret_val = xmlUCSIsKanbun(code);
38022 desret_int(ret_val);
38023 call_tests++;
38024 des_int(n_code, code, 0);
38025 xmlResetLastError();
38026 if (mem_base != xmlMemBlocks()) {
38027 printf("Leak of %d blocks found in xmlUCSIsKanbun",
38028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038029 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038030 printf(" %d", n_code);
38031 printf("\n");
38032 }
38033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038034 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038035#endif
38036
Daniel Veillard42595322004-11-08 10:52:06 +000038037 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038038}
38039
38040
38041static int
38042test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038043 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038044
William M. Brack21e4ef22005-01-02 09:53:13 +000038045#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038046 int mem_base;
38047 int ret_val;
38048 int code; /* UCS code point */
38049 int n_code;
38050
38051 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38052 mem_base = xmlMemBlocks();
38053 code = gen_int(n_code, 0);
38054
38055 ret_val = xmlUCSIsKangxiRadicals(code);
38056 desret_int(ret_val);
38057 call_tests++;
38058 des_int(n_code, code, 0);
38059 xmlResetLastError();
38060 if (mem_base != xmlMemBlocks()) {
38061 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
38062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038063 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038064 printf(" %d", n_code);
38065 printf("\n");
38066 }
38067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038068 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038069#endif
38070
Daniel Veillard42595322004-11-08 10:52:06 +000038071 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038072}
38073
38074
38075static int
38076test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038077 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038078
William M. Brack21e4ef22005-01-02 09:53:13 +000038079#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038080 int mem_base;
38081 int ret_val;
38082 int code; /* UCS code point */
38083 int n_code;
38084
38085 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38086 mem_base = xmlMemBlocks();
38087 code = gen_int(n_code, 0);
38088
38089 ret_val = xmlUCSIsKannada(code);
38090 desret_int(ret_val);
38091 call_tests++;
38092 des_int(n_code, code, 0);
38093 xmlResetLastError();
38094 if (mem_base != xmlMemBlocks()) {
38095 printf("Leak of %d blocks found in xmlUCSIsKannada",
38096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038097 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038098 printf(" %d", n_code);
38099 printf("\n");
38100 }
38101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038102 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038103#endif
38104
Daniel Veillard42595322004-11-08 10:52:06 +000038105 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038106}
38107
38108
38109static int
38110test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038111 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038112
William M. Brack21e4ef22005-01-02 09:53:13 +000038113#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038114 int mem_base;
38115 int ret_val;
38116 int code; /* UCS code point */
38117 int n_code;
38118
38119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38120 mem_base = xmlMemBlocks();
38121 code = gen_int(n_code, 0);
38122
38123 ret_val = xmlUCSIsKatakana(code);
38124 desret_int(ret_val);
38125 call_tests++;
38126 des_int(n_code, code, 0);
38127 xmlResetLastError();
38128 if (mem_base != xmlMemBlocks()) {
38129 printf("Leak of %d blocks found in xmlUCSIsKatakana",
38130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038131 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038132 printf(" %d", n_code);
38133 printf("\n");
38134 }
38135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038136 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038137#endif
38138
Daniel Veillard42595322004-11-08 10:52:06 +000038139 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038140}
38141
38142
38143static int
38144test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038145 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038146
William M. Brack21e4ef22005-01-02 09:53:13 +000038147#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038148 int mem_base;
38149 int ret_val;
38150 int code; /* UCS code point */
38151 int n_code;
38152
38153 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38154 mem_base = xmlMemBlocks();
38155 code = gen_int(n_code, 0);
38156
38157 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
38158 desret_int(ret_val);
38159 call_tests++;
38160 des_int(n_code, code, 0);
38161 xmlResetLastError();
38162 if (mem_base != xmlMemBlocks()) {
38163 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
38164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038165 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038166 printf(" %d", n_code);
38167 printf("\n");
38168 }
38169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038170 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038171#endif
38172
Daniel Veillard42595322004-11-08 10:52:06 +000038173 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038174}
38175
38176
38177static int
38178test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038179 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038180
William M. Brack21e4ef22005-01-02 09:53:13 +000038181#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038182 int mem_base;
38183 int ret_val;
38184 int code; /* UCS code point */
38185 int n_code;
38186
38187 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38188 mem_base = xmlMemBlocks();
38189 code = gen_int(n_code, 0);
38190
38191 ret_val = xmlUCSIsKhmer(code);
38192 desret_int(ret_val);
38193 call_tests++;
38194 des_int(n_code, code, 0);
38195 xmlResetLastError();
38196 if (mem_base != xmlMemBlocks()) {
38197 printf("Leak of %d blocks found in xmlUCSIsKhmer",
38198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038199 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038200 printf(" %d", n_code);
38201 printf("\n");
38202 }
38203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038204 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038205#endif
38206
Daniel Veillard42595322004-11-08 10:52:06 +000038207 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038208}
38209
38210
38211static int
38212test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038213 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038214
William M. Brack21e4ef22005-01-02 09:53:13 +000038215#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038216 int mem_base;
38217 int ret_val;
38218 int code; /* UCS code point */
38219 int n_code;
38220
38221 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38222 mem_base = xmlMemBlocks();
38223 code = gen_int(n_code, 0);
38224
38225 ret_val = xmlUCSIsKhmerSymbols(code);
38226 desret_int(ret_val);
38227 call_tests++;
38228 des_int(n_code, code, 0);
38229 xmlResetLastError();
38230 if (mem_base != xmlMemBlocks()) {
38231 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
38232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038233 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038234 printf(" %d", n_code);
38235 printf("\n");
38236 }
38237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038238 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038239#endif
38240
Daniel Veillard42595322004-11-08 10:52:06 +000038241 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038242}
38243
38244
38245static int
38246test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038247 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038248
William M. Brack21e4ef22005-01-02 09:53:13 +000038249#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038250 int mem_base;
38251 int ret_val;
38252 int code; /* UCS code point */
38253 int n_code;
38254
38255 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38256 mem_base = xmlMemBlocks();
38257 code = gen_int(n_code, 0);
38258
38259 ret_val = xmlUCSIsLao(code);
38260 desret_int(ret_val);
38261 call_tests++;
38262 des_int(n_code, code, 0);
38263 xmlResetLastError();
38264 if (mem_base != xmlMemBlocks()) {
38265 printf("Leak of %d blocks found in xmlUCSIsLao",
38266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038267 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038268 printf(" %d", n_code);
38269 printf("\n");
38270 }
38271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038272 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038273#endif
38274
Daniel Veillard42595322004-11-08 10:52:06 +000038275 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038276}
38277
38278
38279static int
38280test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038281 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038282
William M. Brack21e4ef22005-01-02 09:53:13 +000038283#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038284 int mem_base;
38285 int ret_val;
38286 int code; /* UCS code point */
38287 int n_code;
38288
38289 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38290 mem_base = xmlMemBlocks();
38291 code = gen_int(n_code, 0);
38292
38293 ret_val = xmlUCSIsLatin1Supplement(code);
38294 desret_int(ret_val);
38295 call_tests++;
38296 des_int(n_code, code, 0);
38297 xmlResetLastError();
38298 if (mem_base != xmlMemBlocks()) {
38299 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038301 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038302 printf(" %d", n_code);
38303 printf("\n");
38304 }
38305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038306 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038307#endif
38308
Daniel Veillard42595322004-11-08 10:52:06 +000038309 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038310}
38311
38312
38313static int
38314test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038315 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038316
William M. Brack21e4ef22005-01-02 09:53:13 +000038317#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038318 int mem_base;
38319 int ret_val;
38320 int code; /* UCS code point */
38321 int n_code;
38322
38323 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38324 mem_base = xmlMemBlocks();
38325 code = gen_int(n_code, 0);
38326
38327 ret_val = xmlUCSIsLatinExtendedA(code);
38328 desret_int(ret_val);
38329 call_tests++;
38330 des_int(n_code, code, 0);
38331 xmlResetLastError();
38332 if (mem_base != xmlMemBlocks()) {
38333 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038335 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038336 printf(" %d", n_code);
38337 printf("\n");
38338 }
38339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038340 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038341#endif
38342
Daniel Veillard42595322004-11-08 10:52:06 +000038343 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038344}
38345
38346
38347static int
38348test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038349 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038350
William M. Brack21e4ef22005-01-02 09:53:13 +000038351#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038352 int mem_base;
38353 int ret_val;
38354 int code; /* UCS code point */
38355 int n_code;
38356
38357 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38358 mem_base = xmlMemBlocks();
38359 code = gen_int(n_code, 0);
38360
38361 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38362 desret_int(ret_val);
38363 call_tests++;
38364 des_int(n_code, code, 0);
38365 xmlResetLastError();
38366 if (mem_base != xmlMemBlocks()) {
38367 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038369 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038370 printf(" %d", n_code);
38371 printf("\n");
38372 }
38373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038374 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038375#endif
38376
Daniel Veillard42595322004-11-08 10:52:06 +000038377 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038378}
38379
38380
38381static int
38382test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038383 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038384
William M. Brack21e4ef22005-01-02 09:53:13 +000038385#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038386 int mem_base;
38387 int ret_val;
38388 int code; /* UCS code point */
38389 int n_code;
38390
38391 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38392 mem_base = xmlMemBlocks();
38393 code = gen_int(n_code, 0);
38394
38395 ret_val = xmlUCSIsLatinExtendedB(code);
38396 desret_int(ret_val);
38397 call_tests++;
38398 des_int(n_code, code, 0);
38399 xmlResetLastError();
38400 if (mem_base != xmlMemBlocks()) {
38401 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038403 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038404 printf(" %d", n_code);
38405 printf("\n");
38406 }
38407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038408 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038409#endif
38410
Daniel Veillard42595322004-11-08 10:52:06 +000038411 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038412}
38413
38414
38415static int
38416test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038417 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038418
William M. Brack21e4ef22005-01-02 09:53:13 +000038419#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038420 int mem_base;
38421 int ret_val;
38422 int code; /* UCS code point */
38423 int n_code;
38424
38425 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38426 mem_base = xmlMemBlocks();
38427 code = gen_int(n_code, 0);
38428
38429 ret_val = xmlUCSIsLetterlikeSymbols(code);
38430 desret_int(ret_val);
38431 call_tests++;
38432 des_int(n_code, code, 0);
38433 xmlResetLastError();
38434 if (mem_base != xmlMemBlocks()) {
38435 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038437 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038438 printf(" %d", n_code);
38439 printf("\n");
38440 }
38441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038442 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038443#endif
38444
Daniel Veillard42595322004-11-08 10:52:06 +000038445 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038446}
38447
38448
38449static int
38450test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038451 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038452
William M. Brack21e4ef22005-01-02 09:53:13 +000038453#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038454 int mem_base;
38455 int ret_val;
38456 int code; /* UCS code point */
38457 int n_code;
38458
38459 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38460 mem_base = xmlMemBlocks();
38461 code = gen_int(n_code, 0);
38462
38463 ret_val = xmlUCSIsLimbu(code);
38464 desret_int(ret_val);
38465 call_tests++;
38466 des_int(n_code, code, 0);
38467 xmlResetLastError();
38468 if (mem_base != xmlMemBlocks()) {
38469 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038471 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038472 printf(" %d", n_code);
38473 printf("\n");
38474 }
38475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038476 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038477#endif
38478
Daniel Veillard42595322004-11-08 10:52:06 +000038479 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038480}
38481
38482
38483static int
38484test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038485 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038486
William M. Brack21e4ef22005-01-02 09:53:13 +000038487#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038488 int mem_base;
38489 int ret_val;
38490 int code; /* UCS code point */
38491 int n_code;
38492
38493 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38494 mem_base = xmlMemBlocks();
38495 code = gen_int(n_code, 0);
38496
38497 ret_val = xmlUCSIsLinearBIdeograms(code);
38498 desret_int(ret_val);
38499 call_tests++;
38500 des_int(n_code, code, 0);
38501 xmlResetLastError();
38502 if (mem_base != xmlMemBlocks()) {
38503 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038505 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038506 printf(" %d", n_code);
38507 printf("\n");
38508 }
38509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038510 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038511#endif
38512
Daniel Veillard42595322004-11-08 10:52:06 +000038513 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038514}
38515
38516
38517static int
38518test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038519 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038520
William M. Brack21e4ef22005-01-02 09:53:13 +000038521#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038522 int mem_base;
38523 int ret_val;
38524 int code; /* UCS code point */
38525 int n_code;
38526
38527 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38528 mem_base = xmlMemBlocks();
38529 code = gen_int(n_code, 0);
38530
38531 ret_val = xmlUCSIsLinearBSyllabary(code);
38532 desret_int(ret_val);
38533 call_tests++;
38534 des_int(n_code, code, 0);
38535 xmlResetLastError();
38536 if (mem_base != xmlMemBlocks()) {
38537 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038539 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038540 printf(" %d", n_code);
38541 printf("\n");
38542 }
38543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038544 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038545#endif
38546
Daniel Veillard42595322004-11-08 10:52:06 +000038547 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038548}
38549
38550
38551static int
38552test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038553 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038554
William M. Brack21e4ef22005-01-02 09:53:13 +000038555#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038556 int mem_base;
38557 int ret_val;
38558 int code; /* UCS code point */
38559 int n_code;
38560
38561 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38562 mem_base = xmlMemBlocks();
38563 code = gen_int(n_code, 0);
38564
38565 ret_val = xmlUCSIsLowSurrogates(code);
38566 desret_int(ret_val);
38567 call_tests++;
38568 des_int(n_code, code, 0);
38569 xmlResetLastError();
38570 if (mem_base != xmlMemBlocks()) {
38571 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038573 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038574 printf(" %d", n_code);
38575 printf("\n");
38576 }
38577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038578 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038579#endif
38580
Daniel Veillard42595322004-11-08 10:52:06 +000038581 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038582}
38583
38584
38585static int
38586test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038587 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038588
William M. Brack21e4ef22005-01-02 09:53:13 +000038589#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038590 int mem_base;
38591 int ret_val;
38592 int code; /* UCS code point */
38593 int n_code;
38594
38595 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38596 mem_base = xmlMemBlocks();
38597 code = gen_int(n_code, 0);
38598
38599 ret_val = xmlUCSIsMalayalam(code);
38600 desret_int(ret_val);
38601 call_tests++;
38602 des_int(n_code, code, 0);
38603 xmlResetLastError();
38604 if (mem_base != xmlMemBlocks()) {
38605 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038607 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038608 printf(" %d", n_code);
38609 printf("\n");
38610 }
38611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038612 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038613#endif
38614
Daniel Veillard42595322004-11-08 10:52:06 +000038615 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038616}
38617
38618
38619static int
38620test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038621 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038622
William M. Brack21e4ef22005-01-02 09:53:13 +000038623#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038624 int mem_base;
38625 int ret_val;
38626 int code; /* UCS code point */
38627 int n_code;
38628
38629 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38630 mem_base = xmlMemBlocks();
38631 code = gen_int(n_code, 0);
38632
38633 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38634 desret_int(ret_val);
38635 call_tests++;
38636 des_int(n_code, code, 0);
38637 xmlResetLastError();
38638 if (mem_base != xmlMemBlocks()) {
38639 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038641 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038642 printf(" %d", n_code);
38643 printf("\n");
38644 }
38645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038646 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038647#endif
38648
Daniel Veillard42595322004-11-08 10:52:06 +000038649 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038650}
38651
38652
38653static int
38654test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038655 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038656
William M. Brack21e4ef22005-01-02 09:53:13 +000038657#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038658 int mem_base;
38659 int ret_val;
38660 int code; /* UCS code point */
38661 int n_code;
38662
38663 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38664 mem_base = xmlMemBlocks();
38665 code = gen_int(n_code, 0);
38666
38667 ret_val = xmlUCSIsMathematicalOperators(code);
38668 desret_int(ret_val);
38669 call_tests++;
38670 des_int(n_code, code, 0);
38671 xmlResetLastError();
38672 if (mem_base != xmlMemBlocks()) {
38673 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038675 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038676 printf(" %d", n_code);
38677 printf("\n");
38678 }
38679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038680 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038681#endif
38682
Daniel Veillard42595322004-11-08 10:52:06 +000038683 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038684}
38685
38686
38687static int
38688test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038689 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038690
William M. Brack21e4ef22005-01-02 09:53:13 +000038691#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038692 int mem_base;
38693 int ret_val;
38694 int code; /* UCS code point */
38695 int n_code;
38696
38697 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38698 mem_base = xmlMemBlocks();
38699 code = gen_int(n_code, 0);
38700
38701 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38702 desret_int(ret_val);
38703 call_tests++;
38704 des_int(n_code, code, 0);
38705 xmlResetLastError();
38706 if (mem_base != xmlMemBlocks()) {
38707 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038709 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038710 printf(" %d", n_code);
38711 printf("\n");
38712 }
38713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038714 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038715#endif
38716
Daniel Veillard42595322004-11-08 10:52:06 +000038717 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038718}
38719
38720
38721static int
38722test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038723 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038724
William M. Brack21e4ef22005-01-02 09:53:13 +000038725#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038726 int mem_base;
38727 int ret_val;
38728 int code; /* UCS code point */
38729 int n_code;
38730
38731 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38732 mem_base = xmlMemBlocks();
38733 code = gen_int(n_code, 0);
38734
38735 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38736 desret_int(ret_val);
38737 call_tests++;
38738 des_int(n_code, code, 0);
38739 xmlResetLastError();
38740 if (mem_base != xmlMemBlocks()) {
38741 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038743 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038744 printf(" %d", n_code);
38745 printf("\n");
38746 }
38747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038748 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038749#endif
38750
Daniel Veillard42595322004-11-08 10:52:06 +000038751 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038752}
38753
38754
38755static int
38756test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038757 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038758
William M. Brack21e4ef22005-01-02 09:53:13 +000038759#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038760 int mem_base;
38761 int ret_val;
38762 int code; /* UCS code point */
38763 int n_code;
38764
38765 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38766 mem_base = xmlMemBlocks();
38767 code = gen_int(n_code, 0);
38768
38769 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38770 desret_int(ret_val);
38771 call_tests++;
38772 des_int(n_code, code, 0);
38773 xmlResetLastError();
38774 if (mem_base != xmlMemBlocks()) {
38775 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038777 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038778 printf(" %d", n_code);
38779 printf("\n");
38780 }
38781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038782 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038783#endif
38784
Daniel Veillard42595322004-11-08 10:52:06 +000038785 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038786}
38787
38788
38789static int
38790test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038791 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038792
William M. Brack21e4ef22005-01-02 09:53:13 +000038793#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038794 int mem_base;
38795 int ret_val;
38796 int code; /* UCS code point */
38797 int n_code;
38798
38799 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38800 mem_base = xmlMemBlocks();
38801 code = gen_int(n_code, 0);
38802
38803 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38804 desret_int(ret_val);
38805 call_tests++;
38806 des_int(n_code, code, 0);
38807 xmlResetLastError();
38808 if (mem_base != xmlMemBlocks()) {
38809 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038811 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038812 printf(" %d", n_code);
38813 printf("\n");
38814 }
38815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038816 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038817#endif
38818
Daniel Veillard42595322004-11-08 10:52:06 +000038819 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038820}
38821
38822
38823static int
38824test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038825 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038826
William M. Brack21e4ef22005-01-02 09:53:13 +000038827#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038828 int mem_base;
38829 int ret_val;
38830 int code; /* UCS code point */
38831 int n_code;
38832
38833 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38834 mem_base = xmlMemBlocks();
38835 code = gen_int(n_code, 0);
38836
38837 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38838 desret_int(ret_val);
38839 call_tests++;
38840 des_int(n_code, code, 0);
38841 xmlResetLastError();
38842 if (mem_base != xmlMemBlocks()) {
38843 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038845 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038846 printf(" %d", n_code);
38847 printf("\n");
38848 }
38849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038850 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038851#endif
38852
Daniel Veillard42595322004-11-08 10:52:06 +000038853 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038854}
38855
38856
38857static int
38858test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038859 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038860
William M. Brack21e4ef22005-01-02 09:53:13 +000038861#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038862 int mem_base;
38863 int ret_val;
38864 int code; /* UCS code point */
38865 int n_code;
38866
38867 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38868 mem_base = xmlMemBlocks();
38869 code = gen_int(n_code, 0);
38870
38871 ret_val = xmlUCSIsMongolian(code);
38872 desret_int(ret_val);
38873 call_tests++;
38874 des_int(n_code, code, 0);
38875 xmlResetLastError();
38876 if (mem_base != xmlMemBlocks()) {
38877 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038879 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038880 printf(" %d", n_code);
38881 printf("\n");
38882 }
38883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038884 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038885#endif
38886
Daniel Veillard42595322004-11-08 10:52:06 +000038887 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038888}
38889
38890
38891static int
38892test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038893 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038894
William M. Brack21e4ef22005-01-02 09:53:13 +000038895#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038896 int mem_base;
38897 int ret_val;
38898 int code; /* UCS code point */
38899 int n_code;
38900
38901 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38902 mem_base = xmlMemBlocks();
38903 code = gen_int(n_code, 0);
38904
38905 ret_val = xmlUCSIsMusicalSymbols(code);
38906 desret_int(ret_val);
38907 call_tests++;
38908 des_int(n_code, code, 0);
38909 xmlResetLastError();
38910 if (mem_base != xmlMemBlocks()) {
38911 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038913 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038914 printf(" %d", n_code);
38915 printf("\n");
38916 }
38917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038918 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038919#endif
38920
Daniel Veillard42595322004-11-08 10:52:06 +000038921 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038922}
38923
38924
38925static int
38926test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038927 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038928
William M. Brack21e4ef22005-01-02 09:53:13 +000038929#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038930 int mem_base;
38931 int ret_val;
38932 int code; /* UCS code point */
38933 int n_code;
38934
38935 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38936 mem_base = xmlMemBlocks();
38937 code = gen_int(n_code, 0);
38938
38939 ret_val = xmlUCSIsMyanmar(code);
38940 desret_int(ret_val);
38941 call_tests++;
38942 des_int(n_code, code, 0);
38943 xmlResetLastError();
38944 if (mem_base != xmlMemBlocks()) {
38945 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038947 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038948 printf(" %d", n_code);
38949 printf("\n");
38950 }
38951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038952 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038953#endif
38954
Daniel Veillard42595322004-11-08 10:52:06 +000038955 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038956}
38957
38958
38959static int
38960test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038961 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038962
William M. Brack21e4ef22005-01-02 09:53:13 +000038963#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038964 int mem_base;
38965 int ret_val;
38966 int code; /* UCS code point */
38967 int n_code;
38968
38969 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38970 mem_base = xmlMemBlocks();
38971 code = gen_int(n_code, 0);
38972
38973 ret_val = xmlUCSIsNumberForms(code);
38974 desret_int(ret_val);
38975 call_tests++;
38976 des_int(n_code, code, 0);
38977 xmlResetLastError();
38978 if (mem_base != xmlMemBlocks()) {
38979 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038981 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038982 printf(" %d", n_code);
38983 printf("\n");
38984 }
38985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038986 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038987#endif
38988
Daniel Veillard42595322004-11-08 10:52:06 +000038989 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038990}
38991
38992
38993static int
38994test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038995 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038996
William M. Brack21e4ef22005-01-02 09:53:13 +000038997#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038998 int mem_base;
38999 int ret_val;
39000 int code; /* UCS code point */
39001 int n_code;
39002
39003 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39004 mem_base = xmlMemBlocks();
39005 code = gen_int(n_code, 0);
39006
39007 ret_val = xmlUCSIsOgham(code);
39008 desret_int(ret_val);
39009 call_tests++;
39010 des_int(n_code, code, 0);
39011 xmlResetLastError();
39012 if (mem_base != xmlMemBlocks()) {
39013 printf("Leak of %d blocks found in xmlUCSIsOgham",
39014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039015 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039016 printf(" %d", n_code);
39017 printf("\n");
39018 }
39019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039020 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039021#endif
39022
Daniel Veillard42595322004-11-08 10:52:06 +000039023 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039024}
39025
39026
39027static int
39028test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039029 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039030
William M. Brack21e4ef22005-01-02 09:53:13 +000039031#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039032 int mem_base;
39033 int ret_val;
39034 int code; /* UCS code point */
39035 int n_code;
39036
39037 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39038 mem_base = xmlMemBlocks();
39039 code = gen_int(n_code, 0);
39040
39041 ret_val = xmlUCSIsOldItalic(code);
39042 desret_int(ret_val);
39043 call_tests++;
39044 des_int(n_code, code, 0);
39045 xmlResetLastError();
39046 if (mem_base != xmlMemBlocks()) {
39047 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
39048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039049 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039050 printf(" %d", n_code);
39051 printf("\n");
39052 }
39053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039054 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039055#endif
39056
Daniel Veillard42595322004-11-08 10:52:06 +000039057 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039058}
39059
39060
39061static int
39062test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039063 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039064
William M. Brack21e4ef22005-01-02 09:53:13 +000039065#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039066 int mem_base;
39067 int ret_val;
39068 int code; /* UCS code point */
39069 int n_code;
39070
39071 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39072 mem_base = xmlMemBlocks();
39073 code = gen_int(n_code, 0);
39074
39075 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
39076 desret_int(ret_val);
39077 call_tests++;
39078 des_int(n_code, code, 0);
39079 xmlResetLastError();
39080 if (mem_base != xmlMemBlocks()) {
39081 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
39082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039083 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039084 printf(" %d", n_code);
39085 printf("\n");
39086 }
39087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039088 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039089#endif
39090
Daniel Veillard42595322004-11-08 10:52:06 +000039091 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039092}
39093
39094
39095static int
39096test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039097 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039098
William M. Brack21e4ef22005-01-02 09:53:13 +000039099#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039100 int mem_base;
39101 int ret_val;
39102 int code; /* UCS code point */
39103 int n_code;
39104
39105 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39106 mem_base = xmlMemBlocks();
39107 code = gen_int(n_code, 0);
39108
39109 ret_val = xmlUCSIsOriya(code);
39110 desret_int(ret_val);
39111 call_tests++;
39112 des_int(n_code, code, 0);
39113 xmlResetLastError();
39114 if (mem_base != xmlMemBlocks()) {
39115 printf("Leak of %d blocks found in xmlUCSIsOriya",
39116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039117 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039118 printf(" %d", n_code);
39119 printf("\n");
39120 }
39121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039122 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039123#endif
39124
Daniel Veillard42595322004-11-08 10:52:06 +000039125 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039126}
39127
39128
39129static int
39130test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039131 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039132
William M. Brack21e4ef22005-01-02 09:53:13 +000039133#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039134 int mem_base;
39135 int ret_val;
39136 int code; /* UCS code point */
39137 int n_code;
39138
39139 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39140 mem_base = xmlMemBlocks();
39141 code = gen_int(n_code, 0);
39142
39143 ret_val = xmlUCSIsOsmanya(code);
39144 desret_int(ret_val);
39145 call_tests++;
39146 des_int(n_code, code, 0);
39147 xmlResetLastError();
39148 if (mem_base != xmlMemBlocks()) {
39149 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
39150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039151 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039152 printf(" %d", n_code);
39153 printf("\n");
39154 }
39155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039156 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039157#endif
39158
Daniel Veillard42595322004-11-08 10:52:06 +000039159 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039160}
39161
39162
39163static int
39164test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039165 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039166
William M. Brack21e4ef22005-01-02 09:53:13 +000039167#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039168 int mem_base;
39169 int ret_val;
39170 int code; /* UCS code point */
39171 int n_code;
39172
39173 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39174 mem_base = xmlMemBlocks();
39175 code = gen_int(n_code, 0);
39176
39177 ret_val = xmlUCSIsPhoneticExtensions(code);
39178 desret_int(ret_val);
39179 call_tests++;
39180 des_int(n_code, code, 0);
39181 xmlResetLastError();
39182 if (mem_base != xmlMemBlocks()) {
39183 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
39184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039185 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039186 printf(" %d", n_code);
39187 printf("\n");
39188 }
39189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039190 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039191#endif
39192
Daniel Veillard42595322004-11-08 10:52:06 +000039193 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039194}
39195
39196
39197static int
39198test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039199 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039200
William M. Brack21e4ef22005-01-02 09:53:13 +000039201#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039202 int mem_base;
39203 int ret_val;
39204 int code; /* UCS code point */
39205 int n_code;
39206
39207 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39208 mem_base = xmlMemBlocks();
39209 code = gen_int(n_code, 0);
39210
39211 ret_val = xmlUCSIsPrivateUse(code);
39212 desret_int(ret_val);
39213 call_tests++;
39214 des_int(n_code, code, 0);
39215 xmlResetLastError();
39216 if (mem_base != xmlMemBlocks()) {
39217 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
39218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039219 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039220 printf(" %d", n_code);
39221 printf("\n");
39222 }
39223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039224 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039225#endif
39226
Daniel Veillard42595322004-11-08 10:52:06 +000039227 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039228}
39229
39230
39231static int
39232test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039233 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039234
William M. Brack21e4ef22005-01-02 09:53:13 +000039235#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039236 int mem_base;
39237 int ret_val;
39238 int code; /* UCS code point */
39239 int n_code;
39240
39241 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39242 mem_base = xmlMemBlocks();
39243 code = gen_int(n_code, 0);
39244
39245 ret_val = xmlUCSIsPrivateUseArea(code);
39246 desret_int(ret_val);
39247 call_tests++;
39248 des_int(n_code, code, 0);
39249 xmlResetLastError();
39250 if (mem_base != xmlMemBlocks()) {
39251 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
39252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039253 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039254 printf(" %d", n_code);
39255 printf("\n");
39256 }
39257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039258 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039259#endif
39260
Daniel Veillard42595322004-11-08 10:52:06 +000039261 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039262}
39263
39264
39265static int
39266test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039267 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039268
William M. Brack21e4ef22005-01-02 09:53:13 +000039269#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039270 int mem_base;
39271 int ret_val;
39272 int code; /* UCS code point */
39273 int n_code;
39274
39275 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39276 mem_base = xmlMemBlocks();
39277 code = gen_int(n_code, 0);
39278
39279 ret_val = xmlUCSIsRunic(code);
39280 desret_int(ret_val);
39281 call_tests++;
39282 des_int(n_code, code, 0);
39283 xmlResetLastError();
39284 if (mem_base != xmlMemBlocks()) {
39285 printf("Leak of %d blocks found in xmlUCSIsRunic",
39286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039287 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039288 printf(" %d", n_code);
39289 printf("\n");
39290 }
39291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039292 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039293#endif
39294
Daniel Veillard42595322004-11-08 10:52:06 +000039295 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039296}
39297
39298
39299static int
39300test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039301 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039302
William M. Brack21e4ef22005-01-02 09:53:13 +000039303#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039304 int mem_base;
39305 int ret_val;
39306 int code; /* UCS code point */
39307 int n_code;
39308
39309 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39310 mem_base = xmlMemBlocks();
39311 code = gen_int(n_code, 0);
39312
39313 ret_val = xmlUCSIsShavian(code);
39314 desret_int(ret_val);
39315 call_tests++;
39316 des_int(n_code, code, 0);
39317 xmlResetLastError();
39318 if (mem_base != xmlMemBlocks()) {
39319 printf("Leak of %d blocks found in xmlUCSIsShavian",
39320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039321 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039322 printf(" %d", n_code);
39323 printf("\n");
39324 }
39325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039326 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039327#endif
39328
Daniel Veillard42595322004-11-08 10:52:06 +000039329 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039330}
39331
39332
39333static int
39334test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039335 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039336
William M. Brack21e4ef22005-01-02 09:53:13 +000039337#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039338 int mem_base;
39339 int ret_val;
39340 int code; /* UCS code point */
39341 int n_code;
39342
39343 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39344 mem_base = xmlMemBlocks();
39345 code = gen_int(n_code, 0);
39346
39347 ret_val = xmlUCSIsSinhala(code);
39348 desret_int(ret_val);
39349 call_tests++;
39350 des_int(n_code, code, 0);
39351 xmlResetLastError();
39352 if (mem_base != xmlMemBlocks()) {
39353 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039355 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039356 printf(" %d", n_code);
39357 printf("\n");
39358 }
39359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039360 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039361#endif
39362
Daniel Veillard42595322004-11-08 10:52:06 +000039363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039364}
39365
39366
39367static int
39368test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039370
William M. Brack21e4ef22005-01-02 09:53:13 +000039371#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039372 int mem_base;
39373 int ret_val;
39374 int code; /* UCS code point */
39375 int n_code;
39376
39377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39378 mem_base = xmlMemBlocks();
39379 code = gen_int(n_code, 0);
39380
39381 ret_val = xmlUCSIsSmallFormVariants(code);
39382 desret_int(ret_val);
39383 call_tests++;
39384 des_int(n_code, code, 0);
39385 xmlResetLastError();
39386 if (mem_base != xmlMemBlocks()) {
39387 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039390 printf(" %d", n_code);
39391 printf("\n");
39392 }
39393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039395#endif
39396
Daniel Veillard42595322004-11-08 10:52:06 +000039397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039398}
39399
39400
39401static int
39402test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039404
William M. Brack21e4ef22005-01-02 09:53:13 +000039405#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039406 int mem_base;
39407 int ret_val;
39408 int code; /* UCS code point */
39409 int n_code;
39410
39411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39412 mem_base = xmlMemBlocks();
39413 code = gen_int(n_code, 0);
39414
39415 ret_val = xmlUCSIsSpacingModifierLetters(code);
39416 desret_int(ret_val);
39417 call_tests++;
39418 des_int(n_code, code, 0);
39419 xmlResetLastError();
39420 if (mem_base != xmlMemBlocks()) {
39421 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039424 printf(" %d", n_code);
39425 printf("\n");
39426 }
39427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039429#endif
39430
Daniel Veillard42595322004-11-08 10:52:06 +000039431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039432}
39433
39434
39435static int
39436test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039438
William M. Brack21e4ef22005-01-02 09:53:13 +000039439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039440 int mem_base;
39441 int ret_val;
39442 int code; /* UCS code point */
39443 int n_code;
39444
39445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39446 mem_base = xmlMemBlocks();
39447 code = gen_int(n_code, 0);
39448
39449 ret_val = xmlUCSIsSpecials(code);
39450 desret_int(ret_val);
39451 call_tests++;
39452 des_int(n_code, code, 0);
39453 xmlResetLastError();
39454 if (mem_base != xmlMemBlocks()) {
39455 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039458 printf(" %d", n_code);
39459 printf("\n");
39460 }
39461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039463#endif
39464
Daniel Veillard42595322004-11-08 10:52:06 +000039465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039466}
39467
39468
39469static int
39470test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039472
William M. Brack21e4ef22005-01-02 09:53:13 +000039473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039474 int mem_base;
39475 int ret_val;
39476 int code; /* UCS code point */
39477 int n_code;
39478
39479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39480 mem_base = xmlMemBlocks();
39481 code = gen_int(n_code, 0);
39482
39483 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39484 desret_int(ret_val);
39485 call_tests++;
39486 des_int(n_code, code, 0);
39487 xmlResetLastError();
39488 if (mem_base != xmlMemBlocks()) {
39489 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039492 printf(" %d", n_code);
39493 printf("\n");
39494 }
39495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039497#endif
39498
Daniel Veillard42595322004-11-08 10:52:06 +000039499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039500}
39501
39502
39503static int
39504test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039506
William M. Brack21e4ef22005-01-02 09:53:13 +000039507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039508 int mem_base;
39509 int ret_val;
39510 int code; /* UCS code point */
39511 int n_code;
39512
39513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39514 mem_base = xmlMemBlocks();
39515 code = gen_int(n_code, 0);
39516
39517 ret_val = xmlUCSIsSupplementalArrowsA(code);
39518 desret_int(ret_val);
39519 call_tests++;
39520 des_int(n_code, code, 0);
39521 xmlResetLastError();
39522 if (mem_base != xmlMemBlocks()) {
39523 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039526 printf(" %d", n_code);
39527 printf("\n");
39528 }
39529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039531#endif
39532
Daniel Veillard42595322004-11-08 10:52:06 +000039533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039534}
39535
39536
39537static int
39538test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039540
William M. Brack21e4ef22005-01-02 09:53:13 +000039541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039542 int mem_base;
39543 int ret_val;
39544 int code; /* UCS code point */
39545 int n_code;
39546
39547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39548 mem_base = xmlMemBlocks();
39549 code = gen_int(n_code, 0);
39550
39551 ret_val = xmlUCSIsSupplementalArrowsB(code);
39552 desret_int(ret_val);
39553 call_tests++;
39554 des_int(n_code, code, 0);
39555 xmlResetLastError();
39556 if (mem_base != xmlMemBlocks()) {
39557 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039560 printf(" %d", n_code);
39561 printf("\n");
39562 }
39563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039565#endif
39566
Daniel Veillard42595322004-11-08 10:52:06 +000039567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039568}
39569
39570
39571static int
39572test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039574
William M. Brack21e4ef22005-01-02 09:53:13 +000039575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039576 int mem_base;
39577 int ret_val;
39578 int code; /* UCS code point */
39579 int n_code;
39580
39581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39582 mem_base = xmlMemBlocks();
39583 code = gen_int(n_code, 0);
39584
39585 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39586 desret_int(ret_val);
39587 call_tests++;
39588 des_int(n_code, code, 0);
39589 xmlResetLastError();
39590 if (mem_base != xmlMemBlocks()) {
39591 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039594 printf(" %d", n_code);
39595 printf("\n");
39596 }
39597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039599#endif
39600
Daniel Veillard42595322004-11-08 10:52:06 +000039601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039602}
39603
39604
39605static int
39606test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039608
William M. Brack21e4ef22005-01-02 09:53:13 +000039609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039610 int mem_base;
39611 int ret_val;
39612 int code; /* UCS code point */
39613 int n_code;
39614
39615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39616 mem_base = xmlMemBlocks();
39617 code = gen_int(n_code, 0);
39618
39619 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39620 desret_int(ret_val);
39621 call_tests++;
39622 des_int(n_code, code, 0);
39623 xmlResetLastError();
39624 if (mem_base != xmlMemBlocks()) {
39625 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039628 printf(" %d", n_code);
39629 printf("\n");
39630 }
39631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039633#endif
39634
Daniel Veillard42595322004-11-08 10:52:06 +000039635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039636}
39637
39638
39639static int
39640test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039642
William M. Brack21e4ef22005-01-02 09:53:13 +000039643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039644 int mem_base;
39645 int ret_val;
39646 int code; /* UCS code point */
39647 int n_code;
39648
39649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39650 mem_base = xmlMemBlocks();
39651 code = gen_int(n_code, 0);
39652
39653 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39654 desret_int(ret_val);
39655 call_tests++;
39656 des_int(n_code, code, 0);
39657 xmlResetLastError();
39658 if (mem_base != xmlMemBlocks()) {
39659 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039662 printf(" %d", n_code);
39663 printf("\n");
39664 }
39665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039667#endif
39668
Daniel Veillard42595322004-11-08 10:52:06 +000039669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039670}
39671
39672
39673static int
39674test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039676
William M. Brack21e4ef22005-01-02 09:53:13 +000039677#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039678 int mem_base;
39679 int ret_val;
39680 int code; /* UCS code point */
39681 int n_code;
39682
39683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39684 mem_base = xmlMemBlocks();
39685 code = gen_int(n_code, 0);
39686
39687 ret_val = xmlUCSIsSyriac(code);
39688 desret_int(ret_val);
39689 call_tests++;
39690 des_int(n_code, code, 0);
39691 xmlResetLastError();
39692 if (mem_base != xmlMemBlocks()) {
39693 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039696 printf(" %d", n_code);
39697 printf("\n");
39698 }
39699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039701#endif
39702
Daniel Veillard42595322004-11-08 10:52:06 +000039703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039704}
39705
39706
39707static int
39708test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039710
William M. Brack21e4ef22005-01-02 09:53:13 +000039711#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039712 int mem_base;
39713 int ret_val;
39714 int code; /* UCS code point */
39715 int n_code;
39716
39717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39718 mem_base = xmlMemBlocks();
39719 code = gen_int(n_code, 0);
39720
39721 ret_val = xmlUCSIsTagalog(code);
39722 desret_int(ret_val);
39723 call_tests++;
39724 des_int(n_code, code, 0);
39725 xmlResetLastError();
39726 if (mem_base != xmlMemBlocks()) {
39727 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039730 printf(" %d", n_code);
39731 printf("\n");
39732 }
39733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039735#endif
39736
Daniel Veillard42595322004-11-08 10:52:06 +000039737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039738}
39739
39740
39741static int
39742test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039744
William M. Brack21e4ef22005-01-02 09:53:13 +000039745#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039746 int mem_base;
39747 int ret_val;
39748 int code; /* UCS code point */
39749 int n_code;
39750
39751 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39752 mem_base = xmlMemBlocks();
39753 code = gen_int(n_code, 0);
39754
39755 ret_val = xmlUCSIsTagbanwa(code);
39756 desret_int(ret_val);
39757 call_tests++;
39758 des_int(n_code, code, 0);
39759 xmlResetLastError();
39760 if (mem_base != xmlMemBlocks()) {
39761 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039763 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039764 printf(" %d", n_code);
39765 printf("\n");
39766 }
39767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039768 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039769#endif
39770
Daniel Veillard42595322004-11-08 10:52:06 +000039771 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039772}
39773
39774
39775static int
39776test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039777 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039778
William M. Brack21e4ef22005-01-02 09:53:13 +000039779#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039780 int mem_base;
39781 int ret_val;
39782 int code; /* UCS code point */
39783 int n_code;
39784
39785 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39786 mem_base = xmlMemBlocks();
39787 code = gen_int(n_code, 0);
39788
39789 ret_val = xmlUCSIsTags(code);
39790 desret_int(ret_val);
39791 call_tests++;
39792 des_int(n_code, code, 0);
39793 xmlResetLastError();
39794 if (mem_base != xmlMemBlocks()) {
39795 printf("Leak of %d blocks found in xmlUCSIsTags",
39796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039797 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039798 printf(" %d", n_code);
39799 printf("\n");
39800 }
39801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039802 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039803#endif
39804
Daniel Veillard42595322004-11-08 10:52:06 +000039805 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039806}
39807
39808
39809static int
39810test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039811 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039812
William M. Brack21e4ef22005-01-02 09:53:13 +000039813#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039814 int mem_base;
39815 int ret_val;
39816 int code; /* UCS code point */
39817 int n_code;
39818
39819 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39820 mem_base = xmlMemBlocks();
39821 code = gen_int(n_code, 0);
39822
39823 ret_val = xmlUCSIsTaiLe(code);
39824 desret_int(ret_val);
39825 call_tests++;
39826 des_int(n_code, code, 0);
39827 xmlResetLastError();
39828 if (mem_base != xmlMemBlocks()) {
39829 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039831 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039832 printf(" %d", n_code);
39833 printf("\n");
39834 }
39835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039836 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039837#endif
39838
Daniel Veillard42595322004-11-08 10:52:06 +000039839 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039840}
39841
39842
39843static int
39844test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039845 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039846
William M. Brack21e4ef22005-01-02 09:53:13 +000039847#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039848 int mem_base;
39849 int ret_val;
39850 int code; /* UCS code point */
39851 int n_code;
39852
39853 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39854 mem_base = xmlMemBlocks();
39855 code = gen_int(n_code, 0);
39856
39857 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39858 desret_int(ret_val);
39859 call_tests++;
39860 des_int(n_code, code, 0);
39861 xmlResetLastError();
39862 if (mem_base != xmlMemBlocks()) {
39863 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039865 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039866 printf(" %d", n_code);
39867 printf("\n");
39868 }
39869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039870 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039871#endif
39872
Daniel Veillard42595322004-11-08 10:52:06 +000039873 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039874}
39875
39876
39877static int
39878test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039879 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039880
William M. Brack21e4ef22005-01-02 09:53:13 +000039881#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039882 int mem_base;
39883 int ret_val;
39884 int code; /* UCS code point */
39885 int n_code;
39886
39887 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39888 mem_base = xmlMemBlocks();
39889 code = gen_int(n_code, 0);
39890
39891 ret_val = xmlUCSIsTamil(code);
39892 desret_int(ret_val);
39893 call_tests++;
39894 des_int(n_code, code, 0);
39895 xmlResetLastError();
39896 if (mem_base != xmlMemBlocks()) {
39897 printf("Leak of %d blocks found in xmlUCSIsTamil",
39898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039900 printf(" %d", n_code);
39901 printf("\n");
39902 }
39903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039904 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039905#endif
39906
Daniel Veillard42595322004-11-08 10:52:06 +000039907 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039908}
39909
39910
39911static int
39912test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039913 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039914
William M. Brack21e4ef22005-01-02 09:53:13 +000039915#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039916 int mem_base;
39917 int ret_val;
39918 int code; /* UCS code point */
39919 int n_code;
39920
39921 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39922 mem_base = xmlMemBlocks();
39923 code = gen_int(n_code, 0);
39924
39925 ret_val = xmlUCSIsTelugu(code);
39926 desret_int(ret_val);
39927 call_tests++;
39928 des_int(n_code, code, 0);
39929 xmlResetLastError();
39930 if (mem_base != xmlMemBlocks()) {
39931 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039933 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039934 printf(" %d", n_code);
39935 printf("\n");
39936 }
39937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039938 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039939#endif
39940
Daniel Veillard42595322004-11-08 10:52:06 +000039941 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039942}
39943
39944
39945static int
39946test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039947 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039948
William M. Brack21e4ef22005-01-02 09:53:13 +000039949#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039950 int mem_base;
39951 int ret_val;
39952 int code; /* UCS code point */
39953 int n_code;
39954
39955 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39956 mem_base = xmlMemBlocks();
39957 code = gen_int(n_code, 0);
39958
39959 ret_val = xmlUCSIsThaana(code);
39960 desret_int(ret_val);
39961 call_tests++;
39962 des_int(n_code, code, 0);
39963 xmlResetLastError();
39964 if (mem_base != xmlMemBlocks()) {
39965 printf("Leak of %d blocks found in xmlUCSIsThaana",
39966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039967 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039968 printf(" %d", n_code);
39969 printf("\n");
39970 }
39971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039972 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039973#endif
39974
Daniel Veillard42595322004-11-08 10:52:06 +000039975 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039976}
39977
39978
39979static int
39980test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039981 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039982
William M. Brack21e4ef22005-01-02 09:53:13 +000039983#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039984 int mem_base;
39985 int ret_val;
39986 int code; /* UCS code point */
39987 int n_code;
39988
39989 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39990 mem_base = xmlMemBlocks();
39991 code = gen_int(n_code, 0);
39992
39993 ret_val = xmlUCSIsThai(code);
39994 desret_int(ret_val);
39995 call_tests++;
39996 des_int(n_code, code, 0);
39997 xmlResetLastError();
39998 if (mem_base != xmlMemBlocks()) {
39999 printf("Leak of %d blocks found in xmlUCSIsThai",
40000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040001 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040002 printf(" %d", n_code);
40003 printf("\n");
40004 }
40005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040006 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040007#endif
40008
Daniel Veillard42595322004-11-08 10:52:06 +000040009 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040010}
40011
40012
40013static int
40014test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040015 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040016
William M. Brack21e4ef22005-01-02 09:53:13 +000040017#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040018 int mem_base;
40019 int ret_val;
40020 int code; /* UCS code point */
40021 int n_code;
40022
40023 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40024 mem_base = xmlMemBlocks();
40025 code = gen_int(n_code, 0);
40026
40027 ret_val = xmlUCSIsTibetan(code);
40028 desret_int(ret_val);
40029 call_tests++;
40030 des_int(n_code, code, 0);
40031 xmlResetLastError();
40032 if (mem_base != xmlMemBlocks()) {
40033 printf("Leak of %d blocks found in xmlUCSIsTibetan",
40034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040035 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040036 printf(" %d", n_code);
40037 printf("\n");
40038 }
40039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040040 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040041#endif
40042
Daniel Veillard42595322004-11-08 10:52:06 +000040043 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040044}
40045
40046
40047static int
40048test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040049 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040050
William M. Brack21e4ef22005-01-02 09:53:13 +000040051#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040052 int mem_base;
40053 int ret_val;
40054 int code; /* UCS code point */
40055 int n_code;
40056
40057 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40058 mem_base = xmlMemBlocks();
40059 code = gen_int(n_code, 0);
40060
40061 ret_val = xmlUCSIsUgaritic(code);
40062 desret_int(ret_val);
40063 call_tests++;
40064 des_int(n_code, code, 0);
40065 xmlResetLastError();
40066 if (mem_base != xmlMemBlocks()) {
40067 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
40068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040069 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040070 printf(" %d", n_code);
40071 printf("\n");
40072 }
40073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040074 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040075#endif
40076
Daniel Veillard42595322004-11-08 10:52:06 +000040077 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040078}
40079
40080
40081static int
40082test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040083 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040084
William M. Brack21e4ef22005-01-02 09:53:13 +000040085#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040086 int mem_base;
40087 int ret_val;
40088 int code; /* UCS code point */
40089 int n_code;
40090
40091 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40092 mem_base = xmlMemBlocks();
40093 code = gen_int(n_code, 0);
40094
40095 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
40096 desret_int(ret_val);
40097 call_tests++;
40098 des_int(n_code, code, 0);
40099 xmlResetLastError();
40100 if (mem_base != xmlMemBlocks()) {
40101 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
40102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040103 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040104 printf(" %d", n_code);
40105 printf("\n");
40106 }
40107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040108 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040109#endif
40110
Daniel Veillard42595322004-11-08 10:52:06 +000040111 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040112}
40113
40114
40115static int
40116test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040117 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040118
William M. Brack21e4ef22005-01-02 09:53:13 +000040119#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040120 int mem_base;
40121 int ret_val;
40122 int code; /* UCS code point */
40123 int n_code;
40124
40125 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40126 mem_base = xmlMemBlocks();
40127 code = gen_int(n_code, 0);
40128
40129 ret_val = xmlUCSIsVariationSelectors(code);
40130 desret_int(ret_val);
40131 call_tests++;
40132 des_int(n_code, code, 0);
40133 xmlResetLastError();
40134 if (mem_base != xmlMemBlocks()) {
40135 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
40136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040137 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040138 printf(" %d", n_code);
40139 printf("\n");
40140 }
40141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040142 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040143#endif
40144
Daniel Veillard42595322004-11-08 10:52:06 +000040145 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040146}
40147
40148
40149static int
40150test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040151 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040152
William M. Brack21e4ef22005-01-02 09:53:13 +000040153#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040154 int mem_base;
40155 int ret_val;
40156 int code; /* UCS code point */
40157 int n_code;
40158
40159 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40160 mem_base = xmlMemBlocks();
40161 code = gen_int(n_code, 0);
40162
40163 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
40164 desret_int(ret_val);
40165 call_tests++;
40166 des_int(n_code, code, 0);
40167 xmlResetLastError();
40168 if (mem_base != xmlMemBlocks()) {
40169 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
40170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040171 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040172 printf(" %d", n_code);
40173 printf("\n");
40174 }
40175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040176 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040177#endif
40178
Daniel Veillard42595322004-11-08 10:52:06 +000040179 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040180}
40181
40182
40183static int
40184test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040185 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040186
William M. Brack21e4ef22005-01-02 09:53:13 +000040187#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040188 int mem_base;
40189 int ret_val;
40190 int code; /* UCS code point */
40191 int n_code;
40192
40193 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40194 mem_base = xmlMemBlocks();
40195 code = gen_int(n_code, 0);
40196
40197 ret_val = xmlUCSIsYiRadicals(code);
40198 desret_int(ret_val);
40199 call_tests++;
40200 des_int(n_code, code, 0);
40201 xmlResetLastError();
40202 if (mem_base != xmlMemBlocks()) {
40203 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
40204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040205 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040206 printf(" %d", n_code);
40207 printf("\n");
40208 }
40209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040210 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040211#endif
40212
Daniel Veillard42595322004-11-08 10:52:06 +000040213 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040214}
40215
40216
40217static int
40218test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040219 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040220
William M. Brack21e4ef22005-01-02 09:53:13 +000040221#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040222 int mem_base;
40223 int ret_val;
40224 int code; /* UCS code point */
40225 int n_code;
40226
40227 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40228 mem_base = xmlMemBlocks();
40229 code = gen_int(n_code, 0);
40230
40231 ret_val = xmlUCSIsYiSyllables(code);
40232 desret_int(ret_val);
40233 call_tests++;
40234 des_int(n_code, code, 0);
40235 xmlResetLastError();
40236 if (mem_base != xmlMemBlocks()) {
40237 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
40238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040239 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040240 printf(" %d", n_code);
40241 printf("\n");
40242 }
40243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040244 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040245#endif
40246
Daniel Veillard42595322004-11-08 10:52:06 +000040247 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040248}
40249
40250
40251static int
40252test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040253 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040254
William M. Brack21e4ef22005-01-02 09:53:13 +000040255#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040256 int mem_base;
40257 int ret_val;
40258 int code; /* UCS code point */
40259 int n_code;
40260
40261 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40262 mem_base = xmlMemBlocks();
40263 code = gen_int(n_code, 0);
40264
40265 ret_val = xmlUCSIsYijingHexagramSymbols(code);
40266 desret_int(ret_val);
40267 call_tests++;
40268 des_int(n_code, code, 0);
40269 xmlResetLastError();
40270 if (mem_base != xmlMemBlocks()) {
40271 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
40272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040273 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040274 printf(" %d", n_code);
40275 printf("\n");
40276 }
40277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040278 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040279#endif
40280
Daniel Veillard42595322004-11-08 10:52:06 +000040281 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040282}
40283
40284static int
40285test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040286 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040287
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040288 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000040289 test_ret += test_xmlUCSIsAegeanNumbers();
40290 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
40291 test_ret += test_xmlUCSIsArabic();
40292 test_ret += test_xmlUCSIsArabicPresentationFormsA();
40293 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40294 test_ret += test_xmlUCSIsArmenian();
40295 test_ret += test_xmlUCSIsArrows();
40296 test_ret += test_xmlUCSIsBasicLatin();
40297 test_ret += test_xmlUCSIsBengali();
40298 test_ret += test_xmlUCSIsBlock();
40299 test_ret += test_xmlUCSIsBlockElements();
40300 test_ret += test_xmlUCSIsBopomofo();
40301 test_ret += test_xmlUCSIsBopomofoExtended();
40302 test_ret += test_xmlUCSIsBoxDrawing();
40303 test_ret += test_xmlUCSIsBraillePatterns();
40304 test_ret += test_xmlUCSIsBuhid();
40305 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40306 test_ret += test_xmlUCSIsCJKCompatibility();
40307 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40308 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40309 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40310 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40311 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40312 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40313 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40314 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40315 test_ret += test_xmlUCSIsCat();
40316 test_ret += test_xmlUCSIsCatC();
40317 test_ret += test_xmlUCSIsCatCc();
40318 test_ret += test_xmlUCSIsCatCf();
40319 test_ret += test_xmlUCSIsCatCo();
40320 test_ret += test_xmlUCSIsCatCs();
40321 test_ret += test_xmlUCSIsCatL();
40322 test_ret += test_xmlUCSIsCatLl();
40323 test_ret += test_xmlUCSIsCatLm();
40324 test_ret += test_xmlUCSIsCatLo();
40325 test_ret += test_xmlUCSIsCatLt();
40326 test_ret += test_xmlUCSIsCatLu();
40327 test_ret += test_xmlUCSIsCatM();
40328 test_ret += test_xmlUCSIsCatMc();
40329 test_ret += test_xmlUCSIsCatMe();
40330 test_ret += test_xmlUCSIsCatMn();
40331 test_ret += test_xmlUCSIsCatN();
40332 test_ret += test_xmlUCSIsCatNd();
40333 test_ret += test_xmlUCSIsCatNl();
40334 test_ret += test_xmlUCSIsCatNo();
40335 test_ret += test_xmlUCSIsCatP();
40336 test_ret += test_xmlUCSIsCatPc();
40337 test_ret += test_xmlUCSIsCatPd();
40338 test_ret += test_xmlUCSIsCatPe();
40339 test_ret += test_xmlUCSIsCatPf();
40340 test_ret += test_xmlUCSIsCatPi();
40341 test_ret += test_xmlUCSIsCatPo();
40342 test_ret += test_xmlUCSIsCatPs();
40343 test_ret += test_xmlUCSIsCatS();
40344 test_ret += test_xmlUCSIsCatSc();
40345 test_ret += test_xmlUCSIsCatSk();
40346 test_ret += test_xmlUCSIsCatSm();
40347 test_ret += test_xmlUCSIsCatSo();
40348 test_ret += test_xmlUCSIsCatZ();
40349 test_ret += test_xmlUCSIsCatZl();
40350 test_ret += test_xmlUCSIsCatZp();
40351 test_ret += test_xmlUCSIsCatZs();
40352 test_ret += test_xmlUCSIsCherokee();
40353 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40354 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40355 test_ret += test_xmlUCSIsCombiningHalfMarks();
40356 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40357 test_ret += test_xmlUCSIsControlPictures();
40358 test_ret += test_xmlUCSIsCurrencySymbols();
40359 test_ret += test_xmlUCSIsCypriotSyllabary();
40360 test_ret += test_xmlUCSIsCyrillic();
40361 test_ret += test_xmlUCSIsCyrillicSupplement();
40362 test_ret += test_xmlUCSIsDeseret();
40363 test_ret += test_xmlUCSIsDevanagari();
40364 test_ret += test_xmlUCSIsDingbats();
40365 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40366 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40367 test_ret += test_xmlUCSIsEthiopic();
40368 test_ret += test_xmlUCSIsGeneralPunctuation();
40369 test_ret += test_xmlUCSIsGeometricShapes();
40370 test_ret += test_xmlUCSIsGeorgian();
40371 test_ret += test_xmlUCSIsGothic();
40372 test_ret += test_xmlUCSIsGreek();
40373 test_ret += test_xmlUCSIsGreekExtended();
40374 test_ret += test_xmlUCSIsGreekandCoptic();
40375 test_ret += test_xmlUCSIsGujarati();
40376 test_ret += test_xmlUCSIsGurmukhi();
40377 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40378 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40379 test_ret += test_xmlUCSIsHangulJamo();
40380 test_ret += test_xmlUCSIsHangulSyllables();
40381 test_ret += test_xmlUCSIsHanunoo();
40382 test_ret += test_xmlUCSIsHebrew();
40383 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40384 test_ret += test_xmlUCSIsHighSurrogates();
40385 test_ret += test_xmlUCSIsHiragana();
40386 test_ret += test_xmlUCSIsIPAExtensions();
40387 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40388 test_ret += test_xmlUCSIsKanbun();
40389 test_ret += test_xmlUCSIsKangxiRadicals();
40390 test_ret += test_xmlUCSIsKannada();
40391 test_ret += test_xmlUCSIsKatakana();
40392 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40393 test_ret += test_xmlUCSIsKhmer();
40394 test_ret += test_xmlUCSIsKhmerSymbols();
40395 test_ret += test_xmlUCSIsLao();
40396 test_ret += test_xmlUCSIsLatin1Supplement();
40397 test_ret += test_xmlUCSIsLatinExtendedA();
40398 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40399 test_ret += test_xmlUCSIsLatinExtendedB();
40400 test_ret += test_xmlUCSIsLetterlikeSymbols();
40401 test_ret += test_xmlUCSIsLimbu();
40402 test_ret += test_xmlUCSIsLinearBIdeograms();
40403 test_ret += test_xmlUCSIsLinearBSyllabary();
40404 test_ret += test_xmlUCSIsLowSurrogates();
40405 test_ret += test_xmlUCSIsMalayalam();
40406 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40407 test_ret += test_xmlUCSIsMathematicalOperators();
40408 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40409 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40410 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40411 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40412 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40413 test_ret += test_xmlUCSIsMongolian();
40414 test_ret += test_xmlUCSIsMusicalSymbols();
40415 test_ret += test_xmlUCSIsMyanmar();
40416 test_ret += test_xmlUCSIsNumberForms();
40417 test_ret += test_xmlUCSIsOgham();
40418 test_ret += test_xmlUCSIsOldItalic();
40419 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40420 test_ret += test_xmlUCSIsOriya();
40421 test_ret += test_xmlUCSIsOsmanya();
40422 test_ret += test_xmlUCSIsPhoneticExtensions();
40423 test_ret += test_xmlUCSIsPrivateUse();
40424 test_ret += test_xmlUCSIsPrivateUseArea();
40425 test_ret += test_xmlUCSIsRunic();
40426 test_ret += test_xmlUCSIsShavian();
40427 test_ret += test_xmlUCSIsSinhala();
40428 test_ret += test_xmlUCSIsSmallFormVariants();
40429 test_ret += test_xmlUCSIsSpacingModifierLetters();
40430 test_ret += test_xmlUCSIsSpecials();
40431 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40432 test_ret += test_xmlUCSIsSupplementalArrowsA();
40433 test_ret += test_xmlUCSIsSupplementalArrowsB();
40434 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40435 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40436 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40437 test_ret += test_xmlUCSIsSyriac();
40438 test_ret += test_xmlUCSIsTagalog();
40439 test_ret += test_xmlUCSIsTagbanwa();
40440 test_ret += test_xmlUCSIsTags();
40441 test_ret += test_xmlUCSIsTaiLe();
40442 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40443 test_ret += test_xmlUCSIsTamil();
40444 test_ret += test_xmlUCSIsTelugu();
40445 test_ret += test_xmlUCSIsThaana();
40446 test_ret += test_xmlUCSIsThai();
40447 test_ret += test_xmlUCSIsTibetan();
40448 test_ret += test_xmlUCSIsUgaritic();
40449 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40450 test_ret += test_xmlUCSIsVariationSelectors();
40451 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40452 test_ret += test_xmlUCSIsYiRadicals();
40453 test_ret += test_xmlUCSIsYiSyllables();
40454 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040455
Daniel Veillard42595322004-11-08 10:52:06 +000040456 if (test_ret != 0)
40457 printf("Module xmlunicode: %d errors\n", test_ret);
40458 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040459}
40460
40461static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040462test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040464
William M. Brack21e4ef22005-01-02 09:53:13 +000040465#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040466 int mem_base;
40467 xmlTextWriterPtr ret_val;
40468 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40469 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040470
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040471 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40472 mem_base = xmlMemBlocks();
40473 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040474
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040475 ret_val = xmlNewTextWriter(out);
40476 if (ret_val != NULL) out = NULL;
40477 desret_xmlTextWriterPtr(ret_val);
40478 call_tests++;
40479 des_xmlOutputBufferPtr(n_out, out, 0);
40480 xmlResetLastError();
40481 if (mem_base != xmlMemBlocks()) {
40482 printf("Leak of %d blocks found in xmlNewTextWriter",
40483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040484 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040485 printf(" %d", n_out);
40486 printf("\n");
40487 }
40488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040489 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040490#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040491
Daniel Veillard42595322004-11-08 10:52:06 +000040492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040493}
40494
40495
40496static int
40497test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040499
William M. Brack21e4ef22005-01-02 09:53:13 +000040500#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040501 int mem_base;
40502 xmlTextWriterPtr ret_val;
40503 const char * uri; /* the URI of the resource for the output */
40504 int n_uri;
40505 int compression; /* compress the output? */
40506 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040507
Daniel Veillard42595322004-11-08 10:52:06 +000040508 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040509 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40510 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040511 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040512 compression = gen_int(n_compression, 1);
40513
40514 ret_val = xmlNewTextWriterFilename(uri, compression);
40515 desret_xmlTextWriterPtr(ret_val);
40516 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040517 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040518 des_int(n_compression, compression, 1);
40519 xmlResetLastError();
40520 if (mem_base != xmlMemBlocks()) {
40521 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040523 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040524 printf(" %d", n_uri);
40525 printf(" %d", n_compression);
40526 printf("\n");
40527 }
40528 }
40529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040530 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040531#endif
40532
Daniel Veillard42595322004-11-08 10:52:06 +000040533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040534}
40535
40536
40537static int
40538test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040540
William M. Brack21e4ef22005-01-02 09:53:13 +000040541#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040542 int mem_base;
40543 xmlTextWriterPtr ret_val;
40544 xmlBufferPtr buf; /* xmlBufferPtr */
40545 int n_buf;
40546 int compression; /* compress the output? */
40547 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040548
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040549 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40550 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40551 mem_base = xmlMemBlocks();
40552 buf = gen_xmlBufferPtr(n_buf, 0);
40553 compression = gen_int(n_compression, 1);
40554
40555 ret_val = xmlNewTextWriterMemory(buf, compression);
40556 desret_xmlTextWriterPtr(ret_val);
40557 call_tests++;
40558 des_xmlBufferPtr(n_buf, buf, 0);
40559 des_int(n_compression, compression, 1);
40560 xmlResetLastError();
40561 if (mem_base != xmlMemBlocks()) {
40562 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040564 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040565 printf(" %d", n_buf);
40566 printf(" %d", n_compression);
40567 printf("\n");
40568 }
40569 }
40570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040571 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040572#endif
40573
Daniel Veillard42595322004-11-08 10:52:06 +000040574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040575}
40576
40577
40578static int
40579test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040581
William M. Brack21e4ef22005-01-02 09:53:13 +000040582#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040583 int mem_base;
40584 xmlTextWriterPtr ret_val;
40585 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40586 int n_ctxt;
40587 int compression; /* compress the output? */
40588 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040589
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040590 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40591 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40592 mem_base = xmlMemBlocks();
40593 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40594 compression = gen_int(n_compression, 1);
40595
40596 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040597 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040598 desret_xmlTextWriterPtr(ret_val);
40599 call_tests++;
40600 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40601 des_int(n_compression, compression, 1);
40602 xmlResetLastError();
40603 if (mem_base != xmlMemBlocks()) {
40604 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040606 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040607 printf(" %d", n_ctxt);
40608 printf(" %d", n_compression);
40609 printf("\n");
40610 }
40611 }
40612 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040613 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040614#endif
40615
Daniel Veillard42595322004-11-08 10:52:06 +000040616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040617}
40618
40619
40620static int
40621test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040623
William M. Brack21e4ef22005-01-02 09:53:13 +000040624#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040625 int mem_base;
40626 xmlTextWriterPtr ret_val;
40627 xmlDocPtr doc; /* xmlDocPtr */
40628 int n_doc;
40629 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40630 int n_node;
40631 int compression; /* compress the output? */
40632 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040633
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040634 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40635 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40636 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40637 mem_base = xmlMemBlocks();
40638 doc = gen_xmlDocPtr(n_doc, 0);
40639 node = gen_xmlNodePtr(n_node, 1);
40640 compression = gen_int(n_compression, 2);
40641
40642 ret_val = xmlNewTextWriterTree(doc, node, compression);
40643 desret_xmlTextWriterPtr(ret_val);
40644 call_tests++;
40645 des_xmlDocPtr(n_doc, doc, 0);
40646 des_xmlNodePtr(n_node, node, 1);
40647 des_int(n_compression, compression, 2);
40648 xmlResetLastError();
40649 if (mem_base != xmlMemBlocks()) {
40650 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040652 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040653 printf(" %d", n_doc);
40654 printf(" %d", n_node);
40655 printf(" %d", n_compression);
40656 printf("\n");
40657 }
40658 }
40659 }
40660 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040661 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040662#endif
40663
Daniel Veillard42595322004-11-08 10:52:06 +000040664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040665}
40666
40667
40668static int
40669test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040671
William M. Brack21e4ef22005-01-02 09:53:13 +000040672#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040673 int mem_base;
40674 int ret_val;
40675 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40676 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040677
Daniel Veillarde43cc572004-11-03 11:50:29 +000040678 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40679 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040680 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040681
40682 ret_val = xmlTextWriterEndAttribute(writer);
40683 desret_int(ret_val);
40684 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040685 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040686 xmlResetLastError();
40687 if (mem_base != xmlMemBlocks()) {
40688 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040690 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040691 printf(" %d", n_writer);
40692 printf("\n");
40693 }
40694 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040695 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040696#endif
40697
Daniel Veillard42595322004-11-08 10:52:06 +000040698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040699}
40700
40701
40702static int
40703test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040705
William M. Brack21e4ef22005-01-02 09:53:13 +000040706#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040707 int mem_base;
40708 int ret_val;
40709 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40710 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040711
Daniel Veillarde43cc572004-11-03 11:50:29 +000040712 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40713 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040714 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040715
40716 ret_val = xmlTextWriterEndCDATA(writer);
40717 desret_int(ret_val);
40718 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040719 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040720 xmlResetLastError();
40721 if (mem_base != xmlMemBlocks()) {
40722 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040724 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040725 printf(" %d", n_writer);
40726 printf("\n");
40727 }
40728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040729 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040730#endif
40731
Daniel Veillard42595322004-11-08 10:52:06 +000040732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040733}
40734
40735
40736static int
40737test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040739
William M. Brack21e4ef22005-01-02 09:53:13 +000040740#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040741 int mem_base;
40742 int ret_val;
40743 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40744 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040745
Daniel Veillarde43cc572004-11-03 11:50:29 +000040746 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40747 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040748 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040749
40750 ret_val = xmlTextWriterEndComment(writer);
40751 desret_int(ret_val);
40752 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040753 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040754 xmlResetLastError();
40755 if (mem_base != xmlMemBlocks()) {
40756 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040758 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040759 printf(" %d", n_writer);
40760 printf("\n");
40761 }
40762 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040763 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040764#endif
40765
Daniel Veillard42595322004-11-08 10:52:06 +000040766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040767}
40768
40769
40770static int
40771test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040773
William M. Brack21e4ef22005-01-02 09:53:13 +000040774#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040775 int mem_base;
40776 int ret_val;
40777 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40778 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040779
Daniel Veillarde43cc572004-11-03 11:50:29 +000040780 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40781 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040782 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040783
40784 ret_val = xmlTextWriterEndDTD(writer);
40785 desret_int(ret_val);
40786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040787 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040788 xmlResetLastError();
40789 if (mem_base != xmlMemBlocks()) {
40790 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040792 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040793 printf(" %d", n_writer);
40794 printf("\n");
40795 }
40796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040797 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040798#endif
40799
Daniel Veillard42595322004-11-08 10:52:06 +000040800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040801}
40802
40803
40804static int
40805test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040807
William M. Brack21e4ef22005-01-02 09:53:13 +000040808#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040809 int mem_base;
40810 int ret_val;
40811 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40812 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040813
Daniel Veillarde43cc572004-11-03 11:50:29 +000040814 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040816 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040817
40818 ret_val = xmlTextWriterEndDTDAttlist(writer);
40819 desret_int(ret_val);
40820 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040821 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040822 xmlResetLastError();
40823 if (mem_base != xmlMemBlocks()) {
40824 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040826 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040827 printf(" %d", n_writer);
40828 printf("\n");
40829 }
40830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040831 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040832#endif
40833
Daniel Veillard42595322004-11-08 10:52:06 +000040834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040835}
40836
40837
40838static int
40839test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040841
William M. Brack21e4ef22005-01-02 09:53:13 +000040842#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040843 int mem_base;
40844 int ret_val;
40845 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40846 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040847
Daniel Veillarde43cc572004-11-03 11:50:29 +000040848 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40849 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040850 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040851
40852 ret_val = xmlTextWriterEndDTDElement(writer);
40853 desret_int(ret_val);
40854 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040855 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040856 xmlResetLastError();
40857 if (mem_base != xmlMemBlocks()) {
40858 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040860 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040861 printf(" %d", n_writer);
40862 printf("\n");
40863 }
40864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040865 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040866#endif
40867
Daniel Veillard42595322004-11-08 10:52:06 +000040868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040869}
40870
40871
40872static int
40873test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040875
William M. Brack21e4ef22005-01-02 09:53:13 +000040876#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 int mem_base;
40878 int ret_val;
40879 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40880 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040881
Daniel Veillarde43cc572004-11-03 11:50:29 +000040882 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40883 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040884 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040885
40886 ret_val = xmlTextWriterEndDTDEntity(writer);
40887 desret_int(ret_val);
40888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040889 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040890 xmlResetLastError();
40891 if (mem_base != xmlMemBlocks()) {
40892 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040894 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040895 printf(" %d", n_writer);
40896 printf("\n");
40897 }
40898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040899 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040900#endif
40901
Daniel Veillard42595322004-11-08 10:52:06 +000040902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040903}
40904
40905
40906static int
40907test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040909
William M. Brack21e4ef22005-01-02 09:53:13 +000040910#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040911 int mem_base;
40912 int ret_val;
40913 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40914 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040915
Daniel Veillarde43cc572004-11-03 11:50:29 +000040916 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40917 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040918 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040919
40920 ret_val = xmlTextWriterEndDocument(writer);
40921 desret_int(ret_val);
40922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040923 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040924 xmlResetLastError();
40925 if (mem_base != xmlMemBlocks()) {
40926 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040928 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040929 printf(" %d", n_writer);
40930 printf("\n");
40931 }
40932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040933 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040934#endif
40935
Daniel Veillard42595322004-11-08 10:52:06 +000040936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040937}
40938
40939
40940static int
40941test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040943
William M. Brack21e4ef22005-01-02 09:53:13 +000040944#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040945 int mem_base;
40946 int ret_val;
40947 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40948 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040949
Daniel Veillarde43cc572004-11-03 11:50:29 +000040950 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40951 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040952 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040953
40954 ret_val = xmlTextWriterEndElement(writer);
40955 desret_int(ret_val);
40956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040957 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040958 xmlResetLastError();
40959 if (mem_base != xmlMemBlocks()) {
40960 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040962 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040963 printf(" %d", n_writer);
40964 printf("\n");
40965 }
40966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040967 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040968#endif
40969
Daniel Veillard42595322004-11-08 10:52:06 +000040970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040971}
40972
40973
40974static int
40975test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040977
William M. Brack21e4ef22005-01-02 09:53:13 +000040978#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040979 int mem_base;
40980 int ret_val;
40981 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40982 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040983
Daniel Veillarde43cc572004-11-03 11:50:29 +000040984 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40985 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040986 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040987
40988 ret_val = xmlTextWriterEndPI(writer);
40989 desret_int(ret_val);
40990 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040991 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040992 xmlResetLastError();
40993 if (mem_base != xmlMemBlocks()) {
40994 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040996 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040997 printf(" %d", n_writer);
40998 printf("\n");
40999 }
41000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041001 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041002#endif
41003
Daniel Veillard42595322004-11-08 10:52:06 +000041004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041005}
41006
41007
41008static int
41009test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041011
William M. Brack21e4ef22005-01-02 09:53:13 +000041012#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041013 int mem_base;
41014 int ret_val;
41015 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41016 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041017
Daniel Veillarde43cc572004-11-03 11:50:29 +000041018 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041020 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041021
41022 ret_val = xmlTextWriterFlush(writer);
41023 desret_int(ret_val);
41024 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041025 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041026 xmlResetLastError();
41027 if (mem_base != xmlMemBlocks()) {
41028 printf("Leak of %d blocks found in xmlTextWriterFlush",
41029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041030 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041031 printf(" %d", n_writer);
41032 printf("\n");
41033 }
41034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041035 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041036#endif
41037
Daniel Veillard42595322004-11-08 10:52:06 +000041038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041039}
41040
41041
41042static int
41043test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041045
William M. Brack21e4ef22005-01-02 09:53:13 +000041046#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041047 int mem_base;
41048 int ret_val;
41049 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41050 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041051
Daniel Veillarde43cc572004-11-03 11:50:29 +000041052 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041054 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041055
41056 ret_val = xmlTextWriterFullEndElement(writer);
41057 desret_int(ret_val);
41058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041059 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041060 xmlResetLastError();
41061 if (mem_base != xmlMemBlocks()) {
41062 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
41063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041064 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041065 printf(" %d", n_writer);
41066 printf("\n");
41067 }
41068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041069 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041070#endif
41071
Daniel Veillard42595322004-11-08 10:52:06 +000041072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041073}
41074
41075
41076static int
41077test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041079
William M. Brack21e4ef22005-01-02 09:53:13 +000041080#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041081 int mem_base;
41082 int ret_val;
41083 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41084 int n_writer;
41085 int indent; /* do indentation? */
41086 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041087
Daniel Veillarde43cc572004-11-03 11:50:29 +000041088 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41089 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
41090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041091 writer = gen_xmlTextWriterPtr(n_writer, 0);
41092 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041093
41094 ret_val = xmlTextWriterSetIndent(writer, indent);
41095 desret_int(ret_val);
41096 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041097 des_xmlTextWriterPtr(n_writer, writer, 0);
41098 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041099 xmlResetLastError();
41100 if (mem_base != xmlMemBlocks()) {
41101 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
41102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041103 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041104 printf(" %d", n_writer);
41105 printf(" %d", n_indent);
41106 printf("\n");
41107 }
41108 }
41109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041110 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041111#endif
41112
Daniel Veillard42595322004-11-08 10:52:06 +000041113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041114}
41115
41116
41117static int
41118test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041120
William M. Brack21e4ef22005-01-02 09:53:13 +000041121#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041122 int mem_base;
41123 int ret_val;
41124 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41125 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041126 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041127 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041128
Daniel Veillarde43cc572004-11-03 11:50:29 +000041129 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41130 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
41131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041132 writer = gen_xmlTextWriterPtr(n_writer, 0);
41133 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041134
William M. Brackf13f77f2004-11-12 16:03:48 +000041135 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041136 desret_int(ret_val);
41137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041138 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041139 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041140 xmlResetLastError();
41141 if (mem_base != xmlMemBlocks()) {
41142 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
41143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041144 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041145 printf(" %d", n_writer);
41146 printf(" %d", n_str);
41147 printf("\n");
41148 }
41149 }
41150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041151 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041152#endif
41153
Daniel Veillard42595322004-11-08 10:52:06 +000041154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041155}
41156
41157
41158static int
41159test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041161
William M. Brack21e4ef22005-01-02 09:53:13 +000041162#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041163 int mem_base;
41164 int ret_val;
41165 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41166 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041167 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041168 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041169
Daniel Veillarde43cc572004-11-03 11:50:29 +000041170 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41172 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041173 writer = gen_xmlTextWriterPtr(n_writer, 0);
41174 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041175
William M. Brackf13f77f2004-11-12 16:03:48 +000041176 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041177 desret_int(ret_val);
41178 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041179 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041180 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041181 xmlResetLastError();
41182 if (mem_base != xmlMemBlocks()) {
41183 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
41184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041185 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041186 printf(" %d", n_writer);
41187 printf(" %d", n_name);
41188 printf("\n");
41189 }
41190 }
41191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041192 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041193#endif
41194
Daniel Veillard42595322004-11-08 10:52:06 +000041195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041196}
41197
41198
41199static int
41200test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041202
William M. Brack21e4ef22005-01-02 09:53:13 +000041203#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041204 int mem_base;
41205 int ret_val;
41206 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41207 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041208 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041209 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041210 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041211 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041212 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041213 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041214
Daniel Veillarde43cc572004-11-03 11:50:29 +000041215 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41216 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41217 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41218 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41219 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041220 writer = gen_xmlTextWriterPtr(n_writer, 0);
41221 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41222 name = gen_const_xmlChar_ptr(n_name, 2);
41223 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041224
William M. Brackf13f77f2004-11-12 16:03:48 +000041225 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041226 desret_int(ret_val);
41227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041228 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041229 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41230 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41231 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041232 xmlResetLastError();
41233 if (mem_base != xmlMemBlocks()) {
41234 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
41235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041236 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041237 printf(" %d", n_writer);
41238 printf(" %d", n_prefix);
41239 printf(" %d", n_name);
41240 printf(" %d", n_namespaceURI);
41241 printf("\n");
41242 }
41243 }
41244 }
41245 }
41246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041247 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041248#endif
41249
Daniel Veillard42595322004-11-08 10:52:06 +000041250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041251}
41252
41253
41254static int
41255test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041257
William M. Brack21e4ef22005-01-02 09:53:13 +000041258#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041259 int mem_base;
41260 int ret_val;
41261 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41262 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041263
Daniel Veillarde43cc572004-11-03 11:50:29 +000041264 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041266 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041267
41268 ret_val = xmlTextWriterStartCDATA(writer);
41269 desret_int(ret_val);
41270 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041271 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041272 xmlResetLastError();
41273 if (mem_base != xmlMemBlocks()) {
41274 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
41275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041276 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041277 printf(" %d", n_writer);
41278 printf("\n");
41279 }
41280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041281 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041282#endif
41283
Daniel Veillard42595322004-11-08 10:52:06 +000041284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041285}
41286
41287
41288static int
41289test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041291
William M. Brack21e4ef22005-01-02 09:53:13 +000041292#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041293 int mem_base;
41294 int ret_val;
41295 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41296 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041297
Daniel Veillarde43cc572004-11-03 11:50:29 +000041298 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041300 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041301
41302 ret_val = xmlTextWriterStartComment(writer);
41303 desret_int(ret_val);
41304 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041305 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041306 xmlResetLastError();
41307 if (mem_base != xmlMemBlocks()) {
41308 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041310 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041311 printf(" %d", n_writer);
41312 printf("\n");
41313 }
41314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041315 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041316#endif
41317
Daniel Veillard42595322004-11-08 10:52:06 +000041318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041319}
41320
41321
41322static int
41323test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041325
William M. Brack21e4ef22005-01-02 09:53:13 +000041326#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041327 int mem_base;
41328 int ret_val;
41329 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41330 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041331 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041332 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041333 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041334 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041335 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041336 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041337
Daniel Veillarde43cc572004-11-03 11:50:29 +000041338 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41339 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41340 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41341 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041343 writer = gen_xmlTextWriterPtr(n_writer, 0);
41344 name = gen_const_xmlChar_ptr(n_name, 1);
41345 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41346 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041347
William M. Brackf13f77f2004-11-12 16:03:48 +000041348 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041349 desret_int(ret_val);
41350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041351 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041352 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41353 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41354 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041355 xmlResetLastError();
41356 if (mem_base != xmlMemBlocks()) {
41357 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041359 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041360 printf(" %d", n_writer);
41361 printf(" %d", n_name);
41362 printf(" %d", n_pubid);
41363 printf(" %d", n_sysid);
41364 printf("\n");
41365 }
41366 }
41367 }
41368 }
41369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041370 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041371#endif
41372
Daniel Veillard42595322004-11-08 10:52:06 +000041373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041374}
41375
41376
41377static int
41378test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041380
William M. Brack21e4ef22005-01-02 09:53:13 +000041381#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041382 int mem_base;
41383 int ret_val;
41384 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41385 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041386 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041387 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041388
Daniel Veillarde43cc572004-11-03 11:50:29 +000041389 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41391 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041392 writer = gen_xmlTextWriterPtr(n_writer, 0);
41393 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041394
William M. Brackf13f77f2004-11-12 16:03:48 +000041395 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041396 desret_int(ret_val);
41397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041398 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041400 xmlResetLastError();
41401 if (mem_base != xmlMemBlocks()) {
41402 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041404 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041405 printf(" %d", n_writer);
41406 printf(" %d", n_name);
41407 printf("\n");
41408 }
41409 }
41410 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041411 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041412#endif
41413
Daniel Veillard42595322004-11-08 10:52:06 +000041414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041415}
41416
41417
41418static int
41419test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041421
William M. Brack21e4ef22005-01-02 09:53:13 +000041422#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 int mem_base;
41424 int ret_val;
41425 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41426 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041427 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041428 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041429
Daniel Veillarde43cc572004-11-03 11:50:29 +000041430 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41431 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041433 writer = gen_xmlTextWriterPtr(n_writer, 0);
41434 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041435
William M. Brackf13f77f2004-11-12 16:03:48 +000041436 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041437 desret_int(ret_val);
41438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041439 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041440 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041441 xmlResetLastError();
41442 if (mem_base != xmlMemBlocks()) {
41443 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041445 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041446 printf(" %d", n_writer);
41447 printf(" %d", n_name);
41448 printf("\n");
41449 }
41450 }
41451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041452 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041453#endif
41454
Daniel Veillard42595322004-11-08 10:52:06 +000041455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041456}
41457
41458
41459static int
41460test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041462
William M. Brack21e4ef22005-01-02 09:53:13 +000041463#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041464 int mem_base;
41465 int ret_val;
41466 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41467 int n_writer;
41468 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41469 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041470 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041471 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041472
Daniel Veillarde43cc572004-11-03 11:50:29 +000041473 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41474 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41475 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041477 writer = gen_xmlTextWriterPtr(n_writer, 0);
41478 pe = gen_int(n_pe, 1);
41479 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041480
William M. Brackf13f77f2004-11-12 16:03:48 +000041481 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482 desret_int(ret_val);
41483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041484 des_xmlTextWriterPtr(n_writer, writer, 0);
41485 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041486 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041487 xmlResetLastError();
41488 if (mem_base != xmlMemBlocks()) {
41489 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041491 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041492 printf(" %d", n_writer);
41493 printf(" %d", n_pe);
41494 printf(" %d", n_name);
41495 printf("\n");
41496 }
41497 }
41498 }
41499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041500 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041501#endif
41502
Daniel Veillard42595322004-11-08 10:52:06 +000041503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041504}
41505
41506
41507static int
41508test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041510
William M. Brack21e4ef22005-01-02 09:53:13 +000041511#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041512 int mem_base;
41513 int ret_val;
41514 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41515 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041516 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041517 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041518 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041519 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041520 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041521 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041522
Daniel Veillarde43cc572004-11-03 11:50:29 +000041523 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41524 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41525 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41526 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041528 writer = gen_xmlTextWriterPtr(n_writer, 0);
41529 version = gen_const_char_ptr(n_version, 1);
41530 encoding = gen_const_char_ptr(n_encoding, 2);
41531 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041532
William M. Brackf13f77f2004-11-12 16:03:48 +000041533 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041534 desret_int(ret_val);
41535 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041536 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041537 des_const_char_ptr(n_version, (const char *)version, 1);
41538 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41539 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041540 xmlResetLastError();
41541 if (mem_base != xmlMemBlocks()) {
41542 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041544 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041545 printf(" %d", n_writer);
41546 printf(" %d", n_version);
41547 printf(" %d", n_encoding);
41548 printf(" %d", n_standalone);
41549 printf("\n");
41550 }
41551 }
41552 }
41553 }
41554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041555 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041556#endif
41557
Daniel Veillard42595322004-11-08 10:52:06 +000041558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041559}
41560
41561
41562static int
41563test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041565
William M. Brack21e4ef22005-01-02 09:53:13 +000041566#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041567 int mem_base;
41568 int ret_val;
41569 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41570 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041571 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041572 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041573
Daniel Veillarde43cc572004-11-03 11:50:29 +000041574 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41575 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41576 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041577 writer = gen_xmlTextWriterPtr(n_writer, 0);
41578 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041579
William M. Brackf13f77f2004-11-12 16:03:48 +000041580 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041581 desret_int(ret_val);
41582 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041583 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041584 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041585 xmlResetLastError();
41586 if (mem_base != xmlMemBlocks()) {
41587 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041589 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041590 printf(" %d", n_writer);
41591 printf(" %d", n_name);
41592 printf("\n");
41593 }
41594 }
41595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041596 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041597#endif
41598
Daniel Veillard42595322004-11-08 10:52:06 +000041599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041600}
41601
41602
41603static int
41604test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041606
William M. Brack21e4ef22005-01-02 09:53:13 +000041607#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041608 int mem_base;
41609 int ret_val;
41610 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41611 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041612 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041613 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041614 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041615 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041616 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041617 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041618
Daniel Veillarde43cc572004-11-03 11:50:29 +000041619 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41620 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41621 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41622 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041624 writer = gen_xmlTextWriterPtr(n_writer, 0);
41625 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41626 name = gen_const_xmlChar_ptr(n_name, 2);
41627 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041628
William M. Brackf13f77f2004-11-12 16:03:48 +000041629 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041630 desret_int(ret_val);
41631 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041632 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041633 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41634 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41635 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041636 xmlResetLastError();
41637 if (mem_base != xmlMemBlocks()) {
41638 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041640 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041641 printf(" %d", n_writer);
41642 printf(" %d", n_prefix);
41643 printf(" %d", n_name);
41644 printf(" %d", n_namespaceURI);
41645 printf("\n");
41646 }
41647 }
41648 }
41649 }
41650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041651 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041652#endif
41653
Daniel Veillard42595322004-11-08 10:52:06 +000041654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041655}
41656
41657
41658static int
41659test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041661
William M. Brack21e4ef22005-01-02 09:53:13 +000041662#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041663 int mem_base;
41664 int ret_val;
41665 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41666 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041667 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041668 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041669
Daniel Veillarde43cc572004-11-03 11:50:29 +000041670 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41671 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41672 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041673 writer = gen_xmlTextWriterPtr(n_writer, 0);
41674 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041675
William M. Brackf13f77f2004-11-12 16:03:48 +000041676 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041677 desret_int(ret_val);
41678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041679 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041680 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041681 xmlResetLastError();
41682 if (mem_base != xmlMemBlocks()) {
41683 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041685 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041686 printf(" %d", n_writer);
41687 printf(" %d", n_target);
41688 printf("\n");
41689 }
41690 }
41691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041692 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041693#endif
41694
Daniel Veillard42595322004-11-08 10:52:06 +000041695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041696}
41697
41698
41699static int
41700test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041702
William M. Brack21e4ef22005-01-02 09:53:13 +000041703#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041704 int mem_base;
41705 int ret_val;
41706 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41707 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041708 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041709 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041710 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041711 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041712
Daniel Veillarde43cc572004-11-03 11:50:29 +000041713 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41714 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41715 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041717 writer = gen_xmlTextWriterPtr(n_writer, 0);
41718 name = gen_const_xmlChar_ptr(n_name, 1);
41719 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041720
William M. Brackf13f77f2004-11-12 16:03:48 +000041721 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041722 desret_int(ret_val);
41723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041724 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041725 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41726 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727 xmlResetLastError();
41728 if (mem_base != xmlMemBlocks()) {
41729 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041731 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041732 printf(" %d", n_writer);
41733 printf(" %d", n_name);
41734 printf(" %d", n_content);
41735 printf("\n");
41736 }
41737 }
41738 }
41739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041740 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041741#endif
41742
Daniel Veillard42595322004-11-08 10:52:06 +000041743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041744}
41745
41746
41747static int
41748test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041750
William M. Brack21e4ef22005-01-02 09:53:13 +000041751#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041752 int mem_base;
41753 int ret_val;
41754 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41755 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041756 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041757 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041758 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041759 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041760 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041761 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041762 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041763 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041764
Daniel Veillarde43cc572004-11-03 11:50:29 +000041765 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41766 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41767 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41768 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41769 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041771 writer = gen_xmlTextWriterPtr(n_writer, 0);
41772 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41773 name = gen_const_xmlChar_ptr(n_name, 2);
41774 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41775 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041776
William M. Brackf13f77f2004-11-12 16:03:48 +000041777 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041778 desret_int(ret_val);
41779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041780 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041781 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41782 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41783 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41784 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041785 xmlResetLastError();
41786 if (mem_base != xmlMemBlocks()) {
41787 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041789 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041790 printf(" %d", n_writer);
41791 printf(" %d", n_prefix);
41792 printf(" %d", n_name);
41793 printf(" %d", n_namespaceURI);
41794 printf(" %d", n_content);
41795 printf("\n");
41796 }
41797 }
41798 }
41799 }
41800 }
41801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041802 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041803#endif
41804
Daniel Veillard42595322004-11-08 10:52:06 +000041805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041806}
41807
41808
41809static int
41810test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041812
William M. Brack21e4ef22005-01-02 09:53:13 +000041813#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814 int mem_base;
41815 int ret_val;
41816 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41817 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041818 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041819 int n_data;
41820 int start; /* the position within the data of the first byte to encode */
41821 int n_start;
41822 int len; /* the number of bytes to encode */
41823 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041824
Daniel Veillarde43cc572004-11-03 11:50:29 +000041825 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41826 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41827 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41828 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041830 writer = gen_xmlTextWriterPtr(n_writer, 0);
41831 data = gen_const_char_ptr(n_data, 1);
41832 start = gen_int(n_start, 2);
41833 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041834
William M. Brackf13f77f2004-11-12 16:03:48 +000041835 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041836 desret_int(ret_val);
41837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041838 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041839 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041840 des_int(n_start, start, 2);
41841 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041842 xmlResetLastError();
41843 if (mem_base != xmlMemBlocks()) {
41844 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041846 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041847 printf(" %d", n_writer);
41848 printf(" %d", n_data);
41849 printf(" %d", n_start);
41850 printf(" %d", n_len);
41851 printf("\n");
41852 }
41853 }
41854 }
41855 }
41856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041857 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041858#endif
41859
Daniel Veillard42595322004-11-08 10:52:06 +000041860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041861}
41862
41863
41864static int
41865test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041867
William M. Brack21e4ef22005-01-02 09:53:13 +000041868#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041869 int mem_base;
41870 int ret_val;
41871 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41872 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041873 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041874 int n_data;
41875 int start; /* the position within the data of the first byte to encode */
41876 int n_start;
41877 int len; /* the number of bytes to encode */
41878 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041879
Daniel Veillarde43cc572004-11-03 11:50:29 +000041880 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41881 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41882 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41883 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041885 writer = gen_xmlTextWriterPtr(n_writer, 0);
41886 data = gen_const_char_ptr(n_data, 1);
41887 start = gen_int(n_start, 2);
41888 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041889
William M. Brackf13f77f2004-11-12 16:03:48 +000041890 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041891 desret_int(ret_val);
41892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041893 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041894 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041895 des_int(n_start, start, 2);
41896 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041897 xmlResetLastError();
41898 if (mem_base != xmlMemBlocks()) {
41899 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041901 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041902 printf(" %d", n_writer);
41903 printf(" %d", n_data);
41904 printf(" %d", n_start);
41905 printf(" %d", n_len);
41906 printf("\n");
41907 }
41908 }
41909 }
41910 }
41911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041912 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041913#endif
41914
Daniel Veillard42595322004-11-08 10:52:06 +000041915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916}
41917
41918
41919static int
41920test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041922
William M. Brack21e4ef22005-01-02 09:53:13 +000041923#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041924 int mem_base;
41925 int ret_val;
41926 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41927 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041928 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041929 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041930
Daniel Veillarde43cc572004-11-03 11:50:29 +000041931 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41932 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041934 writer = gen_xmlTextWriterPtr(n_writer, 0);
41935 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041936
William M. Brackf13f77f2004-11-12 16:03:48 +000041937 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041938 desret_int(ret_val);
41939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041940 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041941 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041942 xmlResetLastError();
41943 if (mem_base != xmlMemBlocks()) {
41944 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041946 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041947 printf(" %d", n_writer);
41948 printf(" %d", n_content);
41949 printf("\n");
41950 }
41951 }
41952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041953 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041954#endif
41955
Daniel Veillard42595322004-11-08 10:52:06 +000041956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041957}
41958
41959
41960static int
41961test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041963
William M. Brack21e4ef22005-01-02 09:53:13 +000041964#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041965 int mem_base;
41966 int ret_val;
41967 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41968 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041969 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041970 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041971
Daniel Veillarde43cc572004-11-03 11:50:29 +000041972 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41973 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041975 writer = gen_xmlTextWriterPtr(n_writer, 0);
41976 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041977
William M. Brackf13f77f2004-11-12 16:03:48 +000041978 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041979 desret_int(ret_val);
41980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041981 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041982 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041983 xmlResetLastError();
41984 if (mem_base != xmlMemBlocks()) {
41985 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041987 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041988 printf(" %d", n_writer);
41989 printf(" %d", n_content);
41990 printf("\n");
41991 }
41992 }
41993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041994 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041995#endif
41996
Daniel Veillard42595322004-11-08 10:52:06 +000041997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041998}
41999
42000
42001static int
42002test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042004
William M. Brack21e4ef22005-01-02 09:53:13 +000042005#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042006 int mem_base;
42007 int ret_val;
42008 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42009 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042010 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042011 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042012 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042013 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042014 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042015 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042016 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042017 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042018
Daniel Veillarde43cc572004-11-03 11:50:29 +000042019 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42020 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42021 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42022 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42023 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
42024 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042025 writer = gen_xmlTextWriterPtr(n_writer, 0);
42026 name = gen_const_xmlChar_ptr(n_name, 1);
42027 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42028 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
42029 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042030
William M. Brackf13f77f2004-11-12 16:03:48 +000042031 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042032 desret_int(ret_val);
42033 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042034 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042035 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42036 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42037 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
42038 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042039 xmlResetLastError();
42040 if (mem_base != xmlMemBlocks()) {
42041 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
42042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042043 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042044 printf(" %d", n_writer);
42045 printf(" %d", n_name);
42046 printf(" %d", n_pubid);
42047 printf(" %d", n_sysid);
42048 printf(" %d", n_subset);
42049 printf("\n");
42050 }
42051 }
42052 }
42053 }
42054 }
42055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042056 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042057#endif
42058
Daniel Veillard42595322004-11-08 10:52:06 +000042059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042060}
42061
42062
42063static int
42064test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042066
William M. Brack21e4ef22005-01-02 09:53:13 +000042067#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042068 int mem_base;
42069 int ret_val;
42070 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42071 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042072 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042073 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042074 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042075 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042076
Daniel Veillarde43cc572004-11-03 11:50:29 +000042077 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42078 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42079 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042081 writer = gen_xmlTextWriterPtr(n_writer, 0);
42082 name = gen_const_xmlChar_ptr(n_name, 1);
42083 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042084
William M. Brackf13f77f2004-11-12 16:03:48 +000042085 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042086 desret_int(ret_val);
42087 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042088 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042089 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42090 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042091 xmlResetLastError();
42092 if (mem_base != xmlMemBlocks()) {
42093 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
42094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042095 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042096 printf(" %d", n_writer);
42097 printf(" %d", n_name);
42098 printf(" %d", n_content);
42099 printf("\n");
42100 }
42101 }
42102 }
42103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042104 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042105#endif
42106
Daniel Veillard42595322004-11-08 10:52:06 +000042107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042108}
42109
42110
42111static int
42112test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042114
William M. Brack21e4ef22005-01-02 09:53:13 +000042115#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042116 int mem_base;
42117 int ret_val;
42118 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42119 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042120 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042121 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042122 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042123 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042124
Daniel Veillarde43cc572004-11-03 11:50:29 +000042125 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42126 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42127 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042129 writer = gen_xmlTextWriterPtr(n_writer, 0);
42130 name = gen_const_xmlChar_ptr(n_name, 1);
42131 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042132
William M. Brackf13f77f2004-11-12 16:03:48 +000042133 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042134 desret_int(ret_val);
42135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042136 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042137 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42138 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042139 xmlResetLastError();
42140 if (mem_base != xmlMemBlocks()) {
42141 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
42142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042143 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042144 printf(" %d", n_writer);
42145 printf(" %d", n_name);
42146 printf(" %d", n_content);
42147 printf("\n");
42148 }
42149 }
42150 }
42151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042152 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042153#endif
42154
Daniel Veillard42595322004-11-08 10:52:06 +000042155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042156}
42157
42158
42159static int
42160test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042162
William M. Brack21e4ef22005-01-02 09:53:13 +000042163#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042164 int mem_base;
42165 int ret_val;
42166 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42167 int n_writer;
42168 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42169 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042170 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042171 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042172 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042173 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042174 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042175 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042176 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042177 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042178 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042179 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042180
Daniel Veillarde43cc572004-11-03 11:50:29 +000042181 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42182 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42183 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42184 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42185 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42186 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42187 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042189 writer = gen_xmlTextWriterPtr(n_writer, 0);
42190 pe = gen_int(n_pe, 1);
42191 name = gen_const_xmlChar_ptr(n_name, 2);
42192 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42193 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42194 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
42195 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042196
William M. Brackf13f77f2004-11-12 16:03:48 +000042197 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 +000042198 desret_int(ret_val);
42199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042200 des_xmlTextWriterPtr(n_writer, writer, 0);
42201 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042202 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42203 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42204 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42205 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
42206 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042207 xmlResetLastError();
42208 if (mem_base != xmlMemBlocks()) {
42209 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
42210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042211 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042212 printf(" %d", n_writer);
42213 printf(" %d", n_pe);
42214 printf(" %d", n_name);
42215 printf(" %d", n_pubid);
42216 printf(" %d", n_sysid);
42217 printf(" %d", n_ndataid);
42218 printf(" %d", n_content);
42219 printf("\n");
42220 }
42221 }
42222 }
42223 }
42224 }
42225 }
42226 }
42227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042228 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042229#endif
42230
Daniel Veillard42595322004-11-08 10:52:06 +000042231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042232}
42233
42234
42235static int
42236test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042238
William M. Brack21e4ef22005-01-02 09:53:13 +000042239#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042240 int mem_base;
42241 int ret_val;
42242 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42243 int n_writer;
42244 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42245 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042246 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042247 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042248 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042249 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042250 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042251 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042252 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042253 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042254
Daniel Veillarde43cc572004-11-03 11:50:29 +000042255 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42256 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42257 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42258 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42259 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42260 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42261 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042262 writer = gen_xmlTextWriterPtr(n_writer, 0);
42263 pe = gen_int(n_pe, 1);
42264 name = gen_const_xmlChar_ptr(n_name, 2);
42265 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42266 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42267 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042268
William M. Brackf13f77f2004-11-12 16:03:48 +000042269 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042270 desret_int(ret_val);
42271 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042272 des_xmlTextWriterPtr(n_writer, writer, 0);
42273 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042274 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42275 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42276 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42277 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042278 xmlResetLastError();
42279 if (mem_base != xmlMemBlocks()) {
42280 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
42281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042282 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042283 printf(" %d", n_writer);
42284 printf(" %d", n_pe);
42285 printf(" %d", n_name);
42286 printf(" %d", n_pubid);
42287 printf(" %d", n_sysid);
42288 printf(" %d", n_ndataid);
42289 printf("\n");
42290 }
42291 }
42292 }
42293 }
42294 }
42295 }
42296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042297 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042298#endif
42299
Daniel Veillard42595322004-11-08 10:52:06 +000042300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042301}
42302
42303
42304static int
42305test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042307
William M. Brack21e4ef22005-01-02 09:53:13 +000042308#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042309 int mem_base;
42310 int ret_val;
42311 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42312 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042313 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042314 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042315 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042316 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042317 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042318 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042319
Daniel Veillarde43cc572004-11-03 11:50:29 +000042320 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42321 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42322 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42323 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042325 writer = gen_xmlTextWriterPtr(n_writer, 0);
42326 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42327 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42328 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042329
William M. Brackf13f77f2004-11-12 16:03:48 +000042330 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042331 desret_int(ret_val);
42332 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042333 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042334 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42335 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42336 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042337 xmlResetLastError();
42338 if (mem_base != xmlMemBlocks()) {
42339 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042341 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042342 printf(" %d", n_writer);
42343 printf(" %d", n_pubid);
42344 printf(" %d", n_sysid);
42345 printf(" %d", n_ndataid);
42346 printf("\n");
42347 }
42348 }
42349 }
42350 }
42351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042352 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042353#endif
42354
Daniel Veillard42595322004-11-08 10:52:06 +000042355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042356}
42357
42358
42359static int
42360test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042362
William M. Brack21e4ef22005-01-02 09:53:13 +000042363#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042364 int mem_base;
42365 int ret_val;
42366 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42367 int n_writer;
42368 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42369 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042370 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042371 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042372 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042373 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042374
Daniel Veillarde43cc572004-11-03 11:50:29 +000042375 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42376 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42377 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42378 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42379 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042380 writer = gen_xmlTextWriterPtr(n_writer, 0);
42381 pe = gen_int(n_pe, 1);
42382 name = gen_const_xmlChar_ptr(n_name, 2);
42383 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042384
William M. Brackf13f77f2004-11-12 16:03:48 +000042385 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042386 desret_int(ret_val);
42387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042388 des_xmlTextWriterPtr(n_writer, writer, 0);
42389 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042390 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42391 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042392 xmlResetLastError();
42393 if (mem_base != xmlMemBlocks()) {
42394 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042396 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042397 printf(" %d", n_writer);
42398 printf(" %d", n_pe);
42399 printf(" %d", n_name);
42400 printf(" %d", n_content);
42401 printf("\n");
42402 }
42403 }
42404 }
42405 }
42406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042407 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042408#endif
42409
Daniel Veillard42595322004-11-08 10:52:06 +000042410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042411}
42412
42413
42414static int
42415test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042417
William M. Brack21e4ef22005-01-02 09:53:13 +000042418#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042419 int mem_base;
42420 int ret_val;
42421 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42422 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042423 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042424 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042425 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042426 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042427 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042428 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042429
Daniel Veillarde43cc572004-11-03 11:50:29 +000042430 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42431 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42432 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42433 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042435 writer = gen_xmlTextWriterPtr(n_writer, 0);
42436 name = gen_const_xmlChar_ptr(n_name, 1);
42437 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42438 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042439
William M. Brackf13f77f2004-11-12 16:03:48 +000042440 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042441 desret_int(ret_val);
42442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042443 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042444 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42445 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42446 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042447 xmlResetLastError();
42448 if (mem_base != xmlMemBlocks()) {
42449 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042451 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042452 printf(" %d", n_writer);
42453 printf(" %d", n_name);
42454 printf(" %d", n_pubid);
42455 printf(" %d", n_sysid);
42456 printf("\n");
42457 }
42458 }
42459 }
42460 }
42461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042462 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042463#endif
42464
Daniel Veillard42595322004-11-08 10:52:06 +000042465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042466}
42467
42468
42469static int
42470test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042472
William M. Brack21e4ef22005-01-02 09:53:13 +000042473#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042474 int mem_base;
42475 int ret_val;
42476 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42477 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042478 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042479 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042480 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042481 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042482
Daniel Veillarde43cc572004-11-03 11:50:29 +000042483 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42484 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42485 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042487 writer = gen_xmlTextWriterPtr(n_writer, 0);
42488 name = gen_const_xmlChar_ptr(n_name, 1);
42489 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042490
William M. Brackf13f77f2004-11-12 16:03:48 +000042491 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042492 desret_int(ret_val);
42493 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042494 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042495 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42496 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042497 xmlResetLastError();
42498 if (mem_base != xmlMemBlocks()) {
42499 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042501 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042502 printf(" %d", n_writer);
42503 printf(" %d", n_name);
42504 printf(" %d", n_content);
42505 printf("\n");
42506 }
42507 }
42508 }
42509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042510 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042511#endif
42512
Daniel Veillard42595322004-11-08 10:52:06 +000042513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042514}
42515
42516
42517static int
42518test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042520
William M. Brack21e4ef22005-01-02 09:53:13 +000042521#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042522 int mem_base;
42523 int ret_val;
42524 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42525 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042526 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042527 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042528 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042529 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042530 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042531 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042532 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042533 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042534
Daniel Veillarde43cc572004-11-03 11:50:29 +000042535 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42536 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42537 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42538 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42539 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042541 writer = gen_xmlTextWriterPtr(n_writer, 0);
42542 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42543 name = gen_const_xmlChar_ptr(n_name, 2);
42544 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42545 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042546
William M. Brackf13f77f2004-11-12 16:03:48 +000042547 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042548 desret_int(ret_val);
42549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042550 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042551 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42552 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42553 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42554 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042555 xmlResetLastError();
42556 if (mem_base != xmlMemBlocks()) {
42557 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042559 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042560 printf(" %d", n_writer);
42561 printf(" %d", n_prefix);
42562 printf(" %d", n_name);
42563 printf(" %d", n_namespaceURI);
42564 printf(" %d", n_content);
42565 printf("\n");
42566 }
42567 }
42568 }
42569 }
42570 }
42571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042572 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042573#endif
42574
Daniel Veillard42595322004-11-08 10:52:06 +000042575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042576}
42577
42578
42579static int
42580test_xmlTextWriterWriteFormatAttribute(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_xmlTextWriterWriteFormatAttributeNS(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_xmlTextWriterWriteFormatCDATA(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_xmlTextWriterWriteFormatComment(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_xmlTextWriterWriteFormatDTD(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_xmlTextWriterWriteFormatDTDAttlist(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_xmlTextWriterWriteFormatDTDElement(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_xmlTextWriterWriteFormatDTDInternalEntity(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_xmlTextWriterWriteFormatElement(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_xmlTextWriterWriteFormatElementNS(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
42678
42679static int
42680test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042682
42683
42684 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042686}
42687
42688
42689static int
42690test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042692
42693
42694 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042696}
42697
42698
42699static int
42700test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042702
42703
42704 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042706}
42707
42708
42709static int
42710test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042712
William M. Brack21e4ef22005-01-02 09:53:13 +000042713#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042714 int mem_base;
42715 int ret_val;
42716 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42717 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042718 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042719 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042720 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042721 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042722
Daniel Veillarde43cc572004-11-03 11:50:29 +000042723 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42724 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42725 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042727 writer = gen_xmlTextWriterPtr(n_writer, 0);
42728 target = gen_const_xmlChar_ptr(n_target, 1);
42729 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042730
William M. Brackf13f77f2004-11-12 16:03:48 +000042731 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042732 desret_int(ret_val);
42733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042734 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042735 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42736 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042737 xmlResetLastError();
42738 if (mem_base != xmlMemBlocks()) {
42739 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042741 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042742 printf(" %d", n_writer);
42743 printf(" %d", n_target);
42744 printf(" %d", n_content);
42745 printf("\n");
42746 }
42747 }
42748 }
42749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042750 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042751#endif
42752
Daniel Veillard42595322004-11-08 10:52:06 +000042753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042754}
42755
42756
42757static int
42758test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042760
William M. Brack21e4ef22005-01-02 09:53:13 +000042761#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042762 int mem_base;
42763 int ret_val;
42764 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42765 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042766 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042767 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042768
Daniel Veillarde43cc572004-11-03 11:50:29 +000042769 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42770 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42771 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042772 writer = gen_xmlTextWriterPtr(n_writer, 0);
42773 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042774
William M. Brackf13f77f2004-11-12 16:03:48 +000042775 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042776 desret_int(ret_val);
42777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042778 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042779 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042780 xmlResetLastError();
42781 if (mem_base != xmlMemBlocks()) {
42782 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042784 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042785 printf(" %d", n_writer);
42786 printf(" %d", n_content);
42787 printf("\n");
42788 }
42789 }
42790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042791 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042792#endif
42793
Daniel Veillard42595322004-11-08 10:52:06 +000042794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042795}
42796
42797
42798static int
42799test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042801
William M. Brack21e4ef22005-01-02 09:53:13 +000042802#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042803 int mem_base;
42804 int ret_val;
42805 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42806 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042807 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042808 int n_content;
42809 int len; /* length of the text string */
42810 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042811
Daniel Veillarde43cc572004-11-03 11:50:29 +000042812 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42813 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42814 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042816 writer = gen_xmlTextWriterPtr(n_writer, 0);
42817 content = gen_const_xmlChar_ptr(n_content, 1);
42818 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042819
William M. Brackf13f77f2004-11-12 16:03:48 +000042820 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042821 desret_int(ret_val);
42822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042823 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042824 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042825 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042826 xmlResetLastError();
42827 if (mem_base != xmlMemBlocks()) {
42828 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042830 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042831 printf(" %d", n_writer);
42832 printf(" %d", n_content);
42833 printf(" %d", n_len);
42834 printf("\n");
42835 }
42836 }
42837 }
42838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042839 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042840#endif
42841
Daniel Veillard42595322004-11-08 10:52:06 +000042842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042843}
42844
42845
42846static int
42847test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042849
William M. Brack21e4ef22005-01-02 09:53:13 +000042850#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042851 int mem_base;
42852 int ret_val;
42853 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42854 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042855 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042856 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042857
Daniel Veillarde43cc572004-11-03 11:50:29 +000042858 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42859 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042861 writer = gen_xmlTextWriterPtr(n_writer, 0);
42862 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042863
William M. Brackf13f77f2004-11-12 16:03:48 +000042864 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042865 desret_int(ret_val);
42866 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042867 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042868 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042869 xmlResetLastError();
42870 if (mem_base != xmlMemBlocks()) {
42871 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042873 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042874 printf(" %d", n_writer);
42875 printf(" %d", n_content);
42876 printf("\n");
42877 }
42878 }
42879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042880 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042881#endif
42882
Daniel Veillard42595322004-11-08 10:52:06 +000042883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042884}
42885
42886
42887static int
42888test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042890
42891
42892 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042894}
42895
42896
42897static int
42898test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042900
42901
42902 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042904}
42905
42906
42907static int
42908test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042910
42911
42912 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042914}
42915
42916
42917static int
42918test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042920
42921
42922 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042924}
42925
42926
42927static int
42928test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042930
42931
42932 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042934}
42935
42936
42937static int
42938test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042940
42941
42942 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042944}
42945
42946
42947static int
42948test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042950
42951
42952 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042954}
42955
42956
42957static int
42958test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042960
42961
42962 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042964}
42965
42966
42967static int
42968test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042970
42971
42972 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042974}
42975
42976
42977static int
42978test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042980
42981
42982 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042984}
42985
42986
42987static int
42988test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042990
42991
42992 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042994}
42995
42996
42997static int
42998test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043000
43001
43002 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043004}
43005
43006
43007static int
43008test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043010
43011
43012 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043014}
43015
43016static int
43017test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043019
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043020 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043021 test_ret += test_xmlNewTextWriter();
43022 test_ret += test_xmlNewTextWriterFilename();
43023 test_ret += test_xmlNewTextWriterMemory();
43024 test_ret += test_xmlNewTextWriterPushParser();
43025 test_ret += test_xmlNewTextWriterTree();
43026 test_ret += test_xmlTextWriterEndAttribute();
43027 test_ret += test_xmlTextWriterEndCDATA();
43028 test_ret += test_xmlTextWriterEndComment();
43029 test_ret += test_xmlTextWriterEndDTD();
43030 test_ret += test_xmlTextWriterEndDTDAttlist();
43031 test_ret += test_xmlTextWriterEndDTDElement();
43032 test_ret += test_xmlTextWriterEndDTDEntity();
43033 test_ret += test_xmlTextWriterEndDocument();
43034 test_ret += test_xmlTextWriterEndElement();
43035 test_ret += test_xmlTextWriterEndPI();
43036 test_ret += test_xmlTextWriterFlush();
43037 test_ret += test_xmlTextWriterFullEndElement();
43038 test_ret += test_xmlTextWriterSetIndent();
43039 test_ret += test_xmlTextWriterSetIndentString();
43040 test_ret += test_xmlTextWriterStartAttribute();
43041 test_ret += test_xmlTextWriterStartAttributeNS();
43042 test_ret += test_xmlTextWriterStartCDATA();
43043 test_ret += test_xmlTextWriterStartComment();
43044 test_ret += test_xmlTextWriterStartDTD();
43045 test_ret += test_xmlTextWriterStartDTDAttlist();
43046 test_ret += test_xmlTextWriterStartDTDElement();
43047 test_ret += test_xmlTextWriterStartDTDEntity();
43048 test_ret += test_xmlTextWriterStartDocument();
43049 test_ret += test_xmlTextWriterStartElement();
43050 test_ret += test_xmlTextWriterStartElementNS();
43051 test_ret += test_xmlTextWriterStartPI();
43052 test_ret += test_xmlTextWriterWriteAttribute();
43053 test_ret += test_xmlTextWriterWriteAttributeNS();
43054 test_ret += test_xmlTextWriterWriteBase64();
43055 test_ret += test_xmlTextWriterWriteBinHex();
43056 test_ret += test_xmlTextWriterWriteCDATA();
43057 test_ret += test_xmlTextWriterWriteComment();
43058 test_ret += test_xmlTextWriterWriteDTD();
43059 test_ret += test_xmlTextWriterWriteDTDAttlist();
43060 test_ret += test_xmlTextWriterWriteDTDElement();
43061 test_ret += test_xmlTextWriterWriteDTDEntity();
43062 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
43063 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
43064 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
43065 test_ret += test_xmlTextWriterWriteDTDNotation();
43066 test_ret += test_xmlTextWriterWriteElement();
43067 test_ret += test_xmlTextWriterWriteElementNS();
43068 test_ret += test_xmlTextWriterWriteFormatAttribute();
43069 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
43070 test_ret += test_xmlTextWriterWriteFormatCDATA();
43071 test_ret += test_xmlTextWriterWriteFormatComment();
43072 test_ret += test_xmlTextWriterWriteFormatDTD();
43073 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
43074 test_ret += test_xmlTextWriterWriteFormatDTDElement();
43075 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
43076 test_ret += test_xmlTextWriterWriteFormatElement();
43077 test_ret += test_xmlTextWriterWriteFormatElementNS();
43078 test_ret += test_xmlTextWriterWriteFormatPI();
43079 test_ret += test_xmlTextWriterWriteFormatRaw();
43080 test_ret += test_xmlTextWriterWriteFormatString();
43081 test_ret += test_xmlTextWriterWritePI();
43082 test_ret += test_xmlTextWriterWriteRaw();
43083 test_ret += test_xmlTextWriterWriteRawLen();
43084 test_ret += test_xmlTextWriterWriteString();
43085 test_ret += test_xmlTextWriterWriteVFormatAttribute();
43086 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
43087 test_ret += test_xmlTextWriterWriteVFormatCDATA();
43088 test_ret += test_xmlTextWriterWriteVFormatComment();
43089 test_ret += test_xmlTextWriterWriteVFormatDTD();
43090 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
43091 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
43092 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
43093 test_ret += test_xmlTextWriterWriteVFormatElement();
43094 test_ret += test_xmlTextWriterWriteVFormatElementNS();
43095 test_ret += test_xmlTextWriterWriteVFormatPI();
43096 test_ret += test_xmlTextWriterWriteVFormatRaw();
43097 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043098
Daniel Veillard42595322004-11-08 10:52:06 +000043099 if (test_ret != 0)
43100 printf("Module xmlwriter: %d errors\n", test_ret);
43101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043102}
43103
43104static int
43105test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043107
William M. Brack21e4ef22005-01-02 09:53:13 +000043108#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043109 int mem_base;
43110 double ret_val;
43111 int val; /* a boolean */
43112 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043113
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043114 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43115 mem_base = xmlMemBlocks();
43116 val = gen_int(n_val, 0);
43117
43118 ret_val = xmlXPathCastBooleanToNumber(val);
43119 desret_double(ret_val);
43120 call_tests++;
43121 des_int(n_val, val, 0);
43122 xmlResetLastError();
43123 if (mem_base != xmlMemBlocks()) {
43124 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
43125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043126 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043127 printf(" %d", n_val);
43128 printf("\n");
43129 }
43130 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043131 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043132#endif
43133
Daniel Veillard42595322004-11-08 10:52:06 +000043134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043135}
43136
43137
43138static int
43139test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043141
William M. Brack21e4ef22005-01-02 09:53:13 +000043142#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043143 int mem_base;
43144 xmlChar * ret_val;
43145 int val; /* a boolean */
43146 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043147
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043148 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043150 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043151
43152 ret_val = xmlXPathCastBooleanToString(val);
43153 desret_xmlChar_ptr(ret_val);
43154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043155 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043156 xmlResetLastError();
43157 if (mem_base != xmlMemBlocks()) {
43158 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
43159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043160 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043161 printf(" %d", n_val);
43162 printf("\n");
43163 }
43164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043165 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043166#endif
43167
Daniel Veillard42595322004-11-08 10:52:06 +000043168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043169}
43170
43171
43172static int
43173test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043175
William M. Brack21e4ef22005-01-02 09:53:13 +000043176#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043177 int mem_base;
43178 int ret_val;
43179 xmlNodeSetPtr ns; /* a node-set */
43180 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043181
Daniel Veillardce682bc2004-11-05 17:22:25 +000043182 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43183 mem_base = xmlMemBlocks();
43184 ns = gen_xmlNodeSetPtr(n_ns, 0);
43185
43186 ret_val = xmlXPathCastNodeSetToBoolean(ns);
43187 desret_int(ret_val);
43188 call_tests++;
43189 des_xmlNodeSetPtr(n_ns, ns, 0);
43190 xmlResetLastError();
43191 if (mem_base != xmlMemBlocks()) {
43192 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
43193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043194 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043195 printf(" %d", n_ns);
43196 printf("\n");
43197 }
43198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043199 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043200#endif
43201
Daniel Veillard42595322004-11-08 10:52:06 +000043202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043203}
43204
43205
43206static int
43207test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043209
William M. Brack21e4ef22005-01-02 09:53:13 +000043210#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043211 int mem_base;
43212 double ret_val;
43213 xmlNodeSetPtr ns; /* a node-set */
43214 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043215
Daniel Veillardce682bc2004-11-05 17:22:25 +000043216 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43217 mem_base = xmlMemBlocks();
43218 ns = gen_xmlNodeSetPtr(n_ns, 0);
43219
43220 ret_val = xmlXPathCastNodeSetToNumber(ns);
43221 desret_double(ret_val);
43222 call_tests++;
43223 des_xmlNodeSetPtr(n_ns, ns, 0);
43224 xmlResetLastError();
43225 if (mem_base != xmlMemBlocks()) {
43226 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
43227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043228 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043229 printf(" %d", n_ns);
43230 printf("\n");
43231 }
43232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043233 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043234#endif
43235
Daniel Veillard42595322004-11-08 10:52:06 +000043236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043237}
43238
43239
43240static int
43241test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043243
William M. Brack21e4ef22005-01-02 09:53:13 +000043244#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043245 int mem_base;
43246 xmlChar * ret_val;
43247 xmlNodeSetPtr ns; /* a node-set */
43248 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043249
Daniel Veillardce682bc2004-11-05 17:22:25 +000043250 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43251 mem_base = xmlMemBlocks();
43252 ns = gen_xmlNodeSetPtr(n_ns, 0);
43253
43254 ret_val = xmlXPathCastNodeSetToString(ns);
43255 desret_xmlChar_ptr(ret_val);
43256 call_tests++;
43257 des_xmlNodeSetPtr(n_ns, ns, 0);
43258 xmlResetLastError();
43259 if (mem_base != xmlMemBlocks()) {
43260 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
43261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043262 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043263 printf(" %d", n_ns);
43264 printf("\n");
43265 }
43266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043267 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043268#endif
43269
Daniel Veillard42595322004-11-08 10:52:06 +000043270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043271}
43272
43273
43274static int
43275test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043277
William M. Brack21e4ef22005-01-02 09:53:13 +000043278#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043279 int mem_base;
43280 double ret_val;
43281 xmlNodePtr node; /* a node */
43282 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043283
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043284 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43285 mem_base = xmlMemBlocks();
43286 node = gen_xmlNodePtr(n_node, 0);
43287
43288 ret_val = xmlXPathCastNodeToNumber(node);
43289 desret_double(ret_val);
43290 call_tests++;
43291 des_xmlNodePtr(n_node, node, 0);
43292 xmlResetLastError();
43293 if (mem_base != xmlMemBlocks()) {
43294 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043296 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043297 printf(" %d", n_node);
43298 printf("\n");
43299 }
43300 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043301 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043302#endif
43303
Daniel Veillard42595322004-11-08 10:52:06 +000043304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043305}
43306
43307
43308static int
43309test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043311
William M. Brack21e4ef22005-01-02 09:53:13 +000043312#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043313 int mem_base;
43314 xmlChar * ret_val;
43315 xmlNodePtr node; /* a node */
43316 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043317
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043318 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043320 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043321
43322 ret_val = xmlXPathCastNodeToString(node);
43323 desret_xmlChar_ptr(ret_val);
43324 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043325 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043326 xmlResetLastError();
43327 if (mem_base != xmlMemBlocks()) {
43328 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043330 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043331 printf(" %d", n_node);
43332 printf("\n");
43333 }
43334 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043335 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043336#endif
43337
Daniel Veillard42595322004-11-08 10:52:06 +000043338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043339}
43340
43341
43342static int
43343test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043345
William M. Brack21e4ef22005-01-02 09:53:13 +000043346#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043347 int mem_base;
43348 int ret_val;
43349 double val; /* a number */
43350 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043351
Daniel Veillard3d95c732004-11-06 22:25:14 +000043352 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43353 mem_base = xmlMemBlocks();
43354 val = gen_double(n_val, 0);
43355
43356 ret_val = xmlXPathCastNumberToBoolean(val);
43357 desret_int(ret_val);
43358 call_tests++;
43359 des_double(n_val, val, 0);
43360 xmlResetLastError();
43361 if (mem_base != xmlMemBlocks()) {
43362 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043364 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043365 printf(" %d", n_val);
43366 printf("\n");
43367 }
43368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043369 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043370#endif
43371
Daniel Veillard42595322004-11-08 10:52:06 +000043372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043373}
43374
43375
43376static int
43377test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043379
William M. Brack21e4ef22005-01-02 09:53:13 +000043380#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043381 int mem_base;
43382 xmlChar * ret_val;
43383 double val; /* a number */
43384 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043385
Daniel Veillard3d95c732004-11-06 22:25:14 +000043386 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43387 mem_base = xmlMemBlocks();
43388 val = gen_double(n_val, 0);
43389
43390 ret_val = xmlXPathCastNumberToString(val);
43391 desret_xmlChar_ptr(ret_val);
43392 call_tests++;
43393 des_double(n_val, val, 0);
43394 xmlResetLastError();
43395 if (mem_base != xmlMemBlocks()) {
43396 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043398 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043399 printf(" %d", n_val);
43400 printf("\n");
43401 }
43402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043403 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043404#endif
43405
Daniel Veillard42595322004-11-08 10:52:06 +000043406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043407}
43408
43409
43410static int
43411test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043413
William M. Brack21e4ef22005-01-02 09:53:13 +000043414#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043415 int mem_base;
43416 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043417 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043418 int n_val;
43419
43420 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43421 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043422 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043423
William M. Brackf13f77f2004-11-12 16:03:48 +000043424 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043425 desret_int(ret_val);
43426 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043427 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043428 xmlResetLastError();
43429 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043430 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043432 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043433 printf(" %d", n_val);
43434 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043435 }
43436 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043437 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043438#endif
43439
Daniel Veillard42595322004-11-08 10:52:06 +000043440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043441}
43442
43443
43444static int
43445test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043447
William M. Brack21e4ef22005-01-02 09:53:13 +000043448#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043449 int mem_base;
43450 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043451 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043452 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043453
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043454 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43455 mem_base = xmlMemBlocks();
43456 val = gen_const_xmlChar_ptr(n_val, 0);
43457
William M. Brackf13f77f2004-11-12 16:03:48 +000043458 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043459 desret_double(ret_val);
43460 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043461 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043462 xmlResetLastError();
43463 if (mem_base != xmlMemBlocks()) {
43464 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043466 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043467 printf(" %d", n_val);
43468 printf("\n");
43469 }
43470 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043471 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043472#endif
43473
Daniel Veillard42595322004-11-08 10:52:06 +000043474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043475}
43476
43477
43478static int
43479test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043481
William M. Brack21e4ef22005-01-02 09:53:13 +000043482#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043483 int mem_base;
43484 int ret_val;
43485 xmlXPathObjectPtr val; /* an XPath object */
43486 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043487
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043488 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043490 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043491
43492 ret_val = xmlXPathCastToBoolean(val);
43493 desret_int(ret_val);
43494 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043495 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043496 xmlResetLastError();
43497 if (mem_base != xmlMemBlocks()) {
43498 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043500 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043501 printf(" %d", n_val);
43502 printf("\n");
43503 }
43504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043505 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043506#endif
43507
Daniel Veillard42595322004-11-08 10:52:06 +000043508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043509}
43510
43511
43512static int
43513test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043515
William M. Brack21e4ef22005-01-02 09:53:13 +000043516#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043517 int mem_base;
43518 double ret_val;
43519 xmlXPathObjectPtr val; /* an XPath object */
43520 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043521
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043522 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43523 mem_base = xmlMemBlocks();
43524 val = gen_xmlXPathObjectPtr(n_val, 0);
43525
43526 ret_val = xmlXPathCastToNumber(val);
43527 desret_double(ret_val);
43528 call_tests++;
43529 des_xmlXPathObjectPtr(n_val, val, 0);
43530 xmlResetLastError();
43531 if (mem_base != xmlMemBlocks()) {
43532 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043534 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043535 printf(" %d", n_val);
43536 printf("\n");
43537 }
43538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043539 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043540#endif
43541
Daniel Veillard42595322004-11-08 10:52:06 +000043542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043543}
43544
43545
43546static int
43547test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043549
William M. Brack21e4ef22005-01-02 09:53:13 +000043550#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043551 int mem_base;
43552 xmlChar * ret_val;
43553 xmlXPathObjectPtr val; /* an XPath object */
43554 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043555
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043556 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043558 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043559
43560 ret_val = xmlXPathCastToString(val);
43561 desret_xmlChar_ptr(ret_val);
43562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043563 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043564 xmlResetLastError();
43565 if (mem_base != xmlMemBlocks()) {
43566 printf("Leak of %d blocks found in xmlXPathCastToString",
43567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043568 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043569 printf(" %d", n_val);
43570 printf("\n");
43571 }
43572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043573 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043574#endif
43575
Daniel Veillard42595322004-11-08 10:52:06 +000043576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043577}
43578
43579
43580static int
43581test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043583
William M. Brack21e4ef22005-01-02 09:53:13 +000043584#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043585 int mem_base;
43586 int ret_val;
43587 xmlNodePtr node1; /* the first node */
43588 int n_node1;
43589 xmlNodePtr node2; /* the second node */
43590 int n_node2;
43591
43592 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43593 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43594 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043595 node1 = gen_xmlNodePtr(n_node1, 0);
43596 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043597
43598 ret_val = xmlXPathCmpNodes(node1, node2);
43599 desret_int(ret_val);
43600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043601 des_xmlNodePtr(n_node1, node1, 0);
43602 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043603 xmlResetLastError();
43604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043605 printf("Leak of %d blocks found in xmlXPathCmpNodes",
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(" %d", n_node1);
43609 printf(" %d", n_node2);
43610 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043611 }
43612 }
43613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043614 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043615#endif
43616
Daniel Veillard42595322004-11-08 10:52:06 +000043617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043618}
43619
43620
43621static int
43622test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043624
43625
43626 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043628}
43629
Daniel Veillarda521d282004-11-09 14:59:59 +000043630#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043631
Daniel Veillardce682bc2004-11-05 17:22:25 +000043632#define gen_nb_xmlXPathCompExprPtr 1
43633static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43634 return(NULL);
43635}
43636static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43637}
Daniel Veillarda521d282004-11-09 14:59:59 +000043638#endif
43639
43640#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043641
43642#define gen_nb_xmlXPathContextPtr 1
43643static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43644 return(NULL);
43645}
43646static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43647}
Daniel Veillarda521d282004-11-09 14:59:59 +000043648#endif
43649
Daniel Veillardce682bc2004-11-05 17:22:25 +000043650
Daniel Veillardd93f6252004-11-02 15:53:51 +000043651static int
43652test_xmlXPathCompiledEval(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)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043656 int mem_base;
43657 xmlXPathObjectPtr ret_val;
43658 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43659 int n_comp;
43660 xmlXPathContextPtr ctx; /* the XPath context */
43661 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043662
Daniel Veillardce682bc2004-11-05 17:22:25 +000043663 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43664 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43665 mem_base = xmlMemBlocks();
43666 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43667 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43668
43669 ret_val = xmlXPathCompiledEval(comp, ctx);
43670 desret_xmlXPathObjectPtr(ret_val);
43671 call_tests++;
43672 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43673 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43674 xmlResetLastError();
43675 if (mem_base != xmlMemBlocks()) {
43676 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043678 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043679 printf(" %d", n_comp);
43680 printf(" %d", n_ctx);
43681 printf("\n");
43682 }
43683 }
43684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043685 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043686#endif
43687
Daniel Veillard42595322004-11-08 10:52:06 +000043688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043689}
43690
43691
43692static int
43693test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043695
William M. Brack21e4ef22005-01-02 09:53:13 +000043696#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043697 int mem_base;
43698 xmlXPathObjectPtr ret_val;
43699 xmlXPathObjectPtr val; /* an XPath object */
43700 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043701
Daniel Veillard3d97e662004-11-04 10:49:00 +000043702 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43703 mem_base = xmlMemBlocks();
43704 val = gen_xmlXPathObjectPtr(n_val, 0);
43705
43706 ret_val = xmlXPathConvertBoolean(val);
43707 val = NULL;
43708 desret_xmlXPathObjectPtr(ret_val);
43709 call_tests++;
43710 des_xmlXPathObjectPtr(n_val, val, 0);
43711 xmlResetLastError();
43712 if (mem_base != xmlMemBlocks()) {
43713 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043715 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043716 printf(" %d", n_val);
43717 printf("\n");
43718 }
43719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043720 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043721#endif
43722
Daniel Veillard42595322004-11-08 10:52:06 +000043723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043724}
43725
43726
43727static int
43728test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043730
William M. Brack21e4ef22005-01-02 09:53:13 +000043731#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043732 int mem_base;
43733 xmlXPathObjectPtr ret_val;
43734 xmlXPathObjectPtr val; /* an XPath object */
43735 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043736
Daniel Veillard3d97e662004-11-04 10:49:00 +000043737 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43738 mem_base = xmlMemBlocks();
43739 val = gen_xmlXPathObjectPtr(n_val, 0);
43740
43741 ret_val = xmlXPathConvertNumber(val);
43742 val = NULL;
43743 desret_xmlXPathObjectPtr(ret_val);
43744 call_tests++;
43745 des_xmlXPathObjectPtr(n_val, val, 0);
43746 xmlResetLastError();
43747 if (mem_base != xmlMemBlocks()) {
43748 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043750 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043751 printf(" %d", n_val);
43752 printf("\n");
43753 }
43754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043755 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043756#endif
43757
Daniel Veillard42595322004-11-08 10:52:06 +000043758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043759}
43760
43761
43762static int
43763test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043765
William M. Brack21e4ef22005-01-02 09:53:13 +000043766#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043767 int mem_base;
43768 xmlXPathObjectPtr ret_val;
43769 xmlXPathObjectPtr val; /* an XPath object */
43770 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043771
Daniel Veillard3d97e662004-11-04 10:49:00 +000043772 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43773 mem_base = xmlMemBlocks();
43774 val = gen_xmlXPathObjectPtr(n_val, 0);
43775
43776 ret_val = xmlXPathConvertString(val);
43777 val = NULL;
43778 desret_xmlXPathObjectPtr(ret_val);
43779 call_tests++;
43780 des_xmlXPathObjectPtr(n_val, val, 0);
43781 xmlResetLastError();
43782 if (mem_base != xmlMemBlocks()) {
43783 printf("Leak of %d blocks found in xmlXPathConvertString",
43784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043785 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043786 printf(" %d", n_val);
43787 printf("\n");
43788 }
43789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043790 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043791#endif
43792
Daniel Veillard42595322004-11-08 10:52:06 +000043793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043794}
43795
43796
43797static int
43798test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043800
43801
43802 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043804}
43805
43806
43807static int
43808test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043810
William M. Brack21e4ef22005-01-02 09:53:13 +000043811#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043812 int mem_base;
43813 xmlXPathObjectPtr ret_val;
43814 xmlChar * str; /* the XPath expression */
43815 int n_str;
43816 xmlXPathContextPtr ctx; /* the XPath context */
43817 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043818
Daniel Veillardce682bc2004-11-05 17:22:25 +000043819 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43820 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43821 mem_base = xmlMemBlocks();
43822 str = gen_const_xmlChar_ptr(n_str, 0);
43823 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43824
William M. Brackf13f77f2004-11-12 16:03:48 +000043825 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043826 desret_xmlXPathObjectPtr(ret_val);
43827 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043828 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043829 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43830 xmlResetLastError();
43831 if (mem_base != xmlMemBlocks()) {
43832 printf("Leak of %d blocks found in xmlXPathEval",
43833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043834 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043835 printf(" %d", n_str);
43836 printf(" %d", n_ctx);
43837 printf("\n");
43838 }
43839 }
43840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043841 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043842#endif
43843
Daniel Veillard42595322004-11-08 10:52:06 +000043844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043845}
43846
43847
43848static int
43849test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043851
William M. Brack21e4ef22005-01-02 09:53:13 +000043852#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043853 int mem_base;
43854 xmlXPathObjectPtr ret_val;
43855 xmlChar * str; /* the XPath expression */
43856 int n_str;
43857 xmlXPathContextPtr ctxt; /* the XPath context */
43858 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043859
Daniel Veillardce682bc2004-11-05 17:22:25 +000043860 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43861 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43862 mem_base = xmlMemBlocks();
43863 str = gen_const_xmlChar_ptr(n_str, 0);
43864 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43865
William M. Brackf13f77f2004-11-12 16:03:48 +000043866 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043867 desret_xmlXPathObjectPtr(ret_val);
43868 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043869 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043870 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43871 xmlResetLastError();
43872 if (mem_base != xmlMemBlocks()) {
43873 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043875 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043876 printf(" %d", n_str);
43877 printf(" %d", n_ctxt);
43878 printf("\n");
43879 }
43880 }
43881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043882 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043883#endif
43884
Daniel Veillard42595322004-11-08 10:52:06 +000043885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043886}
43887
43888
43889static int
43890test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043892
William M. Brack21e4ef22005-01-02 09:53:13 +000043893#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043894 int mem_base;
43895 int ret_val;
43896 xmlXPathContextPtr ctxt; /* the XPath context */
43897 int n_ctxt;
43898 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43899 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043900
Daniel Veillardce682bc2004-11-05 17:22:25 +000043901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43902 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43903 mem_base = xmlMemBlocks();
43904 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43905 res = gen_xmlXPathObjectPtr(n_res, 1);
43906
43907 ret_val = xmlXPathEvalPredicate(ctxt, res);
43908 desret_int(ret_val);
43909 call_tests++;
43910 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43911 des_xmlXPathObjectPtr(n_res, res, 1);
43912 xmlResetLastError();
43913 if (mem_base != xmlMemBlocks()) {
43914 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043916 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043917 printf(" %d", n_ctxt);
43918 printf(" %d", n_res);
43919 printf("\n");
43920 }
43921 }
43922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043923 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043924#endif
43925
Daniel Veillard42595322004-11-08 10:52:06 +000043926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043927}
43928
43929
43930static int
43931test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043933
William M. Brack21e4ef22005-01-02 09:53:13 +000043934#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043935 int mem_base;
43936
43937 mem_base = xmlMemBlocks();
43938
43939 xmlXPathInit();
43940 call_tests++;
43941 xmlResetLastError();
43942 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043943 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043945 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043946 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043948 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043949#endif
43950
Daniel Veillard42595322004-11-08 10:52:06 +000043951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043952}
43953
43954
43955static int
43956test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043958
William M. Brack21e4ef22005-01-02 09:53:13 +000043959#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043960 int mem_base;
43961 int ret_val;
43962 double val; /* a double value */
43963 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043964
Daniel Veillard3d95c732004-11-06 22:25:14 +000043965 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43966 mem_base = xmlMemBlocks();
43967 val = gen_double(n_val, 0);
43968
43969 ret_val = xmlXPathIsInf(val);
43970 desret_int(ret_val);
43971 call_tests++;
43972 des_double(n_val, val, 0);
43973 xmlResetLastError();
43974 if (mem_base != xmlMemBlocks()) {
43975 printf("Leak of %d blocks found in xmlXPathIsInf",
43976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043977 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043978 printf(" %d", n_val);
43979 printf("\n");
43980 }
43981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043982 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043983#endif
43984
Daniel Veillard42595322004-11-08 10:52:06 +000043985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043986}
43987
43988
43989static int
43990test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043992
William M. Brack21e4ef22005-01-02 09:53:13 +000043993#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043994 int mem_base;
43995 int ret_val;
43996 double val; /* a double value */
43997 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043998
Daniel Veillard3d95c732004-11-06 22:25:14 +000043999 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44000 mem_base = xmlMemBlocks();
44001 val = gen_double(n_val, 0);
44002
44003 ret_val = xmlXPathIsNaN(val);
44004 desret_int(ret_val);
44005 call_tests++;
44006 des_double(n_val, val, 0);
44007 xmlResetLastError();
44008 if (mem_base != xmlMemBlocks()) {
44009 printf("Leak of %d blocks found in xmlXPathIsNaN",
44010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044011 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044012 printf(" %d", n_val);
44013 printf("\n");
44014 }
44015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044016 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044017#endif
44018
Daniel Veillard42595322004-11-08 10:52:06 +000044019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044020}
44021
44022
44023static int
44024test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044026
44027
44028 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044030}
44031
44032
44033static int
44034test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044036
William M. Brack21e4ef22005-01-02 09:53:13 +000044037#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044038 int mem_base;
44039 xmlNodeSetPtr ret_val;
44040 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
44041 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044042
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044043 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44044 mem_base = xmlMemBlocks();
44045 val = gen_xmlNodePtr(n_val, 0);
44046
44047 ret_val = xmlXPathNodeSetCreate(val);
44048 desret_xmlNodeSetPtr(ret_val);
44049 call_tests++;
44050 des_xmlNodePtr(n_val, val, 0);
44051 xmlResetLastError();
44052 if (mem_base != xmlMemBlocks()) {
44053 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
44054 xmlMemBlocks() - mem_base);
44055 test_ret++;
44056 printf(" %d", n_val);
44057 printf("\n");
44058 }
44059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044060 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044061#endif
44062
Daniel Veillard42595322004-11-08 10:52:06 +000044063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044064}
44065
44066
44067static int
44068test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044070
William M. Brack21e4ef22005-01-02 09:53:13 +000044071#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044072 int mem_base;
44073 xmlXPathObjectPtr ret_val;
44074 xmlXPathObjectPtr val; /* the original object */
44075 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044076
Daniel Veillard3d97e662004-11-04 10:49:00 +000044077 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44078 mem_base = xmlMemBlocks();
44079 val = gen_xmlXPathObjectPtr(n_val, 0);
44080
44081 ret_val = xmlXPathObjectCopy(val);
44082 desret_xmlXPathObjectPtr(ret_val);
44083 call_tests++;
44084 des_xmlXPathObjectPtr(n_val, val, 0);
44085 xmlResetLastError();
44086 if (mem_base != xmlMemBlocks()) {
44087 printf("Leak of %d blocks found in xmlXPathObjectCopy",
44088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044089 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044090 printf(" %d", n_val);
44091 printf("\n");
44092 }
44093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044094 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044095#endif
44096
Daniel Veillard42595322004-11-08 10:52:06 +000044097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044098}
44099
44100
44101static int
44102test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044104
William M. Brack21e4ef22005-01-02 09:53:13 +000044105#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044106 int mem_base;
44107 long ret_val;
44108 xmlDocPtr doc; /* an input document */
44109 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044110
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044111 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
44112 mem_base = xmlMemBlocks();
44113 doc = gen_xmlDocPtr(n_doc, 0);
44114
44115 ret_val = xmlXPathOrderDocElems(doc);
44116 desret_long(ret_val);
44117 call_tests++;
44118 des_xmlDocPtr(n_doc, doc, 0);
44119 xmlResetLastError();
44120 if (mem_base != xmlMemBlocks()) {
44121 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
44122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044123 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044124 printf(" %d", n_doc);
44125 printf("\n");
44126 }
44127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044128 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044129#endif
44130
Daniel Veillard42595322004-11-08 10:52:06 +000044131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044132}
44133
44134static int
44135test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044137
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044138 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000044139 test_ret += test_xmlXPathCastBooleanToNumber();
44140 test_ret += test_xmlXPathCastBooleanToString();
44141 test_ret += test_xmlXPathCastNodeSetToBoolean();
44142 test_ret += test_xmlXPathCastNodeSetToNumber();
44143 test_ret += test_xmlXPathCastNodeSetToString();
44144 test_ret += test_xmlXPathCastNodeToNumber();
44145 test_ret += test_xmlXPathCastNodeToString();
44146 test_ret += test_xmlXPathCastNumberToBoolean();
44147 test_ret += test_xmlXPathCastNumberToString();
44148 test_ret += test_xmlXPathCastStringToBoolean();
44149 test_ret += test_xmlXPathCastStringToNumber();
44150 test_ret += test_xmlXPathCastToBoolean();
44151 test_ret += test_xmlXPathCastToNumber();
44152 test_ret += test_xmlXPathCastToString();
44153 test_ret += test_xmlXPathCmpNodes();
44154 test_ret += test_xmlXPathCompile();
44155 test_ret += test_xmlXPathCompiledEval();
44156 test_ret += test_xmlXPathConvertBoolean();
44157 test_ret += test_xmlXPathConvertNumber();
44158 test_ret += test_xmlXPathConvertString();
44159 test_ret += test_xmlXPathCtxtCompile();
44160 test_ret += test_xmlXPathEval();
44161 test_ret += test_xmlXPathEvalExpression();
44162 test_ret += test_xmlXPathEvalPredicate();
44163 test_ret += test_xmlXPathInit();
44164 test_ret += test_xmlXPathIsInf();
44165 test_ret += test_xmlXPathIsNaN();
44166 test_ret += test_xmlXPathNewContext();
44167 test_ret += test_xmlXPathNodeSetCreate();
44168 test_ret += test_xmlXPathObjectCopy();
44169 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000044170
Daniel Veillard42595322004-11-08 10:52:06 +000044171 if (test_ret != 0)
44172 printf("Module xpath: %d errors\n", test_ret);
44173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044174}
Daniel Veillarda521d282004-11-09 14:59:59 +000044175#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044176
Daniel Veillarda82b1822004-11-08 16:24:57 +000044177#define gen_nb_xmlXPathParserContextPtr 1
44178static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44179 return(NULL);
44180}
44181static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44182}
Daniel Veillarda521d282004-11-09 14:59:59 +000044183#endif
44184
Daniel Veillarda82b1822004-11-08 16:24:57 +000044185
44186static int
44187test_valuePop(void) {
44188 int test_ret = 0;
44189
William M. Brack21e4ef22005-01-02 09:53:13 +000044190#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044191 int mem_base;
44192 xmlXPathObjectPtr ret_val;
44193 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44194 int n_ctxt;
44195
44196 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44197 mem_base = xmlMemBlocks();
44198 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44199
44200 ret_val = valuePop(ctxt);
44201 desret_xmlXPathObjectPtr(ret_val);
44202 call_tests++;
44203 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44204 xmlResetLastError();
44205 if (mem_base != xmlMemBlocks()) {
44206 printf("Leak of %d blocks found in valuePop",
44207 xmlMemBlocks() - mem_base);
44208 test_ret++;
44209 printf(" %d", n_ctxt);
44210 printf("\n");
44211 }
44212 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044213 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044214#endif
44215
Daniel Veillarda82b1822004-11-08 16:24:57 +000044216 return(test_ret);
44217}
44218
44219
44220static int
44221test_valuePush(void) {
44222 int test_ret = 0;
44223
William M. Brack21e4ef22005-01-02 09:53:13 +000044224#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044225 int mem_base;
44226 int ret_val;
44227 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44228 int n_ctxt;
44229 xmlXPathObjectPtr value; /* the XPath object */
44230 int n_value;
44231
44232 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44233 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44234 mem_base = xmlMemBlocks();
44235 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44236 value = gen_xmlXPathObjectPtr(n_value, 1);
44237
44238 ret_val = valuePush(ctxt, value);
44239 desret_int(ret_val);
44240 call_tests++;
44241 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44242 des_xmlXPathObjectPtr(n_value, value, 1);
44243 xmlResetLastError();
44244 if (mem_base != xmlMemBlocks()) {
44245 printf("Leak of %d blocks found in valuePush",
44246 xmlMemBlocks() - mem_base);
44247 test_ret++;
44248 printf(" %d", n_ctxt);
44249 printf(" %d", n_value);
44250 printf("\n");
44251 }
44252 }
44253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044254 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044255#endif
44256
Daniel Veillarda82b1822004-11-08 16:24:57 +000044257 return(test_ret);
44258}
44259
44260
44261static int
44262test_xmlXPathAddValues(void) {
44263 int test_ret = 0;
44264
William M. Brack21e4ef22005-01-02 09:53:13 +000044265#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044266 int mem_base;
44267 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44268 int n_ctxt;
44269
44270 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44271 mem_base = xmlMemBlocks();
44272 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44273
44274 xmlXPathAddValues(ctxt);
44275 call_tests++;
44276 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44277 xmlResetLastError();
44278 if (mem_base != xmlMemBlocks()) {
44279 printf("Leak of %d blocks found in xmlXPathAddValues",
44280 xmlMemBlocks() - mem_base);
44281 test_ret++;
44282 printf(" %d", n_ctxt);
44283 printf("\n");
44284 }
44285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044286 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044287#endif
44288
Daniel Veillarda82b1822004-11-08 16:24:57 +000044289 return(test_ret);
44290}
44291
44292
44293static int
44294test_xmlXPathBooleanFunction(void) {
44295 int test_ret = 0;
44296
William M. Brack21e4ef22005-01-02 09:53:13 +000044297#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044298 int mem_base;
44299 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44300 int n_ctxt;
44301 int nargs; /* the number of arguments */
44302 int n_nargs;
44303
44304 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44305 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44306 mem_base = xmlMemBlocks();
44307 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44308 nargs = gen_int(n_nargs, 1);
44309
44310 xmlXPathBooleanFunction(ctxt, nargs);
44311 call_tests++;
44312 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44313 des_int(n_nargs, nargs, 1);
44314 xmlResetLastError();
44315 if (mem_base != xmlMemBlocks()) {
44316 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44317 xmlMemBlocks() - mem_base);
44318 test_ret++;
44319 printf(" %d", n_ctxt);
44320 printf(" %d", n_nargs);
44321 printf("\n");
44322 }
44323 }
44324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044325 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044326#endif
44327
Daniel Veillarda82b1822004-11-08 16:24:57 +000044328 return(test_ret);
44329}
44330
44331
44332static int
44333test_xmlXPathCeilingFunction(void) {
44334 int test_ret = 0;
44335
William M. Brack21e4ef22005-01-02 09:53:13 +000044336#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044337 int mem_base;
44338 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44339 int n_ctxt;
44340 int nargs; /* the number of arguments */
44341 int n_nargs;
44342
44343 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44344 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44345 mem_base = xmlMemBlocks();
44346 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44347 nargs = gen_int(n_nargs, 1);
44348
44349 xmlXPathCeilingFunction(ctxt, nargs);
44350 call_tests++;
44351 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44352 des_int(n_nargs, nargs, 1);
44353 xmlResetLastError();
44354 if (mem_base != xmlMemBlocks()) {
44355 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44356 xmlMemBlocks() - mem_base);
44357 test_ret++;
44358 printf(" %d", n_ctxt);
44359 printf(" %d", n_nargs);
44360 printf("\n");
44361 }
44362 }
44363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044364 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044365#endif
44366
Daniel Veillarda82b1822004-11-08 16:24:57 +000044367 return(test_ret);
44368}
44369
44370
44371static int
44372test_xmlXPathCompareValues(void) {
44373 int test_ret = 0;
44374
William M. Brack21e4ef22005-01-02 09:53:13 +000044375#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044376 int mem_base;
44377 int ret_val;
44378 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44379 int n_ctxt;
44380 int inf; /* less than (1) or greater than (0) */
44381 int n_inf;
44382 int strict; /* is the comparison strict */
44383 int n_strict;
44384
44385 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44386 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44387 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44388 mem_base = xmlMemBlocks();
44389 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44390 inf = gen_int(n_inf, 1);
44391 strict = gen_int(n_strict, 2);
44392
44393 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44394 desret_int(ret_val);
44395 call_tests++;
44396 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44397 des_int(n_inf, inf, 1);
44398 des_int(n_strict, strict, 2);
44399 xmlResetLastError();
44400 if (mem_base != xmlMemBlocks()) {
44401 printf("Leak of %d blocks found in xmlXPathCompareValues",
44402 xmlMemBlocks() - mem_base);
44403 test_ret++;
44404 printf(" %d", n_ctxt);
44405 printf(" %d", n_inf);
44406 printf(" %d", n_strict);
44407 printf("\n");
44408 }
44409 }
44410 }
44411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044412 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044413#endif
44414
Daniel Veillarda82b1822004-11-08 16:24:57 +000044415 return(test_ret);
44416}
44417
44418
44419static int
44420test_xmlXPathConcatFunction(void) {
44421 int test_ret = 0;
44422
William M. Brack21e4ef22005-01-02 09:53:13 +000044423#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044424 int mem_base;
44425 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44426 int n_ctxt;
44427 int nargs; /* the number of arguments */
44428 int n_nargs;
44429
44430 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44431 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44432 mem_base = xmlMemBlocks();
44433 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44434 nargs = gen_int(n_nargs, 1);
44435
44436 xmlXPathConcatFunction(ctxt, nargs);
44437 call_tests++;
44438 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44439 des_int(n_nargs, nargs, 1);
44440 xmlResetLastError();
44441 if (mem_base != xmlMemBlocks()) {
44442 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44443 xmlMemBlocks() - mem_base);
44444 test_ret++;
44445 printf(" %d", n_ctxt);
44446 printf(" %d", n_nargs);
44447 printf("\n");
44448 }
44449 }
44450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044451 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044452#endif
44453
Daniel Veillarda82b1822004-11-08 16:24:57 +000044454 return(test_ret);
44455}
44456
44457
44458static int
44459test_xmlXPathContainsFunction(void) {
44460 int test_ret = 0;
44461
William M. Brack21e4ef22005-01-02 09:53:13 +000044462#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044463 int mem_base;
44464 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44465 int n_ctxt;
44466 int nargs; /* the number of arguments */
44467 int n_nargs;
44468
44469 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44470 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44471 mem_base = xmlMemBlocks();
44472 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44473 nargs = gen_int(n_nargs, 1);
44474
44475 xmlXPathContainsFunction(ctxt, nargs);
44476 call_tests++;
44477 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44478 des_int(n_nargs, nargs, 1);
44479 xmlResetLastError();
44480 if (mem_base != xmlMemBlocks()) {
44481 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44482 xmlMemBlocks() - mem_base);
44483 test_ret++;
44484 printf(" %d", n_ctxt);
44485 printf(" %d", n_nargs);
44486 printf("\n");
44487 }
44488 }
44489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044490 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044491#endif
44492
Daniel Veillarda82b1822004-11-08 16:24:57 +000044493 return(test_ret);
44494}
44495
44496
44497static int
44498test_xmlXPathCountFunction(void) {
44499 int test_ret = 0;
44500
William M. Brack21e4ef22005-01-02 09:53:13 +000044501#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044502 int mem_base;
44503 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44504 int n_ctxt;
44505 int nargs; /* the number of arguments */
44506 int n_nargs;
44507
44508 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44509 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44510 mem_base = xmlMemBlocks();
44511 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44512 nargs = gen_int(n_nargs, 1);
44513
44514 xmlXPathCountFunction(ctxt, nargs);
44515 call_tests++;
44516 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44517 des_int(n_nargs, nargs, 1);
44518 xmlResetLastError();
44519 if (mem_base != xmlMemBlocks()) {
44520 printf("Leak of %d blocks found in xmlXPathCountFunction",
44521 xmlMemBlocks() - mem_base);
44522 test_ret++;
44523 printf(" %d", n_ctxt);
44524 printf(" %d", n_nargs);
44525 printf("\n");
44526 }
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_xmlXPathDebugDumpCompExpr(void) {
44538 int test_ret = 0;
44539
William M. Brack21e4ef22005-01-02 09:53:13 +000044540#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044541 int mem_base;
44542 FILE * output; /* the FILE * for the output */
44543 int n_output;
44544 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44545 int n_comp;
44546 int depth; /* the indentation level. */
44547 int n_depth;
44548
44549 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44550 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44551 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44552 mem_base = xmlMemBlocks();
44553 output = gen_FILE_ptr(n_output, 0);
44554 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44555 depth = gen_int(n_depth, 2);
44556
44557 xmlXPathDebugDumpCompExpr(output, comp, depth);
44558 call_tests++;
44559 des_FILE_ptr(n_output, output, 0);
44560 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44561 des_int(n_depth, depth, 2);
44562 xmlResetLastError();
44563 if (mem_base != xmlMemBlocks()) {
44564 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44565 xmlMemBlocks() - mem_base);
44566 test_ret++;
44567 printf(" %d", n_output);
44568 printf(" %d", n_comp);
44569 printf(" %d", n_depth);
44570 printf("\n");
44571 }
44572 }
44573 }
44574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044575 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044576#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044577
Daniel Veillarda82b1822004-11-08 16:24:57 +000044578 return(test_ret);
44579}
44580
44581
44582static int
44583test_xmlXPathDebugDumpObject(void) {
44584 int test_ret = 0;
44585
William M. Brack21e4ef22005-01-02 09:53:13 +000044586#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044587 int mem_base;
44588 FILE * output; /* the FILE * to dump the output */
44589 int n_output;
44590 xmlXPathObjectPtr cur; /* the object to inspect */
44591 int n_cur;
44592 int depth; /* indentation level */
44593 int n_depth;
44594
44595 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44596 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44597 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44598 mem_base = xmlMemBlocks();
44599 output = gen_FILE_ptr(n_output, 0);
44600 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44601 depth = gen_int(n_depth, 2);
44602
44603 xmlXPathDebugDumpObject(output, cur, depth);
44604 call_tests++;
44605 des_FILE_ptr(n_output, output, 0);
44606 des_xmlXPathObjectPtr(n_cur, cur, 1);
44607 des_int(n_depth, depth, 2);
44608 xmlResetLastError();
44609 if (mem_base != xmlMemBlocks()) {
44610 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44611 xmlMemBlocks() - mem_base);
44612 test_ret++;
44613 printf(" %d", n_output);
44614 printf(" %d", n_cur);
44615 printf(" %d", n_depth);
44616 printf("\n");
44617 }
44618 }
44619 }
44620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044621 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044622#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044623
Daniel Veillarda82b1822004-11-08 16:24:57 +000044624 return(test_ret);
44625}
44626
44627
44628static int
44629test_xmlXPathDifference(void) {
44630 int test_ret = 0;
44631
William M. Brack21e4ef22005-01-02 09:53:13 +000044632#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044633 int mem_base;
44634 xmlNodeSetPtr ret_val;
44635 xmlNodeSetPtr nodes1; /* a node-set */
44636 int n_nodes1;
44637 xmlNodeSetPtr nodes2; /* a node-set */
44638 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044639
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044640 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44641 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44642 mem_base = xmlMemBlocks();
44643 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44644 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44645
44646 ret_val = xmlXPathDifference(nodes1, nodes2);
44647 desret_xmlNodeSetPtr(ret_val);
44648 call_tests++;
44649 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44650 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44651 xmlResetLastError();
44652 if (mem_base != xmlMemBlocks()) {
44653 printf("Leak of %d blocks found in xmlXPathDifference",
44654 xmlMemBlocks() - mem_base);
44655 test_ret++;
44656 printf(" %d", n_nodes1);
44657 printf(" %d", n_nodes2);
44658 printf("\n");
44659 }
44660 }
44661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044662 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044663#endif
44664
Daniel Veillarda82b1822004-11-08 16:24:57 +000044665 return(test_ret);
44666}
44667
44668
44669static int
44670test_xmlXPathDistinct(void) {
44671 int test_ret = 0;
44672
William M. Brack21e4ef22005-01-02 09:53:13 +000044673#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044674 int mem_base;
44675 xmlNodeSetPtr ret_val;
44676 xmlNodeSetPtr nodes; /* a node-set */
44677 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044678
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044679 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44680 mem_base = xmlMemBlocks();
44681 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44682
44683 ret_val = xmlXPathDistinct(nodes);
44684 desret_xmlNodeSetPtr(ret_val);
44685 call_tests++;
44686 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44687 xmlResetLastError();
44688 if (mem_base != xmlMemBlocks()) {
44689 printf("Leak of %d blocks found in xmlXPathDistinct",
44690 xmlMemBlocks() - mem_base);
44691 test_ret++;
44692 printf(" %d", n_nodes);
44693 printf("\n");
44694 }
44695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044696 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044697#endif
44698
Daniel Veillarda82b1822004-11-08 16:24:57 +000044699 return(test_ret);
44700}
44701
44702
44703static int
44704test_xmlXPathDistinctSorted(void) {
44705 int test_ret = 0;
44706
William M. Brack21e4ef22005-01-02 09:53:13 +000044707#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044708 int mem_base;
44709 xmlNodeSetPtr ret_val;
44710 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44711 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044712
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044713 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44714 mem_base = xmlMemBlocks();
44715 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44716
44717 ret_val = xmlXPathDistinctSorted(nodes);
44718 desret_xmlNodeSetPtr(ret_val);
44719 call_tests++;
44720 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44721 xmlResetLastError();
44722 if (mem_base != xmlMemBlocks()) {
44723 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44724 xmlMemBlocks() - mem_base);
44725 test_ret++;
44726 printf(" %d", n_nodes);
44727 printf("\n");
44728 }
44729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044730 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044731#endif
44732
Daniel Veillarda82b1822004-11-08 16:24:57 +000044733 return(test_ret);
44734}
44735
44736
44737static int
44738test_xmlXPathDivValues(void) {
44739 int test_ret = 0;
44740
William M. Brack21e4ef22005-01-02 09:53:13 +000044741#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044742 int mem_base;
44743 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44744 int n_ctxt;
44745
44746 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44747 mem_base = xmlMemBlocks();
44748 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44749
44750 xmlXPathDivValues(ctxt);
44751 call_tests++;
44752 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44753 xmlResetLastError();
44754 if (mem_base != xmlMemBlocks()) {
44755 printf("Leak of %d blocks found in xmlXPathDivValues",
44756 xmlMemBlocks() - mem_base);
44757 test_ret++;
44758 printf(" %d", n_ctxt);
44759 printf("\n");
44760 }
44761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044762 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044763#endif
44764
Daniel Veillarda82b1822004-11-08 16:24:57 +000044765 return(test_ret);
44766}
44767
44768
44769static int
44770test_xmlXPathEqualValues(void) {
44771 int test_ret = 0;
44772
William M. Brack21e4ef22005-01-02 09:53:13 +000044773#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044774 int mem_base;
44775 int ret_val;
44776 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44777 int n_ctxt;
44778
44779 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44780 mem_base = xmlMemBlocks();
44781 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44782
44783 ret_val = xmlXPathEqualValues(ctxt);
44784 desret_int(ret_val);
44785 call_tests++;
44786 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44787 xmlResetLastError();
44788 if (mem_base != xmlMemBlocks()) {
44789 printf("Leak of %d blocks found in xmlXPathEqualValues",
44790 xmlMemBlocks() - mem_base);
44791 test_ret++;
44792 printf(" %d", n_ctxt);
44793 printf("\n");
44794 }
44795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044796 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044797#endif
44798
Daniel Veillarda82b1822004-11-08 16:24:57 +000044799 return(test_ret);
44800}
44801
44802
44803static int
44804test_xmlXPathErr(void) {
44805 int test_ret = 0;
44806
William M. Brack21e4ef22005-01-02 09:53:13 +000044807#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044808 int mem_base;
44809 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44810 int n_ctxt;
44811 int error; /* the error code */
44812 int n_error;
44813
44814 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44815 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44816 mem_base = xmlMemBlocks();
44817 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44818 error = gen_int(n_error, 1);
44819
44820 xmlXPathErr(ctxt, error);
44821 call_tests++;
44822 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44823 des_int(n_error, error, 1);
44824 xmlResetLastError();
44825 if (mem_base != xmlMemBlocks()) {
44826 printf("Leak of %d blocks found in xmlXPathErr",
44827 xmlMemBlocks() - mem_base);
44828 test_ret++;
44829 printf(" %d", n_ctxt);
44830 printf(" %d", n_error);
44831 printf("\n");
44832 }
44833 }
44834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044835 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044836#endif
44837
Daniel Veillarda82b1822004-11-08 16:24:57 +000044838 return(test_ret);
44839}
44840
44841
44842static int
44843test_xmlXPathEvalExpr(void) {
44844 int test_ret = 0;
44845
William M. Brack21e4ef22005-01-02 09:53:13 +000044846#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044847 int mem_base;
44848 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44849 int n_ctxt;
44850
44851 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44852 mem_base = xmlMemBlocks();
44853 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44854
44855 xmlXPathEvalExpr(ctxt);
44856 call_tests++;
44857 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44858 xmlResetLastError();
44859 if (mem_base != xmlMemBlocks()) {
44860 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44861 xmlMemBlocks() - mem_base);
44862 test_ret++;
44863 printf(" %d", n_ctxt);
44864 printf("\n");
44865 }
44866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044867 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044868#endif
44869
Daniel Veillarda82b1822004-11-08 16:24:57 +000044870 return(test_ret);
44871}
44872
44873
44874static int
44875test_xmlXPathEvaluatePredicateResult(void) {
44876 int test_ret = 0;
44877
William M. Brack21e4ef22005-01-02 09:53:13 +000044878#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044879 int mem_base;
44880 int ret_val;
44881 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44882 int n_ctxt;
44883 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44884 int n_res;
44885
44886 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44887 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44888 mem_base = xmlMemBlocks();
44889 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44890 res = gen_xmlXPathObjectPtr(n_res, 1);
44891
44892 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44893 desret_int(ret_val);
44894 call_tests++;
44895 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44896 des_xmlXPathObjectPtr(n_res, res, 1);
44897 xmlResetLastError();
44898 if (mem_base != xmlMemBlocks()) {
44899 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44900 xmlMemBlocks() - mem_base);
44901 test_ret++;
44902 printf(" %d", n_ctxt);
44903 printf(" %d", n_res);
44904 printf("\n");
44905 }
44906 }
44907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044908 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044909#endif
44910
Daniel Veillarda82b1822004-11-08 16:24:57 +000044911 return(test_ret);
44912}
44913
44914
44915static int
44916test_xmlXPathFalseFunction(void) {
44917 int test_ret = 0;
44918
William M. Brack21e4ef22005-01-02 09:53:13 +000044919#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044920 int mem_base;
44921 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44922 int n_ctxt;
44923 int nargs; /* the number of arguments */
44924 int n_nargs;
44925
44926 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44927 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44928 mem_base = xmlMemBlocks();
44929 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44930 nargs = gen_int(n_nargs, 1);
44931
44932 xmlXPathFalseFunction(ctxt, nargs);
44933 call_tests++;
44934 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44935 des_int(n_nargs, nargs, 1);
44936 xmlResetLastError();
44937 if (mem_base != xmlMemBlocks()) {
44938 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44939 xmlMemBlocks() - mem_base);
44940 test_ret++;
44941 printf(" %d", n_ctxt);
44942 printf(" %d", n_nargs);
44943 printf("\n");
44944 }
44945 }
44946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044947 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044948#endif
44949
Daniel Veillarda82b1822004-11-08 16:24:57 +000044950 return(test_ret);
44951}
44952
44953
44954static int
44955test_xmlXPathFloorFunction(void) {
44956 int test_ret = 0;
44957
William M. Brack21e4ef22005-01-02 09:53:13 +000044958#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044959 int mem_base;
44960 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44961 int n_ctxt;
44962 int nargs; /* the number of arguments */
44963 int n_nargs;
44964
44965 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44966 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44967 mem_base = xmlMemBlocks();
44968 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44969 nargs = gen_int(n_nargs, 1);
44970
44971 xmlXPathFloorFunction(ctxt, nargs);
44972 call_tests++;
44973 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44974 des_int(n_nargs, nargs, 1);
44975 xmlResetLastError();
44976 if (mem_base != xmlMemBlocks()) {
44977 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44978 xmlMemBlocks() - mem_base);
44979 test_ret++;
44980 printf(" %d", n_ctxt);
44981 printf(" %d", n_nargs);
44982 printf("\n");
44983 }
44984 }
44985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044986 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044987#endif
44988
Daniel Veillarda82b1822004-11-08 16:24:57 +000044989 return(test_ret);
44990}
44991
44992
44993static int
44994test_xmlXPathFunctionLookup(void) {
44995 int test_ret = 0;
44996
44997
44998 /* missing type support */
44999 return(test_ret);
45000}
45001
45002
45003static int
45004test_xmlXPathFunctionLookupNS(void) {
45005 int test_ret = 0;
45006
45007
45008 /* missing type support */
45009 return(test_ret);
45010}
45011
45012
45013static int
45014test_xmlXPathHasSameNodes(void) {
45015 int test_ret = 0;
45016
William M. Brack21e4ef22005-01-02 09:53:13 +000045017#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045018 int mem_base;
45019 int ret_val;
45020 xmlNodeSetPtr nodes1; /* a node-set */
45021 int n_nodes1;
45022 xmlNodeSetPtr nodes2; /* a node-set */
45023 int n_nodes2;
45024
45025 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45026 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45027 mem_base = xmlMemBlocks();
45028 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45029 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45030
45031 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
45032 desret_int(ret_val);
45033 call_tests++;
45034 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45035 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45036 xmlResetLastError();
45037 if (mem_base != xmlMemBlocks()) {
45038 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
45039 xmlMemBlocks() - mem_base);
45040 test_ret++;
45041 printf(" %d", n_nodes1);
45042 printf(" %d", n_nodes2);
45043 printf("\n");
45044 }
45045 }
45046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045047 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045048#endif
45049
Daniel Veillarda82b1822004-11-08 16:24:57 +000045050 return(test_ret);
45051}
45052
45053
45054static int
45055test_xmlXPathIdFunction(void) {
45056 int test_ret = 0;
45057
William M. Brack21e4ef22005-01-02 09:53:13 +000045058#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045059 int mem_base;
45060 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45061 int n_ctxt;
45062 int nargs; /* the number of arguments */
45063 int n_nargs;
45064
45065 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45066 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45067 mem_base = xmlMemBlocks();
45068 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45069 nargs = gen_int(n_nargs, 1);
45070
45071 xmlXPathIdFunction(ctxt, nargs);
45072 call_tests++;
45073 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45074 des_int(n_nargs, nargs, 1);
45075 xmlResetLastError();
45076 if (mem_base != xmlMemBlocks()) {
45077 printf("Leak of %d blocks found in xmlXPathIdFunction",
45078 xmlMemBlocks() - mem_base);
45079 test_ret++;
45080 printf(" %d", n_ctxt);
45081 printf(" %d", n_nargs);
45082 printf("\n");
45083 }
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_xmlXPathIntersection(void) {
45095 int test_ret = 0;
45096
William M. Brack21e4ef22005-01-02 09:53:13 +000045097#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045098 int mem_base;
45099 xmlNodeSetPtr ret_val;
45100 xmlNodeSetPtr nodes1; /* a node-set */
45101 int n_nodes1;
45102 xmlNodeSetPtr nodes2; /* a node-set */
45103 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045104
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045105 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45106 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45107 mem_base = xmlMemBlocks();
45108 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45109 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45110
45111 ret_val = xmlXPathIntersection(nodes1, nodes2);
45112 desret_xmlNodeSetPtr(ret_val);
45113 call_tests++;
45114 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45115 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45116 xmlResetLastError();
45117 if (mem_base != xmlMemBlocks()) {
45118 printf("Leak of %d blocks found in xmlXPathIntersection",
45119 xmlMemBlocks() - mem_base);
45120 test_ret++;
45121 printf(" %d", n_nodes1);
45122 printf(" %d", n_nodes2);
45123 printf("\n");
45124 }
45125 }
45126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045127 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045128#endif
45129
Daniel Veillarda82b1822004-11-08 16:24:57 +000045130 return(test_ret);
45131}
45132
45133
45134static int
45135test_xmlXPathIsNodeType(void) {
45136 int test_ret = 0;
45137
William M. Brack21e4ef22005-01-02 09:53:13 +000045138#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045139 int mem_base;
45140 int ret_val;
45141 xmlChar * name; /* a name string */
45142 int n_name;
45143
45144 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45145 mem_base = xmlMemBlocks();
45146 name = gen_const_xmlChar_ptr(n_name, 0);
45147
William M. Brackf13f77f2004-11-12 16:03:48 +000045148 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045149 desret_int(ret_val);
45150 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045151 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045152 xmlResetLastError();
45153 if (mem_base != xmlMemBlocks()) {
45154 printf("Leak of %d blocks found in xmlXPathIsNodeType",
45155 xmlMemBlocks() - mem_base);
45156 test_ret++;
45157 printf(" %d", n_name);
45158 printf("\n");
45159 }
45160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045161 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045162#endif
45163
Daniel Veillarda82b1822004-11-08 16:24:57 +000045164 return(test_ret);
45165}
45166
45167
45168static int
45169test_xmlXPathLangFunction(void) {
45170 int test_ret = 0;
45171
William M. Brack21e4ef22005-01-02 09:53:13 +000045172#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045173 int mem_base;
45174 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45175 int n_ctxt;
45176 int nargs; /* the number of arguments */
45177 int n_nargs;
45178
45179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45180 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45181 mem_base = xmlMemBlocks();
45182 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45183 nargs = gen_int(n_nargs, 1);
45184
45185 xmlXPathLangFunction(ctxt, nargs);
45186 call_tests++;
45187 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45188 des_int(n_nargs, nargs, 1);
45189 xmlResetLastError();
45190 if (mem_base != xmlMemBlocks()) {
45191 printf("Leak of %d blocks found in xmlXPathLangFunction",
45192 xmlMemBlocks() - mem_base);
45193 test_ret++;
45194 printf(" %d", n_ctxt);
45195 printf(" %d", n_nargs);
45196 printf("\n");
45197 }
45198 }
45199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045200 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045201#endif
45202
Daniel Veillarda82b1822004-11-08 16:24:57 +000045203 return(test_ret);
45204}
45205
45206
45207static int
45208test_xmlXPathLastFunction(void) {
45209 int test_ret = 0;
45210
William M. Brack21e4ef22005-01-02 09:53:13 +000045211#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045212 int mem_base;
45213 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45214 int n_ctxt;
45215 int nargs; /* the number of arguments */
45216 int n_nargs;
45217
45218 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45219 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45220 mem_base = xmlMemBlocks();
45221 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45222 nargs = gen_int(n_nargs, 1);
45223
45224 xmlXPathLastFunction(ctxt, nargs);
45225 call_tests++;
45226 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45227 des_int(n_nargs, nargs, 1);
45228 xmlResetLastError();
45229 if (mem_base != xmlMemBlocks()) {
45230 printf("Leak of %d blocks found in xmlXPathLastFunction",
45231 xmlMemBlocks() - mem_base);
45232 test_ret++;
45233 printf(" %d", n_ctxt);
45234 printf(" %d", n_nargs);
45235 printf("\n");
45236 }
45237 }
45238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045239 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045240#endif
45241
Daniel Veillarda82b1822004-11-08 16:24:57 +000045242 return(test_ret);
45243}
45244
45245
45246static int
45247test_xmlXPathLeading(void) {
45248 int test_ret = 0;
45249
William M. Brack21e4ef22005-01-02 09:53:13 +000045250#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045251 int mem_base;
45252 xmlNodeSetPtr ret_val;
45253 xmlNodeSetPtr nodes1; /* a node-set */
45254 int n_nodes1;
45255 xmlNodeSetPtr nodes2; /* a node-set */
45256 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045257
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045258 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45259 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45260 mem_base = xmlMemBlocks();
45261 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45262 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45263
45264 ret_val = xmlXPathLeading(nodes1, nodes2);
45265 desret_xmlNodeSetPtr(ret_val);
45266 call_tests++;
45267 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45268 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45269 xmlResetLastError();
45270 if (mem_base != xmlMemBlocks()) {
45271 printf("Leak of %d blocks found in xmlXPathLeading",
45272 xmlMemBlocks() - mem_base);
45273 test_ret++;
45274 printf(" %d", n_nodes1);
45275 printf(" %d", n_nodes2);
45276 printf("\n");
45277 }
45278 }
45279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045280 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045281#endif
45282
Daniel Veillarda82b1822004-11-08 16:24:57 +000045283 return(test_ret);
45284}
45285
45286
45287static int
45288test_xmlXPathLeadingSorted(void) {
45289 int test_ret = 0;
45290
William M. Brack21e4ef22005-01-02 09:53:13 +000045291#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045292 int mem_base;
45293 xmlNodeSetPtr ret_val;
45294 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45295 int n_nodes1;
45296 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45297 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045298
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045299 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45300 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45301 mem_base = xmlMemBlocks();
45302 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45303 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45304
45305 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45306 desret_xmlNodeSetPtr(ret_val);
45307 call_tests++;
45308 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45309 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45310 xmlResetLastError();
45311 if (mem_base != xmlMemBlocks()) {
45312 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45313 xmlMemBlocks() - mem_base);
45314 test_ret++;
45315 printf(" %d", n_nodes1);
45316 printf(" %d", n_nodes2);
45317 printf("\n");
45318 }
45319 }
45320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045321 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045322#endif
45323
Daniel Veillarda82b1822004-11-08 16:24:57 +000045324 return(test_ret);
45325}
45326
45327
45328static int
45329test_xmlXPathLocalNameFunction(void) {
45330 int test_ret = 0;
45331
William M. Brack21e4ef22005-01-02 09:53:13 +000045332#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045333 int mem_base;
45334 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45335 int n_ctxt;
45336 int nargs; /* the number of arguments */
45337 int n_nargs;
45338
45339 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45340 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45341 mem_base = xmlMemBlocks();
45342 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45343 nargs = gen_int(n_nargs, 1);
45344
45345 xmlXPathLocalNameFunction(ctxt, nargs);
45346 call_tests++;
45347 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45348 des_int(n_nargs, nargs, 1);
45349 xmlResetLastError();
45350 if (mem_base != xmlMemBlocks()) {
45351 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45352 xmlMemBlocks() - mem_base);
45353 test_ret++;
45354 printf(" %d", n_ctxt);
45355 printf(" %d", n_nargs);
45356 printf("\n");
45357 }
45358 }
45359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045360 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045361#endif
45362
Daniel Veillarda82b1822004-11-08 16:24:57 +000045363 return(test_ret);
45364}
45365
45366
45367static int
45368test_xmlXPathModValues(void) {
45369 int test_ret = 0;
45370
William M. Brack21e4ef22005-01-02 09:53:13 +000045371#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045372 int mem_base;
45373 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45374 int n_ctxt;
45375
45376 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45377 mem_base = xmlMemBlocks();
45378 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45379
45380 xmlXPathModValues(ctxt);
45381 call_tests++;
45382 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45383 xmlResetLastError();
45384 if (mem_base != xmlMemBlocks()) {
45385 printf("Leak of %d blocks found in xmlXPathModValues",
45386 xmlMemBlocks() - mem_base);
45387 test_ret++;
45388 printf(" %d", n_ctxt);
45389 printf("\n");
45390 }
45391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045392 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045393#endif
45394
Daniel Veillarda82b1822004-11-08 16:24:57 +000045395 return(test_ret);
45396}
45397
45398
45399static int
45400test_xmlXPathMultValues(void) {
45401 int test_ret = 0;
45402
William M. Brack21e4ef22005-01-02 09:53:13 +000045403#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045404 int mem_base;
45405 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45406 int n_ctxt;
45407
45408 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45409 mem_base = xmlMemBlocks();
45410 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45411
45412 xmlXPathMultValues(ctxt);
45413 call_tests++;
45414 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45415 xmlResetLastError();
45416 if (mem_base != xmlMemBlocks()) {
45417 printf("Leak of %d blocks found in xmlXPathMultValues",
45418 xmlMemBlocks() - mem_base);
45419 test_ret++;
45420 printf(" %d", n_ctxt);
45421 printf("\n");
45422 }
45423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045424 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045425#endif
45426
Daniel Veillarda82b1822004-11-08 16:24:57 +000045427 return(test_ret);
45428}
45429
45430
45431static int
45432test_xmlXPathNamespaceURIFunction(void) {
45433 int test_ret = 0;
45434
William M. Brack21e4ef22005-01-02 09:53:13 +000045435#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045436 int mem_base;
45437 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45438 int n_ctxt;
45439 int nargs; /* the number of arguments */
45440 int n_nargs;
45441
45442 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45443 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45444 mem_base = xmlMemBlocks();
45445 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45446 nargs = gen_int(n_nargs, 1);
45447
45448 xmlXPathNamespaceURIFunction(ctxt, nargs);
45449 call_tests++;
45450 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45451 des_int(n_nargs, nargs, 1);
45452 xmlResetLastError();
45453 if (mem_base != xmlMemBlocks()) {
45454 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45455 xmlMemBlocks() - mem_base);
45456 test_ret++;
45457 printf(" %d", n_ctxt);
45458 printf(" %d", n_nargs);
45459 printf("\n");
45460 }
45461 }
45462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045463 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045464#endif
45465
Daniel Veillarda82b1822004-11-08 16:24:57 +000045466 return(test_ret);
45467}
45468
45469
45470static int
45471test_xmlXPathNewBoolean(void) {
45472 int test_ret = 0;
45473
William M. Brack21e4ef22005-01-02 09:53:13 +000045474#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045475 int mem_base;
45476 xmlXPathObjectPtr ret_val;
45477 int val; /* the boolean value */
45478 int n_val;
45479
45480 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45481 mem_base = xmlMemBlocks();
45482 val = gen_int(n_val, 0);
45483
45484 ret_val = xmlXPathNewBoolean(val);
45485 desret_xmlXPathObjectPtr(ret_val);
45486 call_tests++;
45487 des_int(n_val, val, 0);
45488 xmlResetLastError();
45489 if (mem_base != xmlMemBlocks()) {
45490 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45491 xmlMemBlocks() - mem_base);
45492 test_ret++;
45493 printf(" %d", n_val);
45494 printf("\n");
45495 }
45496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045497 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045498#endif
45499
Daniel Veillarda82b1822004-11-08 16:24:57 +000045500 return(test_ret);
45501}
45502
45503
45504static int
45505test_xmlXPathNewCString(void) {
45506 int test_ret = 0;
45507
William M. Brack21e4ef22005-01-02 09:53:13 +000045508#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045509 int mem_base;
45510 xmlXPathObjectPtr ret_val;
45511 char * val; /* the char * value */
45512 int n_val;
45513
45514 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45515 mem_base = xmlMemBlocks();
45516 val = gen_const_char_ptr(n_val, 0);
45517
William M. Brackf13f77f2004-11-12 16:03:48 +000045518 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045519 desret_xmlXPathObjectPtr(ret_val);
45520 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045521 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045522 xmlResetLastError();
45523 if (mem_base != xmlMemBlocks()) {
45524 printf("Leak of %d blocks found in xmlXPathNewCString",
45525 xmlMemBlocks() - mem_base);
45526 test_ret++;
45527 printf(" %d", n_val);
45528 printf("\n");
45529 }
45530 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045531 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045532#endif
45533
Daniel Veillarda82b1822004-11-08 16:24:57 +000045534 return(test_ret);
45535}
45536
45537
45538static int
45539test_xmlXPathNewFloat(void) {
45540 int test_ret = 0;
45541
William M. Brack21e4ef22005-01-02 09:53:13 +000045542#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045543 int mem_base;
45544 xmlXPathObjectPtr ret_val;
45545 double val; /* the double value */
45546 int n_val;
45547
45548 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45549 mem_base = xmlMemBlocks();
45550 val = gen_double(n_val, 0);
45551
45552 ret_val = xmlXPathNewFloat(val);
45553 desret_xmlXPathObjectPtr(ret_val);
45554 call_tests++;
45555 des_double(n_val, val, 0);
45556 xmlResetLastError();
45557 if (mem_base != xmlMemBlocks()) {
45558 printf("Leak of %d blocks found in xmlXPathNewFloat",
45559 xmlMemBlocks() - mem_base);
45560 test_ret++;
45561 printf(" %d", n_val);
45562 printf("\n");
45563 }
45564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045565 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045566#endif
45567
Daniel Veillarda82b1822004-11-08 16:24:57 +000045568 return(test_ret);
45569}
45570
45571
45572static int
45573test_xmlXPathNewNodeSet(void) {
45574 int test_ret = 0;
45575
William M. Brack21e4ef22005-01-02 09:53:13 +000045576#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045577 int mem_base;
45578 xmlXPathObjectPtr ret_val;
45579 xmlNodePtr val; /* the NodePtr value */
45580 int n_val;
45581
45582 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45583 mem_base = xmlMemBlocks();
45584 val = gen_xmlNodePtr(n_val, 0);
45585
45586 ret_val = xmlXPathNewNodeSet(val);
45587 desret_xmlXPathObjectPtr(ret_val);
45588 call_tests++;
45589 des_xmlNodePtr(n_val, val, 0);
45590 xmlResetLastError();
45591 if (mem_base != xmlMemBlocks()) {
45592 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45593 xmlMemBlocks() - mem_base);
45594 test_ret++;
45595 printf(" %d", n_val);
45596 printf("\n");
45597 }
45598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045599 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045600#endif
45601
Daniel Veillarda82b1822004-11-08 16:24:57 +000045602 return(test_ret);
45603}
45604
45605
45606static int
45607test_xmlXPathNewNodeSetList(void) {
45608 int test_ret = 0;
45609
William M. Brack21e4ef22005-01-02 09:53:13 +000045610#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045611 int mem_base;
45612 xmlXPathObjectPtr ret_val;
45613 xmlNodeSetPtr val; /* an existing NodeSet */
45614 int n_val;
45615
45616 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45617 mem_base = xmlMemBlocks();
45618 val = gen_xmlNodeSetPtr(n_val, 0);
45619
45620 ret_val = xmlXPathNewNodeSetList(val);
45621 desret_xmlXPathObjectPtr(ret_val);
45622 call_tests++;
45623 des_xmlNodeSetPtr(n_val, val, 0);
45624 xmlResetLastError();
45625 if (mem_base != xmlMemBlocks()) {
45626 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45627 xmlMemBlocks() - mem_base);
45628 test_ret++;
45629 printf(" %d", n_val);
45630 printf("\n");
45631 }
45632 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045633 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045634#endif
45635
Daniel Veillarda82b1822004-11-08 16:24:57 +000045636 return(test_ret);
45637}
45638
45639
45640static int
45641test_xmlXPathNewParserContext(void) {
45642 int test_ret = 0;
45643
45644
45645 /* missing type support */
45646 return(test_ret);
45647}
45648
45649
45650static int
45651test_xmlXPathNewString(void) {
45652 int test_ret = 0;
45653
William M. Brack21e4ef22005-01-02 09:53:13 +000045654#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045655 int mem_base;
45656 xmlXPathObjectPtr ret_val;
45657 xmlChar * val; /* the xmlChar * value */
45658 int n_val;
45659
45660 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45661 mem_base = xmlMemBlocks();
45662 val = gen_const_xmlChar_ptr(n_val, 0);
45663
William M. Brackf13f77f2004-11-12 16:03:48 +000045664 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045665 desret_xmlXPathObjectPtr(ret_val);
45666 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045667 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045668 xmlResetLastError();
45669 if (mem_base != xmlMemBlocks()) {
45670 printf("Leak of %d blocks found in xmlXPathNewString",
45671 xmlMemBlocks() - mem_base);
45672 test_ret++;
45673 printf(" %d", n_val);
45674 printf("\n");
45675 }
45676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045677 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045678#endif
45679
Daniel Veillarda82b1822004-11-08 16:24:57 +000045680 return(test_ret);
45681}
45682
45683
45684static int
45685test_xmlXPathNextAncestor(void) {
45686 int test_ret = 0;
45687
William M. Brack21e4ef22005-01-02 09:53:13 +000045688#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045689 int mem_base;
45690 xmlNodePtr ret_val;
45691 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45692 int n_ctxt;
45693 xmlNodePtr cur; /* the current node in the traversal */
45694 int n_cur;
45695
45696 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45697 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45698 mem_base = xmlMemBlocks();
45699 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45700 cur = gen_xmlNodePtr(n_cur, 1);
45701
45702 ret_val = xmlXPathNextAncestor(ctxt, cur);
45703 desret_xmlNodePtr(ret_val);
45704 call_tests++;
45705 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45706 des_xmlNodePtr(n_cur, cur, 1);
45707 xmlResetLastError();
45708 if (mem_base != xmlMemBlocks()) {
45709 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45710 xmlMemBlocks() - mem_base);
45711 test_ret++;
45712 printf(" %d", n_ctxt);
45713 printf(" %d", n_cur);
45714 printf("\n");
45715 }
45716 }
45717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045718 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045719#endif
45720
Daniel Veillarda82b1822004-11-08 16:24:57 +000045721 return(test_ret);
45722}
45723
45724
45725static int
45726test_xmlXPathNextAncestorOrSelf(void) {
45727 int test_ret = 0;
45728
William M. Brack21e4ef22005-01-02 09:53:13 +000045729#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045730 int mem_base;
45731 xmlNodePtr ret_val;
45732 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45733 int n_ctxt;
45734 xmlNodePtr cur; /* the current node in the traversal */
45735 int n_cur;
45736
45737 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45738 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45739 mem_base = xmlMemBlocks();
45740 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45741 cur = gen_xmlNodePtr(n_cur, 1);
45742
45743 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45744 desret_xmlNodePtr(ret_val);
45745 call_tests++;
45746 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45747 des_xmlNodePtr(n_cur, cur, 1);
45748 xmlResetLastError();
45749 if (mem_base != xmlMemBlocks()) {
45750 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45751 xmlMemBlocks() - mem_base);
45752 test_ret++;
45753 printf(" %d", n_ctxt);
45754 printf(" %d", n_cur);
45755 printf("\n");
45756 }
45757 }
45758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045759 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045760#endif
45761
Daniel Veillarda82b1822004-11-08 16:24:57 +000045762 return(test_ret);
45763}
45764
45765
45766static int
45767test_xmlXPathNextAttribute(void) {
45768 int test_ret = 0;
45769
William M. Brack21e4ef22005-01-02 09:53:13 +000045770#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045771 int mem_base;
45772 xmlNodePtr ret_val;
45773 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45774 int n_ctxt;
45775 xmlNodePtr cur; /* the current attribute in the traversal */
45776 int n_cur;
45777
45778 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45779 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45780 mem_base = xmlMemBlocks();
45781 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45782 cur = gen_xmlNodePtr(n_cur, 1);
45783
45784 ret_val = xmlXPathNextAttribute(ctxt, cur);
45785 desret_xmlNodePtr(ret_val);
45786 call_tests++;
45787 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45788 des_xmlNodePtr(n_cur, cur, 1);
45789 xmlResetLastError();
45790 if (mem_base != xmlMemBlocks()) {
45791 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45792 xmlMemBlocks() - mem_base);
45793 test_ret++;
45794 printf(" %d", n_ctxt);
45795 printf(" %d", n_cur);
45796 printf("\n");
45797 }
45798 }
45799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045800 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045801#endif
45802
Daniel Veillarda82b1822004-11-08 16:24:57 +000045803 return(test_ret);
45804}
45805
45806
45807static int
45808test_xmlXPathNextChild(void) {
45809 int test_ret = 0;
45810
William M. Brack21e4ef22005-01-02 09:53:13 +000045811#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045812 int mem_base;
45813 xmlNodePtr ret_val;
45814 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45815 int n_ctxt;
45816 xmlNodePtr cur; /* the current node in the traversal */
45817 int n_cur;
45818
45819 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45820 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45821 mem_base = xmlMemBlocks();
45822 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45823 cur = gen_xmlNodePtr(n_cur, 1);
45824
45825 ret_val = xmlXPathNextChild(ctxt, cur);
45826 desret_xmlNodePtr(ret_val);
45827 call_tests++;
45828 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45829 des_xmlNodePtr(n_cur, cur, 1);
45830 xmlResetLastError();
45831 if (mem_base != xmlMemBlocks()) {
45832 printf("Leak of %d blocks found in xmlXPathNextChild",
45833 xmlMemBlocks() - mem_base);
45834 test_ret++;
45835 printf(" %d", n_ctxt);
45836 printf(" %d", n_cur);
45837 printf("\n");
45838 }
45839 }
45840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045841 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045842#endif
45843
Daniel Veillarda82b1822004-11-08 16:24:57 +000045844 return(test_ret);
45845}
45846
45847
45848static int
45849test_xmlXPathNextDescendant(void) {
45850 int test_ret = 0;
45851
William M. Brack21e4ef22005-01-02 09:53:13 +000045852#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045853 int mem_base;
45854 xmlNodePtr ret_val;
45855 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45856 int n_ctxt;
45857 xmlNodePtr cur; /* the current node in the traversal */
45858 int n_cur;
45859
45860 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45861 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45862 mem_base = xmlMemBlocks();
45863 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45864 cur = gen_xmlNodePtr(n_cur, 1);
45865
45866 ret_val = xmlXPathNextDescendant(ctxt, cur);
45867 desret_xmlNodePtr(ret_val);
45868 call_tests++;
45869 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45870 des_xmlNodePtr(n_cur, cur, 1);
45871 xmlResetLastError();
45872 if (mem_base != xmlMemBlocks()) {
45873 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45874 xmlMemBlocks() - mem_base);
45875 test_ret++;
45876 printf(" %d", n_ctxt);
45877 printf(" %d", n_cur);
45878 printf("\n");
45879 }
45880 }
45881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045882 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045883#endif
45884
Daniel Veillarda82b1822004-11-08 16:24:57 +000045885 return(test_ret);
45886}
45887
45888
45889static int
45890test_xmlXPathNextDescendantOrSelf(void) {
45891 int test_ret = 0;
45892
William M. Brack21e4ef22005-01-02 09:53:13 +000045893#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045894 int mem_base;
45895 xmlNodePtr ret_val;
45896 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45897 int n_ctxt;
45898 xmlNodePtr cur; /* the current node in the traversal */
45899 int n_cur;
45900
45901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45902 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45903 mem_base = xmlMemBlocks();
45904 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45905 cur = gen_xmlNodePtr(n_cur, 1);
45906
45907 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45908 desret_xmlNodePtr(ret_val);
45909 call_tests++;
45910 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45911 des_xmlNodePtr(n_cur, cur, 1);
45912 xmlResetLastError();
45913 if (mem_base != xmlMemBlocks()) {
45914 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45915 xmlMemBlocks() - mem_base);
45916 test_ret++;
45917 printf(" %d", n_ctxt);
45918 printf(" %d", n_cur);
45919 printf("\n");
45920 }
45921 }
45922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045923 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045924#endif
45925
Daniel Veillarda82b1822004-11-08 16:24:57 +000045926 return(test_ret);
45927}
45928
45929
45930static int
45931test_xmlXPathNextFollowing(void) {
45932 int test_ret = 0;
45933
William M. Brack21e4ef22005-01-02 09:53:13 +000045934#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045935 int mem_base;
45936 xmlNodePtr ret_val;
45937 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45938 int n_ctxt;
45939 xmlNodePtr cur; /* the current node in the traversal */
45940 int n_cur;
45941
45942 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45943 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45944 mem_base = xmlMemBlocks();
45945 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45946 cur = gen_xmlNodePtr(n_cur, 1);
45947
45948 ret_val = xmlXPathNextFollowing(ctxt, cur);
45949 desret_xmlNodePtr(ret_val);
45950 call_tests++;
45951 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45952 des_xmlNodePtr(n_cur, cur, 1);
45953 xmlResetLastError();
45954 if (mem_base != xmlMemBlocks()) {
45955 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45956 xmlMemBlocks() - mem_base);
45957 test_ret++;
45958 printf(" %d", n_ctxt);
45959 printf(" %d", n_cur);
45960 printf("\n");
45961 }
45962 }
45963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045964 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045965#endif
45966
Daniel Veillarda82b1822004-11-08 16:24:57 +000045967 return(test_ret);
45968}
45969
45970
45971static int
45972test_xmlXPathNextFollowingSibling(void) {
45973 int test_ret = 0;
45974
William M. Brack21e4ef22005-01-02 09:53:13 +000045975#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045976 int mem_base;
45977 xmlNodePtr ret_val;
45978 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45979 int n_ctxt;
45980 xmlNodePtr cur; /* the current node in the traversal */
45981 int n_cur;
45982
45983 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45984 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45985 mem_base = xmlMemBlocks();
45986 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45987 cur = gen_xmlNodePtr(n_cur, 1);
45988
45989 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45990 desret_xmlNodePtr(ret_val);
45991 call_tests++;
45992 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45993 des_xmlNodePtr(n_cur, cur, 1);
45994 xmlResetLastError();
45995 if (mem_base != xmlMemBlocks()) {
45996 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45997 xmlMemBlocks() - mem_base);
45998 test_ret++;
45999 printf(" %d", n_ctxt);
46000 printf(" %d", n_cur);
46001 printf("\n");
46002 }
46003 }
46004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046005 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046006#endif
46007
Daniel Veillarda82b1822004-11-08 16:24:57 +000046008 return(test_ret);
46009}
46010
46011
46012static int
46013test_xmlXPathNextNamespace(void) {
46014 int test_ret = 0;
46015
William M. Brack21e4ef22005-01-02 09:53:13 +000046016#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046017 int mem_base;
46018 xmlNodePtr ret_val;
46019 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46020 int n_ctxt;
46021 xmlNodePtr cur; /* the current attribute in the traversal */
46022 int n_cur;
46023
46024 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46025 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46026 mem_base = xmlMemBlocks();
46027 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46028 cur = gen_xmlNodePtr(n_cur, 1);
46029
46030 ret_val = xmlXPathNextNamespace(ctxt, cur);
46031 desret_xmlNodePtr(ret_val);
46032 call_tests++;
46033 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46034 des_xmlNodePtr(n_cur, cur, 1);
46035 xmlResetLastError();
46036 if (mem_base != xmlMemBlocks()) {
46037 printf("Leak of %d blocks found in xmlXPathNextNamespace",
46038 xmlMemBlocks() - mem_base);
46039 test_ret++;
46040 printf(" %d", n_ctxt);
46041 printf(" %d", n_cur);
46042 printf("\n");
46043 }
46044 }
46045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046046 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046047#endif
46048
Daniel Veillarda82b1822004-11-08 16:24:57 +000046049 return(test_ret);
46050}
46051
46052
46053static int
46054test_xmlXPathNextParent(void) {
46055 int test_ret = 0;
46056
William M. Brack21e4ef22005-01-02 09:53:13 +000046057#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046058 int mem_base;
46059 xmlNodePtr ret_val;
46060 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46061 int n_ctxt;
46062 xmlNodePtr cur; /* the current node in the traversal */
46063 int n_cur;
46064
46065 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46066 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46067 mem_base = xmlMemBlocks();
46068 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46069 cur = gen_xmlNodePtr(n_cur, 1);
46070
46071 ret_val = xmlXPathNextParent(ctxt, cur);
46072 desret_xmlNodePtr(ret_val);
46073 call_tests++;
46074 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46075 des_xmlNodePtr(n_cur, cur, 1);
46076 xmlResetLastError();
46077 if (mem_base != xmlMemBlocks()) {
46078 printf("Leak of %d blocks found in xmlXPathNextParent",
46079 xmlMemBlocks() - mem_base);
46080 test_ret++;
46081 printf(" %d", n_ctxt);
46082 printf(" %d", n_cur);
46083 printf("\n");
46084 }
46085 }
46086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046087 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046088#endif
46089
Daniel Veillarda82b1822004-11-08 16:24:57 +000046090 return(test_ret);
46091}
46092
46093
46094static int
46095test_xmlXPathNextPreceding(void) {
46096 int test_ret = 0;
46097
William M. Brack21e4ef22005-01-02 09:53:13 +000046098#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046099 int mem_base;
46100 xmlNodePtr ret_val;
46101 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46102 int n_ctxt;
46103 xmlNodePtr cur; /* the current node in the traversal */
46104 int n_cur;
46105
46106 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46107 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46108 mem_base = xmlMemBlocks();
46109 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46110 cur = gen_xmlNodePtr(n_cur, 1);
46111
46112 ret_val = xmlXPathNextPreceding(ctxt, cur);
46113 desret_xmlNodePtr(ret_val);
46114 call_tests++;
46115 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46116 des_xmlNodePtr(n_cur, cur, 1);
46117 xmlResetLastError();
46118 if (mem_base != xmlMemBlocks()) {
46119 printf("Leak of %d blocks found in xmlXPathNextPreceding",
46120 xmlMemBlocks() - mem_base);
46121 test_ret++;
46122 printf(" %d", n_ctxt);
46123 printf(" %d", n_cur);
46124 printf("\n");
46125 }
46126 }
46127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046128 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046129#endif
46130
Daniel Veillarda82b1822004-11-08 16:24:57 +000046131 return(test_ret);
46132}
46133
46134
46135static int
46136test_xmlXPathNextPrecedingSibling(void) {
46137 int test_ret = 0;
46138
William M. Brack21e4ef22005-01-02 09:53:13 +000046139#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046140 int mem_base;
46141 xmlNodePtr ret_val;
46142 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46143 int n_ctxt;
46144 xmlNodePtr cur; /* the current node in the traversal */
46145 int n_cur;
46146
46147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46148 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46149 mem_base = xmlMemBlocks();
46150 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46151 cur = gen_xmlNodePtr(n_cur, 1);
46152
46153 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
46154 desret_xmlNodePtr(ret_val);
46155 call_tests++;
46156 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46157 des_xmlNodePtr(n_cur, cur, 1);
46158 xmlResetLastError();
46159 if (mem_base != xmlMemBlocks()) {
46160 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
46161 xmlMemBlocks() - mem_base);
46162 test_ret++;
46163 printf(" %d", n_ctxt);
46164 printf(" %d", n_cur);
46165 printf("\n");
46166 }
46167 }
46168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046169 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046170#endif
46171
Daniel Veillarda82b1822004-11-08 16:24:57 +000046172 return(test_ret);
46173}
46174
46175
46176static int
46177test_xmlXPathNextSelf(void) {
46178 int test_ret = 0;
46179
William M. Brack21e4ef22005-01-02 09:53:13 +000046180#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046181 int mem_base;
46182 xmlNodePtr ret_val;
46183 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46184 int n_ctxt;
46185 xmlNodePtr cur; /* the current node in the traversal */
46186 int n_cur;
46187
46188 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46189 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46190 mem_base = xmlMemBlocks();
46191 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46192 cur = gen_xmlNodePtr(n_cur, 1);
46193
46194 ret_val = xmlXPathNextSelf(ctxt, cur);
46195 desret_xmlNodePtr(ret_val);
46196 call_tests++;
46197 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46198 des_xmlNodePtr(n_cur, cur, 1);
46199 xmlResetLastError();
46200 if (mem_base != xmlMemBlocks()) {
46201 printf("Leak of %d blocks found in xmlXPathNextSelf",
46202 xmlMemBlocks() - mem_base);
46203 test_ret++;
46204 printf(" %d", n_ctxt);
46205 printf(" %d", n_cur);
46206 printf("\n");
46207 }
46208 }
46209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046210 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046211#endif
46212
Daniel Veillarda82b1822004-11-08 16:24:57 +000046213 return(test_ret);
46214}
46215
46216
46217static int
46218test_xmlXPathNodeLeading(void) {
46219 int test_ret = 0;
46220
William M. Brack21e4ef22005-01-02 09:53:13 +000046221#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046222 int mem_base;
46223 xmlNodeSetPtr ret_val;
46224 xmlNodeSetPtr nodes; /* a node-set */
46225 int n_nodes;
46226 xmlNodePtr node; /* a node */
46227 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046228
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046229 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46230 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46231 mem_base = xmlMemBlocks();
46232 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46233 node = gen_xmlNodePtr(n_node, 1);
46234
46235 ret_val = xmlXPathNodeLeading(nodes, node);
46236 desret_xmlNodeSetPtr(ret_val);
46237 call_tests++;
46238 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46239 des_xmlNodePtr(n_node, node, 1);
46240 xmlResetLastError();
46241 if (mem_base != xmlMemBlocks()) {
46242 printf("Leak of %d blocks found in xmlXPathNodeLeading",
46243 xmlMemBlocks() - mem_base);
46244 test_ret++;
46245 printf(" %d", n_nodes);
46246 printf(" %d", n_node);
46247 printf("\n");
46248 }
46249 }
46250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046251 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046252#endif
46253
Daniel Veillarda82b1822004-11-08 16:24:57 +000046254 return(test_ret);
46255}
46256
46257
46258static int
46259test_xmlXPathNodeLeadingSorted(void) {
46260 int test_ret = 0;
46261
William M. Brack21e4ef22005-01-02 09:53:13 +000046262#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046263 int mem_base;
46264 xmlNodeSetPtr ret_val;
46265 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46266 int n_nodes;
46267 xmlNodePtr node; /* a node */
46268 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046269
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046270 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46271 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46272 mem_base = xmlMemBlocks();
46273 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46274 node = gen_xmlNodePtr(n_node, 1);
46275
46276 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
46277 desret_xmlNodeSetPtr(ret_val);
46278 call_tests++;
46279 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46280 des_xmlNodePtr(n_node, node, 1);
46281 xmlResetLastError();
46282 if (mem_base != xmlMemBlocks()) {
46283 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
46284 xmlMemBlocks() - mem_base);
46285 test_ret++;
46286 printf(" %d", n_nodes);
46287 printf(" %d", n_node);
46288 printf("\n");
46289 }
46290 }
46291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046292 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046293#endif
46294
Daniel Veillarda82b1822004-11-08 16:24:57 +000046295 return(test_ret);
46296}
46297
46298
46299static int
46300test_xmlXPathNodeSetAdd(void) {
46301 int test_ret = 0;
46302
William M. Brack21e4ef22005-01-02 09:53:13 +000046303#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046304 int mem_base;
46305 xmlNodeSetPtr cur; /* the initial node set */
46306 int n_cur;
46307 xmlNodePtr val; /* a new xmlNodePtr */
46308 int n_val;
46309
46310 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46311 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46312 mem_base = xmlMemBlocks();
46313 cur = gen_xmlNodeSetPtr(n_cur, 0);
46314 val = gen_xmlNodePtr(n_val, 1);
46315
46316 xmlXPathNodeSetAdd(cur, val);
46317 call_tests++;
46318 des_xmlNodeSetPtr(n_cur, cur, 0);
46319 des_xmlNodePtr(n_val, val, 1);
46320 xmlResetLastError();
46321 if (mem_base != xmlMemBlocks()) {
46322 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46323 xmlMemBlocks() - mem_base);
46324 test_ret++;
46325 printf(" %d", n_cur);
46326 printf(" %d", n_val);
46327 printf("\n");
46328 }
46329 }
46330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046331 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046332#endif
46333
Daniel Veillarda82b1822004-11-08 16:24:57 +000046334 return(test_ret);
46335}
46336
46337
46338static int
46339test_xmlXPathNodeSetAddNs(void) {
46340 int test_ret = 0;
46341
William M. Brack21e4ef22005-01-02 09:53:13 +000046342#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046343 int mem_base;
46344 xmlNodeSetPtr cur; /* the initial node set */
46345 int n_cur;
46346 xmlNodePtr node; /* the hosting node */
46347 int n_node;
46348 xmlNsPtr ns; /* a the namespace node */
46349 int n_ns;
46350
46351 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46352 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46353 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46354 mem_base = xmlMemBlocks();
46355 cur = gen_xmlNodeSetPtr(n_cur, 0);
46356 node = gen_xmlNodePtr(n_node, 1);
46357 ns = gen_xmlNsPtr(n_ns, 2);
46358
46359 xmlXPathNodeSetAddNs(cur, node, ns);
46360 call_tests++;
46361 des_xmlNodeSetPtr(n_cur, cur, 0);
46362 des_xmlNodePtr(n_node, node, 1);
46363 des_xmlNsPtr(n_ns, ns, 2);
46364 xmlResetLastError();
46365 if (mem_base != xmlMemBlocks()) {
46366 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46367 xmlMemBlocks() - mem_base);
46368 test_ret++;
46369 printf(" %d", n_cur);
46370 printf(" %d", n_node);
46371 printf(" %d", n_ns);
46372 printf("\n");
46373 }
46374 }
46375 }
46376 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046377 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046378#endif
46379
Daniel Veillarda82b1822004-11-08 16:24:57 +000046380 return(test_ret);
46381}
46382
46383
46384static int
46385test_xmlXPathNodeSetAddUnique(void) {
46386 int test_ret = 0;
46387
William M. Brack21e4ef22005-01-02 09:53:13 +000046388#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046389 int mem_base;
46390 xmlNodeSetPtr cur; /* the initial node set */
46391 int n_cur;
46392 xmlNodePtr val; /* a new xmlNodePtr */
46393 int n_val;
46394
46395 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46396 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46397 mem_base = xmlMemBlocks();
46398 cur = gen_xmlNodeSetPtr(n_cur, 0);
46399 val = gen_xmlNodePtr(n_val, 1);
46400
46401 xmlXPathNodeSetAddUnique(cur, val);
46402 call_tests++;
46403 des_xmlNodeSetPtr(n_cur, cur, 0);
46404 des_xmlNodePtr(n_val, val, 1);
46405 xmlResetLastError();
46406 if (mem_base != xmlMemBlocks()) {
46407 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46408 xmlMemBlocks() - mem_base);
46409 test_ret++;
46410 printf(" %d", n_cur);
46411 printf(" %d", n_val);
46412 printf("\n");
46413 }
46414 }
46415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046416 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046417#endif
46418
Daniel Veillarda82b1822004-11-08 16:24:57 +000046419 return(test_ret);
46420}
46421
46422
46423static int
46424test_xmlXPathNodeSetContains(void) {
46425 int test_ret = 0;
46426
William M. Brack21e4ef22005-01-02 09:53:13 +000046427#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046428 int mem_base;
46429 int ret_val;
46430 xmlNodeSetPtr cur; /* the node-set */
46431 int n_cur;
46432 xmlNodePtr val; /* the node */
46433 int n_val;
46434
46435 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46436 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46437 mem_base = xmlMemBlocks();
46438 cur = gen_xmlNodeSetPtr(n_cur, 0);
46439 val = gen_xmlNodePtr(n_val, 1);
46440
46441 ret_val = xmlXPathNodeSetContains(cur, val);
46442 desret_int(ret_val);
46443 call_tests++;
46444 des_xmlNodeSetPtr(n_cur, cur, 0);
46445 des_xmlNodePtr(n_val, val, 1);
46446 xmlResetLastError();
46447 if (mem_base != xmlMemBlocks()) {
46448 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46449 xmlMemBlocks() - mem_base);
46450 test_ret++;
46451 printf(" %d", n_cur);
46452 printf(" %d", n_val);
46453 printf("\n");
46454 }
46455 }
46456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046457 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046458#endif
46459
Daniel Veillarda82b1822004-11-08 16:24:57 +000046460 return(test_ret);
46461}
46462
46463
46464static int
46465test_xmlXPathNodeSetDel(void) {
46466 int test_ret = 0;
46467
William M. Brack21e4ef22005-01-02 09:53:13 +000046468#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046469 int mem_base;
46470 xmlNodeSetPtr cur; /* the initial node set */
46471 int n_cur;
46472 xmlNodePtr val; /* an xmlNodePtr */
46473 int n_val;
46474
46475 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46476 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46477 mem_base = xmlMemBlocks();
46478 cur = gen_xmlNodeSetPtr(n_cur, 0);
46479 val = gen_xmlNodePtr(n_val, 1);
46480
46481 xmlXPathNodeSetDel(cur, val);
46482 call_tests++;
46483 des_xmlNodeSetPtr(n_cur, cur, 0);
46484 des_xmlNodePtr(n_val, val, 1);
46485 xmlResetLastError();
46486 if (mem_base != xmlMemBlocks()) {
46487 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46488 xmlMemBlocks() - mem_base);
46489 test_ret++;
46490 printf(" %d", n_cur);
46491 printf(" %d", n_val);
46492 printf("\n");
46493 }
46494 }
46495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046496 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046497#endif
46498
Daniel Veillarda82b1822004-11-08 16:24:57 +000046499 return(test_ret);
46500}
46501
46502
46503static int
46504test_xmlXPathNodeSetMerge(void) {
46505 int test_ret = 0;
46506
William M. Brack21e4ef22005-01-02 09:53:13 +000046507#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046508 int mem_base;
46509 xmlNodeSetPtr ret_val;
46510 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46511 int n_val1;
46512 xmlNodeSetPtr val2; /* the second NodeSet */
46513 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046514
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046515 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46516 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46517 mem_base = xmlMemBlocks();
46518 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46519 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46520
46521 ret_val = xmlXPathNodeSetMerge(val1, val2);
46522 desret_xmlNodeSetPtr(ret_val);
46523 call_tests++;
46524 des_xmlNodeSetPtr(n_val1, val1, 0);
46525 des_xmlNodeSetPtr(n_val2, val2, 1);
46526 xmlResetLastError();
46527 if (mem_base != xmlMemBlocks()) {
46528 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46529 xmlMemBlocks() - mem_base);
46530 test_ret++;
46531 printf(" %d", n_val1);
46532 printf(" %d", n_val2);
46533 printf("\n");
46534 }
46535 }
46536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046537 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046538#endif
46539
Daniel Veillarda82b1822004-11-08 16:24:57 +000046540 return(test_ret);
46541}
46542
46543
46544static int
46545test_xmlXPathNodeSetRemove(void) {
46546 int test_ret = 0;
46547
William M. Brack21e4ef22005-01-02 09:53:13 +000046548#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046549 int mem_base;
46550 xmlNodeSetPtr cur; /* the initial node set */
46551 int n_cur;
46552 int val; /* the index to remove */
46553 int n_val;
46554
46555 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46556 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46557 mem_base = xmlMemBlocks();
46558 cur = gen_xmlNodeSetPtr(n_cur, 0);
46559 val = gen_int(n_val, 1);
46560
46561 xmlXPathNodeSetRemove(cur, val);
46562 call_tests++;
46563 des_xmlNodeSetPtr(n_cur, cur, 0);
46564 des_int(n_val, val, 1);
46565 xmlResetLastError();
46566 if (mem_base != xmlMemBlocks()) {
46567 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46568 xmlMemBlocks() - mem_base);
46569 test_ret++;
46570 printf(" %d", n_cur);
46571 printf(" %d", n_val);
46572 printf("\n");
46573 }
46574 }
46575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046576 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046577#endif
46578
Daniel Veillarda82b1822004-11-08 16:24:57 +000046579 return(test_ret);
46580}
46581
46582
46583static int
46584test_xmlXPathNodeSetSort(void) {
46585 int test_ret = 0;
46586
William M. Brack21e4ef22005-01-02 09:53:13 +000046587#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046588 int mem_base;
46589 xmlNodeSetPtr set; /* the node set */
46590 int n_set;
46591
46592 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46593 mem_base = xmlMemBlocks();
46594 set = gen_xmlNodeSetPtr(n_set, 0);
46595
46596 xmlXPathNodeSetSort(set);
46597 call_tests++;
46598 des_xmlNodeSetPtr(n_set, set, 0);
46599 xmlResetLastError();
46600 if (mem_base != xmlMemBlocks()) {
46601 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46602 xmlMemBlocks() - mem_base);
46603 test_ret++;
46604 printf(" %d", n_set);
46605 printf("\n");
46606 }
46607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046608 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046609#endif
46610
Daniel Veillarda82b1822004-11-08 16:24:57 +000046611 return(test_ret);
46612}
46613
46614
46615static int
46616test_xmlXPathNodeTrailing(void) {
46617 int test_ret = 0;
46618
William M. Brack21e4ef22005-01-02 09:53:13 +000046619#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046620 int mem_base;
46621 xmlNodeSetPtr ret_val;
46622 xmlNodeSetPtr nodes; /* a node-set */
46623 int n_nodes;
46624 xmlNodePtr node; /* a node */
46625 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046626
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046627 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46628 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46629 mem_base = xmlMemBlocks();
46630 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46631 node = gen_xmlNodePtr(n_node, 1);
46632
46633 ret_val = xmlXPathNodeTrailing(nodes, node);
46634 desret_xmlNodeSetPtr(ret_val);
46635 call_tests++;
46636 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46637 des_xmlNodePtr(n_node, node, 1);
46638 xmlResetLastError();
46639 if (mem_base != xmlMemBlocks()) {
46640 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46641 xmlMemBlocks() - mem_base);
46642 test_ret++;
46643 printf(" %d", n_nodes);
46644 printf(" %d", n_node);
46645 printf("\n");
46646 }
46647 }
46648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046649 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046650#endif
46651
Daniel Veillarda82b1822004-11-08 16:24:57 +000046652 return(test_ret);
46653}
46654
46655
46656static int
46657test_xmlXPathNodeTrailingSorted(void) {
46658 int test_ret = 0;
46659
William M. Brack21e4ef22005-01-02 09:53:13 +000046660#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046661 int mem_base;
46662 xmlNodeSetPtr ret_val;
46663 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46664 int n_nodes;
46665 xmlNodePtr node; /* a node */
46666 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046667
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046668 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46669 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46670 mem_base = xmlMemBlocks();
46671 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46672 node = gen_xmlNodePtr(n_node, 1);
46673
46674 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46675 desret_xmlNodeSetPtr(ret_val);
46676 call_tests++;
46677 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46678 des_xmlNodePtr(n_node, node, 1);
46679 xmlResetLastError();
46680 if (mem_base != xmlMemBlocks()) {
46681 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46682 xmlMemBlocks() - mem_base);
46683 test_ret++;
46684 printf(" %d", n_nodes);
46685 printf(" %d", n_node);
46686 printf("\n");
46687 }
46688 }
46689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046690 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046691#endif
46692
Daniel Veillarda82b1822004-11-08 16:24:57 +000046693 return(test_ret);
46694}
46695
46696
46697static int
46698test_xmlXPathNormalizeFunction(void) {
46699 int test_ret = 0;
46700
William M. Brack21e4ef22005-01-02 09:53:13 +000046701#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046702 int mem_base;
46703 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46704 int n_ctxt;
46705 int nargs; /* the number of arguments */
46706 int n_nargs;
46707
46708 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46709 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46710 mem_base = xmlMemBlocks();
46711 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46712 nargs = gen_int(n_nargs, 1);
46713
46714 xmlXPathNormalizeFunction(ctxt, nargs);
46715 call_tests++;
46716 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46717 des_int(n_nargs, nargs, 1);
46718 xmlResetLastError();
46719 if (mem_base != xmlMemBlocks()) {
46720 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46721 xmlMemBlocks() - mem_base);
46722 test_ret++;
46723 printf(" %d", n_ctxt);
46724 printf(" %d", n_nargs);
46725 printf("\n");
46726 }
46727 }
46728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046729 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046730#endif
46731
Daniel Veillarda82b1822004-11-08 16:24:57 +000046732 return(test_ret);
46733}
46734
46735
46736static int
46737test_xmlXPathNotEqualValues(void) {
46738 int test_ret = 0;
46739
William M. Brack21e4ef22005-01-02 09:53:13 +000046740#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046741 int mem_base;
46742 int ret_val;
46743 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46744 int n_ctxt;
46745
46746 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46747 mem_base = xmlMemBlocks();
46748 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46749
46750 ret_val = xmlXPathNotEqualValues(ctxt);
46751 desret_int(ret_val);
46752 call_tests++;
46753 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46754 xmlResetLastError();
46755 if (mem_base != xmlMemBlocks()) {
46756 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46757 xmlMemBlocks() - mem_base);
46758 test_ret++;
46759 printf(" %d", n_ctxt);
46760 printf("\n");
46761 }
46762 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046763 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046764#endif
46765
Daniel Veillarda82b1822004-11-08 16:24:57 +000046766 return(test_ret);
46767}
46768
46769
46770static int
46771test_xmlXPathNotFunction(void) {
46772 int test_ret = 0;
46773
William M. Brack21e4ef22005-01-02 09:53:13 +000046774#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046775 int mem_base;
46776 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46777 int n_ctxt;
46778 int nargs; /* the number of arguments */
46779 int n_nargs;
46780
46781 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46782 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46783 mem_base = xmlMemBlocks();
46784 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46785 nargs = gen_int(n_nargs, 1);
46786
46787 xmlXPathNotFunction(ctxt, nargs);
46788 call_tests++;
46789 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46790 des_int(n_nargs, nargs, 1);
46791 xmlResetLastError();
46792 if (mem_base != xmlMemBlocks()) {
46793 printf("Leak of %d blocks found in xmlXPathNotFunction",
46794 xmlMemBlocks() - mem_base);
46795 test_ret++;
46796 printf(" %d", n_ctxt);
46797 printf(" %d", n_nargs);
46798 printf("\n");
46799 }
46800 }
46801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046802 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046803#endif
46804
Daniel Veillarda82b1822004-11-08 16:24:57 +000046805 return(test_ret);
46806}
46807
46808
46809static int
46810test_xmlXPathNsLookup(void) {
46811 int test_ret = 0;
46812
William M. Brack21e4ef22005-01-02 09:53:13 +000046813#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046814 int mem_base;
46815 const xmlChar * ret_val;
46816 xmlXPathContextPtr ctxt; /* the XPath context */
46817 int n_ctxt;
46818 xmlChar * prefix; /* the namespace prefix value */
46819 int n_prefix;
46820
46821 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46822 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46823 mem_base = xmlMemBlocks();
46824 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46825 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46826
William M. Brackf13f77f2004-11-12 16:03:48 +000046827 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046828 desret_const_xmlChar_ptr(ret_val);
46829 call_tests++;
46830 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046831 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046832 xmlResetLastError();
46833 if (mem_base != xmlMemBlocks()) {
46834 printf("Leak of %d blocks found in xmlXPathNsLookup",
46835 xmlMemBlocks() - mem_base);
46836 test_ret++;
46837 printf(" %d", n_ctxt);
46838 printf(" %d", n_prefix);
46839 printf("\n");
46840 }
46841 }
46842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046843 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046844#endif
46845
Daniel Veillarda82b1822004-11-08 16:24:57 +000046846 return(test_ret);
46847}
46848
46849
46850static int
46851test_xmlXPathNumberFunction(void) {
46852 int test_ret = 0;
46853
William M. Brack21e4ef22005-01-02 09:53:13 +000046854#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046855 int mem_base;
46856 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46857 int n_ctxt;
46858 int nargs; /* the number of arguments */
46859 int n_nargs;
46860
46861 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46862 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46863 mem_base = xmlMemBlocks();
46864 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46865 nargs = gen_int(n_nargs, 1);
46866
46867 xmlXPathNumberFunction(ctxt, nargs);
46868 call_tests++;
46869 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46870 des_int(n_nargs, nargs, 1);
46871 xmlResetLastError();
46872 if (mem_base != xmlMemBlocks()) {
46873 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46874 xmlMemBlocks() - mem_base);
46875 test_ret++;
46876 printf(" %d", n_ctxt);
46877 printf(" %d", n_nargs);
46878 printf("\n");
46879 }
46880 }
46881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046882 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046883#endif
46884
Daniel Veillarda82b1822004-11-08 16:24:57 +000046885 return(test_ret);
46886}
46887
46888
46889static int
46890test_xmlXPathParseNCName(void) {
46891 int test_ret = 0;
46892
William M. Brack21e4ef22005-01-02 09:53:13 +000046893#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046894 int mem_base;
46895 xmlChar * ret_val;
46896 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46897 int n_ctxt;
46898
46899 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46900 mem_base = xmlMemBlocks();
46901 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46902
46903 ret_val = xmlXPathParseNCName(ctxt);
46904 desret_xmlChar_ptr(ret_val);
46905 call_tests++;
46906 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46907 xmlResetLastError();
46908 if (mem_base != xmlMemBlocks()) {
46909 printf("Leak of %d blocks found in xmlXPathParseNCName",
46910 xmlMemBlocks() - mem_base);
46911 test_ret++;
46912 printf(" %d", n_ctxt);
46913 printf("\n");
46914 }
46915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046916 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046917#endif
46918
Daniel Veillarda82b1822004-11-08 16:24:57 +000046919 return(test_ret);
46920}
46921
46922
46923static int
46924test_xmlXPathParseName(void) {
46925 int test_ret = 0;
46926
William M. Brack21e4ef22005-01-02 09:53:13 +000046927#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046928 int mem_base;
46929 xmlChar * ret_val;
46930 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46931 int n_ctxt;
46932
46933 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46934 mem_base = xmlMemBlocks();
46935 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46936
46937 ret_val = xmlXPathParseName(ctxt);
46938 desret_xmlChar_ptr(ret_val);
46939 call_tests++;
46940 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46941 xmlResetLastError();
46942 if (mem_base != xmlMemBlocks()) {
46943 printf("Leak of %d blocks found in xmlXPathParseName",
46944 xmlMemBlocks() - mem_base);
46945 test_ret++;
46946 printf(" %d", n_ctxt);
46947 printf("\n");
46948 }
46949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046950 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046951#endif
46952
Daniel Veillarda82b1822004-11-08 16:24:57 +000046953 return(test_ret);
46954}
46955
46956
46957static int
46958test_xmlXPathPopBoolean(void) {
46959 int test_ret = 0;
46960
William M. Brack21e4ef22005-01-02 09:53:13 +000046961#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046962 int mem_base;
46963 int ret_val;
46964 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46965 int n_ctxt;
46966
46967 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46968 mem_base = xmlMemBlocks();
46969 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46970
46971 ret_val = xmlXPathPopBoolean(ctxt);
46972 desret_int(ret_val);
46973 call_tests++;
46974 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46975 xmlResetLastError();
46976 if (mem_base != xmlMemBlocks()) {
46977 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46978 xmlMemBlocks() - mem_base);
46979 test_ret++;
46980 printf(" %d", n_ctxt);
46981 printf("\n");
46982 }
46983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046984 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046985#endif
46986
Daniel Veillarda82b1822004-11-08 16:24:57 +000046987 return(test_ret);
46988}
46989
46990
46991static int
46992test_xmlXPathPopExternal(void) {
46993 int test_ret = 0;
46994
William M. Brack21e4ef22005-01-02 09:53:13 +000046995#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046996 int mem_base;
46997 void * ret_val;
46998 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46999 int n_ctxt;
47000
47001 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47002 mem_base = xmlMemBlocks();
47003 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47004
47005 ret_val = xmlXPathPopExternal(ctxt);
47006 desret_void_ptr(ret_val);
47007 call_tests++;
47008 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47009 xmlResetLastError();
47010 if (mem_base != xmlMemBlocks()) {
47011 printf("Leak of %d blocks found in xmlXPathPopExternal",
47012 xmlMemBlocks() - mem_base);
47013 test_ret++;
47014 printf(" %d", n_ctxt);
47015 printf("\n");
47016 }
47017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047018 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047019#endif
47020
Daniel Veillarda82b1822004-11-08 16:24:57 +000047021 return(test_ret);
47022}
47023
47024
47025static int
47026test_xmlXPathPopNodeSet(void) {
47027 int test_ret = 0;
47028
William M. Brack21e4ef22005-01-02 09:53:13 +000047029#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047030 int mem_base;
47031 xmlNodeSetPtr ret_val;
47032 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47033 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047034
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047035 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47036 mem_base = xmlMemBlocks();
47037 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47038
47039 ret_val = xmlXPathPopNodeSet(ctxt);
47040 desret_xmlNodeSetPtr(ret_val);
47041 call_tests++;
47042 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47043 xmlResetLastError();
47044 if (mem_base != xmlMemBlocks()) {
47045 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
47046 xmlMemBlocks() - mem_base);
47047 test_ret++;
47048 printf(" %d", n_ctxt);
47049 printf("\n");
47050 }
47051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047052 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047053#endif
47054
Daniel Veillarda82b1822004-11-08 16:24:57 +000047055 return(test_ret);
47056}
47057
47058
47059static int
47060test_xmlXPathPopNumber(void) {
47061 int test_ret = 0;
47062
William M. Brack21e4ef22005-01-02 09:53:13 +000047063#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047064 int mem_base;
47065 double ret_val;
47066 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47067 int n_ctxt;
47068
47069 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47070 mem_base = xmlMemBlocks();
47071 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47072
47073 ret_val = xmlXPathPopNumber(ctxt);
47074 desret_double(ret_val);
47075 call_tests++;
47076 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47077 xmlResetLastError();
47078 if (mem_base != xmlMemBlocks()) {
47079 printf("Leak of %d blocks found in xmlXPathPopNumber",
47080 xmlMemBlocks() - mem_base);
47081 test_ret++;
47082 printf(" %d", n_ctxt);
47083 printf("\n");
47084 }
47085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047086 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047087#endif
47088
Daniel Veillarda82b1822004-11-08 16:24:57 +000047089 return(test_ret);
47090}
47091
47092
47093static int
47094test_xmlXPathPopString(void) {
47095 int test_ret = 0;
47096
William M. Brack21e4ef22005-01-02 09:53:13 +000047097#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047098 int mem_base;
47099 xmlChar * ret_val;
47100 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47101 int n_ctxt;
47102
47103 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47104 mem_base = xmlMemBlocks();
47105 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47106
47107 ret_val = xmlXPathPopString(ctxt);
47108 desret_xmlChar_ptr(ret_val);
47109 call_tests++;
47110 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47111 xmlResetLastError();
47112 if (mem_base != xmlMemBlocks()) {
47113 printf("Leak of %d blocks found in xmlXPathPopString",
47114 xmlMemBlocks() - mem_base);
47115 test_ret++;
47116 printf(" %d", n_ctxt);
47117 printf("\n");
47118 }
47119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047120 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047121#endif
47122
Daniel Veillarda82b1822004-11-08 16:24:57 +000047123 return(test_ret);
47124}
47125
47126
47127static int
47128test_xmlXPathPositionFunction(void) {
47129 int test_ret = 0;
47130
William M. Brack21e4ef22005-01-02 09:53:13 +000047131#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047132 int mem_base;
47133 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47134 int n_ctxt;
47135 int nargs; /* the number of arguments */
47136 int n_nargs;
47137
47138 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47139 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47140 mem_base = xmlMemBlocks();
47141 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47142 nargs = gen_int(n_nargs, 1);
47143
47144 xmlXPathPositionFunction(ctxt, nargs);
47145 call_tests++;
47146 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47147 des_int(n_nargs, nargs, 1);
47148 xmlResetLastError();
47149 if (mem_base != xmlMemBlocks()) {
47150 printf("Leak of %d blocks found in xmlXPathPositionFunction",
47151 xmlMemBlocks() - mem_base);
47152 test_ret++;
47153 printf(" %d", n_ctxt);
47154 printf(" %d", n_nargs);
47155 printf("\n");
47156 }
47157 }
47158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047159 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047160#endif
47161
Daniel Veillarda82b1822004-11-08 16:24:57 +000047162 return(test_ret);
47163}
47164
47165
47166static int
47167test_xmlXPathRegisterAllFunctions(void) {
47168 int test_ret = 0;
47169
William M. Brack21e4ef22005-01-02 09:53:13 +000047170#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047171 int mem_base;
47172 xmlXPathContextPtr ctxt; /* the XPath context */
47173 int n_ctxt;
47174
47175 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47176 mem_base = xmlMemBlocks();
47177 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47178
47179 xmlXPathRegisterAllFunctions(ctxt);
47180 call_tests++;
47181 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47182 xmlResetLastError();
47183 if (mem_base != xmlMemBlocks()) {
47184 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
47185 xmlMemBlocks() - mem_base);
47186 test_ret++;
47187 printf(" %d", n_ctxt);
47188 printf("\n");
47189 }
47190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047191 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047192#endif
47193
Daniel Veillarda82b1822004-11-08 16:24:57 +000047194 return(test_ret);
47195}
47196
47197
47198static int
47199test_xmlXPathRegisterFunc(void) {
47200 int test_ret = 0;
47201
47202
47203 /* missing type support */
47204 return(test_ret);
47205}
47206
47207
47208static int
47209test_xmlXPathRegisterFuncLookup(void) {
47210 int test_ret = 0;
47211
47212
47213 /* missing type support */
47214 return(test_ret);
47215}
47216
47217
47218static int
47219test_xmlXPathRegisterFuncNS(void) {
47220 int test_ret = 0;
47221
47222
47223 /* missing type support */
47224 return(test_ret);
47225}
47226
47227
47228static int
47229test_xmlXPathRegisterNs(void) {
47230 int test_ret = 0;
47231
William M. Brack21e4ef22005-01-02 09:53:13 +000047232#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047233 int mem_base;
47234 int ret_val;
47235 xmlXPathContextPtr ctxt; /* the XPath context */
47236 int n_ctxt;
47237 xmlChar * prefix; /* the namespace prefix */
47238 int n_prefix;
47239 xmlChar * ns_uri; /* the namespace name */
47240 int n_ns_uri;
47241
47242 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47243 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47244 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47245 mem_base = xmlMemBlocks();
47246 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47247 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47248 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47249
William M. Brackf13f77f2004-11-12 16:03:48 +000047250 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047251 desret_int(ret_val);
47252 call_tests++;
47253 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047254 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
47255 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047256 xmlResetLastError();
47257 if (mem_base != xmlMemBlocks()) {
47258 printf("Leak of %d blocks found in xmlXPathRegisterNs",
47259 xmlMemBlocks() - mem_base);
47260 test_ret++;
47261 printf(" %d", n_ctxt);
47262 printf(" %d", n_prefix);
47263 printf(" %d", n_ns_uri);
47264 printf("\n");
47265 }
47266 }
47267 }
47268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047269 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047270#endif
47271
Daniel Veillarda82b1822004-11-08 16:24:57 +000047272 return(test_ret);
47273}
47274
47275
47276static int
47277test_xmlXPathRegisterVariable(void) {
47278 int test_ret = 0;
47279
William M. Brack21e4ef22005-01-02 09:53:13 +000047280#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047281 int mem_base;
47282 int ret_val;
47283 xmlXPathContextPtr ctxt; /* the XPath context */
47284 int n_ctxt;
47285 xmlChar * name; /* the variable name */
47286 int n_name;
47287 xmlXPathObjectPtr value; /* the variable value or NULL */
47288 int n_value;
47289
47290 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47291 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47292 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47293 mem_base = xmlMemBlocks();
47294 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47295 name = gen_const_xmlChar_ptr(n_name, 1);
47296 value = gen_xmlXPathObjectPtr(n_value, 2);
47297
William M. Brackf13f77f2004-11-12 16:03:48 +000047298 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047299 desret_int(ret_val);
47300 call_tests++;
47301 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047302 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047303 des_xmlXPathObjectPtr(n_value, value, 2);
47304 xmlResetLastError();
47305 if (mem_base != xmlMemBlocks()) {
47306 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47307 xmlMemBlocks() - mem_base);
47308 test_ret++;
47309 printf(" %d", n_ctxt);
47310 printf(" %d", n_name);
47311 printf(" %d", n_value);
47312 printf("\n");
47313 }
47314 }
47315 }
47316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047317 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047318#endif
47319
Daniel Veillarda82b1822004-11-08 16:24:57 +000047320 return(test_ret);
47321}
47322
47323
47324static int
47325test_xmlXPathRegisterVariableLookup(void) {
47326 int test_ret = 0;
47327
47328
47329 /* missing type support */
47330 return(test_ret);
47331}
47332
47333
47334static int
47335test_xmlXPathRegisterVariableNS(void) {
47336 int test_ret = 0;
47337
William M. Brack21e4ef22005-01-02 09:53:13 +000047338#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047339 int mem_base;
47340 int ret_val;
47341 xmlXPathContextPtr ctxt; /* the XPath context */
47342 int n_ctxt;
47343 xmlChar * name; /* the variable name */
47344 int n_name;
47345 xmlChar * ns_uri; /* the variable namespace URI */
47346 int n_ns_uri;
47347 xmlXPathObjectPtr value; /* the variable value or NULL */
47348 int n_value;
47349
47350 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47351 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47352 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47353 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47354 mem_base = xmlMemBlocks();
47355 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47356 name = gen_const_xmlChar_ptr(n_name, 1);
47357 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47358 value = gen_xmlXPathObjectPtr(n_value, 3);
47359
William M. Brackf13f77f2004-11-12 16:03:48 +000047360 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047361 desret_int(ret_val);
47362 call_tests++;
47363 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047364 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47365 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047366 des_xmlXPathObjectPtr(n_value, value, 3);
47367 xmlResetLastError();
47368 if (mem_base != xmlMemBlocks()) {
47369 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47370 xmlMemBlocks() - mem_base);
47371 test_ret++;
47372 printf(" %d", n_ctxt);
47373 printf(" %d", n_name);
47374 printf(" %d", n_ns_uri);
47375 printf(" %d", n_value);
47376 printf("\n");
47377 }
47378 }
47379 }
47380 }
47381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047382 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047383#endif
47384
Daniel Veillarda82b1822004-11-08 16:24:57 +000047385 return(test_ret);
47386}
47387
47388
47389static int
47390test_xmlXPathRegisteredFuncsCleanup(void) {
47391 int test_ret = 0;
47392
William M. Brack21e4ef22005-01-02 09:53:13 +000047393#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047394 int mem_base;
47395 xmlXPathContextPtr ctxt; /* the XPath context */
47396 int n_ctxt;
47397
47398 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47399 mem_base = xmlMemBlocks();
47400 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47401
47402 xmlXPathRegisteredFuncsCleanup(ctxt);
47403 call_tests++;
47404 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47405 xmlResetLastError();
47406 if (mem_base != xmlMemBlocks()) {
47407 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
47408 xmlMemBlocks() - mem_base);
47409 test_ret++;
47410 printf(" %d", n_ctxt);
47411 printf("\n");
47412 }
47413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047414 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047415#endif
47416
Daniel Veillarda82b1822004-11-08 16:24:57 +000047417 return(test_ret);
47418}
47419
47420
47421static int
47422test_xmlXPathRegisteredNsCleanup(void) {
47423 int test_ret = 0;
47424
William M. Brack21e4ef22005-01-02 09:53:13 +000047425#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047426 int mem_base;
47427 xmlXPathContextPtr ctxt; /* the XPath context */
47428 int n_ctxt;
47429
47430 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47431 mem_base = xmlMemBlocks();
47432 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47433
47434 xmlXPathRegisteredNsCleanup(ctxt);
47435 call_tests++;
47436 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47437 xmlResetLastError();
47438 if (mem_base != xmlMemBlocks()) {
47439 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47440 xmlMemBlocks() - mem_base);
47441 test_ret++;
47442 printf(" %d", n_ctxt);
47443 printf("\n");
47444 }
47445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047446 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047447#endif
47448
Daniel Veillarda82b1822004-11-08 16:24:57 +000047449 return(test_ret);
47450}
47451
47452
47453static int
47454test_xmlXPathRegisteredVariablesCleanup(void) {
47455 int test_ret = 0;
47456
William M. Brack21e4ef22005-01-02 09:53:13 +000047457#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047458 int mem_base;
47459 xmlXPathContextPtr ctxt; /* the XPath context */
47460 int n_ctxt;
47461
47462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47463 mem_base = xmlMemBlocks();
47464 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47465
47466 xmlXPathRegisteredVariablesCleanup(ctxt);
47467 call_tests++;
47468 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47469 xmlResetLastError();
47470 if (mem_base != xmlMemBlocks()) {
47471 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47472 xmlMemBlocks() - mem_base);
47473 test_ret++;
47474 printf(" %d", n_ctxt);
47475 printf("\n");
47476 }
47477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047478 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047479#endif
47480
Daniel Veillarda82b1822004-11-08 16:24:57 +000047481 return(test_ret);
47482}
47483
47484
47485static int
47486test_xmlXPathRoot(void) {
47487 int test_ret = 0;
47488
William M. Brack21e4ef22005-01-02 09:53:13 +000047489#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047490 int mem_base;
47491 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47492 int n_ctxt;
47493
47494 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47495 mem_base = xmlMemBlocks();
47496 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47497
47498 xmlXPathRoot(ctxt);
47499 call_tests++;
47500 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47501 xmlResetLastError();
47502 if (mem_base != xmlMemBlocks()) {
47503 printf("Leak of %d blocks found in xmlXPathRoot",
47504 xmlMemBlocks() - mem_base);
47505 test_ret++;
47506 printf(" %d", n_ctxt);
47507 printf("\n");
47508 }
47509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047510 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047511#endif
47512
Daniel Veillarda82b1822004-11-08 16:24:57 +000047513 return(test_ret);
47514}
47515
47516
47517static int
47518test_xmlXPathRoundFunction(void) {
47519 int test_ret = 0;
47520
William M. Brack21e4ef22005-01-02 09:53:13 +000047521#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047522 int mem_base;
47523 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47524 int n_ctxt;
47525 int nargs; /* the number of arguments */
47526 int n_nargs;
47527
47528 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47529 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47530 mem_base = xmlMemBlocks();
47531 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47532 nargs = gen_int(n_nargs, 1);
47533
47534 xmlXPathRoundFunction(ctxt, nargs);
47535 call_tests++;
47536 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47537 des_int(n_nargs, nargs, 1);
47538 xmlResetLastError();
47539 if (mem_base != xmlMemBlocks()) {
47540 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47541 xmlMemBlocks() - mem_base);
47542 test_ret++;
47543 printf(" %d", n_ctxt);
47544 printf(" %d", n_nargs);
47545 printf("\n");
47546 }
47547 }
47548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047549 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047550#endif
47551
Daniel Veillarda82b1822004-11-08 16:24:57 +000047552 return(test_ret);
47553}
47554
47555
47556static int
47557test_xmlXPathStartsWithFunction(void) {
47558 int test_ret = 0;
47559
William M. Brack21e4ef22005-01-02 09:53:13 +000047560#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047561 int mem_base;
47562 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47563 int n_ctxt;
47564 int nargs; /* the number of arguments */
47565 int n_nargs;
47566
47567 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47568 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47569 mem_base = xmlMemBlocks();
47570 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47571 nargs = gen_int(n_nargs, 1);
47572
47573 xmlXPathStartsWithFunction(ctxt, nargs);
47574 call_tests++;
47575 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47576 des_int(n_nargs, nargs, 1);
47577 xmlResetLastError();
47578 if (mem_base != xmlMemBlocks()) {
47579 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47580 xmlMemBlocks() - mem_base);
47581 test_ret++;
47582 printf(" %d", n_ctxt);
47583 printf(" %d", n_nargs);
47584 printf("\n");
47585 }
47586 }
47587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047588 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047589#endif
47590
Daniel Veillarda82b1822004-11-08 16:24:57 +000047591 return(test_ret);
47592}
47593
47594
47595static int
47596test_xmlXPathStringEvalNumber(void) {
47597 int test_ret = 0;
47598
William M. Brack21e4ef22005-01-02 09:53:13 +000047599#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047600 int mem_base;
47601 double ret_val;
47602 xmlChar * str; /* A string to scan */
47603 int n_str;
47604
47605 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47606 mem_base = xmlMemBlocks();
47607 str = gen_const_xmlChar_ptr(n_str, 0);
47608
William M. Brackf13f77f2004-11-12 16:03:48 +000047609 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047610 desret_double(ret_val);
47611 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047612 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047613 xmlResetLastError();
47614 if (mem_base != xmlMemBlocks()) {
47615 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47616 xmlMemBlocks() - mem_base);
47617 test_ret++;
47618 printf(" %d", n_str);
47619 printf("\n");
47620 }
47621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047622 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047623#endif
47624
Daniel Veillarda82b1822004-11-08 16:24:57 +000047625 return(test_ret);
47626}
47627
47628
47629static int
47630test_xmlXPathStringFunction(void) {
47631 int test_ret = 0;
47632
William M. Brack21e4ef22005-01-02 09:53:13 +000047633#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047634 int mem_base;
47635 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47636 int n_ctxt;
47637 int nargs; /* the number of arguments */
47638 int n_nargs;
47639
47640 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47641 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47642 mem_base = xmlMemBlocks();
47643 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47644 nargs = gen_int(n_nargs, 1);
47645
47646 xmlXPathStringFunction(ctxt, nargs);
47647 call_tests++;
47648 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47649 des_int(n_nargs, nargs, 1);
47650 xmlResetLastError();
47651 if (mem_base != xmlMemBlocks()) {
47652 printf("Leak of %d blocks found in xmlXPathStringFunction",
47653 xmlMemBlocks() - mem_base);
47654 test_ret++;
47655 printf(" %d", n_ctxt);
47656 printf(" %d", n_nargs);
47657 printf("\n");
47658 }
47659 }
47660 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047661 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047662#endif
47663
Daniel Veillarda82b1822004-11-08 16:24:57 +000047664 return(test_ret);
47665}
47666
47667
47668static int
47669test_xmlXPathStringLengthFunction(void) {
47670 int test_ret = 0;
47671
William M. Brack21e4ef22005-01-02 09:53:13 +000047672#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047673 int mem_base;
47674 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47675 int n_ctxt;
47676 int nargs; /* the number of arguments */
47677 int n_nargs;
47678
47679 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47680 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47681 mem_base = xmlMemBlocks();
47682 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47683 nargs = gen_int(n_nargs, 1);
47684
47685 xmlXPathStringLengthFunction(ctxt, nargs);
47686 call_tests++;
47687 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47688 des_int(n_nargs, nargs, 1);
47689 xmlResetLastError();
47690 if (mem_base != xmlMemBlocks()) {
47691 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47692 xmlMemBlocks() - mem_base);
47693 test_ret++;
47694 printf(" %d", n_ctxt);
47695 printf(" %d", n_nargs);
47696 printf("\n");
47697 }
47698 }
47699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047700 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047701#endif
47702
Daniel Veillarda82b1822004-11-08 16:24:57 +000047703 return(test_ret);
47704}
47705
47706
47707static int
47708test_xmlXPathSubValues(void) {
47709 int test_ret = 0;
47710
William M. Brack21e4ef22005-01-02 09:53:13 +000047711#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047712 int mem_base;
47713 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47714 int n_ctxt;
47715
47716 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47717 mem_base = xmlMemBlocks();
47718 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47719
47720 xmlXPathSubValues(ctxt);
47721 call_tests++;
47722 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47723 xmlResetLastError();
47724 if (mem_base != xmlMemBlocks()) {
47725 printf("Leak of %d blocks found in xmlXPathSubValues",
47726 xmlMemBlocks() - mem_base);
47727 test_ret++;
47728 printf(" %d", n_ctxt);
47729 printf("\n");
47730 }
47731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047732 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047733#endif
47734
Daniel Veillarda82b1822004-11-08 16:24:57 +000047735 return(test_ret);
47736}
47737
47738
47739static int
47740test_xmlXPathSubstringAfterFunction(void) {
47741 int test_ret = 0;
47742
William M. Brack21e4ef22005-01-02 09:53:13 +000047743#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047744 int mem_base;
47745 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47746 int n_ctxt;
47747 int nargs; /* the number of arguments */
47748 int n_nargs;
47749
47750 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47751 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47752 mem_base = xmlMemBlocks();
47753 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47754 nargs = gen_int(n_nargs, 1);
47755
47756 xmlXPathSubstringAfterFunction(ctxt, nargs);
47757 call_tests++;
47758 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47759 des_int(n_nargs, nargs, 1);
47760 xmlResetLastError();
47761 if (mem_base != xmlMemBlocks()) {
47762 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47763 xmlMemBlocks() - mem_base);
47764 test_ret++;
47765 printf(" %d", n_ctxt);
47766 printf(" %d", n_nargs);
47767 printf("\n");
47768 }
47769 }
47770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047771 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047772#endif
47773
Daniel Veillarda82b1822004-11-08 16:24:57 +000047774 return(test_ret);
47775}
47776
47777
47778static int
47779test_xmlXPathSubstringBeforeFunction(void) {
47780 int test_ret = 0;
47781
William M. Brack21e4ef22005-01-02 09:53:13 +000047782#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047783 int mem_base;
47784 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47785 int n_ctxt;
47786 int nargs; /* the number of arguments */
47787 int n_nargs;
47788
47789 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47790 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47791 mem_base = xmlMemBlocks();
47792 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47793 nargs = gen_int(n_nargs, 1);
47794
47795 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47796 call_tests++;
47797 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47798 des_int(n_nargs, nargs, 1);
47799 xmlResetLastError();
47800 if (mem_base != xmlMemBlocks()) {
47801 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47802 xmlMemBlocks() - mem_base);
47803 test_ret++;
47804 printf(" %d", n_ctxt);
47805 printf(" %d", n_nargs);
47806 printf("\n");
47807 }
47808 }
47809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047810 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047811#endif
47812
Daniel Veillarda82b1822004-11-08 16:24:57 +000047813 return(test_ret);
47814}
47815
47816
47817static int
47818test_xmlXPathSubstringFunction(void) {
47819 int test_ret = 0;
47820
William M. Brack21e4ef22005-01-02 09:53:13 +000047821#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047822 int mem_base;
47823 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47824 int n_ctxt;
47825 int nargs; /* the number of arguments */
47826 int n_nargs;
47827
47828 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47829 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47830 mem_base = xmlMemBlocks();
47831 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47832 nargs = gen_int(n_nargs, 1);
47833
47834 xmlXPathSubstringFunction(ctxt, nargs);
47835 call_tests++;
47836 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47837 des_int(n_nargs, nargs, 1);
47838 xmlResetLastError();
47839 if (mem_base != xmlMemBlocks()) {
47840 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47841 xmlMemBlocks() - mem_base);
47842 test_ret++;
47843 printf(" %d", n_ctxt);
47844 printf(" %d", n_nargs);
47845 printf("\n");
47846 }
47847 }
47848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047849 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047850#endif
47851
Daniel Veillarda82b1822004-11-08 16:24:57 +000047852 return(test_ret);
47853}
47854
47855
47856static int
47857test_xmlXPathSumFunction(void) {
47858 int test_ret = 0;
47859
William M. Brack21e4ef22005-01-02 09:53:13 +000047860#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047861 int mem_base;
47862 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47863 int n_ctxt;
47864 int nargs; /* the number of arguments */
47865 int n_nargs;
47866
47867 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47868 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47869 mem_base = xmlMemBlocks();
47870 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47871 nargs = gen_int(n_nargs, 1);
47872
47873 xmlXPathSumFunction(ctxt, nargs);
47874 call_tests++;
47875 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47876 des_int(n_nargs, nargs, 1);
47877 xmlResetLastError();
47878 if (mem_base != xmlMemBlocks()) {
47879 printf("Leak of %d blocks found in xmlXPathSumFunction",
47880 xmlMemBlocks() - mem_base);
47881 test_ret++;
47882 printf(" %d", n_ctxt);
47883 printf(" %d", n_nargs);
47884 printf("\n");
47885 }
47886 }
47887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047888 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047889#endif
47890
Daniel Veillarda82b1822004-11-08 16:24:57 +000047891 return(test_ret);
47892}
47893
47894
47895static int
47896test_xmlXPathTrailing(void) {
47897 int test_ret = 0;
47898
William M. Brack21e4ef22005-01-02 09:53:13 +000047899#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047900 int mem_base;
47901 xmlNodeSetPtr ret_val;
47902 xmlNodeSetPtr nodes1; /* a node-set */
47903 int n_nodes1;
47904 xmlNodeSetPtr nodes2; /* a node-set */
47905 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047906
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047907 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47908 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47909 mem_base = xmlMemBlocks();
47910 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47911 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47912
47913 ret_val = xmlXPathTrailing(nodes1, nodes2);
47914 desret_xmlNodeSetPtr(ret_val);
47915 call_tests++;
47916 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47917 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47918 xmlResetLastError();
47919 if (mem_base != xmlMemBlocks()) {
47920 printf("Leak of %d blocks found in xmlXPathTrailing",
47921 xmlMemBlocks() - mem_base);
47922 test_ret++;
47923 printf(" %d", n_nodes1);
47924 printf(" %d", n_nodes2);
47925 printf("\n");
47926 }
47927 }
47928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047929 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047930#endif
47931
Daniel Veillarda82b1822004-11-08 16:24:57 +000047932 return(test_ret);
47933}
47934
47935
47936static int
47937test_xmlXPathTrailingSorted(void) {
47938 int test_ret = 0;
47939
William M. Brack21e4ef22005-01-02 09:53:13 +000047940#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047941 int mem_base;
47942 xmlNodeSetPtr ret_val;
47943 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47944 int n_nodes1;
47945 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47946 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047947
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047948 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47949 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47950 mem_base = xmlMemBlocks();
47951 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47952 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47953
47954 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47955 desret_xmlNodeSetPtr(ret_val);
47956 call_tests++;
47957 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47958 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47959 xmlResetLastError();
47960 if (mem_base != xmlMemBlocks()) {
47961 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47962 xmlMemBlocks() - mem_base);
47963 test_ret++;
47964 printf(" %d", n_nodes1);
47965 printf(" %d", n_nodes2);
47966 printf("\n");
47967 }
47968 }
47969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047970 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047971#endif
47972
Daniel Veillarda82b1822004-11-08 16:24:57 +000047973 return(test_ret);
47974}
47975
47976
47977static int
47978test_xmlXPathTranslateFunction(void) {
47979 int test_ret = 0;
47980
William M. Brack21e4ef22005-01-02 09:53:13 +000047981#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047982 int mem_base;
47983 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47984 int n_ctxt;
47985 int nargs; /* the number of arguments */
47986 int n_nargs;
47987
47988 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47989 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47990 mem_base = xmlMemBlocks();
47991 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47992 nargs = gen_int(n_nargs, 1);
47993
47994 xmlXPathTranslateFunction(ctxt, nargs);
47995 call_tests++;
47996 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47997 des_int(n_nargs, nargs, 1);
47998 xmlResetLastError();
47999 if (mem_base != xmlMemBlocks()) {
48000 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
48001 xmlMemBlocks() - mem_base);
48002 test_ret++;
48003 printf(" %d", n_ctxt);
48004 printf(" %d", n_nargs);
48005 printf("\n");
48006 }
48007 }
48008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048009 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048010#endif
48011
Daniel Veillarda82b1822004-11-08 16:24:57 +000048012 return(test_ret);
48013}
48014
48015
48016static int
48017test_xmlXPathTrueFunction(void) {
48018 int test_ret = 0;
48019
William M. Brack21e4ef22005-01-02 09:53:13 +000048020#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048021 int mem_base;
48022 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48023 int n_ctxt;
48024 int nargs; /* the number of arguments */
48025 int n_nargs;
48026
48027 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48028 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48029 mem_base = xmlMemBlocks();
48030 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48031 nargs = gen_int(n_nargs, 1);
48032
48033 xmlXPathTrueFunction(ctxt, nargs);
48034 call_tests++;
48035 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48036 des_int(n_nargs, nargs, 1);
48037 xmlResetLastError();
48038 if (mem_base != xmlMemBlocks()) {
48039 printf("Leak of %d blocks found in xmlXPathTrueFunction",
48040 xmlMemBlocks() - mem_base);
48041 test_ret++;
48042 printf(" %d", n_ctxt);
48043 printf(" %d", n_nargs);
48044 printf("\n");
48045 }
48046 }
48047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048049#endif
48050
Daniel Veillarda82b1822004-11-08 16:24:57 +000048051 return(test_ret);
48052}
48053
48054
48055static int
48056test_xmlXPathValueFlipSign(void) {
48057 int test_ret = 0;
48058
William M. Brack21e4ef22005-01-02 09:53:13 +000048059#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048060 int mem_base;
48061 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48062 int n_ctxt;
48063
48064 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48065 mem_base = xmlMemBlocks();
48066 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48067
48068 xmlXPathValueFlipSign(ctxt);
48069 call_tests++;
48070 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48071 xmlResetLastError();
48072 if (mem_base != xmlMemBlocks()) {
48073 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
48074 xmlMemBlocks() - mem_base);
48075 test_ret++;
48076 printf(" %d", n_ctxt);
48077 printf("\n");
48078 }
48079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048080 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048081#endif
48082
Daniel Veillarda82b1822004-11-08 16:24:57 +000048083 return(test_ret);
48084}
48085
48086
48087static int
48088test_xmlXPathVariableLookup(void) {
48089 int test_ret = 0;
48090
William M. Brack21e4ef22005-01-02 09:53:13 +000048091#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048092 int mem_base;
48093 xmlXPathObjectPtr ret_val;
48094 xmlXPathContextPtr ctxt; /* the XPath context */
48095 int n_ctxt;
48096 xmlChar * name; /* the variable name */
48097 int n_name;
48098
48099 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48100 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48101 mem_base = xmlMemBlocks();
48102 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48103 name = gen_const_xmlChar_ptr(n_name, 1);
48104
William M. Brackf13f77f2004-11-12 16:03:48 +000048105 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048106 desret_xmlXPathObjectPtr(ret_val);
48107 call_tests++;
48108 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048109 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048110 xmlResetLastError();
48111 if (mem_base != xmlMemBlocks()) {
48112 printf("Leak of %d blocks found in xmlXPathVariableLookup",
48113 xmlMemBlocks() - mem_base);
48114 test_ret++;
48115 printf(" %d", n_ctxt);
48116 printf(" %d", n_name);
48117 printf("\n");
48118 }
48119 }
48120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048121 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048122#endif
48123
Daniel Veillarda82b1822004-11-08 16:24:57 +000048124 return(test_ret);
48125}
48126
48127
48128static int
48129test_xmlXPathVariableLookupNS(void) {
48130 int test_ret = 0;
48131
William M. Brack21e4ef22005-01-02 09:53:13 +000048132#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048133 int mem_base;
48134 xmlXPathObjectPtr ret_val;
48135 xmlXPathContextPtr ctxt; /* the XPath context */
48136 int n_ctxt;
48137 xmlChar * name; /* the variable name */
48138 int n_name;
48139 xmlChar * ns_uri; /* the variable namespace URI */
48140 int n_ns_uri;
48141
48142 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48143 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48144 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
48145 mem_base = xmlMemBlocks();
48146 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48147 name = gen_const_xmlChar_ptr(n_name, 1);
48148 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
48149
William M. Brackf13f77f2004-11-12 16:03:48 +000048150 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048151 desret_xmlXPathObjectPtr(ret_val);
48152 call_tests++;
48153 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048154 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
48155 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048156 xmlResetLastError();
48157 if (mem_base != xmlMemBlocks()) {
48158 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
48159 xmlMemBlocks() - mem_base);
48160 test_ret++;
48161 printf(" %d", n_ctxt);
48162 printf(" %d", n_name);
48163 printf(" %d", n_ns_uri);
48164 printf("\n");
48165 }
48166 }
48167 }
48168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048169 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048170#endif
48171
Daniel Veillarda82b1822004-11-08 16:24:57 +000048172 return(test_ret);
48173}
48174
48175
48176static int
48177test_xmlXPathWrapCString(void) {
48178 int test_ret = 0;
48179
William M. Brack21e4ef22005-01-02 09:53:13 +000048180#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048181 int mem_base;
48182 xmlXPathObjectPtr ret_val;
48183 char * val; /* the char * value */
48184 int n_val;
48185
48186 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
48187 mem_base = xmlMemBlocks();
48188 val = gen_char_ptr(n_val, 0);
48189
48190 ret_val = xmlXPathWrapCString(val);
48191 desret_xmlXPathObjectPtr(ret_val);
48192 call_tests++;
48193 des_char_ptr(n_val, val, 0);
48194 xmlResetLastError();
48195 if (mem_base != xmlMemBlocks()) {
48196 printf("Leak of %d blocks found in xmlXPathWrapCString",
48197 xmlMemBlocks() - mem_base);
48198 test_ret++;
48199 printf(" %d", n_val);
48200 printf("\n");
48201 }
48202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048203 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048204#endif
48205
Daniel Veillarda82b1822004-11-08 16:24:57 +000048206 return(test_ret);
48207}
48208
48209
48210static int
48211test_xmlXPathWrapExternal(void) {
48212 int test_ret = 0;
48213
William M. Brack21e4ef22005-01-02 09:53:13 +000048214#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048215 int mem_base;
48216 xmlXPathObjectPtr ret_val;
48217 void * val; /* the user data */
48218 int n_val;
48219
48220 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
48221 mem_base = xmlMemBlocks();
48222 val = gen_void_ptr(n_val, 0);
48223
48224 ret_val = xmlXPathWrapExternal(val);
48225 desret_xmlXPathObjectPtr(ret_val);
48226 call_tests++;
48227 des_void_ptr(n_val, val, 0);
48228 xmlResetLastError();
48229 if (mem_base != xmlMemBlocks()) {
48230 printf("Leak of %d blocks found in xmlXPathWrapExternal",
48231 xmlMemBlocks() - mem_base);
48232 test_ret++;
48233 printf(" %d", n_val);
48234 printf("\n");
48235 }
48236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048237 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048238#endif
48239
Daniel Veillarda82b1822004-11-08 16:24:57 +000048240 return(test_ret);
48241}
48242
48243
48244static int
48245test_xmlXPathWrapNodeSet(void) {
48246 int test_ret = 0;
48247
William M. Brack21e4ef22005-01-02 09:53:13 +000048248#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048249 int mem_base;
48250 xmlXPathObjectPtr ret_val;
48251 xmlNodeSetPtr val; /* the NodePtr value */
48252 int n_val;
48253
48254 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
48255 mem_base = xmlMemBlocks();
48256 val = gen_xmlNodeSetPtr(n_val, 0);
48257
48258 ret_val = xmlXPathWrapNodeSet(val);
48259 desret_xmlXPathObjectPtr(ret_val);
48260 call_tests++;
48261 des_xmlNodeSetPtr(n_val, val, 0);
48262 xmlResetLastError();
48263 if (mem_base != xmlMemBlocks()) {
48264 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
48265 xmlMemBlocks() - mem_base);
48266 test_ret++;
48267 printf(" %d", n_val);
48268 printf("\n");
48269 }
48270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048271 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048272#endif
48273
Daniel Veillarda82b1822004-11-08 16:24:57 +000048274 return(test_ret);
48275}
48276
48277
48278static int
48279test_xmlXPatherror(void) {
48280 int test_ret = 0;
48281
William M. Brack21e4ef22005-01-02 09:53:13 +000048282#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048283 int mem_base;
48284 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48285 int n_ctxt;
48286 const char * file; /* the file name */
48287 int n_file;
48288 int line; /* the line number */
48289 int n_line;
48290 int no; /* the error number */
48291 int n_no;
48292
48293 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48294 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48295 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48296 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48297 mem_base = xmlMemBlocks();
48298 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48299 file = gen_filepath(n_file, 1);
48300 line = gen_int(n_line, 2);
48301 no = gen_int(n_no, 3);
48302
48303 xmlXPatherror(ctxt, file, line, no);
48304 call_tests++;
48305 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48306 des_filepath(n_file, file, 1);
48307 des_int(n_line, line, 2);
48308 des_int(n_no, no, 3);
48309 xmlResetLastError();
48310 if (mem_base != xmlMemBlocks()) {
48311 printf("Leak of %d blocks found in xmlXPatherror",
48312 xmlMemBlocks() - mem_base);
48313 test_ret++;
48314 printf(" %d", n_ctxt);
48315 printf(" %d", n_file);
48316 printf(" %d", n_line);
48317 printf(" %d", n_no);
48318 printf("\n");
48319 }
48320 }
48321 }
48322 }
48323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048324 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048325#endif
48326
Daniel Veillarda82b1822004-11-08 16:24:57 +000048327 return(test_ret);
48328}
48329
48330static int
48331test_xpathInternals(void) {
48332 int test_ret = 0;
48333
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048334 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048335 test_ret += test_valuePop();
48336 test_ret += test_valuePush();
48337 test_ret += test_xmlXPathAddValues();
48338 test_ret += test_xmlXPathBooleanFunction();
48339 test_ret += test_xmlXPathCeilingFunction();
48340 test_ret += test_xmlXPathCompareValues();
48341 test_ret += test_xmlXPathConcatFunction();
48342 test_ret += test_xmlXPathContainsFunction();
48343 test_ret += test_xmlXPathCountFunction();
48344 test_ret += test_xmlXPathDebugDumpCompExpr();
48345 test_ret += test_xmlXPathDebugDumpObject();
48346 test_ret += test_xmlXPathDifference();
48347 test_ret += test_xmlXPathDistinct();
48348 test_ret += test_xmlXPathDistinctSorted();
48349 test_ret += test_xmlXPathDivValues();
48350 test_ret += test_xmlXPathEqualValues();
48351 test_ret += test_xmlXPathErr();
48352 test_ret += test_xmlXPathEvalExpr();
48353 test_ret += test_xmlXPathEvaluatePredicateResult();
48354 test_ret += test_xmlXPathFalseFunction();
48355 test_ret += test_xmlXPathFloorFunction();
48356 test_ret += test_xmlXPathFunctionLookup();
48357 test_ret += test_xmlXPathFunctionLookupNS();
48358 test_ret += test_xmlXPathHasSameNodes();
48359 test_ret += test_xmlXPathIdFunction();
48360 test_ret += test_xmlXPathIntersection();
48361 test_ret += test_xmlXPathIsNodeType();
48362 test_ret += test_xmlXPathLangFunction();
48363 test_ret += test_xmlXPathLastFunction();
48364 test_ret += test_xmlXPathLeading();
48365 test_ret += test_xmlXPathLeadingSorted();
48366 test_ret += test_xmlXPathLocalNameFunction();
48367 test_ret += test_xmlXPathModValues();
48368 test_ret += test_xmlXPathMultValues();
48369 test_ret += test_xmlXPathNamespaceURIFunction();
48370 test_ret += test_xmlXPathNewBoolean();
48371 test_ret += test_xmlXPathNewCString();
48372 test_ret += test_xmlXPathNewFloat();
48373 test_ret += test_xmlXPathNewNodeSet();
48374 test_ret += test_xmlXPathNewNodeSetList();
48375 test_ret += test_xmlXPathNewParserContext();
48376 test_ret += test_xmlXPathNewString();
48377 test_ret += test_xmlXPathNextAncestor();
48378 test_ret += test_xmlXPathNextAncestorOrSelf();
48379 test_ret += test_xmlXPathNextAttribute();
48380 test_ret += test_xmlXPathNextChild();
48381 test_ret += test_xmlXPathNextDescendant();
48382 test_ret += test_xmlXPathNextDescendantOrSelf();
48383 test_ret += test_xmlXPathNextFollowing();
48384 test_ret += test_xmlXPathNextFollowingSibling();
48385 test_ret += test_xmlXPathNextNamespace();
48386 test_ret += test_xmlXPathNextParent();
48387 test_ret += test_xmlXPathNextPreceding();
48388 test_ret += test_xmlXPathNextPrecedingSibling();
48389 test_ret += test_xmlXPathNextSelf();
48390 test_ret += test_xmlXPathNodeLeading();
48391 test_ret += test_xmlXPathNodeLeadingSorted();
48392 test_ret += test_xmlXPathNodeSetAdd();
48393 test_ret += test_xmlXPathNodeSetAddNs();
48394 test_ret += test_xmlXPathNodeSetAddUnique();
48395 test_ret += test_xmlXPathNodeSetContains();
48396 test_ret += test_xmlXPathNodeSetDel();
48397 test_ret += test_xmlXPathNodeSetMerge();
48398 test_ret += test_xmlXPathNodeSetRemove();
48399 test_ret += test_xmlXPathNodeSetSort();
48400 test_ret += test_xmlXPathNodeTrailing();
48401 test_ret += test_xmlXPathNodeTrailingSorted();
48402 test_ret += test_xmlXPathNormalizeFunction();
48403 test_ret += test_xmlXPathNotEqualValues();
48404 test_ret += test_xmlXPathNotFunction();
48405 test_ret += test_xmlXPathNsLookup();
48406 test_ret += test_xmlXPathNumberFunction();
48407 test_ret += test_xmlXPathParseNCName();
48408 test_ret += test_xmlXPathParseName();
48409 test_ret += test_xmlXPathPopBoolean();
48410 test_ret += test_xmlXPathPopExternal();
48411 test_ret += test_xmlXPathPopNodeSet();
48412 test_ret += test_xmlXPathPopNumber();
48413 test_ret += test_xmlXPathPopString();
48414 test_ret += test_xmlXPathPositionFunction();
48415 test_ret += test_xmlXPathRegisterAllFunctions();
48416 test_ret += test_xmlXPathRegisterFunc();
48417 test_ret += test_xmlXPathRegisterFuncLookup();
48418 test_ret += test_xmlXPathRegisterFuncNS();
48419 test_ret += test_xmlXPathRegisterNs();
48420 test_ret += test_xmlXPathRegisterVariable();
48421 test_ret += test_xmlXPathRegisterVariableLookup();
48422 test_ret += test_xmlXPathRegisterVariableNS();
48423 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48424 test_ret += test_xmlXPathRegisteredNsCleanup();
48425 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48426 test_ret += test_xmlXPathRoot();
48427 test_ret += test_xmlXPathRoundFunction();
48428 test_ret += test_xmlXPathStartsWithFunction();
48429 test_ret += test_xmlXPathStringEvalNumber();
48430 test_ret += test_xmlXPathStringFunction();
48431 test_ret += test_xmlXPathStringLengthFunction();
48432 test_ret += test_xmlXPathSubValues();
48433 test_ret += test_xmlXPathSubstringAfterFunction();
48434 test_ret += test_xmlXPathSubstringBeforeFunction();
48435 test_ret += test_xmlXPathSubstringFunction();
48436 test_ret += test_xmlXPathSumFunction();
48437 test_ret += test_xmlXPathTrailing();
48438 test_ret += test_xmlXPathTrailingSorted();
48439 test_ret += test_xmlXPathTranslateFunction();
48440 test_ret += test_xmlXPathTrueFunction();
48441 test_ret += test_xmlXPathValueFlipSign();
48442 test_ret += test_xmlXPathVariableLookup();
48443 test_ret += test_xmlXPathVariableLookupNS();
48444 test_ret += test_xmlXPathWrapCString();
48445 test_ret += test_xmlXPathWrapExternal();
48446 test_ret += test_xmlXPathWrapNodeSet();
48447 test_ret += test_xmlXPatherror();
48448
48449 if (test_ret != 0)
48450 printf("Module xpathInternals: %d errors\n", test_ret);
48451 return(test_ret);
48452}
48453
Daniel Veillardd93f6252004-11-02 15:53:51 +000048454static int
48455test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048457
William M. Brack21e4ef22005-01-02 09:53:13 +000048458#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048459 int mem_base;
48460 xmlNodePtr ret_val;
48461 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48462 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048463
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048464 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048466 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048467
48468 ret_val = xmlXPtrBuildNodeList(obj);
48469 desret_xmlNodePtr(ret_val);
48470 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048471 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048472 xmlResetLastError();
48473 if (mem_base != xmlMemBlocks()) {
48474 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048476 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048477 printf(" %d", n_obj);
48478 printf("\n");
48479 }
48480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048481 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048482#endif
48483
Daniel Veillard42595322004-11-08 10:52:06 +000048484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048485}
48486
48487
48488static int
48489test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048491
William M. Brack21e4ef22005-01-02 09:53:13 +000048492#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048493 int mem_base;
48494 xmlXPathObjectPtr ret_val;
48495 xmlChar * str; /* the XPointer expression */
48496 int n_str;
48497 xmlXPathContextPtr ctx; /* the XPointer context */
48498 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048499
Daniel Veillardce682bc2004-11-05 17:22:25 +000048500 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48501 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48502 mem_base = xmlMemBlocks();
48503 str = gen_const_xmlChar_ptr(n_str, 0);
48504 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48505
William M. Brackf13f77f2004-11-12 16:03:48 +000048506 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048507 desret_xmlXPathObjectPtr(ret_val);
48508 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048509 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048510 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48511 xmlResetLastError();
48512 if (mem_base != xmlMemBlocks()) {
48513 printf("Leak of %d blocks found in xmlXPtrEval",
48514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048516 printf(" %d", n_str);
48517 printf(" %d", n_ctx);
48518 printf("\n");
48519 }
48520 }
48521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048522 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048523#endif
48524
Daniel Veillard42595322004-11-08 10:52:06 +000048525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048526}
48527
48528
48529static int
48530test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048532
William M. Brack21e4ef22005-01-02 09:53:13 +000048533#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048534 int mem_base;
48535 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48536 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048537
Daniel Veillardce682bc2004-11-05 17:22:25 +000048538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48539 mem_base = xmlMemBlocks();
48540 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48541
48542 xmlXPtrEvalRangePredicate(ctxt);
48543 call_tests++;
48544 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48545 xmlResetLastError();
48546 if (mem_base != xmlMemBlocks()) {
48547 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048549 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048550 printf(" %d", n_ctxt);
48551 printf("\n");
48552 }
48553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048554 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048555#endif
48556
Daniel Veillard42595322004-11-08 10:52:06 +000048557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048558}
48559
Daniel Veillarda521d282004-11-09 14:59:59 +000048560#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048561
Daniel Veillardce682bc2004-11-05 17:22:25 +000048562#define gen_nb_xmlLocationSetPtr 1
48563static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48564 return(NULL);
48565}
48566static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48567}
Daniel Veillarda521d282004-11-09 14:59:59 +000048568#endif
48569
Daniel Veillardce682bc2004-11-05 17:22:25 +000048570
Daniel Veillardd93f6252004-11-02 15:53:51 +000048571static int
48572test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048574
William M. Brack21e4ef22005-01-02 09:53:13 +000048575#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048576 int mem_base;
48577 xmlLocationSetPtr cur; /* the initial range set */
48578 int n_cur;
48579 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48580 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048581
Daniel Veillardce682bc2004-11-05 17:22:25 +000048582 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48583 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48584 mem_base = xmlMemBlocks();
48585 cur = gen_xmlLocationSetPtr(n_cur, 0);
48586 val = gen_xmlXPathObjectPtr(n_val, 1);
48587
48588 xmlXPtrLocationSetAdd(cur, val);
48589 call_tests++;
48590 des_xmlLocationSetPtr(n_cur, cur, 0);
48591 des_xmlXPathObjectPtr(n_val, val, 1);
48592 xmlResetLastError();
48593 if (mem_base != xmlMemBlocks()) {
48594 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048596 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048597 printf(" %d", n_cur);
48598 printf(" %d", n_val);
48599 printf("\n");
48600 }
48601 }
48602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048603 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048604#endif
48605
Daniel Veillard42595322004-11-08 10:52:06 +000048606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048607}
48608
48609
48610static int
48611test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048613
48614
48615 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048617}
48618
48619
48620static int
48621test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048623
William M. Brack21e4ef22005-01-02 09:53:13 +000048624#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048625 int mem_base;
48626 xmlLocationSetPtr cur; /* the initial range set */
48627 int n_cur;
48628 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48629 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048630
Daniel Veillardce682bc2004-11-05 17:22:25 +000048631 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48632 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48633 mem_base = xmlMemBlocks();
48634 cur = gen_xmlLocationSetPtr(n_cur, 0);
48635 val = gen_xmlXPathObjectPtr(n_val, 1);
48636
48637 xmlXPtrLocationSetDel(cur, val);
48638 call_tests++;
48639 des_xmlLocationSetPtr(n_cur, cur, 0);
48640 des_xmlXPathObjectPtr(n_val, val, 1);
48641 xmlResetLastError();
48642 if (mem_base != xmlMemBlocks()) {
48643 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048646 printf(" %d", n_cur);
48647 printf(" %d", n_val);
48648 printf("\n");
48649 }
48650 }
48651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048653#endif
48654
Daniel Veillard42595322004-11-08 10:52:06 +000048655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048656}
48657
48658
48659static int
48660test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048662
48663
48664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048666}
48667
48668
48669static int
48670test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048672
William M. Brack21e4ef22005-01-02 09:53:13 +000048673#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048674 int mem_base;
48675 xmlLocationSetPtr cur; /* the initial range set */
48676 int n_cur;
48677 int val; /* the index to remove */
48678 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048679
Daniel Veillardce682bc2004-11-05 17:22:25 +000048680 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48681 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48682 mem_base = xmlMemBlocks();
48683 cur = gen_xmlLocationSetPtr(n_cur, 0);
48684 val = gen_int(n_val, 1);
48685
48686 xmlXPtrLocationSetRemove(cur, val);
48687 call_tests++;
48688 des_xmlLocationSetPtr(n_cur, cur, 0);
48689 des_int(n_val, val, 1);
48690 xmlResetLastError();
48691 if (mem_base != xmlMemBlocks()) {
48692 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048694 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048695 printf(" %d", n_cur);
48696 printf(" %d", n_val);
48697 printf("\n");
48698 }
48699 }
48700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048701 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +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_xmlXPtrNewCollapsedRange(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 xmlNodePtr start; /* the starting and ending node */
48716 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048717
Daniel Veillard3d97e662004-11-04 10:49:00 +000048718 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48719 mem_base = xmlMemBlocks();
48720 start = gen_xmlNodePtr(n_start, 0);
48721
48722 ret_val = xmlXPtrNewCollapsedRange(start);
48723 desret_xmlXPathObjectPtr(ret_val);
48724 call_tests++;
48725 des_xmlNodePtr(n_start, start, 0);
48726 xmlResetLastError();
48727 if (mem_base != xmlMemBlocks()) {
48728 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048730 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048731 printf(" %d", n_start);
48732 printf("\n");
48733 }
48734 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048735 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048736#endif
48737
Daniel Veillard42595322004-11-08 10:52:06 +000048738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048739}
48740
48741
48742static int
48743test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048745
48746
48747 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048749}
48750
48751
48752static int
48753test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048755
William M. Brack21e4ef22005-01-02 09:53:13 +000048756#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048757 int mem_base;
48758 xmlXPathObjectPtr ret_val;
48759 xmlNodeSetPtr set; /* a node set */
48760 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048761
Daniel Veillardce682bc2004-11-05 17:22:25 +000048762 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48763 mem_base = xmlMemBlocks();
48764 set = gen_xmlNodeSetPtr(n_set, 0);
48765
48766 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48767 desret_xmlXPathObjectPtr(ret_val);
48768 call_tests++;
48769 des_xmlNodeSetPtr(n_set, set, 0);
48770 xmlResetLastError();
48771 if (mem_base != xmlMemBlocks()) {
48772 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
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_set);
48776 printf("\n");
48777 }
48778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048779 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048780#endif
48781
Daniel Veillard42595322004-11-08 10:52:06 +000048782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048783}
48784
48785
48786static int
48787test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048789
William M. Brack21e4ef22005-01-02 09:53:13 +000048790#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048791 int mem_base;
48792 xmlXPathObjectPtr ret_val;
48793 xmlNodePtr start; /* the start NodePtr value */
48794 int n_start;
48795 xmlNodePtr end; /* the end NodePtr value or NULL */
48796 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048797
Daniel Veillard3d97e662004-11-04 10:49:00 +000048798 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48799 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48800 mem_base = xmlMemBlocks();
48801 start = gen_xmlNodePtr(n_start, 0);
48802 end = gen_xmlNodePtr(n_end, 1);
48803
48804 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48805 desret_xmlXPathObjectPtr(ret_val);
48806 call_tests++;
48807 des_xmlNodePtr(n_start, start, 0);
48808 des_xmlNodePtr(n_end, end, 1);
48809 xmlResetLastError();
48810 if (mem_base != xmlMemBlocks()) {
48811 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048813 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048814 printf(" %d", n_start);
48815 printf(" %d", n_end);
48816 printf("\n");
48817 }
48818 }
48819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048820 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048821#endif
48822
Daniel Veillard42595322004-11-08 10:52:06 +000048823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048824}
48825
48826
48827static int
48828test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048830
William M. Brack21e4ef22005-01-02 09:53:13 +000048831#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048832 int mem_base;
48833 xmlXPathObjectPtr ret_val;
48834 xmlNodePtr start; /* the starting node */
48835 int n_start;
48836 int startindex; /* the start index */
48837 int n_startindex;
48838 xmlNodePtr end; /* the ending point */
48839 int n_end;
48840 int endindex; /* the ending index */
48841 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048842
Daniel Veillard3d97e662004-11-04 10:49:00 +000048843 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48844 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48845 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48846 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48847 mem_base = xmlMemBlocks();
48848 start = gen_xmlNodePtr(n_start, 0);
48849 startindex = gen_int(n_startindex, 1);
48850 end = gen_xmlNodePtr(n_end, 2);
48851 endindex = gen_int(n_endindex, 3);
48852
48853 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48854 desret_xmlXPathObjectPtr(ret_val);
48855 call_tests++;
48856 des_xmlNodePtr(n_start, start, 0);
48857 des_int(n_startindex, startindex, 1);
48858 des_xmlNodePtr(n_end, end, 2);
48859 des_int(n_endindex, endindex, 3);
48860 xmlResetLastError();
48861 if (mem_base != xmlMemBlocks()) {
48862 printf("Leak of %d blocks found in xmlXPtrNewRange",
48863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048864 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048865 printf(" %d", n_start);
48866 printf(" %d", n_startindex);
48867 printf(" %d", n_end);
48868 printf(" %d", n_endindex);
48869 printf("\n");
48870 }
48871 }
48872 }
48873 }
48874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048875 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048876#endif
48877
Daniel Veillard42595322004-11-08 10:52:06 +000048878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048879}
48880
48881
48882static int
48883test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048885
William M. Brack21e4ef22005-01-02 09:53:13 +000048886#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048887 int mem_base;
48888 xmlXPathObjectPtr ret_val;
48889 xmlNodePtr start; /* the starting node */
48890 int n_start;
48891 xmlXPathObjectPtr end; /* the ending object */
48892 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048893
Daniel Veillard3d97e662004-11-04 10:49:00 +000048894 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48895 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48896 mem_base = xmlMemBlocks();
48897 start = gen_xmlNodePtr(n_start, 0);
48898 end = gen_xmlXPathObjectPtr(n_end, 1);
48899
48900 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48901 desret_xmlXPathObjectPtr(ret_val);
48902 call_tests++;
48903 des_xmlNodePtr(n_start, start, 0);
48904 des_xmlXPathObjectPtr(n_end, end, 1);
48905 xmlResetLastError();
48906 if (mem_base != xmlMemBlocks()) {
48907 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048909 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048910 printf(" %d", n_start);
48911 printf(" %d", n_end);
48912 printf("\n");
48913 }
48914 }
48915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048916 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048917#endif
48918
Daniel Veillard42595322004-11-08 10:52:06 +000048919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048920}
48921
48922
48923static int
48924test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048926
William M. Brack21e4ef22005-01-02 09:53:13 +000048927#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048928 int mem_base;
48929 xmlXPathObjectPtr ret_val;
48930 xmlNodePtr start; /* the starting node */
48931 int n_start;
48932 xmlXPathObjectPtr end; /* the ending point */
48933 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048934
Daniel Veillard3d97e662004-11-04 10:49:00 +000048935 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48936 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48937 mem_base = xmlMemBlocks();
48938 start = gen_xmlNodePtr(n_start, 0);
48939 end = gen_xmlXPathObjectPtr(n_end, 1);
48940
48941 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48942 desret_xmlXPathObjectPtr(ret_val);
48943 call_tests++;
48944 des_xmlNodePtr(n_start, start, 0);
48945 des_xmlXPathObjectPtr(n_end, end, 1);
48946 xmlResetLastError();
48947 if (mem_base != xmlMemBlocks()) {
48948 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048950 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048951 printf(" %d", n_start);
48952 printf(" %d", n_end);
48953 printf("\n");
48954 }
48955 }
48956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048957 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048958#endif
48959
Daniel Veillard42595322004-11-08 10:52:06 +000048960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048961}
48962
48963
48964static int
48965test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048967
William M. Brack21e4ef22005-01-02 09:53:13 +000048968#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048969 int mem_base;
48970 xmlXPathObjectPtr ret_val;
48971 xmlNodePtr start; /* the starting node */
48972 int n_start;
48973 xmlNodePtr end; /* the ending node */
48974 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048975
Daniel Veillard3d97e662004-11-04 10:49:00 +000048976 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48977 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48978 mem_base = xmlMemBlocks();
48979 start = gen_xmlNodePtr(n_start, 0);
48980 end = gen_xmlNodePtr(n_end, 1);
48981
48982 ret_val = xmlXPtrNewRangeNodes(start, end);
48983 desret_xmlXPathObjectPtr(ret_val);
48984 call_tests++;
48985 des_xmlNodePtr(n_start, start, 0);
48986 des_xmlNodePtr(n_end, end, 1);
48987 xmlResetLastError();
48988 if (mem_base != xmlMemBlocks()) {
48989 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048991 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048992 printf(" %d", n_start);
48993 printf(" %d", n_end);
48994 printf("\n");
48995 }
48996 }
48997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048998 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048999#endif
49000
Daniel Veillard42595322004-11-08 10:52:06 +000049001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049002}
49003
49004
49005static int
49006test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049008
William M. Brack21e4ef22005-01-02 09:53:13 +000049009#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049010 int mem_base;
49011 xmlXPathObjectPtr ret_val;
49012 xmlXPathObjectPtr start; /* the starting point */
49013 int n_start;
49014 xmlNodePtr end; /* the ending node */
49015 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049016
Daniel Veillard3d97e662004-11-04 10:49:00 +000049017 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49018 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49019 mem_base = xmlMemBlocks();
49020 start = gen_xmlXPathObjectPtr(n_start, 0);
49021 end = gen_xmlNodePtr(n_end, 1);
49022
49023 ret_val = xmlXPtrNewRangePointNode(start, end);
49024 desret_xmlXPathObjectPtr(ret_val);
49025 call_tests++;
49026 des_xmlXPathObjectPtr(n_start, start, 0);
49027 des_xmlNodePtr(n_end, end, 1);
49028 xmlResetLastError();
49029 if (mem_base != xmlMemBlocks()) {
49030 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
49031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049032 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049033 printf(" %d", n_start);
49034 printf(" %d", n_end);
49035 printf("\n");
49036 }
49037 }
49038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049039 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049040#endif
49041
Daniel Veillard42595322004-11-08 10:52:06 +000049042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049043}
49044
49045
49046static int
49047test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049049
William M. Brack21e4ef22005-01-02 09:53:13 +000049050#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049051 int mem_base;
49052 xmlXPathObjectPtr ret_val;
49053 xmlXPathObjectPtr start; /* the starting point */
49054 int n_start;
49055 xmlXPathObjectPtr end; /* the ending point */
49056 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049057
Daniel Veillard3d97e662004-11-04 10:49:00 +000049058 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49059 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49060 mem_base = xmlMemBlocks();
49061 start = gen_xmlXPathObjectPtr(n_start, 0);
49062 end = gen_xmlXPathObjectPtr(n_end, 1);
49063
49064 ret_val = xmlXPtrNewRangePoints(start, end);
49065 desret_xmlXPathObjectPtr(ret_val);
49066 call_tests++;
49067 des_xmlXPathObjectPtr(n_start, start, 0);
49068 des_xmlXPathObjectPtr(n_end, end, 1);
49069 xmlResetLastError();
49070 if (mem_base != xmlMemBlocks()) {
49071 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
49072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049073 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049074 printf(" %d", n_start);
49075 printf(" %d", n_end);
49076 printf("\n");
49077 }
49078 }
49079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049080 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049081#endif
49082
Daniel Veillard42595322004-11-08 10:52:06 +000049083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049084}
49085
49086
49087static int
49088test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049090
William M. Brack21e4ef22005-01-02 09:53:13 +000049091#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049092 int mem_base;
49093 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
49094 int n_ctxt;
49095 int nargs; /* the number of args */
49096 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049097
Daniel Veillardce682bc2004-11-05 17:22:25 +000049098 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
49099 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
49100 mem_base = xmlMemBlocks();
49101 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
49102 nargs = gen_int(n_nargs, 1);
49103
49104 xmlXPtrRangeToFunction(ctxt, nargs);
49105 call_tests++;
49106 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
49107 des_int(n_nargs, nargs, 1);
49108 xmlResetLastError();
49109 if (mem_base != xmlMemBlocks()) {
49110 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
49111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049112 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049113 printf(" %d", n_ctxt);
49114 printf(" %d", n_nargs);
49115 printf("\n");
49116 }
49117 }
49118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049119 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049120#endif
49121
Daniel Veillard42595322004-11-08 10:52:06 +000049122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049123}
49124
49125
49126static int
49127test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049129
William M. Brack21e4ef22005-01-02 09:53:13 +000049130#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049131 int mem_base;
49132 xmlXPathObjectPtr ret_val;
49133 xmlLocationSetPtr val; /* the LocationSet value */
49134 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049135
Daniel Veillardce682bc2004-11-05 17:22:25 +000049136 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
49137 mem_base = xmlMemBlocks();
49138 val = gen_xmlLocationSetPtr(n_val, 0);
49139
49140 ret_val = xmlXPtrWrapLocationSet(val);
49141 desret_xmlXPathObjectPtr(ret_val);
49142 call_tests++;
49143 des_xmlLocationSetPtr(n_val, val, 0);
49144 xmlResetLastError();
49145 if (mem_base != xmlMemBlocks()) {
49146 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
49147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049148 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049149 printf(" %d", n_val);
49150 printf("\n");
49151 }
49152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049153 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049154#endif
49155
Daniel Veillard42595322004-11-08 10:52:06 +000049156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049157}
49158
49159static int
49160test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049162
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049163 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000049164 test_ret += test_xmlXPtrBuildNodeList();
49165 test_ret += test_xmlXPtrEval();
49166 test_ret += test_xmlXPtrEvalRangePredicate();
49167 test_ret += test_xmlXPtrLocationSetAdd();
49168 test_ret += test_xmlXPtrLocationSetCreate();
49169 test_ret += test_xmlXPtrLocationSetDel();
49170 test_ret += test_xmlXPtrLocationSetMerge();
49171 test_ret += test_xmlXPtrLocationSetRemove();
49172 test_ret += test_xmlXPtrNewCollapsedRange();
49173 test_ret += test_xmlXPtrNewContext();
49174 test_ret += test_xmlXPtrNewLocationSetNodeSet();
49175 test_ret += test_xmlXPtrNewLocationSetNodes();
49176 test_ret += test_xmlXPtrNewRange();
49177 test_ret += test_xmlXPtrNewRangeNodeObject();
49178 test_ret += test_xmlXPtrNewRangeNodePoint();
49179 test_ret += test_xmlXPtrNewRangeNodes();
49180 test_ret += test_xmlXPtrNewRangePointNode();
49181 test_ret += test_xmlXPtrNewRangePoints();
49182 test_ret += test_xmlXPtrRangeToFunction();
49183 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000049184
Daniel Veillard42595322004-11-08 10:52:06 +000049185 if (test_ret != 0)
49186 printf("Module xpointer: %d errors\n", test_ret);
49187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049188}
Daniel Veillardce244ad2004-11-05 10:03:46 +000049189static int
49190test_module(const char *module) {
49191 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
49192 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049193 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049194 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049195 if (!strcmp(module, "catalog")) return(test_catalog());
49196 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049197 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049198 if (!strcmp(module, "dict")) return(test_dict());
49199 if (!strcmp(module, "encoding")) return(test_encoding());
49200 if (!strcmp(module, "entities")) return(test_entities());
49201 if (!strcmp(module, "hash")) return(test_hash());
49202 if (!strcmp(module, "list")) return(test_list());
49203 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
49204 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
49205 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049206 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049207 if (!strcmp(module, "pattern")) return(test_pattern());
49208 if (!strcmp(module, "relaxng")) return(test_relaxng());
49209 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
49210 if (!strcmp(module, "tree")) return(test_tree());
49211 if (!strcmp(module, "uri")) return(test_uri());
49212 if (!strcmp(module, "valid")) return(test_valid());
49213 if (!strcmp(module, "xinclude")) return(test_xinclude());
49214 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049215 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049216 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049217 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049218 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049219 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049220 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
49221 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
49222 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
49223 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000049224 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049225 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
49226 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049227 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049228 if (!strcmp(module, "xpointer")) return(test_xpointer());
49229 return(0);
49230}