blob: 582c269e243d4bdfa8634a044741bddb74e69204 [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}
Daniel Veillard8aa7afa2005-05-10 09:50:01 +0000817#endif
818#ifdef LIBXML_HTTP_ENABLED
William M. Brack015ccb22005-02-13 08:18:52 +0000819static void desret_xmlNanoHTTPCtxtPtr(void *val) {
820 xmlNanoHTTPClose(val);
821}
Daniel Veillardc8311492004-11-08 16:51:13 +0000822#endif
William M. Brack015ccb22005-02-13 08:18:52 +0000823#ifdef LIBXML_FTP_ENABLED
824static void desret_xmlNanoFTPCtxtPtr(void *val) {
825 xmlNanoFTPClose(val);
826}
827#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000828/* cut and pasted from autogenerated to avoid troubles */
829#define gen_nb_const_xmlChar_ptr_ptr 1
830static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
831 return(NULL);
832}
833static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
834}
835
836#define gen_nb_unsigned_char_ptr 1
837static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
838 return(NULL);
839}
840static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
841}
842
843#define gen_nb_const_unsigned_char_ptr 1
844static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
845 return(NULL);
846}
847static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
848}
849
850#ifdef LIBXML_HTML_ENABLED
851#define gen_nb_const_htmlNodePtr 1
852static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 return(NULL);
854}
855static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
856}
857#endif
858
859#ifdef LIBXML_HTML_ENABLED
860#define gen_nb_htmlDocPtr 3
861static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
862 if (no == 0) return(htmlNewDoc(NULL, NULL));
863 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
864 return(NULL);
865}
866static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
867 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
868 xmlFreeDoc(val);
869}
870static void desret_htmlDocPtr(htmlDocPtr val) {
871 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
872 xmlFreeDoc(val);
873}
874#define gen_nb_htmlParserCtxtPtr 3
875static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
876 if (no == 0) return(xmlNewParserCtxt());
877 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
878 return(NULL);
879}
880static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
881 if (val != NULL)
882 htmlFreeParserCtxt(val);
883}
884static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
885 if (val != NULL)
886 htmlFreeParserCtxt(val);
887}
888#endif
889
890#ifdef LIBXML_XPATH_ENABLED
891#define gen_nb_xmlNodeSetPtr 1
892static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893 return(NULL);
894}
895static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
896}
897#endif
898
899#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000900#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000901#define gen_nb_xmlShellCtxtPtr 1
902static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
903 return(NULL);
904}
905static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
906}
907#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000908#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000909
910#ifdef LIBXML_PATTERN_ENABLED
911#define gen_nb_xmlPatternPtr 1
912static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
913 return(NULL);
914}
915static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
916}
917#endif
918
William M. Brack094dd862004-11-14 14:28:34 +0000919#define gen_nb_xmlElementContentPtr 1
920static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
921 return(NULL);
922}
923static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
924 if (val != NULL)
925 xmlFreeElementContent(val);
926}
927static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
928 if (val != NULL)
929 xmlFreeElementContent(val);
930}
931
932#define gen_nb_xmlParserNodeInfoSeqPtr 1
933static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
934 return(NULL);
935}
936static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
937}
938
939static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
940}
941
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000942/************************************************************************
943 * *
944 * WARNING: end of the manually maintained part of the test code *
945 * do not remove or alter the CUT HERE line *
946 * *
947 ************************************************************************/
948
Daniel Veillard34099b42004-11-04 17:34:35 +0000949/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000950#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000951static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
952}
953
Daniel Veillarda521d282004-11-09 14:59:59 +0000954#endif
955
Daniel Veillard57b25162004-11-06 14:50:18 +0000956#define gen_nb_xmlAttributeDefault 4
957static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
958 if (no == 1) return(XML_ATTRIBUTE_FIXED);
959 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
960 if (no == 3) return(XML_ATTRIBUTE_NONE);
961 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
962 return(0);
963}
William M. Brack094dd862004-11-14 14:28:34 +0000964
Daniel Veillard57b25162004-11-06 14:50:18 +0000965static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
966}
Daniel Veillard57b25162004-11-06 14:50:18 +0000967
968#define gen_nb_xmlAttributeType 4
969static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
970 if (no == 1) return(XML_ATTRIBUTE_CDATA);
971 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
972 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
973 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
974 return(0);
975}
William M. Brack094dd862004-11-14 14:28:34 +0000976
Daniel Veillard57b25162004-11-06 14:50:18 +0000977static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
978}
Daniel Veillard57b25162004-11-06 14:50:18 +0000979
980#define gen_nb_xmlBufferAllocationScheme 3
981static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
982 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
983 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
984 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
985 return(0);
986}
William M. Brack094dd862004-11-14 14:28:34 +0000987
Daniel Veillard57b25162004-11-06 14:50:18 +0000988static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
989}
William M. Brack094dd862004-11-14 14:28:34 +0000990
Daniel Veillard57b25162004-11-06 14:50:18 +0000991static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
992}
993
Daniel Veillarda521d282004-11-09 14:59:59 +0000994#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000995#define gen_nb_xmlCatalogAllow 4
996static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
997 if (no == 1) return(XML_CATA_ALLOW_ALL);
998 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
999 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
1000 if (no == 4) return(XML_CATA_ALLOW_NONE);
1001 return(0);
1002}
William M. Brack094dd862004-11-14 14:28:34 +00001003
Daniel Veillard57b25162004-11-06 14:50:18 +00001004static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1005}
William M. Brack094dd862004-11-14 14:28:34 +00001006
Daniel Veillard57b25162004-11-06 14:50:18 +00001007static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1008}
1009
Daniel Veillarda521d282004-11-09 14:59:59 +00001010#endif
1011
1012#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001013#define gen_nb_xmlCatalogPrefer 3
1014static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1015 if (no == 1) return(XML_CATA_PREFER_NONE);
1016 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1017 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1018 return(0);
1019}
William M. Brack094dd862004-11-14 14:28:34 +00001020
Daniel Veillard57b25162004-11-06 14:50:18 +00001021static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1022}
William M. Brack094dd862004-11-14 14:28:34 +00001023
Daniel Veillard57b25162004-11-06 14:50:18 +00001024static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1025}
1026
Daniel Veillarda521d282004-11-09 14:59:59 +00001027#endif
1028
Daniel Veillard57b25162004-11-06 14:50:18 +00001029#define gen_nb_xmlElementContentType 4
1030static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1031 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1032 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1033 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1034 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1035 return(0);
1036}
Daniel Veillard57b25162004-11-06 14:50:18 +00001037
William M. Brack094dd862004-11-14 14:28:34 +00001038static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001039}
1040
1041#define gen_nb_xmlElementTypeVal 4
1042static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1043 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1044 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1045 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1046 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1047 return(0);
1048}
William M. Brack094dd862004-11-14 14:28:34 +00001049
Daniel Veillard57b25162004-11-06 14:50:18 +00001050static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1051}
Daniel Veillard57b25162004-11-06 14:50:18 +00001052
Daniel Veillard57b25162004-11-06 14:50:18 +00001053static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1054}
1055
William M. Brackea152c02005-06-09 18:12:28 +00001056#ifdef LIBXML_PATTERN_ENABLED
1057#define gen_nb_xmlPatternFlags 4
1058static xmlPatternFlags gen_xmlPatternFlags(int no, int nr ATTRIBUTE_UNUSED) {
1059 if (no == 1) return(XML_PATTERN_DEFAULT);
1060 if (no == 2) return(XML_PATTERN_XPATH);
1061 if (no == 3) return(XML_PATTERN_XSFIELD);
1062 if (no == 4) return(XML_PATTERN_XSSEL);
1063 return(0);
1064}
1065
1066static void des_xmlPatternFlags(int no ATTRIBUTE_UNUSED, xmlPatternFlags val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1067}
1068
1069#endif
1070
Daniel Veillarda521d282004-11-09 14:59:59 +00001071#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001072#define gen_nb_xmlSchemaValType 4
1073static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1074 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1075 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1076 if (no == 3) return(XML_SCHEMAS_ANYURI);
1077 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1078 return(0);
1079}
William M. Brack094dd862004-11-14 14:28:34 +00001080
Daniel Veillard57b25162004-11-06 14:50:18 +00001081static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1082}
Daniel Veillard57b25162004-11-06 14:50:18 +00001083
Daniel Veillard5d4644e2005-04-01 13:11:58 +00001084static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1085}
1086
Daniel Veillarda521d282004-11-09 14:59:59 +00001087#endif
1088
Daniel Veillardb5839c32005-02-19 18:27:14 +00001089#ifdef LIBXML_SCHEMAS_ENABLED
1090#define gen_nb_xmlSchemaWhitespaceValueType 4
1091static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
1092 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1093 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1094 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1095 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1096 return(0);
1097}
1098
1099static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1100}
1101
1102#endif
1103
Daniel Veillard34099b42004-11-04 17:34:35 +00001104#include <libxml/HTMLparser.h>
1105#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001106#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001107#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001108#include <libxml/catalog.h>
1109#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001110#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001111#include <libxml/dict.h>
1112#include <libxml/encoding.h>
1113#include <libxml/entities.h>
1114#include <libxml/hash.h>
1115#include <libxml/list.h>
1116#include <libxml/nanoftp.h>
1117#include <libxml/nanohttp.h>
1118#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001119#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001120#include <libxml/pattern.h>
1121#include <libxml/relaxng.h>
1122#include <libxml/schemasInternals.h>
1123#include <libxml/tree.h>
1124#include <libxml/uri.h>
1125#include <libxml/valid.h>
1126#include <libxml/xinclude.h>
1127#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001128#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001129#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001130#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001131#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001132#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001133#include <libxml/xmlsave.h>
1134#include <libxml/xmlschemas.h>
1135#include <libxml/xmlschemastypes.h>
1136#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001137#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001138#include <libxml/xmlwriter.h>
1139#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001140#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001141#include <libxml/xpointer.h>
1142static int test_HTMLparser(void);
1143static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001144static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001145static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001146static int test_catalog(void);
1147static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001148static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001149static int test_dict(void);
1150static int test_encoding(void);
1151static int test_entities(void);
1152static int test_hash(void);
1153static int test_list(void);
1154static int test_nanoftp(void);
1155static int test_nanohttp(void);
1156static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001157static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001158static int test_pattern(void);
1159static int test_relaxng(void);
1160static int test_schemasInternals(void);
1161static int test_tree(void);
1162static int test_uri(void);
1163static int test_valid(void);
1164static int test_xinclude(void);
1165static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001166static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001167static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001168static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001169static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001170static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001171static int test_xmlsave(void);
1172static int test_xmlschemas(void);
1173static int test_xmlschemastypes(void);
1174static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001175static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001176static int test_xmlwriter(void);
1177static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001178static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001179static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001180
1181/**
1182 * testlibxml2:
1183 *
1184 * Main entry point of the tester for the full libxml2 module,
1185 * it calls all the tester entry point for each module.
1186 *
1187 * Returns the number of error found
1188 */
1189static int
1190testlibxml2(void)
1191{
Daniel Veillard42595322004-11-08 10:52:06 +00001192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001193
Daniel Veillard42595322004-11-08 10:52:06 +00001194 test_ret += test_HTMLparser();
1195 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001196 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001197 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001198 test_ret += test_catalog();
1199 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001200 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001201 test_ret += test_dict();
1202 test_ret += test_encoding();
1203 test_ret += test_entities();
1204 test_ret += test_hash();
1205 test_ret += test_list();
1206 test_ret += test_nanoftp();
1207 test_ret += test_nanohttp();
1208 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001209 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001210 test_ret += test_pattern();
1211 test_ret += test_relaxng();
1212 test_ret += test_schemasInternals();
1213 test_ret += test_tree();
1214 test_ret += test_uri();
1215 test_ret += test_valid();
1216 test_ret += test_xinclude();
1217 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001218 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001219 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001220 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001221 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001222 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001223 test_ret += test_xmlsave();
1224 test_ret += test_xmlschemas();
1225 test_ret += test_xmlschemastypes();
1226 test_ret += test_xmlstring();
1227 test_ret += test_xmlunicode();
1228 test_ret += test_xmlwriter();
1229 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001230 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001231 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001232
Daniel Veillard3d97e662004-11-04 10:49:00 +00001233 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001234 function_tests, call_tests, test_ret);
1235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001236}
1237
1238
1239static int
1240test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001242
William M. Brack21e4ef22005-01-02 09:53:13 +00001243#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001244 int mem_base;
1245 int ret_val;
1246 unsigned char * out; /* a pointer to an array of bytes to store the result */
1247 int n_out;
1248 int * outlen; /* the length of @out */
1249 int n_outlen;
1250 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1251 int n_in;
1252 int * inlen; /* the length of @in */
1253 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001254
Daniel Veillardce682bc2004-11-05 17:22:25 +00001255 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1256 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1257 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1258 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1259 mem_base = xmlMemBlocks();
1260 out = gen_unsigned_char_ptr(n_out, 0);
1261 outlen = gen_int_ptr(n_outlen, 1);
1262 in = gen_const_unsigned_char_ptr(n_in, 2);
1263 inlen = gen_int_ptr(n_inlen, 3);
1264
William M. Brackf13f77f2004-11-12 16:03:48 +00001265 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001266 desret_int(ret_val);
1267 call_tests++;
1268 des_unsigned_char_ptr(n_out, out, 0);
1269 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001271 des_int_ptr(n_inlen, inlen, 3);
1272 xmlResetLastError();
1273 if (mem_base != xmlMemBlocks()) {
1274 printf("Leak of %d blocks found in UTF8ToHtml",
1275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001276 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001277 printf(" %d", n_out);
1278 printf(" %d", n_outlen);
1279 printf(" %d", n_in);
1280 printf(" %d", n_inlen);
1281 printf("\n");
1282 }
1283 }
1284 }
1285 }
1286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001287 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001288#endif
1289
Daniel Veillard42595322004-11-08 10:52:06 +00001290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001291}
1292
Daniel Veillarda521d282004-11-09 14:59:59 +00001293#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001294
Daniel Veillardce682bc2004-11-05 17:22:25 +00001295#define gen_nb_const_htmlElemDesc_ptr 1
1296static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1297 return(NULL);
1298}
1299static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1300}
Daniel Veillarda521d282004-11-09 14:59:59 +00001301#endif
1302
Daniel Veillardce682bc2004-11-05 17:22:25 +00001303
Daniel Veillardd93f6252004-11-02 15:53:51 +00001304static int
1305test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001307
William M. Brack21e4ef22005-01-02 09:53:13 +00001308#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001309 int mem_base;
1310 htmlStatus ret_val;
1311 htmlElemDesc * elt; /* HTML element */
1312 int n_elt;
1313 xmlChar * attr; /* HTML attribute */
1314 int n_attr;
1315 int legacy; /* whether to allow deprecated attributes */
1316 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001317
Daniel Veillard57b25162004-11-06 14:50:18 +00001318 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1319 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1320 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1321 mem_base = xmlMemBlocks();
1322 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1323 attr = gen_const_xmlChar_ptr(n_attr, 1);
1324 legacy = gen_int(n_legacy, 2);
1325
William M. Brackf13f77f2004-11-12 16:03:48 +00001326 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001327 desret_htmlStatus(ret_val);
1328 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001329 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1330 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001331 des_int(n_legacy, legacy, 2);
1332 xmlResetLastError();
1333 if (mem_base != xmlMemBlocks()) {
1334 printf("Leak of %d blocks found in htmlAttrAllowed",
1335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001336 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001337 printf(" %d", n_elt);
1338 printf(" %d", n_attr);
1339 printf(" %d", n_legacy);
1340 printf("\n");
1341 }
1342 }
1343 }
1344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001345 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001346#endif
1347
Daniel Veillard42595322004-11-08 10:52:06 +00001348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001349}
1350
Daniel Veillarda521d282004-11-09 14:59:59 +00001351#ifdef LIBXML_HTML_ENABLED
1352
1353#define gen_nb_htmlNodePtr 1
1354static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1355 return(NULL);
1356}
1357static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1358}
1359#endif
1360
Daniel Veillardd93f6252004-11-02 15:53:51 +00001361
1362static int
1363test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001365
William M. Brack21e4ef22005-01-02 09:53:13 +00001366#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001367 int mem_base;
1368 int ret_val;
1369 htmlDocPtr doc; /* the HTML document */
1370 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001371 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001372 int n_name;
1373 htmlNodePtr elem; /* the HTML element */
1374 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001375
Daniel Veillarda521d282004-11-09 14:59:59 +00001376 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001377 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001378 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001379 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001380 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001381 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001382 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001383
William M. Brackf13f77f2004-11-12 16:03:48 +00001384 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001385 desret_int(ret_val);
1386 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001387 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001388 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001389 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001390 xmlResetLastError();
1391 if (mem_base != xmlMemBlocks()) {
1392 printf("Leak of %d blocks found in htmlAutoCloseTag",
1393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001394 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001395 printf(" %d", n_doc);
1396 printf(" %d", n_name);
1397 printf(" %d", n_elem);
1398 printf("\n");
1399 }
1400 }
1401 }
1402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001403 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001404#endif
1405
Daniel Veillard42595322004-11-08 10:52:06 +00001406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001407}
1408
1409
1410static int
1411test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001413
William M. Brack21e4ef22005-01-02 09:53:13 +00001414#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001415 int mem_base;
1416 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001417 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001418 int n_buffer;
1419 int size; /* the size of the array */
1420 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001421
Daniel Veillard34099b42004-11-04 17:34:35 +00001422 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1423 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1424 mem_base = xmlMemBlocks();
1425 buffer = gen_const_char_ptr(n_buffer, 0);
1426 size = gen_int(n_size, 1);
1427
William M. Brackf13f77f2004-11-12 16:03:48 +00001428 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001429 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001430 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001431 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001432 des_int(n_size, size, 1);
1433 xmlResetLastError();
1434 if (mem_base != xmlMemBlocks()) {
1435 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001437 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001438 printf(" %d", n_buffer);
1439 printf(" %d", n_size);
1440 printf("\n");
1441 }
1442 }
1443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001444 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001445#endif
1446
Daniel Veillard42595322004-11-08 10:52:06 +00001447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001448}
1449
Daniel Veillarda521d282004-11-09 14:59:59 +00001450#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001451
Daniel Veillardce682bc2004-11-05 17:22:25 +00001452#define gen_nb_htmlSAXHandlerPtr 1
1453static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1454 return(NULL);
1455}
1456static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1457}
Daniel Veillarda521d282004-11-09 14:59:59 +00001458#endif
1459
Daniel Veillardce682bc2004-11-05 17:22:25 +00001460
Daniel Veillardd93f6252004-11-02 15:53:51 +00001461static int
1462test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001464
William M. Brack21e4ef22005-01-02 09:53:13 +00001465#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466 int mem_base;
1467 htmlParserCtxtPtr ret_val;
1468 htmlSAXHandlerPtr sax; /* a SAX handler */
1469 int n_sax;
1470 void * user_data; /* The user data returned on SAX callbacks */
1471 int n_user_data;
1472 char * chunk; /* a pointer to an array of chars */
1473 int n_chunk;
1474 int size; /* number of chars in the array */
1475 int n_size;
1476 const char * filename; /* an optional file name or URI */
1477 int n_filename;
1478 xmlCharEncoding enc; /* an optional encoding */
1479 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001480
Daniel Veillardce682bc2004-11-05 17:22:25 +00001481 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1482 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1483 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1484 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001485 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001486 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1487 mem_base = xmlMemBlocks();
1488 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1489 user_data = gen_userdata(n_user_data, 1);
1490 chunk = gen_const_char_ptr(n_chunk, 2);
1491 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001492 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001493 enc = gen_xmlCharEncoding(n_enc, 5);
1494
William M. Brackf13f77f2004-11-12 16:03:48 +00001495 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001496 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001497 call_tests++;
1498 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1499 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001500 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001501 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001502 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001503 des_xmlCharEncoding(n_enc, enc, 5);
1504 xmlResetLastError();
1505 if (mem_base != xmlMemBlocks()) {
1506 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001508 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001509 printf(" %d", n_sax);
1510 printf(" %d", n_user_data);
1511 printf(" %d", n_chunk);
1512 printf(" %d", n_size);
1513 printf(" %d", n_filename);
1514 printf(" %d", n_enc);
1515 printf("\n");
1516 }
1517 }
1518 }
1519 }
1520 }
1521 }
1522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001523 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001524#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001525
Daniel Veillard42595322004-11-08 10:52:06 +00001526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001527}
1528
1529
1530static int
1531test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001533
William M. Brack21e4ef22005-01-02 09:53:13 +00001534#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001535 int mem_base;
1536 htmlDocPtr ret_val;
1537 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1538 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001539 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001540 int n_cur;
1541 const char * URL; /* the base URL to use for the document */
1542 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001543 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001544 int n_encoding;
1545 int options; /* a combination of htmlParserOption(s) */
1546 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001547
Daniel Veillarda521d282004-11-09 14:59:59 +00001548 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001549 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1550 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1551 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1552 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1553 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001554 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001555 cur = gen_const_xmlChar_ptr(n_cur, 1);
1556 URL = gen_filepath(n_URL, 2);
1557 encoding = gen_const_char_ptr(n_encoding, 3);
1558 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001559
William M. Brackf13f77f2004-11-12 16:03:48 +00001560 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001561 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001562 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001563 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001564 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001565 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001566 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001567 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001568 xmlResetLastError();
1569 if (mem_base != xmlMemBlocks()) {
1570 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001572 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573 printf(" %d", n_ctxt);
1574 printf(" %d", n_cur);
1575 printf(" %d", n_URL);
1576 printf(" %d", n_encoding);
1577 printf(" %d", n_options);
1578 printf("\n");
1579 }
1580 }
1581 }
1582 }
1583 }
1584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001585 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001586#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001587
Daniel Veillard42595322004-11-08 10:52:06 +00001588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001589}
1590
1591
1592static int
1593test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001595
William M. Brack21e4ef22005-01-02 09:53:13 +00001596#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001597 htmlDocPtr ret_val;
1598 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1599 int n_ctxt;
1600 const char * filename; /* a file or URL */
1601 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001602 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001603 int n_encoding;
1604 int options; /* a combination of htmlParserOption(s) */
1605 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001606
Daniel Veillarda521d282004-11-09 14:59:59 +00001607 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001608 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1609 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1610 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001611 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001612 filename = gen_filepath(n_filename, 1);
1613 encoding = gen_const_char_ptr(n_encoding, 2);
1614 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001615
William M. Brackf13f77f2004-11-12 16:03:48 +00001616 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001617 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001618 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001619 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001620 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001621 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001622 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001623 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001624 }
1625 }
1626 }
1627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001628 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001629#endif
1630
Daniel Veillard42595322004-11-08 10:52:06 +00001631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001632}
1633
1634
1635static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001636test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001638
William M. Brack21e4ef22005-01-02 09:53:13 +00001639#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001640 int mem_base;
1641 htmlDocPtr ret_val;
1642 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1643 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001644 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001645 int n_buffer;
1646 int size; /* the size of the array */
1647 int n_size;
1648 const char * URL; /* the base URL to use for the document */
1649 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001650 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001651 int n_encoding;
1652 int options; /* a combination of htmlParserOption(s) */
1653 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001654
Daniel Veillarda521d282004-11-09 14:59:59 +00001655 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001656 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1657 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1658 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1659 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1660 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1661 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001662 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001663 buffer = gen_const_char_ptr(n_buffer, 1);
1664 size = gen_int(n_size, 2);
1665 URL = gen_filepath(n_URL, 3);
1666 encoding = gen_const_char_ptr(n_encoding, 4);
1667 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001668
William M. Brackf13f77f2004-11-12 16:03:48 +00001669 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001670 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001671 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001672 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001673 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001674 des_int(n_size, size, 2);
1675 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001676 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001677 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001678 xmlResetLastError();
1679 if (mem_base != xmlMemBlocks()) {
1680 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001682 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001683 printf(" %d", n_ctxt);
1684 printf(" %d", n_buffer);
1685 printf(" %d", n_size);
1686 printf(" %d", n_URL);
1687 printf(" %d", n_encoding);
1688 printf(" %d", n_options);
1689 printf("\n");
1690 }
1691 }
1692 }
1693 }
1694 }
1695 }
1696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001697 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001698#endif
1699
Daniel Veillard42595322004-11-08 10:52:06 +00001700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001701}
1702
1703
1704static int
1705test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001707
William M. Brack21e4ef22005-01-02 09:53:13 +00001708#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001709 int mem_base;
1710 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1711 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001712
Daniel Veillarda521d282004-11-09 14:59:59 +00001713 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001714 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001715 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001716
1717 htmlCtxtReset(ctxt);
1718 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001719 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001720 xmlResetLastError();
1721 if (mem_base != xmlMemBlocks()) {
1722 printf("Leak of %d blocks found in htmlCtxtReset",
1723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001725 printf(" %d", n_ctxt);
1726 printf("\n");
1727 }
1728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001729 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001730#endif
1731
Daniel Veillard42595322004-11-08 10:52:06 +00001732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001733}
1734
1735
1736static int
1737test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001739
William M. Brack21e4ef22005-01-02 09:53:13 +00001740#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001741 int mem_base;
1742 int ret_val;
1743 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1744 int n_ctxt;
1745 int options; /* a combination of htmlParserOption(s) */
1746 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001747
Daniel Veillarda521d282004-11-09 14:59:59 +00001748 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001749 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1750 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001751 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001752 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001753
1754 ret_val = htmlCtxtUseOptions(ctxt, options);
1755 desret_int(ret_val);
1756 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001757 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001758 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001759 xmlResetLastError();
1760 if (mem_base != xmlMemBlocks()) {
1761 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001763 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001764 printf(" %d", n_ctxt);
1765 printf(" %d", n_options);
1766 printf("\n");
1767 }
1768 }
1769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001770 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001771#endif
1772
Daniel Veillard42595322004-11-08 10:52:06 +00001773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001774}
1775
1776
1777static int
1778test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001780
William M. Brack21e4ef22005-01-02 09:53:13 +00001781#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001782 int mem_base;
1783 int ret_val;
1784 htmlElemDesc * parent; /* HTML parent element */
1785 int n_parent;
1786 xmlChar * elt; /* HTML element */
1787 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001788
Daniel Veillardce682bc2004-11-05 17:22:25 +00001789 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1790 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1791 mem_base = xmlMemBlocks();
1792 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1793 elt = gen_const_xmlChar_ptr(n_elt, 1);
1794
William M. Brackf13f77f2004-11-12 16:03:48 +00001795 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001796 desret_int(ret_val);
1797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001798 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1799 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001800 xmlResetLastError();
1801 if (mem_base != xmlMemBlocks()) {
1802 printf("Leak of %d blocks found in htmlElementAllowedHere",
1803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001804 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001805 printf(" %d", n_parent);
1806 printf(" %d", n_elt);
1807 printf("\n");
1808 }
1809 }
1810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001811 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001812#endif
1813
Daniel Veillard42595322004-11-08 10:52:06 +00001814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001815}
1816
1817
1818static int
1819test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001821
William M. Brack21e4ef22005-01-02 09:53:13 +00001822#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001823 int mem_base;
1824 htmlStatus ret_val;
1825 htmlElemDesc * parent; /* HTML parent element */
1826 int n_parent;
1827 htmlElemDesc * elt; /* HTML element */
1828 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001829
Daniel Veillard57b25162004-11-06 14:50:18 +00001830 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1831 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1832 mem_base = xmlMemBlocks();
1833 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1834 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1835
William M. Brackf13f77f2004-11-12 16:03:48 +00001836 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001837 desret_htmlStatus(ret_val);
1838 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001839 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1840 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001841 xmlResetLastError();
1842 if (mem_base != xmlMemBlocks()) {
1843 printf("Leak of %d blocks found in htmlElementStatusHere",
1844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001845 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001846 printf(" %d", n_parent);
1847 printf(" %d", n_elt);
1848 printf("\n");
1849 }
1850 }
1851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001852 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001853#endif
1854
Daniel Veillard42595322004-11-08 10:52:06 +00001855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001856}
1857
1858
1859static int
1860test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001862
William M. Brack21e4ef22005-01-02 09:53:13 +00001863#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001864 int mem_base;
1865 int ret_val;
1866 unsigned char * out; /* a pointer to an array of bytes to store the result */
1867 int n_out;
1868 int * outlen; /* the length of @out */
1869 int n_outlen;
1870 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1871 int n_in;
1872 int * inlen; /* the length of @in */
1873 int n_inlen;
1874 int quoteChar; /* the quote character to escape (' or ") or zero. */
1875 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001876
Daniel Veillardce682bc2004-11-05 17:22:25 +00001877 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1878 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1879 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1880 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1881 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1882 mem_base = xmlMemBlocks();
1883 out = gen_unsigned_char_ptr(n_out, 0);
1884 outlen = gen_int_ptr(n_outlen, 1);
1885 in = gen_const_unsigned_char_ptr(n_in, 2);
1886 inlen = gen_int_ptr(n_inlen, 3);
1887 quoteChar = gen_int(n_quoteChar, 4);
1888
William M. Brackf13f77f2004-11-12 16:03:48 +00001889 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001890 desret_int(ret_val);
1891 call_tests++;
1892 des_unsigned_char_ptr(n_out, out, 0);
1893 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001894 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001895 des_int_ptr(n_inlen, inlen, 3);
1896 des_int(n_quoteChar, quoteChar, 4);
1897 xmlResetLastError();
1898 if (mem_base != xmlMemBlocks()) {
1899 printf("Leak of %d blocks found in htmlEncodeEntities",
1900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001901 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001902 printf(" %d", n_out);
1903 printf(" %d", n_outlen);
1904 printf(" %d", n_in);
1905 printf(" %d", n_inlen);
1906 printf(" %d", n_quoteChar);
1907 printf("\n");
1908 }
1909 }
1910 }
1911 }
1912 }
1913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001914 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001915#endif
1916
Daniel Veillard42595322004-11-08 10:52:06 +00001917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001918}
1919
1920
1921static int
1922test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001924
William M. Brack21e4ef22005-01-02 09:53:13 +00001925#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001926 int mem_base;
1927 const htmlEntityDesc * ret_val;
1928 xmlChar * name; /* the entity name */
1929 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001930
Daniel Veillard42595322004-11-08 10:52:06 +00001931 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1932 mem_base = xmlMemBlocks();
1933 name = gen_const_xmlChar_ptr(n_name, 0);
1934
William M. Brackf13f77f2004-11-12 16:03:48 +00001935 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001936 desret_const_htmlEntityDesc_ptr(ret_val);
1937 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001938 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001939 xmlResetLastError();
1940 if (mem_base != xmlMemBlocks()) {
1941 printf("Leak of %d blocks found in htmlEntityLookup",
1942 xmlMemBlocks() - mem_base);
1943 test_ret++;
1944 printf(" %d", n_name);
1945 printf("\n");
1946 }
1947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001948 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001949#endif
1950
Daniel Veillard42595322004-11-08 10:52:06 +00001951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001952}
1953
1954
1955static int
1956test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001958
William M. Brack21e4ef22005-01-02 09:53:13 +00001959#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001960 int mem_base;
1961 const htmlEntityDesc * ret_val;
1962 unsigned int value; /* the entity's unicode value */
1963 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001964
Daniel Veillard42595322004-11-08 10:52:06 +00001965 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1966 mem_base = xmlMemBlocks();
1967 value = gen_unsigned_int(n_value, 0);
1968
1969 ret_val = htmlEntityValueLookup(value);
1970 desret_const_htmlEntityDesc_ptr(ret_val);
1971 call_tests++;
1972 des_unsigned_int(n_value, value, 0);
1973 xmlResetLastError();
1974 if (mem_base != xmlMemBlocks()) {
1975 printf("Leak of %d blocks found in htmlEntityValueLookup",
1976 xmlMemBlocks() - mem_base);
1977 test_ret++;
1978 printf(" %d", n_value);
1979 printf("\n");
1980 }
1981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001982 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001983#endif
1984
Daniel Veillard42595322004-11-08 10:52:06 +00001985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001986}
1987
1988
1989static int
1990test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001992
William M. Brack21e4ef22005-01-02 09:53:13 +00001993#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001994 int mem_base;
1995 int ret_val;
1996 int val; /* int 0 or 1 */
1997 int n_val;
1998
1999 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2000 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002001 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002002
2003 ret_val = htmlHandleOmittedElem(val);
2004 desret_int(ret_val);
2005 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002006 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002007 xmlResetLastError();
2008 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002009 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002011 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002012 printf(" %d", n_val);
2013 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002014 }
2015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002016 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002017#endif
2018
Daniel Veillard42595322004-11-08 10:52:06 +00002019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002020}
2021
2022
2023static int
2024test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002026
William M. Brack21e4ef22005-01-02 09:53:13 +00002027#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002028 int mem_base;
2029 int ret_val;
2030 htmlDocPtr doc; /* the HTML document */
2031 int n_doc;
2032 htmlNodePtr elem; /* the HTML element */
2033 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002034
Daniel Veillarda521d282004-11-09 14:59:59 +00002035 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2036 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002037 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002038 doc = gen_htmlDocPtr(n_doc, 0);
2039 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002040
2041 ret_val = htmlIsAutoClosed(doc, elem);
2042 desret_int(ret_val);
2043 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002044 des_htmlDocPtr(n_doc, doc, 0);
2045 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002046 xmlResetLastError();
2047 if (mem_base != xmlMemBlocks()) {
2048 printf("Leak of %d blocks found in htmlIsAutoClosed",
2049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002050 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002051 printf(" %d", n_doc);
2052 printf(" %d", n_elem);
2053 printf("\n");
2054 }
2055 }
2056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002057 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002058#endif
2059
Daniel Veillard42595322004-11-08 10:52:06 +00002060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002061}
2062
2063
2064static int
2065test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002067
William M. Brack21e4ef22005-01-02 09:53:13 +00002068#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002069 int mem_base;
2070 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002071 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002072 int n_name;
2073
2074 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2075 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002076 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002077
William M. Brackf13f77f2004-11-12 16:03:48 +00002078 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002079 desret_int(ret_val);
2080 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002082 xmlResetLastError();
2083 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002084 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002086 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002087 printf(" %d", n_name);
2088 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002089 }
2090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002091 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002092#endif
2093
Daniel Veillard42595322004-11-08 10:52:06 +00002094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002095}
2096
2097
2098static int
2099test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002101
William M. Brack21e4ef22005-01-02 09:53:13 +00002102#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002103 int mem_base;
2104 htmlStatus ret_val;
2105 htmlNodePtr node; /* an htmlNodePtr in a tree */
2106 int n_node;
2107 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2108 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002109
Daniel Veillarda521d282004-11-09 14:59:59 +00002110 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002111 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2112 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002113 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002114 legacy = gen_int(n_legacy, 1);
2115
William M. Brackf13f77f2004-11-12 16:03:48 +00002116 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002117 desret_htmlStatus(ret_val);
2118 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002119 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002120 des_int(n_legacy, legacy, 1);
2121 xmlResetLastError();
2122 if (mem_base != xmlMemBlocks()) {
2123 printf("Leak of %d blocks found in htmlNodeStatus",
2124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002125 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002126 printf(" %d", n_node);
2127 printf(" %d", n_legacy);
2128 printf("\n");
2129 }
2130 }
2131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002132 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002133#endif
2134
Daniel Veillard42595322004-11-08 10:52:06 +00002135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002136}
2137
2138
2139static int
2140test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002142
William M. Brack21e4ef22005-01-02 09:53:13 +00002143#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002144 int mem_base;
2145 int ret_val;
2146 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2147 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002148
Daniel Veillarda521d282004-11-09 14:59:59 +00002149 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002150 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002151 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002152
2153 ret_val = htmlParseCharRef(ctxt);
2154 desret_int(ret_val);
2155 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002156 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002157 xmlResetLastError();
2158 if (mem_base != xmlMemBlocks()) {
2159 printf("Leak of %d blocks found in htmlParseCharRef",
2160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002161 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002162 printf(" %d", n_ctxt);
2163 printf("\n");
2164 }
2165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002166 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002167#endif
2168
Daniel Veillard42595322004-11-08 10:52:06 +00002169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002170}
2171
2172
2173static int
2174test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002176
William M. Brack21e4ef22005-01-02 09:53:13 +00002177#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002178 int mem_base;
2179 int ret_val;
2180 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2181 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002182 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002183 int n_chunk;
2184 int size; /* the size in byte of the chunk */
2185 int n_size;
2186 int terminate; /* last chunk indicator */
2187 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002188
Daniel Veillarda521d282004-11-09 14:59:59 +00002189 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002190 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2191 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2192 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2193 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002194 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002195 chunk = gen_const_char_ptr(n_chunk, 1);
2196 size = gen_int(n_size, 2);
2197 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002198
William M. Brackf13f77f2004-11-12 16:03:48 +00002199 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002200 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002201 desret_int(ret_val);
2202 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002203 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002204 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002205 des_int(n_size, size, 2);
2206 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002207 xmlResetLastError();
2208 if (mem_base != xmlMemBlocks()) {
2209 printf("Leak of %d blocks found in htmlParseChunk",
2210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002212 printf(" %d", n_ctxt);
2213 printf(" %d", n_chunk);
2214 printf(" %d", n_size);
2215 printf(" %d", n_terminate);
2216 printf("\n");
2217 }
2218 }
2219 }
2220 }
2221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002222 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002223#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002224
Daniel Veillard42595322004-11-08 10:52:06 +00002225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002226}
2227
2228
2229static int
2230test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002232
William M. Brack21e4ef22005-01-02 09:53:13 +00002233#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002234 int mem_base;
2235 htmlDocPtr ret_val;
2236 xmlChar * cur; /* a pointer to an array of xmlChar */
2237 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002238 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002239 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002240
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002241 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2242 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002244 cur = gen_xmlChar_ptr(n_cur, 0);
2245 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002246
William M. Brackf13f77f2004-11-12 16:03:48 +00002247 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002248 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002250 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002251 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002252 xmlResetLastError();
2253 if (mem_base != xmlMemBlocks()) {
2254 printf("Leak of %d blocks found in htmlParseDoc",
2255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002256 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002257 printf(" %d", n_cur);
2258 printf(" %d", n_encoding);
2259 printf("\n");
2260 }
2261 }
2262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002263 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002264#endif
2265
Daniel Veillard42595322004-11-08 10:52:06 +00002266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002267}
2268
2269
2270static int
2271test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002273
William M. Brack21e4ef22005-01-02 09:53:13 +00002274#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002275 int mem_base;
2276 int ret_val;
2277 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2278 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002279
Daniel Veillarda521d282004-11-09 14:59:59 +00002280 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002281 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002282 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002283
2284 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002285 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002286 desret_int(ret_val);
2287 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002288 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002289 xmlResetLastError();
2290 if (mem_base != xmlMemBlocks()) {
2291 printf("Leak of %d blocks found in htmlParseDocument",
2292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002293 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002294 printf(" %d", n_ctxt);
2295 printf("\n");
2296 }
2297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002298 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002299#endif
2300
Daniel Veillard42595322004-11-08 10:52:06 +00002301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002302}
2303
2304
2305static int
2306test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002308
William M. Brack21e4ef22005-01-02 09:53:13 +00002309#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002310 int mem_base;
2311 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2312 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002313
Daniel Veillarda521d282004-11-09 14:59:59 +00002314 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002315 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002316 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002317
2318 htmlParseElement(ctxt);
2319 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002320 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002321 xmlResetLastError();
2322 if (mem_base != xmlMemBlocks()) {
2323 printf("Leak of %d blocks found in htmlParseElement",
2324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002325 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002326 printf(" %d", n_ctxt);
2327 printf("\n");
2328 }
2329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002330 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002331#endif
2332
Daniel Veillard42595322004-11-08 10:52:06 +00002333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002334}
2335
2336
2337static int
2338test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002340
William M. Brack21e4ef22005-01-02 09:53:13 +00002341#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002342 int mem_base;
2343 const htmlEntityDesc * ret_val;
2344 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2345 int n_ctxt;
2346 xmlChar ** str; /* location to store the entity name */
2347 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002348
Daniel Veillarda521d282004-11-09 14:59:59 +00002349 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002350 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2351 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002352 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002353 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2354
William M. Brackf13f77f2004-11-12 16:03:48 +00002355 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002356 desret_const_htmlEntityDesc_ptr(ret_val);
2357 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002358 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002359 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002360 xmlResetLastError();
2361 if (mem_base != xmlMemBlocks()) {
2362 printf("Leak of %d blocks found in htmlParseEntityRef",
2363 xmlMemBlocks() - mem_base);
2364 test_ret++;
2365 printf(" %d", n_ctxt);
2366 printf(" %d", n_str);
2367 printf("\n");
2368 }
2369 }
2370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002371 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002372#endif
2373
Daniel Veillard42595322004-11-08 10:52:06 +00002374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002375}
2376
2377
2378static int
2379test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002381
William M. Brack21e4ef22005-01-02 09:53:13 +00002382#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002383 htmlDocPtr ret_val;
2384 const char * filename; /* the filename */
2385 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002386 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002387 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002388
Daniel Veillarda03e3652004-11-02 18:45:30 +00002389 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2390 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002391 filename = gen_filepath(n_filename, 0);
2392 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002393
William M. Brackf13f77f2004-11-12 16:03:48 +00002394 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002395 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002396 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002397 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002398 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002399 xmlResetLastError();
2400 }
2401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002402 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002403#endif
2404
Daniel Veillard42595322004-11-08 10:52:06 +00002405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002406}
2407
2408
2409static int
2410test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002412
William M. Brack21e4ef22005-01-02 09:53:13 +00002413#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002414 int mem_base;
2415 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002416 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002417 int n_cur;
2418 const char * URL; /* the base URL to use for the document */
2419 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002420 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002421 int n_encoding;
2422 int options; /* a combination of htmlParserOption(s) */
2423 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002424
Daniel Veillarda03e3652004-11-02 18:45:30 +00002425 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2426 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2427 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2428 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2429 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002430 cur = gen_const_xmlChar_ptr(n_cur, 0);
2431 URL = gen_filepath(n_URL, 1);
2432 encoding = gen_const_char_ptr(n_encoding, 2);
2433 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002434
William M. Brackf13f77f2004-11-12 16:03:48 +00002435 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002436 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002437 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002438 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002439 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002440 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002441 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002442 xmlResetLastError();
2443 if (mem_base != xmlMemBlocks()) {
2444 printf("Leak of %d blocks found in htmlReadDoc",
2445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002446 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002447 printf(" %d", n_cur);
2448 printf(" %d", n_URL);
2449 printf(" %d", n_encoding);
2450 printf(" %d", n_options);
2451 printf("\n");
2452 }
2453 }
2454 }
2455 }
2456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002457 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002458#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002459
Daniel Veillard42595322004-11-08 10:52:06 +00002460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002461}
2462
2463
2464static int
2465test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002467
William M. Brack21e4ef22005-01-02 09:53:13 +00002468#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002469 int mem_base;
2470 htmlDocPtr ret_val;
2471 const char * filename; /* a file or URL */
2472 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002473 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002474 int n_encoding;
2475 int options; /* a combination of htmlParserOption(s) */
2476 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002477
Daniel Veillarda03e3652004-11-02 18:45:30 +00002478 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2479 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2480 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002482 filename = gen_filepath(n_filename, 0);
2483 encoding = gen_const_char_ptr(n_encoding, 1);
2484 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002485
William M. Brackf13f77f2004-11-12 16:03:48 +00002486 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002487 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002488 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002489 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002490 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002491 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002492 xmlResetLastError();
2493 if (mem_base != xmlMemBlocks()) {
2494 printf("Leak of %d blocks found in htmlReadFile",
2495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002496 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002497 printf(" %d", n_filename);
2498 printf(" %d", n_encoding);
2499 printf(" %d", n_options);
2500 printf("\n");
2501 }
2502 }
2503 }
2504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002505 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002506#endif
2507
Daniel Veillard42595322004-11-08 10:52:06 +00002508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002509}
2510
2511
2512static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002513test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002515
William M. Brack21e4ef22005-01-02 09:53:13 +00002516#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002517 int mem_base;
2518 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002519 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002520 int n_buffer;
2521 int size; /* the size of the array */
2522 int n_size;
2523 const char * URL; /* the base URL to use for the document */
2524 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002525 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002526 int n_encoding;
2527 int options; /* a combination of htmlParserOption(s) */
2528 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002529
Daniel Veillarda03e3652004-11-02 18:45:30 +00002530 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2531 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2532 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2533 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2534 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2535 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002536 buffer = gen_const_char_ptr(n_buffer, 0);
2537 size = gen_int(n_size, 1);
2538 URL = gen_filepath(n_URL, 2);
2539 encoding = gen_const_char_ptr(n_encoding, 3);
2540 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002541
William M. Brackf13f77f2004-11-12 16:03:48 +00002542 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002543 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002544 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002545 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002546 des_int(n_size, size, 1);
2547 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002548 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002549 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002550 xmlResetLastError();
2551 if (mem_base != xmlMemBlocks()) {
2552 printf("Leak of %d blocks found in htmlReadMemory",
2553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002555 printf(" %d", n_buffer);
2556 printf(" %d", n_size);
2557 printf(" %d", n_URL);
2558 printf(" %d", n_encoding);
2559 printf(" %d", n_options);
2560 printf("\n");
2561 }
2562 }
2563 }
2564 }
2565 }
2566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002567 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002568#endif
2569
Daniel Veillard42595322004-11-08 10:52:06 +00002570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002571}
2572
2573
2574static int
2575test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002577
William M. Brack21e4ef22005-01-02 09:53:13 +00002578#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002579 int mem_base;
2580 htmlDocPtr ret_val;
2581 xmlChar * cur; /* a pointer to an array of xmlChar */
2582 int n_cur;
2583 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2584 int n_encoding;
2585 htmlSAXHandlerPtr sax; /* the SAX handler block */
2586 int n_sax;
2587 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2588 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002589
Daniel Veillardce682bc2004-11-05 17:22:25 +00002590 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2591 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2592 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2593 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2594 mem_base = xmlMemBlocks();
2595 cur = gen_xmlChar_ptr(n_cur, 0);
2596 encoding = gen_const_char_ptr(n_encoding, 1);
2597 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2598 userData = gen_userdata(n_userData, 3);
2599
William M. Brackf13f77f2004-11-12 16:03:48 +00002600 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002601 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002602 call_tests++;
2603 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002604 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002605 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2606 des_userdata(n_userData, userData, 3);
2607 xmlResetLastError();
2608 if (mem_base != xmlMemBlocks()) {
2609 printf("Leak of %d blocks found in htmlSAXParseDoc",
2610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002611 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002612 printf(" %d", n_cur);
2613 printf(" %d", n_encoding);
2614 printf(" %d", n_sax);
2615 printf(" %d", n_userData);
2616 printf("\n");
2617 }
2618 }
2619 }
2620 }
2621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002622 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002623#endif
2624
Daniel Veillard42595322004-11-08 10:52:06 +00002625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002626}
2627
2628
2629static int
2630test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002632
William M. Brack21e4ef22005-01-02 09:53:13 +00002633#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002634 int mem_base;
2635 htmlDocPtr ret_val;
2636 const char * filename; /* the filename */
2637 int n_filename;
2638 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2639 int n_encoding;
2640 htmlSAXHandlerPtr sax; /* the SAX handler block */
2641 int n_sax;
2642 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2643 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002644
Daniel Veillardce682bc2004-11-05 17:22:25 +00002645 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2646 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2647 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2648 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2649 mem_base = xmlMemBlocks();
2650 filename = gen_filepath(n_filename, 0);
2651 encoding = gen_const_char_ptr(n_encoding, 1);
2652 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2653 userData = gen_userdata(n_userData, 3);
2654
William M. Brackf13f77f2004-11-12 16:03:48 +00002655 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002656 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002657 call_tests++;
2658 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002659 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002660 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2661 des_userdata(n_userData, userData, 3);
2662 xmlResetLastError();
2663 if (mem_base != xmlMemBlocks()) {
2664 printf("Leak of %d blocks found in htmlSAXParseFile",
2665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002666 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002667 printf(" %d", n_filename);
2668 printf(" %d", n_encoding);
2669 printf(" %d", n_sax);
2670 printf(" %d", n_userData);
2671 printf("\n");
2672 }
2673 }
2674 }
2675 }
2676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002677 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002678#endif
2679
Daniel Veillard42595322004-11-08 10:52:06 +00002680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002681}
2682
2683
2684static int
2685test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002687
2688
2689 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002691}
2692
2693static int
2694test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002696
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002697 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002698 test_ret += test_UTF8ToHtml();
2699 test_ret += test_htmlAttrAllowed();
2700 test_ret += test_htmlAutoCloseTag();
2701 test_ret += test_htmlCreateMemoryParserCtxt();
2702 test_ret += test_htmlCreatePushParserCtxt();
2703 test_ret += test_htmlCtxtReadDoc();
2704 test_ret += test_htmlCtxtReadFile();
2705 test_ret += test_htmlCtxtReadMemory();
2706 test_ret += test_htmlCtxtReset();
2707 test_ret += test_htmlCtxtUseOptions();
2708 test_ret += test_htmlElementAllowedHere();
2709 test_ret += test_htmlElementStatusHere();
2710 test_ret += test_htmlEncodeEntities();
2711 test_ret += test_htmlEntityLookup();
2712 test_ret += test_htmlEntityValueLookup();
2713 test_ret += test_htmlHandleOmittedElem();
2714 test_ret += test_htmlIsAutoClosed();
2715 test_ret += test_htmlIsScriptAttribute();
2716 test_ret += test_htmlNodeStatus();
2717 test_ret += test_htmlParseCharRef();
2718 test_ret += test_htmlParseChunk();
2719 test_ret += test_htmlParseDoc();
2720 test_ret += test_htmlParseDocument();
2721 test_ret += test_htmlParseElement();
2722 test_ret += test_htmlParseEntityRef();
2723 test_ret += test_htmlParseFile();
2724 test_ret += test_htmlReadDoc();
2725 test_ret += test_htmlReadFile();
2726 test_ret += test_htmlReadMemory();
2727 test_ret += test_htmlSAXParseDoc();
2728 test_ret += test_htmlSAXParseFile();
2729 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730
Daniel Veillard42595322004-11-08 10:52:06 +00002731 if (test_ret != 0)
2732 printf("Module HTMLparser: %d errors\n", test_ret);
2733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002734}
2735
2736static int
2737test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002739
William M. Brack21e4ef22005-01-02 09:53:13 +00002740#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002741 int mem_base;
2742 xmlOutputBufferPtr buf; /* the HTML buffer output */
2743 int n_buf;
2744 xmlDocPtr cur; /* the document */
2745 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002746 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002747 int n_encoding;
2748 int format; /* should formatting spaces been added */
2749 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002750
Daniel Veillard3d97e662004-11-04 10:49:00 +00002751 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2752 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2753 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2754 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2755 mem_base = xmlMemBlocks();
2756 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2757 cur = gen_xmlDocPtr(n_cur, 1);
2758 encoding = gen_const_char_ptr(n_encoding, 2);
2759 format = gen_int(n_format, 3);
2760
William M. Brackf13f77f2004-11-12 16:03:48 +00002761 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002762 call_tests++;
2763 des_xmlOutputBufferPtr(n_buf, buf, 0);
2764 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002765 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002766 des_int(n_format, format, 3);
2767 xmlResetLastError();
2768 if (mem_base != xmlMemBlocks()) {
2769 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002771 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002772 printf(" %d", n_buf);
2773 printf(" %d", n_cur);
2774 printf(" %d", n_encoding);
2775 printf(" %d", n_format);
2776 printf("\n");
2777 }
2778 }
2779 }
2780 }
2781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002782 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002783#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002784
Daniel Veillard42595322004-11-08 10:52:06 +00002785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002786}
2787
2788
2789static int
2790test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002792
William M. Brack21e4ef22005-01-02 09:53:13 +00002793#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002794 int mem_base;
2795 xmlOutputBufferPtr buf; /* the HTML buffer output */
2796 int n_buf;
2797 xmlDocPtr cur; /* the document */
2798 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002799 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002800 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002801
Daniel Veillard3d97e662004-11-04 10:49:00 +00002802 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2803 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2804 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2805 mem_base = xmlMemBlocks();
2806 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2807 cur = gen_xmlDocPtr(n_cur, 1);
2808 encoding = gen_const_char_ptr(n_encoding, 2);
2809
William M. Brackf13f77f2004-11-12 16:03:48 +00002810 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002811 call_tests++;
2812 des_xmlOutputBufferPtr(n_buf, buf, 0);
2813 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002814 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002815 xmlResetLastError();
2816 if (mem_base != xmlMemBlocks()) {
2817 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002819 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002820 printf(" %d", n_buf);
2821 printf(" %d", n_cur);
2822 printf(" %d", n_encoding);
2823 printf("\n");
2824 }
2825 }
2826 }
2827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002828 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002829#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002830
Daniel Veillard42595322004-11-08 10:52:06 +00002831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002832}
2833
2834
2835static int
2836test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002838
William M. Brack21e4ef22005-01-02 09:53:13 +00002839#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002840 int mem_base;
2841 int ret_val;
2842 FILE * f; /* the FILE* */
2843 int n_f;
2844 xmlDocPtr cur; /* the document */
2845 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002846
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002847 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2848 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2849 mem_base = xmlMemBlocks();
2850 f = gen_FILE_ptr(n_f, 0);
2851 cur = gen_xmlDocPtr(n_cur, 1);
2852
2853 ret_val = htmlDocDump(f, cur);
2854 desret_int(ret_val);
2855 call_tests++;
2856 des_FILE_ptr(n_f, f, 0);
2857 des_xmlDocPtr(n_cur, cur, 1);
2858 xmlResetLastError();
2859 if (mem_base != xmlMemBlocks()) {
2860 printf("Leak of %d blocks found in htmlDocDump",
2861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002862 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002863 printf(" %d", n_f);
2864 printf(" %d", n_cur);
2865 printf("\n");
2866 }
2867 }
2868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002869 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002870#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002871
Daniel Veillard42595322004-11-08 10:52:06 +00002872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002873}
2874
2875
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002876#define gen_nb_xmlChar_ptr_ptr 1
2877static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2878 return(NULL);
2879}
2880static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2881}
2882
Daniel Veillardd93f6252004-11-02 15:53:51 +00002883static int
2884test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002886
William M. Brack21e4ef22005-01-02 09:53:13 +00002887#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002888 int mem_base;
2889 xmlDocPtr cur; /* the document */
2890 int n_cur;
2891 xmlChar ** mem; /* OUT: the memory pointer */
2892 int n_mem;
2893 int * size; /* OUT: the memory length */
2894 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002895
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002896 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2897 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2898 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2899 mem_base = xmlMemBlocks();
2900 cur = gen_xmlDocPtr(n_cur, 0);
2901 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2902 size = gen_int_ptr(n_size, 2);
2903
2904 htmlDocDumpMemory(cur, mem, size);
2905 call_tests++;
2906 des_xmlDocPtr(n_cur, cur, 0);
2907 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2908 des_int_ptr(n_size, size, 2);
2909 xmlResetLastError();
2910 if (mem_base != xmlMemBlocks()) {
2911 printf("Leak of %d blocks found in htmlDocDumpMemory",
2912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002913 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002914 printf(" %d", n_cur);
2915 printf(" %d", n_mem);
2916 printf(" %d", n_size);
2917 printf("\n");
2918 }
2919 }
2920 }
2921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002922 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002923#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002924
Daniel Veillard42595322004-11-08 10:52:06 +00002925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002926}
2927
2928
2929static int
2930test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002932
William M. Brack21e4ef22005-01-02 09:53:13 +00002933#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002934 int mem_base;
2935 const xmlChar * ret_val;
2936 htmlDocPtr doc; /* the document */
2937 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002938
Daniel Veillarda521d282004-11-09 14:59:59 +00002939 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002940 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002941 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002942
2943 ret_val = htmlGetMetaEncoding(doc);
2944 desret_const_xmlChar_ptr(ret_val);
2945 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002946 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002947 xmlResetLastError();
2948 if (mem_base != xmlMemBlocks()) {
2949 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002951 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002952 printf(" %d", n_doc);
2953 printf("\n");
2954 }
2955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002956 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002957#endif
2958
Daniel Veillard42595322004-11-08 10:52:06 +00002959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002960}
2961
2962
2963static int
2964test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002966
William M. Brack21e4ef22005-01-02 09:53:13 +00002967#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002968 int mem_base;
2969 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002970 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002971 int n_name;
2972
2973 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002975 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002976
William M. Brackf13f77f2004-11-12 16:03:48 +00002977 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002978 desret_int(ret_val);
2979 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002980 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002981 xmlResetLastError();
2982 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002983 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002985 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002986 printf(" %d", n_name);
2987 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002988 }
2989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002990 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002991#endif
2992
Daniel Veillard42595322004-11-08 10:52:06 +00002993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002994}
2995
2996
2997static int
2998test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003000
William M. Brack21e4ef22005-01-02 09:53:13 +00003001#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003002 int mem_base;
3003 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003004 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003006 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003007 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003008
Daniel Veillarda03e3652004-11-02 18:45:30 +00003009 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3010 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3011 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003012 URI = gen_const_xmlChar_ptr(n_URI, 0);
3013 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003014
William M. Brackf13f77f2004-11-12 16:03:48 +00003015 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003016 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003017 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003018 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3019 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003020 xmlResetLastError();
3021 if (mem_base != xmlMemBlocks()) {
3022 printf("Leak of %d blocks found in htmlNewDoc",
3023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003024 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003025 printf(" %d", n_URI);
3026 printf(" %d", n_ExternalID);
3027 printf("\n");
3028 }
3029 }
3030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003031 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003032#endif
3033
Daniel Veillard42595322004-11-08 10:52:06 +00003034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003035}
3036
3037
3038static int
3039test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003041
William M. Brack21e4ef22005-01-02 09:53:13 +00003042#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003043 int mem_base;
3044 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003045 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003046 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003047 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003048 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003049
Daniel Veillarda03e3652004-11-02 18:45:30 +00003050 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3051 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3052 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003053 URI = gen_const_xmlChar_ptr(n_URI, 0);
3054 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003055
William M. Brackf13f77f2004-11-12 16:03:48 +00003056 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003057 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003058 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003059 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3060 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003061 xmlResetLastError();
3062 if (mem_base != xmlMemBlocks()) {
3063 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003065 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003066 printf(" %d", n_URI);
3067 printf(" %d", n_ExternalID);
3068 printf("\n");
3069 }
3070 }
3071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003072 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003073#endif
3074
Daniel Veillard42595322004-11-08 10:52:06 +00003075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003076}
3077
3078
3079static int
3080test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003082
William M. Brack21e4ef22005-01-02 09:53:13 +00003083#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003084 int mem_base;
3085 int ret_val;
3086 xmlBufferPtr buf; /* the HTML buffer output */
3087 int n_buf;
3088 xmlDocPtr doc; /* the document */
3089 int n_doc;
3090 xmlNodePtr cur; /* the current node */
3091 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003092
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003093 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3094 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3095 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3096 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003097 buf = gen_xmlBufferPtr(n_buf, 0);
3098 doc = gen_xmlDocPtr(n_doc, 1);
3099 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003100
3101 ret_val = htmlNodeDump(buf, doc, cur);
3102 desret_int(ret_val);
3103 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003104 des_xmlBufferPtr(n_buf, buf, 0);
3105 des_xmlDocPtr(n_doc, doc, 1);
3106 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003107 xmlResetLastError();
3108 if (mem_base != xmlMemBlocks()) {
3109 printf("Leak of %d blocks found in htmlNodeDump",
3110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003111 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003112 printf(" %d", n_buf);
3113 printf(" %d", n_doc);
3114 printf(" %d", n_cur);
3115 printf("\n");
3116 }
3117 }
3118 }
3119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003120 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003121#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003122
Daniel Veillard42595322004-11-08 10:52:06 +00003123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003124}
3125
3126
3127static int
3128test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003130
William M. Brack21e4ef22005-01-02 09:53:13 +00003131#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003132 int mem_base;
3133 FILE * out; /* the FILE pointer */
3134 int n_out;
3135 xmlDocPtr doc; /* the document */
3136 int n_doc;
3137 xmlNodePtr cur; /* the current node */
3138 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003139
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003140 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3141 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3142 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3143 mem_base = xmlMemBlocks();
3144 out = gen_FILE_ptr(n_out, 0);
3145 doc = gen_xmlDocPtr(n_doc, 1);
3146 cur = gen_xmlNodePtr(n_cur, 2);
3147
3148 htmlNodeDumpFile(out, doc, cur);
3149 call_tests++;
3150 des_FILE_ptr(n_out, out, 0);
3151 des_xmlDocPtr(n_doc, doc, 1);
3152 des_xmlNodePtr(n_cur, cur, 2);
3153 xmlResetLastError();
3154 if (mem_base != xmlMemBlocks()) {
3155 printf("Leak of %d blocks found in htmlNodeDumpFile",
3156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003157 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003158 printf(" %d", n_out);
3159 printf(" %d", n_doc);
3160 printf(" %d", n_cur);
3161 printf("\n");
3162 }
3163 }
3164 }
3165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003166 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003167#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003168
Daniel Veillard42595322004-11-08 10:52:06 +00003169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003170}
3171
3172
3173static int
3174test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003176
William M. Brack21e4ef22005-01-02 09:53:13 +00003177#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003178 int mem_base;
3179 int ret_val;
3180 FILE * out; /* the FILE pointer */
3181 int n_out;
3182 xmlDocPtr doc; /* the document */
3183 int n_doc;
3184 xmlNodePtr cur; /* the current node */
3185 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003186 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003187 int n_encoding;
3188 int format; /* should formatting spaces been added */
3189 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003190
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003191 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3192 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3193 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3194 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3195 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3196 mem_base = xmlMemBlocks();
3197 out = gen_FILE_ptr(n_out, 0);
3198 doc = gen_xmlDocPtr(n_doc, 1);
3199 cur = gen_xmlNodePtr(n_cur, 2);
3200 encoding = gen_const_char_ptr(n_encoding, 3);
3201 format = gen_int(n_format, 4);
3202
William M. Brackf13f77f2004-11-12 16:03:48 +00003203 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003204 desret_int(ret_val);
3205 call_tests++;
3206 des_FILE_ptr(n_out, out, 0);
3207 des_xmlDocPtr(n_doc, doc, 1);
3208 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003209 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003210 des_int(n_format, format, 4);
3211 xmlResetLastError();
3212 if (mem_base != xmlMemBlocks()) {
3213 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003215 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003216 printf(" %d", n_out);
3217 printf(" %d", n_doc);
3218 printf(" %d", n_cur);
3219 printf(" %d", n_encoding);
3220 printf(" %d", n_format);
3221 printf("\n");
3222 }
3223 }
3224 }
3225 }
3226 }
3227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003228 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003229#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003230
Daniel Veillard42595322004-11-08 10:52:06 +00003231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003232}
3233
3234
3235static int
3236test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003238
William M. Brack21e4ef22005-01-02 09:53:13 +00003239#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003240 int mem_base;
3241 xmlOutputBufferPtr buf; /* the HTML buffer output */
3242 int n_buf;
3243 xmlDocPtr doc; /* the document */
3244 int n_doc;
3245 xmlNodePtr cur; /* the current node */
3246 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003247 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003248 int n_encoding;
3249 int format; /* should formatting spaces been added */
3250 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003251
Daniel Veillard3d97e662004-11-04 10:49:00 +00003252 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3253 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3254 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3255 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3256 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3257 mem_base = xmlMemBlocks();
3258 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3259 doc = gen_xmlDocPtr(n_doc, 1);
3260 cur = gen_xmlNodePtr(n_cur, 2);
3261 encoding = gen_const_char_ptr(n_encoding, 3);
3262 format = gen_int(n_format, 4);
3263
William M. Brackf13f77f2004-11-12 16:03:48 +00003264 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003265 call_tests++;
3266 des_xmlOutputBufferPtr(n_buf, buf, 0);
3267 des_xmlDocPtr(n_doc, doc, 1);
3268 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003269 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270 des_int(n_format, format, 4);
3271 xmlResetLastError();
3272 if (mem_base != xmlMemBlocks()) {
3273 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003275 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003276 printf(" %d", n_buf);
3277 printf(" %d", n_doc);
3278 printf(" %d", n_cur);
3279 printf(" %d", n_encoding);
3280 printf(" %d", n_format);
3281 printf("\n");
3282 }
3283 }
3284 }
3285 }
3286 }
3287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003288 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003289#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003290
Daniel Veillard42595322004-11-08 10:52:06 +00003291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003292}
3293
3294
3295static int
3296test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003298
William M. Brack21e4ef22005-01-02 09:53:13 +00003299#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003300 int mem_base;
3301 xmlOutputBufferPtr buf; /* the HTML buffer output */
3302 int n_buf;
3303 xmlDocPtr doc; /* the document */
3304 int n_doc;
3305 xmlNodePtr cur; /* the current node */
3306 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003307 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003308 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003309
Daniel Veillard3d97e662004-11-04 10:49:00 +00003310 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3312 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3313 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3314 mem_base = xmlMemBlocks();
3315 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3316 doc = gen_xmlDocPtr(n_doc, 1);
3317 cur = gen_xmlNodePtr(n_cur, 2);
3318 encoding = gen_const_char_ptr(n_encoding, 3);
3319
William M. Brackf13f77f2004-11-12 16:03:48 +00003320 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003321 call_tests++;
3322 des_xmlOutputBufferPtr(n_buf, buf, 0);
3323 des_xmlDocPtr(n_doc, doc, 1);
3324 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003325 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003326 xmlResetLastError();
3327 if (mem_base != xmlMemBlocks()) {
3328 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003330 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003331 printf(" %d", n_buf);
3332 printf(" %d", n_doc);
3333 printf(" %d", n_cur);
3334 printf(" %d", n_encoding);
3335 printf("\n");
3336 }
3337 }
3338 }
3339 }
3340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003341 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003342#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003343
Daniel Veillard42595322004-11-08 10:52:06 +00003344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345}
3346
3347
3348static int
3349test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351
William M. Brack21e4ef22005-01-02 09:53:13 +00003352#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003353 int mem_base;
3354 int ret_val;
3355 const char * filename; /* the filename (or URL) */
3356 int n_filename;
3357 xmlDocPtr cur; /* the document */
3358 int n_cur;
3359
3360 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3361 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003363 filename = gen_fileoutput(n_filename, 0);
3364 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003365
3366 ret_val = htmlSaveFile(filename, cur);
3367 desret_int(ret_val);
3368 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003369 des_fileoutput(n_filename, filename, 0);
3370 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003371 xmlResetLastError();
3372 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003373 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003375 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003376 printf(" %d", n_filename);
3377 printf(" %d", n_cur);
3378 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003379 }
3380 }
3381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003382 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003383#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003384
Daniel Veillard42595322004-11-08 10:52:06 +00003385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003386}
3387
3388
3389static int
3390test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003392
William M. Brack21e4ef22005-01-02 09:53:13 +00003393#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003394 int mem_base;
3395 int ret_val;
3396 const char * filename; /* the filename */
3397 int n_filename;
3398 xmlDocPtr cur; /* the document */
3399 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003400 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003401 int n_encoding;
3402
3403 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3404 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3405 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3406 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003407 filename = gen_fileoutput(n_filename, 0);
3408 cur = gen_xmlDocPtr(n_cur, 1);
3409 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003410
William M. Brackf13f77f2004-11-12 16:03:48 +00003411 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003412 desret_int(ret_val);
3413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003414 des_fileoutput(n_filename, filename, 0);
3415 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003416 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003417 xmlResetLastError();
3418 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003419 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003421 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003422 printf(" %d", n_filename);
3423 printf(" %d", n_cur);
3424 printf(" %d", n_encoding);
3425 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003426 }
3427 }
3428 }
3429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003430 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003431#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003432
Daniel Veillard42595322004-11-08 10:52:06 +00003433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003434}
3435
3436
3437static int
3438test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003440
William M. Brack21e4ef22005-01-02 09:53:13 +00003441#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003442 int mem_base;
3443 int ret_val;
3444 const char * filename; /* the filename */
3445 int n_filename;
3446 xmlDocPtr cur; /* the document */
3447 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003448 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003449 int n_encoding;
3450 int format; /* should formatting spaces been added */
3451 int n_format;
3452
3453 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3454 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3455 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3456 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3457 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003458 filename = gen_fileoutput(n_filename, 0);
3459 cur = gen_xmlDocPtr(n_cur, 1);
3460 encoding = gen_const_char_ptr(n_encoding, 2);
3461 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003462
William M. Brackf13f77f2004-11-12 16:03:48 +00003463 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003464 desret_int(ret_val);
3465 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003466 des_fileoutput(n_filename, filename, 0);
3467 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003468 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003469 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003470 xmlResetLastError();
3471 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003472 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003474 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003475 printf(" %d", n_filename);
3476 printf(" %d", n_cur);
3477 printf(" %d", n_encoding);
3478 printf(" %d", n_format);
3479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003480 }
3481 }
3482 }
3483 }
3484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003485 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003486#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003487
Daniel Veillard42595322004-11-08 10:52:06 +00003488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003489}
3490
3491
3492static int
3493test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003495
William M. Brack21e4ef22005-01-02 09:53:13 +00003496#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003497 int mem_base;
3498 int ret_val;
3499 htmlDocPtr doc; /* the document */
3500 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003501 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003502 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003503
Daniel Veillarda521d282004-11-09 14:59:59 +00003504 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003505 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3506 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003507 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003508 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003509
William M. Brackf13f77f2004-11-12 16:03:48 +00003510 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003511 desret_int(ret_val);
3512 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003513 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003514 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003515 xmlResetLastError();
3516 if (mem_base != xmlMemBlocks()) {
3517 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003519 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003520 printf(" %d", n_doc);
3521 printf(" %d", n_encoding);
3522 printf("\n");
3523 }
3524 }
3525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003526 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003527#endif
3528
Daniel Veillard42595322004-11-08 10:52:06 +00003529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003530}
3531
3532static int
3533test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003535
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003536 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003537 test_ret += test_htmlDocContentDumpFormatOutput();
3538 test_ret += test_htmlDocContentDumpOutput();
3539 test_ret += test_htmlDocDump();
3540 test_ret += test_htmlDocDumpMemory();
3541 test_ret += test_htmlGetMetaEncoding();
3542 test_ret += test_htmlIsBooleanAttr();
3543 test_ret += test_htmlNewDoc();
3544 test_ret += test_htmlNewDocNoDtD();
3545 test_ret += test_htmlNodeDump();
3546 test_ret += test_htmlNodeDumpFile();
3547 test_ret += test_htmlNodeDumpFileFormat();
3548 test_ret += test_htmlNodeDumpFormatOutput();
3549 test_ret += test_htmlNodeDumpOutput();
3550 test_ret += test_htmlSaveFile();
3551 test_ret += test_htmlSaveFileEnc();
3552 test_ret += test_htmlSaveFileFormat();
3553 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003554
Daniel Veillard42595322004-11-08 10:52:06 +00003555 if (test_ret != 0)
3556 printf("Module HTMLtree: %d errors\n", test_ret);
3557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003558}
3559
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003560static int
3561test_docbDefaultSAXHandlerInit(void) {
3562 int test_ret = 0;
3563
William M. Brack21e4ef22005-01-02 09:53:13 +00003564#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003565#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003566 int mem_base;
3567
3568 mem_base = xmlMemBlocks();
3569
3570 docbDefaultSAXHandlerInit();
3571 call_tests++;
3572 xmlResetLastError();
3573 if (mem_base != xmlMemBlocks()) {
3574 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3575 xmlMemBlocks() - mem_base);
3576 test_ret++;
3577 printf("\n");
3578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003579 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003580#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003581#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003582
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003583 return(test_ret);
3584}
3585
3586
3587static int
3588test_htmlDefaultSAXHandlerInit(void) {
3589 int test_ret = 0;
3590
William M. Brack21e4ef22005-01-02 09:53:13 +00003591#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003592#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003593 int mem_base;
3594
3595 mem_base = xmlMemBlocks();
3596
3597 htmlDefaultSAXHandlerInit();
3598 call_tests++;
3599 xmlResetLastError();
3600 if (mem_base != xmlMemBlocks()) {
3601 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3602 xmlMemBlocks() - mem_base);
3603 test_ret++;
3604 printf("\n");
3605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003606 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003607#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003608#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003609
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003610 return(test_ret);
3611}
3612
3613
3614static int
3615test_xmlDefaultSAXHandlerInit(void) {
3616 int test_ret = 0;
3617
3618 int mem_base;
3619
3620 mem_base = xmlMemBlocks();
3621
3622 xmlDefaultSAXHandlerInit();
3623 call_tests++;
3624 xmlResetLastError();
3625 if (mem_base != xmlMemBlocks()) {
3626 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3627 xmlMemBlocks() - mem_base);
3628 test_ret++;
3629 printf("\n");
3630 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003631 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003632
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003633 return(test_ret);
3634}
3635
3636
3637#define gen_nb_xmlEnumerationPtr 1
3638static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3639 return(NULL);
3640}
3641static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3642}
3643
3644static int
3645test_xmlSAX2AttributeDecl(void) {
3646 int test_ret = 0;
3647
3648 int mem_base;
3649 void * ctx; /* the user data (XML parser context) */
3650 int n_ctx;
3651 xmlChar * elem; /* the name of the element */
3652 int n_elem;
3653 xmlChar * fullname; /* the attribute name */
3654 int n_fullname;
3655 int type; /* the attribute type */
3656 int n_type;
3657 int def; /* the type of default value */
3658 int n_def;
3659 xmlChar * defaultValue; /* the attribute default value */
3660 int n_defaultValue;
3661 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3662 int n_tree;
3663
3664 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3665 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3666 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3667 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3668 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3669 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3670 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3671 mem_base = xmlMemBlocks();
3672 ctx = gen_void_ptr(n_ctx, 0);
3673 elem = gen_const_xmlChar_ptr(n_elem, 1);
3674 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3675 type = gen_int(n_type, 3);
3676 def = gen_int(n_def, 4);
3677 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3678 tree = gen_xmlEnumerationPtr(n_tree, 6);
3679
William M. Brackf13f77f2004-11-12 16:03:48 +00003680 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003681 call_tests++;
3682 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003683 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3684 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003685 des_int(n_type, type, 3);
3686 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003687 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003688 des_xmlEnumerationPtr(n_tree, tree, 6);
3689 xmlResetLastError();
3690 if (mem_base != xmlMemBlocks()) {
3691 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3692 xmlMemBlocks() - mem_base);
3693 test_ret++;
3694 printf(" %d", n_ctx);
3695 printf(" %d", n_elem);
3696 printf(" %d", n_fullname);
3697 printf(" %d", n_type);
3698 printf(" %d", n_def);
3699 printf(" %d", n_defaultValue);
3700 printf(" %d", n_tree);
3701 printf("\n");
3702 }
3703 }
3704 }
3705 }
3706 }
3707 }
3708 }
3709 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003710 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003711
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003712 return(test_ret);
3713}
3714
3715
3716static int
3717test_xmlSAX2CDataBlock(void) {
3718 int test_ret = 0;
3719
3720 int mem_base;
3721 void * ctx; /* the user data (XML parser context) */
3722 int n_ctx;
3723 xmlChar * value; /* The pcdata content */
3724 int n_value;
3725 int len; /* the block length */
3726 int n_len;
3727
3728 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3729 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3730 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3731 mem_base = xmlMemBlocks();
3732 ctx = gen_void_ptr(n_ctx, 0);
3733 value = gen_const_xmlChar_ptr(n_value, 1);
3734 len = gen_int(n_len, 2);
3735
William M. Brackf13f77f2004-11-12 16:03:48 +00003736 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003737 call_tests++;
3738 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003739 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003740 des_int(n_len, len, 2);
3741 xmlResetLastError();
3742 if (mem_base != xmlMemBlocks()) {
3743 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3744 xmlMemBlocks() - mem_base);
3745 test_ret++;
3746 printf(" %d", n_ctx);
3747 printf(" %d", n_value);
3748 printf(" %d", n_len);
3749 printf("\n");
3750 }
3751 }
3752 }
3753 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003754 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003755
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003756 return(test_ret);
3757}
3758
3759
3760static int
3761test_xmlSAX2Characters(void) {
3762 int test_ret = 0;
3763
3764 int mem_base;
3765 void * ctx; /* the user data (XML parser context) */
3766 int n_ctx;
3767 xmlChar * ch; /* a xmlChar string */
3768 int n_ch;
3769 int len; /* the number of xmlChar */
3770 int n_len;
3771
3772 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3773 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3774 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3775 mem_base = xmlMemBlocks();
3776 ctx = gen_void_ptr(n_ctx, 0);
3777 ch = gen_const_xmlChar_ptr(n_ch, 1);
3778 len = gen_int(n_len, 2);
3779
William M. Brackf13f77f2004-11-12 16:03:48 +00003780 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003781 call_tests++;
3782 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003783 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003784 des_int(n_len, len, 2);
3785 xmlResetLastError();
3786 if (mem_base != xmlMemBlocks()) {
3787 printf("Leak of %d blocks found in xmlSAX2Characters",
3788 xmlMemBlocks() - mem_base);
3789 test_ret++;
3790 printf(" %d", n_ctx);
3791 printf(" %d", n_ch);
3792 printf(" %d", n_len);
3793 printf("\n");
3794 }
3795 }
3796 }
3797 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003798 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003799
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003800 return(test_ret);
3801}
3802
3803
3804static int
3805test_xmlSAX2Comment(void) {
3806 int test_ret = 0;
3807
3808 int mem_base;
3809 void * ctx; /* the user data (XML parser context) */
3810 int n_ctx;
3811 xmlChar * value; /* the xmlSAX2Comment content */
3812 int n_value;
3813
3814 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3815 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3816 mem_base = xmlMemBlocks();
3817 ctx = gen_void_ptr(n_ctx, 0);
3818 value = gen_const_xmlChar_ptr(n_value, 1);
3819
William M. Brackf13f77f2004-11-12 16:03:48 +00003820 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003821 call_tests++;
3822 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003823 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003824 xmlResetLastError();
3825 if (mem_base != xmlMemBlocks()) {
3826 printf("Leak of %d blocks found in xmlSAX2Comment",
3827 xmlMemBlocks() - mem_base);
3828 test_ret++;
3829 printf(" %d", n_ctx);
3830 printf(" %d", n_value);
3831 printf("\n");
3832 }
3833 }
3834 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003836
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003837 return(test_ret);
3838}
3839
3840
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003841static int
3842test_xmlSAX2ElementDecl(void) {
3843 int test_ret = 0;
3844
3845 int mem_base;
3846 void * ctx; /* the user data (XML parser context) */
3847 int n_ctx;
3848 xmlChar * name; /* the element name */
3849 int n_name;
3850 int type; /* the element type */
3851 int n_type;
3852 xmlElementContentPtr content; /* the element value tree */
3853 int n_content;
3854
3855 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3856 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3857 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3858 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3859 mem_base = xmlMemBlocks();
3860 ctx = gen_void_ptr(n_ctx, 0);
3861 name = gen_const_xmlChar_ptr(n_name, 1);
3862 type = gen_int(n_type, 2);
3863 content = gen_xmlElementContentPtr(n_content, 3);
3864
William M. Brackf13f77f2004-11-12 16:03:48 +00003865 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003866 call_tests++;
3867 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003868 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003869 des_int(n_type, type, 2);
3870 des_xmlElementContentPtr(n_content, content, 3);
3871 xmlResetLastError();
3872 if (mem_base != xmlMemBlocks()) {
3873 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3874 xmlMemBlocks() - mem_base);
3875 test_ret++;
3876 printf(" %d", n_ctx);
3877 printf(" %d", n_name);
3878 printf(" %d", n_type);
3879 printf(" %d", n_content);
3880 printf("\n");
3881 }
3882 }
3883 }
3884 }
3885 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003886 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003887
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003888 return(test_ret);
3889}
3890
3891
3892static int
3893test_xmlSAX2EndDocument(void) {
3894 int test_ret = 0;
3895
3896 int mem_base;
3897 void * ctx; /* the user data (XML parser context) */
3898 int n_ctx;
3899
3900 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3901 mem_base = xmlMemBlocks();
3902 ctx = gen_void_ptr(n_ctx, 0);
3903
3904 xmlSAX2EndDocument(ctx);
3905 call_tests++;
3906 des_void_ptr(n_ctx, ctx, 0);
3907 xmlResetLastError();
3908 if (mem_base != xmlMemBlocks()) {
3909 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3910 xmlMemBlocks() - mem_base);
3911 test_ret++;
3912 printf(" %d", n_ctx);
3913 printf("\n");
3914 }
3915 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003916 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003917
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003918 return(test_ret);
3919}
3920
3921
3922static int
3923test_xmlSAX2EndElement(void) {
3924 int test_ret = 0;
3925
William M. Brack21e4ef22005-01-02 09:53:13 +00003926#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003927#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003928 int mem_base;
3929 void * ctx; /* the user data (XML parser context) */
3930 int n_ctx;
3931 xmlChar * name; /* The element name */
3932 int n_name;
3933
3934 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3935 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3936 mem_base = xmlMemBlocks();
3937 ctx = gen_void_ptr(n_ctx, 0);
3938 name = gen_const_xmlChar_ptr(n_name, 1);
3939
William M. Brackf13f77f2004-11-12 16:03:48 +00003940 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003941 call_tests++;
3942 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003943 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003944 xmlResetLastError();
3945 if (mem_base != xmlMemBlocks()) {
3946 printf("Leak of %d blocks found in xmlSAX2EndElement",
3947 xmlMemBlocks() - mem_base);
3948 test_ret++;
3949 printf(" %d", n_ctx);
3950 printf(" %d", n_name);
3951 printf("\n");
3952 }
3953 }
3954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003955 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003956#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003957#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003958
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003959 return(test_ret);
3960}
3961
3962
3963static int
3964test_xmlSAX2EndElementNs(void) {
3965 int test_ret = 0;
3966
3967 int mem_base;
3968 void * ctx; /* the user data (XML parser context) */
3969 int n_ctx;
3970 xmlChar * localname; /* the local name of the element */
3971 int n_localname;
3972 xmlChar * prefix; /* the element namespace prefix if available */
3973 int n_prefix;
3974 xmlChar * URI; /* the element namespace name if available */
3975 int n_URI;
3976
3977 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3978 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3979 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3980 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3981 mem_base = xmlMemBlocks();
3982 ctx = gen_void_ptr(n_ctx, 0);
3983 localname = gen_const_xmlChar_ptr(n_localname, 1);
3984 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3985 URI = gen_const_xmlChar_ptr(n_URI, 3);
3986
William M. Brackf13f77f2004-11-12 16:03:48 +00003987 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003988 call_tests++;
3989 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003990 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3991 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3992 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003993 xmlResetLastError();
3994 if (mem_base != xmlMemBlocks()) {
3995 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3996 xmlMemBlocks() - mem_base);
3997 test_ret++;
3998 printf(" %d", n_ctx);
3999 printf(" %d", n_localname);
4000 printf(" %d", n_prefix);
4001 printf(" %d", n_URI);
4002 printf("\n");
4003 }
4004 }
4005 }
4006 }
4007 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004008 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004009
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004010 return(test_ret);
4011}
4012
4013
4014static int
4015test_xmlSAX2EntityDecl(void) {
4016 int test_ret = 0;
4017
4018 int mem_base;
4019 void * ctx; /* the user data (XML parser context) */
4020 int n_ctx;
4021 xmlChar * name; /* the entity name */
4022 int n_name;
4023 int type; /* the entity type */
4024 int n_type;
4025 xmlChar * publicId; /* The public ID of the entity */
4026 int n_publicId;
4027 xmlChar * systemId; /* The system ID of the entity */
4028 int n_systemId;
4029 xmlChar * content; /* the entity value (without processing). */
4030 int n_content;
4031
4032 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4033 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4034 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4035 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4036 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4037 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4038 mem_base = xmlMemBlocks();
4039 ctx = gen_void_ptr(n_ctx, 0);
4040 name = gen_const_xmlChar_ptr(n_name, 1);
4041 type = gen_int(n_type, 2);
4042 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4043 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4044 content = gen_xmlChar_ptr(n_content, 5);
4045
William M. Brackf13f77f2004-11-12 16:03:48 +00004046 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004047 call_tests++;
4048 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004049 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004050 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004051 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4052 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 des_xmlChar_ptr(n_content, content, 5);
4054 xmlResetLastError();
4055 if (mem_base != xmlMemBlocks()) {
4056 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4057 xmlMemBlocks() - mem_base);
4058 test_ret++;
4059 printf(" %d", n_ctx);
4060 printf(" %d", n_name);
4061 printf(" %d", n_type);
4062 printf(" %d", n_publicId);
4063 printf(" %d", n_systemId);
4064 printf(" %d", n_content);
4065 printf("\n");
4066 }
4067 }
4068 }
4069 }
4070 }
4071 }
4072 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004074
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004075 return(test_ret);
4076}
4077
4078
4079static int
4080test_xmlSAX2ExternalSubset(void) {
4081 int test_ret = 0;
4082
4083 int mem_base;
4084 void * ctx; /* the user data (XML parser context) */
4085 int n_ctx;
4086 xmlChar * name; /* the root element name */
4087 int n_name;
4088 xmlChar * ExternalID; /* the external ID */
4089 int n_ExternalID;
4090 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4091 int n_SystemID;
4092
4093 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4094 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4095 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4096 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4097 mem_base = xmlMemBlocks();
4098 ctx = gen_void_ptr(n_ctx, 0);
4099 name = gen_const_xmlChar_ptr(n_name, 1);
4100 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4101 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4102
William M. Brackf13f77f2004-11-12 16:03:48 +00004103 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004104 call_tests++;
4105 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004106 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4107 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4108 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004109 xmlResetLastError();
4110 if (mem_base != xmlMemBlocks()) {
4111 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4112 xmlMemBlocks() - mem_base);
4113 test_ret++;
4114 printf(" %d", n_ctx);
4115 printf(" %d", n_name);
4116 printf(" %d", n_ExternalID);
4117 printf(" %d", n_SystemID);
4118 printf("\n");
4119 }
4120 }
4121 }
4122 }
4123 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004124 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004125
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004126 return(test_ret);
4127}
4128
4129
4130static int
4131test_xmlSAX2GetColumnNumber(void) {
4132 int test_ret = 0;
4133
4134 int mem_base;
4135 int ret_val;
4136 void * ctx; /* the user data (XML parser context) */
4137 int n_ctx;
4138
4139 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4140 mem_base = xmlMemBlocks();
4141 ctx = gen_void_ptr(n_ctx, 0);
4142
4143 ret_val = xmlSAX2GetColumnNumber(ctx);
4144 desret_int(ret_val);
4145 call_tests++;
4146 des_void_ptr(n_ctx, ctx, 0);
4147 xmlResetLastError();
4148 if (mem_base != xmlMemBlocks()) {
4149 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4150 xmlMemBlocks() - mem_base);
4151 test_ret++;
4152 printf(" %d", n_ctx);
4153 printf("\n");
4154 }
4155 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004156 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004157
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004158 return(test_ret);
4159}
4160
4161
4162static int
4163test_xmlSAX2GetEntity(void) {
4164 int test_ret = 0;
4165
4166 int mem_base;
4167 xmlEntityPtr ret_val;
4168 void * ctx; /* the user data (XML parser context) */
4169 int n_ctx;
4170 xmlChar * name; /* The entity name */
4171 int n_name;
4172
4173 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4174 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4175 mem_base = xmlMemBlocks();
4176 ctx = gen_void_ptr(n_ctx, 0);
4177 name = gen_const_xmlChar_ptr(n_name, 1);
4178
William M. Brackf13f77f2004-11-12 16:03:48 +00004179 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004180 desret_xmlEntityPtr(ret_val);
4181 call_tests++;
4182 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004183 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004184 xmlResetLastError();
4185 if (mem_base != xmlMemBlocks()) {
4186 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4187 xmlMemBlocks() - mem_base);
4188 test_ret++;
4189 printf(" %d", n_ctx);
4190 printf(" %d", n_name);
4191 printf("\n");
4192 }
4193 }
4194 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004195 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004196
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004197 return(test_ret);
4198}
4199
4200
4201static int
4202test_xmlSAX2GetLineNumber(void) {
4203 int test_ret = 0;
4204
4205 int mem_base;
4206 int ret_val;
4207 void * ctx; /* the user data (XML parser context) */
4208 int n_ctx;
4209
4210 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4211 mem_base = xmlMemBlocks();
4212 ctx = gen_void_ptr(n_ctx, 0);
4213
4214 ret_val = xmlSAX2GetLineNumber(ctx);
4215 desret_int(ret_val);
4216 call_tests++;
4217 des_void_ptr(n_ctx, ctx, 0);
4218 xmlResetLastError();
4219 if (mem_base != xmlMemBlocks()) {
4220 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4221 xmlMemBlocks() - mem_base);
4222 test_ret++;
4223 printf(" %d", n_ctx);
4224 printf("\n");
4225 }
4226 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004228
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004229 return(test_ret);
4230}
4231
4232
4233static int
4234test_xmlSAX2GetParameterEntity(void) {
4235 int test_ret = 0;
4236
4237 int mem_base;
4238 xmlEntityPtr ret_val;
4239 void * ctx; /* the user data (XML parser context) */
4240 int n_ctx;
4241 xmlChar * name; /* The entity name */
4242 int n_name;
4243
4244 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4245 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4246 mem_base = xmlMemBlocks();
4247 ctx = gen_void_ptr(n_ctx, 0);
4248 name = gen_const_xmlChar_ptr(n_name, 1);
4249
William M. Brackf13f77f2004-11-12 16:03:48 +00004250 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004251 desret_xmlEntityPtr(ret_val);
4252 call_tests++;
4253 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004254 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004255 xmlResetLastError();
4256 if (mem_base != xmlMemBlocks()) {
4257 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4258 xmlMemBlocks() - mem_base);
4259 test_ret++;
4260 printf(" %d", n_ctx);
4261 printf(" %d", n_name);
4262 printf("\n");
4263 }
4264 }
4265 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004266 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004267
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004268 return(test_ret);
4269}
4270
4271
4272static int
4273test_xmlSAX2GetPublicId(void) {
4274 int test_ret = 0;
4275
4276 int mem_base;
4277 const xmlChar * ret_val;
4278 void * ctx; /* the user data (XML parser context) */
4279 int n_ctx;
4280
4281 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4282 mem_base = xmlMemBlocks();
4283 ctx = gen_void_ptr(n_ctx, 0);
4284
4285 ret_val = xmlSAX2GetPublicId(ctx);
4286 desret_const_xmlChar_ptr(ret_val);
4287 call_tests++;
4288 des_void_ptr(n_ctx, ctx, 0);
4289 xmlResetLastError();
4290 if (mem_base != xmlMemBlocks()) {
4291 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4292 xmlMemBlocks() - mem_base);
4293 test_ret++;
4294 printf(" %d", n_ctx);
4295 printf("\n");
4296 }
4297 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004299
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004300 return(test_ret);
4301}
4302
4303
4304static int
4305test_xmlSAX2GetSystemId(void) {
4306 int test_ret = 0;
4307
4308 int mem_base;
4309 const xmlChar * ret_val;
4310 void * ctx; /* the user data (XML parser context) */
4311 int n_ctx;
4312
4313 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4314 mem_base = xmlMemBlocks();
4315 ctx = gen_void_ptr(n_ctx, 0);
4316
4317 ret_val = xmlSAX2GetSystemId(ctx);
4318 desret_const_xmlChar_ptr(ret_val);
4319 call_tests++;
4320 des_void_ptr(n_ctx, ctx, 0);
4321 xmlResetLastError();
4322 if (mem_base != xmlMemBlocks()) {
4323 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4324 xmlMemBlocks() - mem_base);
4325 test_ret++;
4326 printf(" %d", n_ctx);
4327 printf("\n");
4328 }
4329 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004330 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004331
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004332 return(test_ret);
4333}
4334
4335
4336static int
4337test_xmlSAX2HasExternalSubset(void) {
4338 int test_ret = 0;
4339
4340 int mem_base;
4341 int ret_val;
4342 void * ctx; /* the user data (XML parser context) */
4343 int n_ctx;
4344
4345 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4346 mem_base = xmlMemBlocks();
4347 ctx = gen_void_ptr(n_ctx, 0);
4348
4349 ret_val = xmlSAX2HasExternalSubset(ctx);
4350 desret_int(ret_val);
4351 call_tests++;
4352 des_void_ptr(n_ctx, ctx, 0);
4353 xmlResetLastError();
4354 if (mem_base != xmlMemBlocks()) {
4355 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4356 xmlMemBlocks() - mem_base);
4357 test_ret++;
4358 printf(" %d", n_ctx);
4359 printf("\n");
4360 }
4361 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004362 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004363
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004364 return(test_ret);
4365}
4366
4367
4368static int
4369test_xmlSAX2HasInternalSubset(void) {
4370 int test_ret = 0;
4371
4372 int mem_base;
4373 int ret_val;
4374 void * ctx; /* the user data (XML parser context) */
4375 int n_ctx;
4376
4377 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4378 mem_base = xmlMemBlocks();
4379 ctx = gen_void_ptr(n_ctx, 0);
4380
4381 ret_val = xmlSAX2HasInternalSubset(ctx);
4382 desret_int(ret_val);
4383 call_tests++;
4384 des_void_ptr(n_ctx, ctx, 0);
4385 xmlResetLastError();
4386 if (mem_base != xmlMemBlocks()) {
4387 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4388 xmlMemBlocks() - mem_base);
4389 test_ret++;
4390 printf(" %d", n_ctx);
4391 printf("\n");
4392 }
4393 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004395
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004396 return(test_ret);
4397}
4398
4399
4400static int
4401test_xmlSAX2IgnorableWhitespace(void) {
4402 int test_ret = 0;
4403
4404 int mem_base;
4405 void * ctx; /* the user data (XML parser context) */
4406 int n_ctx;
4407 xmlChar * ch; /* a xmlChar string */
4408 int n_ch;
4409 int len; /* the number of xmlChar */
4410 int n_len;
4411
4412 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4413 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4414 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4415 mem_base = xmlMemBlocks();
4416 ctx = gen_void_ptr(n_ctx, 0);
4417 ch = gen_const_xmlChar_ptr(n_ch, 1);
4418 len = gen_int(n_len, 2);
4419
William M. Brackf13f77f2004-11-12 16:03:48 +00004420 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004421 call_tests++;
4422 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004423 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004424 des_int(n_len, len, 2);
4425 xmlResetLastError();
4426 if (mem_base != xmlMemBlocks()) {
4427 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4428 xmlMemBlocks() - mem_base);
4429 test_ret++;
4430 printf(" %d", n_ctx);
4431 printf(" %d", n_ch);
4432 printf(" %d", n_len);
4433 printf("\n");
4434 }
4435 }
4436 }
4437 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004439
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004440 return(test_ret);
4441}
4442
4443
4444#define gen_nb_xmlSAXHandler_ptr 1
4445static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4446 return(NULL);
4447}
4448static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4449}
4450
4451static int
4452test_xmlSAX2InitDefaultSAXHandler(void) {
4453 int test_ret = 0;
4454
4455 int mem_base;
4456 xmlSAXHandler * hdlr; /* the SAX handler */
4457 int n_hdlr;
4458 int warning; /* flag if non-zero sets the handler warning procedure */
4459 int n_warning;
4460
4461 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4462 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4463 mem_base = xmlMemBlocks();
4464 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4465 warning = gen_int(n_warning, 1);
4466
4467 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4468 call_tests++;
4469 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4470 des_int(n_warning, warning, 1);
4471 xmlResetLastError();
4472 if (mem_base != xmlMemBlocks()) {
4473 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4474 xmlMemBlocks() - mem_base);
4475 test_ret++;
4476 printf(" %d", n_hdlr);
4477 printf(" %d", n_warning);
4478 printf("\n");
4479 }
4480 }
4481 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004482 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004483
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004484 return(test_ret);
4485}
4486
4487
4488static int
4489test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4490 int test_ret = 0;
4491
William M. Brack21e4ef22005-01-02 09:53:13 +00004492#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004493 int mem_base;
4494 xmlSAXHandler * hdlr; /* the SAX handler */
4495 int n_hdlr;
4496
4497 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4498 mem_base = xmlMemBlocks();
4499 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4500
4501 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4502 call_tests++;
4503 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4504 xmlResetLastError();
4505 if (mem_base != xmlMemBlocks()) {
4506 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4507 xmlMemBlocks() - mem_base);
4508 test_ret++;
4509 printf(" %d", n_hdlr);
4510 printf("\n");
4511 }
4512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004513 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004514#endif
4515
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004516 return(test_ret);
4517}
4518
4519
4520static int
4521test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4522 int test_ret = 0;
4523
William M. Brack21e4ef22005-01-02 09:53:13 +00004524#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004525 int mem_base;
4526 xmlSAXHandler * hdlr; /* the SAX handler */
4527 int n_hdlr;
4528
4529 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4530 mem_base = xmlMemBlocks();
4531 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4532
4533 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4534 call_tests++;
4535 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4536 xmlResetLastError();
4537 if (mem_base != xmlMemBlocks()) {
4538 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4539 xmlMemBlocks() - mem_base);
4540 test_ret++;
4541 printf(" %d", n_hdlr);
4542 printf("\n");
4543 }
4544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004545 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004546#endif
4547
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004548 return(test_ret);
4549}
4550
4551
4552static int
4553test_xmlSAX2InternalSubset(void) {
4554 int test_ret = 0;
4555
4556 int mem_base;
4557 void * ctx; /* the user data (XML parser context) */
4558 int n_ctx;
4559 xmlChar * name; /* the root element name */
4560 int n_name;
4561 xmlChar * ExternalID; /* the external ID */
4562 int n_ExternalID;
4563 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4564 int n_SystemID;
4565
4566 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4567 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4568 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4569 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4570 mem_base = xmlMemBlocks();
4571 ctx = gen_void_ptr(n_ctx, 0);
4572 name = gen_const_xmlChar_ptr(n_name, 1);
4573 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4574 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4575
William M. Brackf13f77f2004-11-12 16:03:48 +00004576 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004577 call_tests++;
4578 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004579 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4580 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4581 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004582 xmlResetLastError();
4583 if (mem_base != xmlMemBlocks()) {
4584 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4585 xmlMemBlocks() - mem_base);
4586 test_ret++;
4587 printf(" %d", n_ctx);
4588 printf(" %d", n_name);
4589 printf(" %d", n_ExternalID);
4590 printf(" %d", n_SystemID);
4591 printf("\n");
4592 }
4593 }
4594 }
4595 }
4596 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004597 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004598
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004599 return(test_ret);
4600}
4601
4602
4603static int
4604test_xmlSAX2IsStandalone(void) {
4605 int test_ret = 0;
4606
4607 int mem_base;
4608 int ret_val;
4609 void * ctx; /* the user data (XML parser context) */
4610 int n_ctx;
4611
4612 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4613 mem_base = xmlMemBlocks();
4614 ctx = gen_void_ptr(n_ctx, 0);
4615
4616 ret_val = xmlSAX2IsStandalone(ctx);
4617 desret_int(ret_val);
4618 call_tests++;
4619 des_void_ptr(n_ctx, ctx, 0);
4620 xmlResetLastError();
4621 if (mem_base != xmlMemBlocks()) {
4622 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4623 xmlMemBlocks() - mem_base);
4624 test_ret++;
4625 printf(" %d", n_ctx);
4626 printf("\n");
4627 }
4628 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004629 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004630
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004631 return(test_ret);
4632}
4633
4634
4635static int
4636test_xmlSAX2NotationDecl(void) {
4637 int test_ret = 0;
4638
4639 int mem_base;
4640 void * ctx; /* the user data (XML parser context) */
4641 int n_ctx;
4642 xmlChar * name; /* The name of the notation */
4643 int n_name;
4644 xmlChar * publicId; /* The public ID of the entity */
4645 int n_publicId;
4646 xmlChar * systemId; /* The system ID of the entity */
4647 int n_systemId;
4648
4649 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4650 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4651 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4652 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4653 mem_base = xmlMemBlocks();
4654 ctx = gen_void_ptr(n_ctx, 0);
4655 name = gen_const_xmlChar_ptr(n_name, 1);
4656 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4657 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4658
William M. Brackf13f77f2004-11-12 16:03:48 +00004659 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004660 call_tests++;
4661 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004662 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4663 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4664 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004665 xmlResetLastError();
4666 if (mem_base != xmlMemBlocks()) {
4667 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4668 xmlMemBlocks() - mem_base);
4669 test_ret++;
4670 printf(" %d", n_ctx);
4671 printf(" %d", n_name);
4672 printf(" %d", n_publicId);
4673 printf(" %d", n_systemId);
4674 printf("\n");
4675 }
4676 }
4677 }
4678 }
4679 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004680 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004681
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004682 return(test_ret);
4683}
4684
4685
4686static int
4687test_xmlSAX2ProcessingInstruction(void) {
4688 int test_ret = 0;
4689
4690 int mem_base;
4691 void * ctx; /* the user data (XML parser context) */
4692 int n_ctx;
4693 xmlChar * target; /* the target name */
4694 int n_target;
4695 xmlChar * data; /* the PI data's */
4696 int n_data;
4697
4698 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4699 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4700 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4701 mem_base = xmlMemBlocks();
4702 ctx = gen_void_ptr(n_ctx, 0);
4703 target = gen_const_xmlChar_ptr(n_target, 1);
4704 data = gen_const_xmlChar_ptr(n_data, 2);
4705
William M. Brackf13f77f2004-11-12 16:03:48 +00004706 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004707 call_tests++;
4708 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004709 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4710 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004711 xmlResetLastError();
4712 if (mem_base != xmlMemBlocks()) {
4713 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4714 xmlMemBlocks() - mem_base);
4715 test_ret++;
4716 printf(" %d", n_ctx);
4717 printf(" %d", n_target);
4718 printf(" %d", n_data);
4719 printf("\n");
4720 }
4721 }
4722 }
4723 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004725
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004726 return(test_ret);
4727}
4728
4729
4730static int
4731test_xmlSAX2Reference(void) {
4732 int test_ret = 0;
4733
4734 int mem_base;
4735 void * ctx; /* the user data (XML parser context) */
4736 int n_ctx;
4737 xmlChar * name; /* The entity name */
4738 int n_name;
4739
4740 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4741 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4742 mem_base = xmlMemBlocks();
4743 ctx = gen_void_ptr(n_ctx, 0);
4744 name = gen_const_xmlChar_ptr(n_name, 1);
4745
William M. Brackf13f77f2004-11-12 16:03:48 +00004746 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004747 call_tests++;
4748 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004749 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004750 xmlResetLastError();
4751 if (mem_base != xmlMemBlocks()) {
4752 printf("Leak of %d blocks found in xmlSAX2Reference",
4753 xmlMemBlocks() - mem_base);
4754 test_ret++;
4755 printf(" %d", n_ctx);
4756 printf(" %d", n_name);
4757 printf("\n");
4758 }
4759 }
4760 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004761 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004762
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004763 return(test_ret);
4764}
4765
4766
4767static int
4768test_xmlSAX2ResolveEntity(void) {
4769 int test_ret = 0;
4770
4771 int mem_base;
4772 xmlParserInputPtr ret_val;
4773 void * ctx; /* the user data (XML parser context) */
4774 int n_ctx;
4775 xmlChar * publicId; /* The public ID of the entity */
4776 int n_publicId;
4777 xmlChar * systemId; /* The system ID of the entity */
4778 int n_systemId;
4779
4780 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4781 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4782 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4783 mem_base = xmlMemBlocks();
4784 ctx = gen_void_ptr(n_ctx, 0);
4785 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4786 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4787
William M. Brackf13f77f2004-11-12 16:03:48 +00004788 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004789 desret_xmlParserInputPtr(ret_val);
4790 call_tests++;
4791 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004792 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4793 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004794 xmlResetLastError();
4795 if (mem_base != xmlMemBlocks()) {
4796 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4797 xmlMemBlocks() - mem_base);
4798 test_ret++;
4799 printf(" %d", n_ctx);
4800 printf(" %d", n_publicId);
4801 printf(" %d", n_systemId);
4802 printf("\n");
4803 }
4804 }
4805 }
4806 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004807 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004808
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004809 return(test_ret);
4810}
4811
4812
4813#define gen_nb_xmlSAXLocatorPtr 1
4814static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4815 return(NULL);
4816}
4817static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4818}
4819
4820static int
4821test_xmlSAX2SetDocumentLocator(void) {
4822 int test_ret = 0;
4823
4824 int mem_base;
4825 void * ctx; /* the user data (XML parser context) */
4826 int n_ctx;
4827 xmlSAXLocatorPtr loc; /* A SAX Locator */
4828 int n_loc;
4829
4830 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4831 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4832 mem_base = xmlMemBlocks();
4833 ctx = gen_void_ptr(n_ctx, 0);
4834 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4835
4836 xmlSAX2SetDocumentLocator(ctx, loc);
4837 call_tests++;
4838 des_void_ptr(n_ctx, ctx, 0);
4839 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4840 xmlResetLastError();
4841 if (mem_base != xmlMemBlocks()) {
4842 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4843 xmlMemBlocks() - mem_base);
4844 test_ret++;
4845 printf(" %d", n_ctx);
4846 printf(" %d", n_loc);
4847 printf("\n");
4848 }
4849 }
4850 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004851 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004852
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004853 return(test_ret);
4854}
4855
4856
4857static int
4858test_xmlSAX2StartDocument(void) {
4859 int test_ret = 0;
4860
4861 int mem_base;
4862 void * ctx; /* the user data (XML parser context) */
4863 int n_ctx;
4864
4865 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4866 mem_base = xmlMemBlocks();
4867 ctx = gen_void_ptr(n_ctx, 0);
4868
4869 xmlSAX2StartDocument(ctx);
4870 call_tests++;
4871 des_void_ptr(n_ctx, ctx, 0);
4872 xmlResetLastError();
4873 if (mem_base != xmlMemBlocks()) {
4874 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4875 xmlMemBlocks() - mem_base);
4876 test_ret++;
4877 printf(" %d", n_ctx);
4878 printf("\n");
4879 }
4880 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004881 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004882
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004883 return(test_ret);
4884}
4885
4886
4887static int
4888test_xmlSAX2StartElement(void) {
4889 int test_ret = 0;
4890
William M. Brack21e4ef22005-01-02 09:53:13 +00004891#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004892#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004893 int mem_base;
4894 void * ctx; /* the user data (XML parser context) */
4895 int n_ctx;
4896 xmlChar * fullname; /* The element name, including namespace prefix */
4897 int n_fullname;
4898 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4899 int n_atts;
4900
4901 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4902 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4903 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4904 mem_base = xmlMemBlocks();
4905 ctx = gen_void_ptr(n_ctx, 0);
4906 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4907 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4908
William M. Brackf13f77f2004-11-12 16:03:48 +00004909 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004910 call_tests++;
4911 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004912 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4913 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004914 xmlResetLastError();
4915 if (mem_base != xmlMemBlocks()) {
4916 printf("Leak of %d blocks found in xmlSAX2StartElement",
4917 xmlMemBlocks() - mem_base);
4918 test_ret++;
4919 printf(" %d", n_ctx);
4920 printf(" %d", n_fullname);
4921 printf(" %d", n_atts);
4922 printf("\n");
4923 }
4924 }
4925 }
4926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004927 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004928#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004929#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004930
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004931 return(test_ret);
4932}
4933
4934
4935static int
4936test_xmlSAX2StartElementNs(void) {
4937 int test_ret = 0;
4938
4939 int mem_base;
4940 void * ctx; /* the user data (XML parser context) */
4941 int n_ctx;
4942 xmlChar * localname; /* the local name of the element */
4943 int n_localname;
4944 xmlChar * prefix; /* the element namespace prefix if available */
4945 int n_prefix;
4946 xmlChar * URI; /* the element namespace name if available */
4947 int n_URI;
4948 int nb_namespaces; /* number of namespace definitions on that node */
4949 int n_nb_namespaces;
4950 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4951 int n_namespaces;
4952 int nb_attributes; /* the number of attributes on that node */
4953 int n_nb_attributes;
4954 int nb_defaulted; /* the number of defaulted attributes. */
4955 int n_nb_defaulted;
4956 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4957 int n_attributes;
4958
4959 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4960 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4961 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4962 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4963 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4964 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4965 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4966 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4967 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4968 mem_base = xmlMemBlocks();
4969 ctx = gen_void_ptr(n_ctx, 0);
4970 localname = gen_const_xmlChar_ptr(n_localname, 1);
4971 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4972 URI = gen_const_xmlChar_ptr(n_URI, 3);
4973 nb_namespaces = gen_int(n_nb_namespaces, 4);
4974 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4975 nb_attributes = gen_int(n_nb_attributes, 6);
4976 nb_defaulted = gen_int(n_nb_defaulted, 7);
4977 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4978
William M. Brackf13f77f2004-11-12 16:03:48 +00004979 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 +00004980 call_tests++;
4981 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004982 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4983 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4984 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004985 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004986 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004987 des_int(n_nb_attributes, nb_attributes, 6);
4988 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004989 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004990 xmlResetLastError();
4991 if (mem_base != xmlMemBlocks()) {
4992 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4993 xmlMemBlocks() - mem_base);
4994 test_ret++;
4995 printf(" %d", n_ctx);
4996 printf(" %d", n_localname);
4997 printf(" %d", n_prefix);
4998 printf(" %d", n_URI);
4999 printf(" %d", n_nb_namespaces);
5000 printf(" %d", n_namespaces);
5001 printf(" %d", n_nb_attributes);
5002 printf(" %d", n_nb_defaulted);
5003 printf(" %d", n_attributes);
5004 printf("\n");
5005 }
5006 }
5007 }
5008 }
5009 }
5010 }
5011 }
5012 }
5013 }
5014 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005015 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005016
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005017 return(test_ret);
5018}
5019
5020
5021static int
5022test_xmlSAX2UnparsedEntityDecl(void) {
5023 int test_ret = 0;
5024
5025 int mem_base;
5026 void * ctx; /* the user data (XML parser context) */
5027 int n_ctx;
5028 xmlChar * name; /* The name of the entity */
5029 int n_name;
5030 xmlChar * publicId; /* The public ID of the entity */
5031 int n_publicId;
5032 xmlChar * systemId; /* The system ID of the entity */
5033 int n_systemId;
5034 xmlChar * notationName; /* the name of the notation */
5035 int n_notationName;
5036
5037 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5038 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5039 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5040 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5041 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5042 mem_base = xmlMemBlocks();
5043 ctx = gen_void_ptr(n_ctx, 0);
5044 name = gen_const_xmlChar_ptr(n_name, 1);
5045 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5046 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5047 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5048
William M. Brackf13f77f2004-11-12 16:03:48 +00005049 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005050 call_tests++;
5051 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005052 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5053 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5054 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5055 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005056 xmlResetLastError();
5057 if (mem_base != xmlMemBlocks()) {
5058 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5059 xmlMemBlocks() - mem_base);
5060 test_ret++;
5061 printf(" %d", n_ctx);
5062 printf(" %d", n_name);
5063 printf(" %d", n_publicId);
5064 printf(" %d", n_systemId);
5065 printf(" %d", n_notationName);
5066 printf("\n");
5067 }
5068 }
5069 }
5070 }
5071 }
5072 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005074
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005075 return(test_ret);
5076}
5077
5078
5079static int
5080test_xmlSAXDefaultVersion(void) {
5081 int test_ret = 0;
5082
William M. Brack21e4ef22005-01-02 09:53:13 +00005083#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005084#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005085 int mem_base;
5086 int ret_val;
5087 int version; /* the version, 1 or 2 */
5088 int n_version;
5089
5090 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5091 mem_base = xmlMemBlocks();
5092 version = gen_int(n_version, 0);
5093
5094 ret_val = xmlSAXDefaultVersion(version);
5095 desret_int(ret_val);
5096 call_tests++;
5097 des_int(n_version, version, 0);
5098 xmlResetLastError();
5099 if (mem_base != xmlMemBlocks()) {
5100 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5101 xmlMemBlocks() - mem_base);
5102 test_ret++;
5103 printf(" %d", n_version);
5104 printf("\n");
5105 }
5106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005107 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005108#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005109#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005110
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005111 return(test_ret);
5112}
5113
5114
5115static int
5116test_xmlSAXVersion(void) {
5117 int test_ret = 0;
5118
5119 int mem_base;
5120 int ret_val;
5121 xmlSAXHandler * hdlr; /* the SAX handler */
5122 int n_hdlr;
5123 int version; /* the version, 1 or 2 */
5124 int n_version;
5125
5126 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5127 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5128 mem_base = xmlMemBlocks();
5129 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5130 version = gen_int(n_version, 1);
5131
5132 ret_val = xmlSAXVersion(hdlr, version);
5133 desret_int(ret_val);
5134 call_tests++;
5135 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5136 des_int(n_version, version, 1);
5137 xmlResetLastError();
5138 if (mem_base != xmlMemBlocks()) {
5139 printf("Leak of %d blocks found in xmlSAXVersion",
5140 xmlMemBlocks() - mem_base);
5141 test_ret++;
5142 printf(" %d", n_hdlr);
5143 printf(" %d", n_version);
5144 printf("\n");
5145 }
5146 }
5147 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005149
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005150 return(test_ret);
5151}
5152
5153static int
5154test_SAX2(void) {
5155 int test_ret = 0;
5156
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005157 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005158 test_ret += test_docbDefaultSAXHandlerInit();
5159 test_ret += test_htmlDefaultSAXHandlerInit();
5160 test_ret += test_xmlDefaultSAXHandlerInit();
5161 test_ret += test_xmlSAX2AttributeDecl();
5162 test_ret += test_xmlSAX2CDataBlock();
5163 test_ret += test_xmlSAX2Characters();
5164 test_ret += test_xmlSAX2Comment();
5165 test_ret += test_xmlSAX2ElementDecl();
5166 test_ret += test_xmlSAX2EndDocument();
5167 test_ret += test_xmlSAX2EndElement();
5168 test_ret += test_xmlSAX2EndElementNs();
5169 test_ret += test_xmlSAX2EntityDecl();
5170 test_ret += test_xmlSAX2ExternalSubset();
5171 test_ret += test_xmlSAX2GetColumnNumber();
5172 test_ret += test_xmlSAX2GetEntity();
5173 test_ret += test_xmlSAX2GetLineNumber();
5174 test_ret += test_xmlSAX2GetParameterEntity();
5175 test_ret += test_xmlSAX2GetPublicId();
5176 test_ret += test_xmlSAX2GetSystemId();
5177 test_ret += test_xmlSAX2HasExternalSubset();
5178 test_ret += test_xmlSAX2HasInternalSubset();
5179 test_ret += test_xmlSAX2IgnorableWhitespace();
5180 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5181 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5182 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5183 test_ret += test_xmlSAX2InternalSubset();
5184 test_ret += test_xmlSAX2IsStandalone();
5185 test_ret += test_xmlSAX2NotationDecl();
5186 test_ret += test_xmlSAX2ProcessingInstruction();
5187 test_ret += test_xmlSAX2Reference();
5188 test_ret += test_xmlSAX2ResolveEntity();
5189 test_ret += test_xmlSAX2SetDocumentLocator();
5190 test_ret += test_xmlSAX2StartDocument();
5191 test_ret += test_xmlSAX2StartElement();
5192 test_ret += test_xmlSAX2StartElementNs();
5193 test_ret += test_xmlSAX2UnparsedEntityDecl();
5194 test_ret += test_xmlSAXDefaultVersion();
5195 test_ret += test_xmlSAXVersion();
5196
5197 if (test_ret != 0)
5198 printf("Module SAX2: %d errors\n", test_ret);
5199 return(test_ret);
5200}
5201
Daniel Veillarda82b1822004-11-08 16:24:57 +00005202static int
5203test_xmlC14NDocDumpMemory(void) {
5204 int test_ret = 0;
5205
William M. Brack21e4ef22005-01-02 09:53:13 +00005206#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005207 int mem_base;
5208 int ret_val;
5209 xmlDocPtr doc; /* the XML document for canonization */
5210 int n_doc;
5211 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5212 int n_nodes;
5213 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5214 int n_exclusive;
5215 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) */
5216 int n_inclusive_ns_prefixes;
5217 int with_comments; /* include comments in the result (!=0) or not (==0) */
5218 int n_with_comments;
5219 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 */
5220 int n_doc_txt_ptr;
5221
5222 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5223 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5224 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5225 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5226 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5227 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5228 mem_base = xmlMemBlocks();
5229 doc = gen_xmlDocPtr(n_doc, 0);
5230 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5231 exclusive = gen_int(n_exclusive, 2);
5232 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5233 with_comments = gen_int(n_with_comments, 4);
5234 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5235
5236 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5237 desret_int(ret_val);
5238 call_tests++;
5239 des_xmlDocPtr(n_doc, doc, 0);
5240 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5241 des_int(n_exclusive, exclusive, 2);
5242 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5243 des_int(n_with_comments, with_comments, 4);
5244 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5245 xmlResetLastError();
5246 if (mem_base != xmlMemBlocks()) {
5247 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5248 xmlMemBlocks() - mem_base);
5249 test_ret++;
5250 printf(" %d", n_doc);
5251 printf(" %d", n_nodes);
5252 printf(" %d", n_exclusive);
5253 printf(" %d", n_inclusive_ns_prefixes);
5254 printf(" %d", n_with_comments);
5255 printf(" %d", n_doc_txt_ptr);
5256 printf("\n");
5257 }
5258 }
5259 }
5260 }
5261 }
5262 }
5263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005264 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005265#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005266
Daniel Veillarda82b1822004-11-08 16:24:57 +00005267 return(test_ret);
5268}
5269
5270
5271static int
5272test_xmlC14NDocSave(void) {
5273 int test_ret = 0;
5274
William M. Brack21e4ef22005-01-02 09:53:13 +00005275#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005276 int mem_base;
5277 int ret_val;
5278 xmlDocPtr doc; /* the XML document for canonization */
5279 int n_doc;
5280 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5281 int n_nodes;
5282 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5283 int n_exclusive;
5284 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) */
5285 int n_inclusive_ns_prefixes;
5286 int with_comments; /* include comments in the result (!=0) or not (==0) */
5287 int n_with_comments;
5288 const char * filename; /* the filename to store canonical XML image */
5289 int n_filename;
5290 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5291 int n_compression;
5292
5293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5294 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5295 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5296 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5297 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5298 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5299 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5300 mem_base = xmlMemBlocks();
5301 doc = gen_xmlDocPtr(n_doc, 0);
5302 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5303 exclusive = gen_int(n_exclusive, 2);
5304 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5305 with_comments = gen_int(n_with_comments, 4);
5306 filename = gen_fileoutput(n_filename, 5);
5307 compression = gen_int(n_compression, 6);
5308
5309 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5310 desret_int(ret_val);
5311 call_tests++;
5312 des_xmlDocPtr(n_doc, doc, 0);
5313 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5314 des_int(n_exclusive, exclusive, 2);
5315 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5316 des_int(n_with_comments, with_comments, 4);
5317 des_fileoutput(n_filename, filename, 5);
5318 des_int(n_compression, compression, 6);
5319 xmlResetLastError();
5320 if (mem_base != xmlMemBlocks()) {
5321 printf("Leak of %d blocks found in xmlC14NDocSave",
5322 xmlMemBlocks() - mem_base);
5323 test_ret++;
5324 printf(" %d", n_doc);
5325 printf(" %d", n_nodes);
5326 printf(" %d", n_exclusive);
5327 printf(" %d", n_inclusive_ns_prefixes);
5328 printf(" %d", n_with_comments);
5329 printf(" %d", n_filename);
5330 printf(" %d", n_compression);
5331 printf("\n");
5332 }
5333 }
5334 }
5335 }
5336 }
5337 }
5338 }
5339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005340 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005341#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005342
Daniel Veillarda82b1822004-11-08 16:24:57 +00005343 return(test_ret);
5344}
5345
5346
5347static int
5348test_xmlC14NDocSaveTo(void) {
5349 int test_ret = 0;
5350
William M. Brack21e4ef22005-01-02 09:53:13 +00005351#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005352 int mem_base;
5353 int ret_val;
5354 xmlDocPtr doc; /* the XML document for canonization */
5355 int n_doc;
5356 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5357 int n_nodes;
5358 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5359 int n_exclusive;
5360 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) */
5361 int n_inclusive_ns_prefixes;
5362 int with_comments; /* include comments in the result (!=0) or not (==0) */
5363 int n_with_comments;
5364 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5365 int n_buf;
5366
5367 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5368 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5369 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5370 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5371 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5372 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5373 mem_base = xmlMemBlocks();
5374 doc = gen_xmlDocPtr(n_doc, 0);
5375 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5376 exclusive = gen_int(n_exclusive, 2);
5377 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5378 with_comments = gen_int(n_with_comments, 4);
5379 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5380
5381 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5382 desret_int(ret_val);
5383 call_tests++;
5384 des_xmlDocPtr(n_doc, doc, 0);
5385 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5386 des_int(n_exclusive, exclusive, 2);
5387 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5388 des_int(n_with_comments, with_comments, 4);
5389 des_xmlOutputBufferPtr(n_buf, buf, 5);
5390 xmlResetLastError();
5391 if (mem_base != xmlMemBlocks()) {
5392 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5393 xmlMemBlocks() - mem_base);
5394 test_ret++;
5395 printf(" %d", n_doc);
5396 printf(" %d", n_nodes);
5397 printf(" %d", n_exclusive);
5398 printf(" %d", n_inclusive_ns_prefixes);
5399 printf(" %d", n_with_comments);
5400 printf(" %d", n_buf);
5401 printf("\n");
5402 }
5403 }
5404 }
5405 }
5406 }
5407 }
5408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005409 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005410#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005411
Daniel Veillarda82b1822004-11-08 16:24:57 +00005412 return(test_ret);
5413}
5414
5415
5416static int
5417test_xmlC14NExecute(void) {
5418 int test_ret = 0;
5419
5420
5421 /* missing type support */
5422 return(test_ret);
5423}
5424
5425static int
5426test_c14n(void) {
5427 int test_ret = 0;
5428
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005429 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005430 test_ret += test_xmlC14NDocDumpMemory();
5431 test_ret += test_xmlC14NDocSave();
5432 test_ret += test_xmlC14NDocSaveTo();
5433 test_ret += test_xmlC14NExecute();
5434
5435 if (test_ret != 0)
5436 printf("Module c14n: %d errors\n", test_ret);
5437 return(test_ret);
5438}
Daniel Veillarda521d282004-11-09 14:59:59 +00005439#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005440
Daniel Veillardce682bc2004-11-05 17:22:25 +00005441#define gen_nb_xmlCatalogPtr 1
5442static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5443 return(NULL);
5444}
5445static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5446}
Daniel Veillarda521d282004-11-09 14:59:59 +00005447#endif
5448
Daniel Veillardce682bc2004-11-05 17:22:25 +00005449
Daniel Veillardd93f6252004-11-02 15:53:51 +00005450static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005451test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005453
William M. Brack21e4ef22005-01-02 09:53:13 +00005454#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005455 int mem_base;
5456 int ret_val;
5457 xmlCatalogPtr catal; /* a Catalog */
5458 int n_catal;
5459 xmlChar * type; /* the type of record to add to the catalog */
5460 int n_type;
5461 xmlChar * orig; /* the system, public or prefix to match */
5462 int n_orig;
5463 xmlChar * replace; /* the replacement value for the match */
5464 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005465
Daniel Veillardce682bc2004-11-05 17:22:25 +00005466 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5467 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5468 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5469 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5470 mem_base = xmlMemBlocks();
5471 catal = gen_xmlCatalogPtr(n_catal, 0);
5472 type = gen_const_xmlChar_ptr(n_type, 1);
5473 orig = gen_const_xmlChar_ptr(n_orig, 2);
5474 replace = gen_const_xmlChar_ptr(n_replace, 3);
5475
William M. Brackf13f77f2004-11-12 16:03:48 +00005476 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005477 desret_int(ret_val);
5478 call_tests++;
5479 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005480 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5481 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5482 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005483 xmlResetLastError();
5484 if (mem_base != xmlMemBlocks()) {
5485 printf("Leak of %d blocks found in xmlACatalogAdd",
5486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005487 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005488 printf(" %d", n_catal);
5489 printf(" %d", n_type);
5490 printf(" %d", n_orig);
5491 printf(" %d", n_replace);
5492 printf("\n");
5493 }
5494 }
5495 }
5496 }
5497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005498 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005499#endif
5500
Daniel Veillard42595322004-11-08 10:52:06 +00005501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005502}
5503
5504
5505static int
5506test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005508
William M. Brack21e4ef22005-01-02 09:53:13 +00005509#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005510 int mem_base;
5511 xmlCatalogPtr catal; /* a Catalog */
5512 int n_catal;
5513 FILE * out; /* the file. */
5514 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005515
Daniel Veillardce682bc2004-11-05 17:22:25 +00005516 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5517 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5518 mem_base = xmlMemBlocks();
5519 catal = gen_xmlCatalogPtr(n_catal, 0);
5520 out = gen_FILE_ptr(n_out, 1);
5521
5522 xmlACatalogDump(catal, out);
5523 call_tests++;
5524 des_xmlCatalogPtr(n_catal, catal, 0);
5525 des_FILE_ptr(n_out, out, 1);
5526 xmlResetLastError();
5527 if (mem_base != xmlMemBlocks()) {
5528 printf("Leak of %d blocks found in xmlACatalogDump",
5529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005530 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005531 printf(" %d", n_catal);
5532 printf(" %d", n_out);
5533 printf("\n");
5534 }
5535 }
5536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005537 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005538#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005539
Daniel Veillard42595322004-11-08 10:52:06 +00005540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005541}
5542
5543
5544static int
5545test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005547
William M. Brack21e4ef22005-01-02 09:53:13 +00005548#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005549 int mem_base;
5550 int ret_val;
5551 xmlCatalogPtr catal; /* a Catalog */
5552 int n_catal;
5553 xmlChar * value; /* the value to remove */
5554 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005555
Daniel Veillardce682bc2004-11-05 17:22:25 +00005556 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5557 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5558 mem_base = xmlMemBlocks();
5559 catal = gen_xmlCatalogPtr(n_catal, 0);
5560 value = gen_const_xmlChar_ptr(n_value, 1);
5561
William M. Brackf13f77f2004-11-12 16:03:48 +00005562 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005563 desret_int(ret_val);
5564 call_tests++;
5565 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005566 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005567 xmlResetLastError();
5568 if (mem_base != xmlMemBlocks()) {
5569 printf("Leak of %d blocks found in xmlACatalogRemove",
5570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005571 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005572 printf(" %d", n_catal);
5573 printf(" %d", n_value);
5574 printf("\n");
5575 }
5576 }
5577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005578 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005579#endif
5580
Daniel Veillard42595322004-11-08 10:52:06 +00005581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005582}
5583
5584
5585static int
5586test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005588
William M. Brack21e4ef22005-01-02 09:53:13 +00005589#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005590 int mem_base;
5591 xmlChar * ret_val;
5592 xmlCatalogPtr catal; /* a Catalog */
5593 int n_catal;
5594 xmlChar * pubID; /* the public ID string */
5595 int n_pubID;
5596 xmlChar * sysID; /* the system ID string */
5597 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005598
Daniel Veillardce682bc2004-11-05 17:22:25 +00005599 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5600 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5601 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5602 mem_base = xmlMemBlocks();
5603 catal = gen_xmlCatalogPtr(n_catal, 0);
5604 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5605 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5606
William M. Brackf13f77f2004-11-12 16:03:48 +00005607 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005608 desret_xmlChar_ptr(ret_val);
5609 call_tests++;
5610 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005611 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5612 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005613 xmlResetLastError();
5614 if (mem_base != xmlMemBlocks()) {
5615 printf("Leak of %d blocks found in xmlACatalogResolve",
5616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005617 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005618 printf(" %d", n_catal);
5619 printf(" %d", n_pubID);
5620 printf(" %d", n_sysID);
5621 printf("\n");
5622 }
5623 }
5624 }
5625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005626 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005627#endif
5628
Daniel Veillard42595322004-11-08 10:52:06 +00005629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005630}
5631
5632
5633static int
5634test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005636
William M. Brack21e4ef22005-01-02 09:53:13 +00005637#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005638 int mem_base;
5639 xmlChar * ret_val;
5640 xmlCatalogPtr catal; /* a Catalog */
5641 int n_catal;
5642 xmlChar * pubID; /* the public ID string */
5643 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005644
Daniel Veillardce682bc2004-11-05 17:22:25 +00005645 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5646 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5647 mem_base = xmlMemBlocks();
5648 catal = gen_xmlCatalogPtr(n_catal, 0);
5649 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5650
William M. Brackf13f77f2004-11-12 16:03:48 +00005651 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005652 desret_xmlChar_ptr(ret_val);
5653 call_tests++;
5654 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005655 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005656 xmlResetLastError();
5657 if (mem_base != xmlMemBlocks()) {
5658 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005660 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005661 printf(" %d", n_catal);
5662 printf(" %d", n_pubID);
5663 printf("\n");
5664 }
5665 }
5666 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005667 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005668#endif
5669
Daniel Veillard42595322004-11-08 10:52:06 +00005670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005671}
5672
5673
5674static int
5675test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005677
William M. Brack21e4ef22005-01-02 09:53:13 +00005678#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005679 int mem_base;
5680 xmlChar * ret_val;
5681 xmlCatalogPtr catal; /* a Catalog */
5682 int n_catal;
5683 xmlChar * sysID; /* the system ID string */
5684 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005685
Daniel Veillardce682bc2004-11-05 17:22:25 +00005686 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5687 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5688 mem_base = xmlMemBlocks();
5689 catal = gen_xmlCatalogPtr(n_catal, 0);
5690 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5691
William M. Brackf13f77f2004-11-12 16:03:48 +00005692 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005693 desret_xmlChar_ptr(ret_val);
5694 call_tests++;
5695 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005696 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005697 xmlResetLastError();
5698 if (mem_base != xmlMemBlocks()) {
5699 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005701 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005702 printf(" %d", n_catal);
5703 printf(" %d", n_sysID);
5704 printf("\n");
5705 }
5706 }
5707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005708 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005709#endif
5710
Daniel Veillard42595322004-11-08 10:52:06 +00005711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005712}
5713
5714
5715static int
5716test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005718
William M. Brack21e4ef22005-01-02 09:53:13 +00005719#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005720 int mem_base;
5721 xmlChar * ret_val;
5722 xmlCatalogPtr catal; /* a Catalog */
5723 int n_catal;
5724 xmlChar * URI; /* the URI */
5725 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005726
Daniel Veillardce682bc2004-11-05 17:22:25 +00005727 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5728 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5729 mem_base = xmlMemBlocks();
5730 catal = gen_xmlCatalogPtr(n_catal, 0);
5731 URI = gen_const_xmlChar_ptr(n_URI, 1);
5732
William M. Brackf13f77f2004-11-12 16:03:48 +00005733 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005734 desret_xmlChar_ptr(ret_val);
5735 call_tests++;
5736 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005737 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005738 xmlResetLastError();
5739 if (mem_base != xmlMemBlocks()) {
5740 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005742 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005743 printf(" %d", n_catal);
5744 printf(" %d", n_URI);
5745 printf("\n");
5746 }
5747 }
5748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005749 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005750#endif
5751
Daniel Veillard42595322004-11-08 10:52:06 +00005752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005753}
5754
5755
5756static int
5757test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759
William M. Brack21e4ef22005-01-02 09:53:13 +00005760#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005761 int mem_base;
5762 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005763 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005764 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005765 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005766 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005767 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005768 int n_replace;
5769
5770 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5771 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5772 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005774 type = gen_const_xmlChar_ptr(n_type, 0);
5775 orig = gen_const_xmlChar_ptr(n_orig, 1);
5776 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005777
William M. Brackf13f77f2004-11-12 16:03:48 +00005778 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005779 desret_int(ret_val);
5780 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005781 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5782 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5783 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005784 xmlResetLastError();
5785 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005786 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005788 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005789 printf(" %d", n_type);
5790 printf(" %d", n_orig);
5791 printf(" %d", n_replace);
5792 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005793 }
5794 }
5795 }
5796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005797 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005798#endif
5799
Daniel Veillard42595322004-11-08 10:52:06 +00005800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005801}
5802
5803
5804static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005805test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005807
William M. Brack21e4ef22005-01-02 09:53:13 +00005808#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005809
Daniel Veillardd93f6252004-11-02 15:53:51 +00005810
5811 xmlCatalogCleanup();
5812 call_tests++;
5813 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005814 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005815#endif
5816
Daniel Veillard42595322004-11-08 10:52:06 +00005817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005818}
5819
5820
5821static int
5822test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005824
William M. Brack21e4ef22005-01-02 09:53:13 +00005825#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005826 int ret_val;
5827
5828
5829 ret_val = xmlCatalogConvert();
5830 desret_int(ret_val);
5831 call_tests++;
5832 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005833 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005834#endif
5835
Daniel Veillard42595322004-11-08 10:52:06 +00005836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005837}
5838
5839
5840static int
5841test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005843
William M. Brack21e4ef22005-01-02 09:53:13 +00005844#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005845 int mem_base;
5846 FILE * out; /* the file. */
5847 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005848
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005849 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5850 mem_base = xmlMemBlocks();
5851 out = gen_FILE_ptr(n_out, 0);
5852
5853 xmlCatalogDump(out);
5854 call_tests++;
5855 des_FILE_ptr(n_out, out, 0);
5856 xmlResetLastError();
5857 if (mem_base != xmlMemBlocks()) {
5858 printf("Leak of %d blocks found in xmlCatalogDump",
5859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005860 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005861 printf(" %d", n_out);
5862 printf("\n");
5863 }
5864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005865 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005866#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005867
Daniel Veillard42595322004-11-08 10:52:06 +00005868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005869}
5870
5871
5872static int
5873test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005875
William M. Brack21e4ef22005-01-02 09:53:13 +00005876#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005877 int mem_base;
5878 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005879
Daniel Veillard57b25162004-11-06 14:50:18 +00005880 mem_base = xmlMemBlocks();
5881
5882 ret_val = xmlCatalogGetDefaults();
5883 desret_xmlCatalogAllow(ret_val);
5884 call_tests++;
5885 xmlResetLastError();
5886 if (mem_base != xmlMemBlocks()) {
5887 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005889 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005890 printf("\n");
5891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005892 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005893#endif
5894
Daniel Veillard42595322004-11-08 10:52:06 +00005895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005896}
5897
5898
5899static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005900test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005902
William M. Brack21e4ef22005-01-02 09:53:13 +00005903#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005904 int mem_base;
5905 int ret_val;
5906 xmlCatalogPtr catal; /* should this create an SGML catalog */
5907 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005908
Daniel Veillardce682bc2004-11-05 17:22:25 +00005909 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5910 mem_base = xmlMemBlocks();
5911 catal = gen_xmlCatalogPtr(n_catal, 0);
5912
5913 ret_val = xmlCatalogIsEmpty(catal);
5914 desret_int(ret_val);
5915 call_tests++;
5916 des_xmlCatalogPtr(n_catal, catal, 0);
5917 xmlResetLastError();
5918 if (mem_base != xmlMemBlocks()) {
5919 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005921 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005922 printf(" %d", n_catal);
5923 printf("\n");
5924 }
5925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005926 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005927#endif
5928
Daniel Veillard42595322004-11-08 10:52:06 +00005929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005930}
5931
5932
5933static int
5934test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005936
William M. Brack21e4ef22005-01-02 09:53:13 +00005937#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005938 int mem_base;
5939 xmlChar * ret_val;
5940 void * catalogs; /* a document's list of catalogs */
5941 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005942 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005943 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005944 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005945 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005946
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005947 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5948 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5949 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005951 catalogs = gen_void_ptr(n_catalogs, 0);
5952 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5953 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005954
William M. Brackf13f77f2004-11-12 16:03:48 +00005955 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005956 desret_xmlChar_ptr(ret_val);
5957 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005958 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005959 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5960 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005961 xmlResetLastError();
5962 if (mem_base != xmlMemBlocks()) {
5963 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005965 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005966 printf(" %d", n_catalogs);
5967 printf(" %d", n_pubID);
5968 printf(" %d", n_sysID);
5969 printf("\n");
5970 }
5971 }
5972 }
5973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005974 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005975#endif
5976
Daniel Veillard42595322004-11-08 10:52:06 +00005977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005978}
5979
5980
5981static int
5982test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005984
William M. Brack21e4ef22005-01-02 09:53:13 +00005985#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005986 int mem_base;
5987 xmlChar * ret_val;
5988 void * catalogs; /* a document's list of catalogs */
5989 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005990 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005991 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005992
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005993 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5994 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005996 catalogs = gen_void_ptr(n_catalogs, 0);
5997 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005998
William M. Brackf13f77f2004-11-12 16:03:48 +00005999 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006000 desret_xmlChar_ptr(ret_val);
6001 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006002 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006003 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006004 xmlResetLastError();
6005 if (mem_base != xmlMemBlocks()) {
6006 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006008 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006009 printf(" %d", n_catalogs);
6010 printf(" %d", n_URI);
6011 printf("\n");
6012 }
6013 }
6014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006015 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006016#endif
6017
Daniel Veillard42595322004-11-08 10:52:06 +00006018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006019}
6020
6021
6022static int
6023test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006025
William M. Brack21e4ef22005-01-02 09:53:13 +00006026#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006027 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006028 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006029 int n_value;
6030
6031 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006032 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006033
William M. Brackf13f77f2004-11-12 16:03:48 +00006034 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006035 desret_int(ret_val);
6036 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006037 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006038 xmlResetLastError();
6039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006040 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006041#endif
6042
Daniel Veillard42595322004-11-08 10:52:06 +00006043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006044}
6045
6046
6047static int
6048test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006050
William M. Brack21e4ef22005-01-02 09:53:13 +00006051#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006052 int mem_base;
6053 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006054 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006055 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006056 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006057 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006058
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006059 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6060 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6061 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006062 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6063 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006064
William M. Brackf13f77f2004-11-12 16:03:48 +00006065 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006066 desret_xmlChar_ptr(ret_val);
6067 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006068 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6069 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006070 xmlResetLastError();
6071 if (mem_base != xmlMemBlocks()) {
6072 printf("Leak of %d blocks found in xmlCatalogResolve",
6073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006074 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006075 printf(" %d", n_pubID);
6076 printf(" %d", n_sysID);
6077 printf("\n");
6078 }
6079 }
6080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006081 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006082#endif
6083
Daniel Veillard42595322004-11-08 10:52:06 +00006084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006085}
6086
6087
6088static int
6089test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006091
William M. Brack21e4ef22005-01-02 09:53:13 +00006092#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006093 int mem_base;
6094 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006095 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006096 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006097
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006098 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6099 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006100 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006101
William M. Brackf13f77f2004-11-12 16:03:48 +00006102 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006103 desret_xmlChar_ptr(ret_val);
6104 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006105 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006106 xmlResetLastError();
6107 if (mem_base != xmlMemBlocks()) {
6108 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006110 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006111 printf(" %d", n_pubID);
6112 printf("\n");
6113 }
6114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006115 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006116#endif
6117
Daniel Veillard42595322004-11-08 10:52:06 +00006118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006119}
6120
6121
6122static int
6123test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006125
William M. Brack21e4ef22005-01-02 09:53:13 +00006126#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006127 int mem_base;
6128 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006129 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006130 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006131
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006132 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6133 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006134 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006135
William M. Brackf13f77f2004-11-12 16:03:48 +00006136 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006137 desret_xmlChar_ptr(ret_val);
6138 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006139 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006140 xmlResetLastError();
6141 if (mem_base != xmlMemBlocks()) {
6142 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006144 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006145 printf(" %d", n_sysID);
6146 printf("\n");
6147 }
6148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006149 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006150#endif
6151
Daniel Veillard42595322004-11-08 10:52:06 +00006152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006153}
6154
6155
6156static int
6157test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006159
William M. Brack21e4ef22005-01-02 09:53:13 +00006160#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006161 int mem_base;
6162 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006163 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006164 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006165
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006166 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006168 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006169
William M. Brackf13f77f2004-11-12 16:03:48 +00006170 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006171 desret_xmlChar_ptr(ret_val);
6172 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006173 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006174 xmlResetLastError();
6175 if (mem_base != xmlMemBlocks()) {
6176 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006178 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006179 printf(" %d", n_URI);
6180 printf("\n");
6181 }
6182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006183 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006184#endif
6185
Daniel Veillard42595322004-11-08 10:52:06 +00006186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006187}
6188
6189
6190static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006191test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006193
William M. Brack21e4ef22005-01-02 09:53:13 +00006194#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006195 int mem_base;
6196 xmlCatalogPrefer ret_val;
6197 xmlCatalogPrefer prefer; /* the default preference for delegation */
6198 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006199
Daniel Veillard57b25162004-11-06 14:50:18 +00006200 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6201 mem_base = xmlMemBlocks();
6202 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6203
6204 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6205 desret_xmlCatalogPrefer(ret_val);
6206 call_tests++;
6207 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6208 xmlResetLastError();
6209 if (mem_base != xmlMemBlocks()) {
6210 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006212 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006213 printf(" %d", n_prefer);
6214 printf("\n");
6215 }
6216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006217 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006218#endif
6219
Daniel Veillard42595322004-11-08 10:52:06 +00006220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006221}
6222
6223
6224static int
6225test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006227
William M. Brack21e4ef22005-01-02 09:53:13 +00006228#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006229 int mem_base;
6230 xmlCatalogAllow allow; /* what catalogs should be accepted */
6231 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006232
Daniel Veillard57b25162004-11-06 14:50:18 +00006233 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6234 mem_base = xmlMemBlocks();
6235 allow = gen_xmlCatalogAllow(n_allow, 0);
6236
6237 xmlCatalogSetDefaults(allow);
6238 call_tests++;
6239 des_xmlCatalogAllow(n_allow, allow, 0);
6240 xmlResetLastError();
6241 if (mem_base != xmlMemBlocks()) {
6242 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006244 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006245 printf(" %d", n_allow);
6246 printf("\n");
6247 }
6248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006249 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006250#endif
6251
Daniel Veillard42595322004-11-08 10:52:06 +00006252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006253}
6254
6255
6256static int
6257test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006259
William M. Brack21e4ef22005-01-02 09:53:13 +00006260#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006261 int mem_base;
6262 int ret_val;
6263 xmlCatalogPtr catal; /* the catalog */
6264 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006265
Daniel Veillardce682bc2004-11-05 17:22:25 +00006266 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6267 mem_base = xmlMemBlocks();
6268 catal = gen_xmlCatalogPtr(n_catal, 0);
6269
6270 ret_val = xmlConvertSGMLCatalog(catal);
6271 desret_int(ret_val);
6272 call_tests++;
6273 des_xmlCatalogPtr(n_catal, catal, 0);
6274 xmlResetLastError();
6275 if (mem_base != xmlMemBlocks()) {
6276 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006278 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006279 printf(" %d", n_catal);
6280 printf("\n");
6281 }
6282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006283 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006284#endif
6285
Daniel Veillard42595322004-11-08 10:52:06 +00006286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006287}
6288
6289
6290static int
6291test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006293
William M. Brack21e4ef22005-01-02 09:53:13 +00006294#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006295 int mem_base;
6296
6297 mem_base = xmlMemBlocks();
6298
6299 xmlInitializeCatalog();
6300 call_tests++;
6301 xmlResetLastError();
6302 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006303 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006305 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006306 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006308 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006309#endif
6310
Daniel Veillard42595322004-11-08 10:52:06 +00006311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006312}
6313
6314
6315static int
6316test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006318
6319
6320 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006322}
6323
6324
6325static int
6326test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006328
William M. Brack21e4ef22005-01-02 09:53:13 +00006329#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006330 int ret_val;
6331 const char * filename; /* a file path */
6332 int n_filename;
6333
6334 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006335 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336
6337 ret_val = xmlLoadCatalog(filename);
6338 desret_int(ret_val);
6339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006340 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006341 xmlResetLastError();
6342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006343 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006344#endif
6345
Daniel Veillard42595322004-11-08 10:52:06 +00006346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006347}
6348
6349
6350static int
6351test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006353
William M. Brack21e4ef22005-01-02 09:53:13 +00006354#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006355 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006356 int n_pathss;
6357
6358 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006359 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006360
William M. Brackf13f77f2004-11-12 16:03:48 +00006361 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006362 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006363 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006364 xmlResetLastError();
6365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006366 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006367#endif
6368
Daniel Veillard42595322004-11-08 10:52:06 +00006369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006370}
6371
6372
6373static int
6374test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006376
6377
6378 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006380}
6381
6382
6383static int
6384test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006386
6387
6388 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006390}
6391
6392
6393static int
6394test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006396
William M. Brack21e4ef22005-01-02 09:53:13 +00006397#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006398 int mem_base;
6399 xmlDocPtr ret_val;
6400 const char * filename; /* the filename */
6401 int n_filename;
6402
6403 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006405 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006406
6407 ret_val = xmlParseCatalogFile(filename);
6408 desret_xmlDocPtr(ret_val);
6409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006410 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006411 xmlResetLastError();
6412 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006413 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006415 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006416 printf(" %d", n_filename);
6417 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006418 }
6419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006420 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006421#endif
6422
Daniel Veillard42595322004-11-08 10:52:06 +00006423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006424}
6425
6426static int
6427test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006429
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006430 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006431 test_ret += test_xmlACatalogAdd();
6432 test_ret += test_xmlACatalogDump();
6433 test_ret += test_xmlACatalogRemove();
6434 test_ret += test_xmlACatalogResolve();
6435 test_ret += test_xmlACatalogResolvePublic();
6436 test_ret += test_xmlACatalogResolveSystem();
6437 test_ret += test_xmlACatalogResolveURI();
6438 test_ret += test_xmlCatalogAdd();
6439 test_ret += test_xmlCatalogCleanup();
6440 test_ret += test_xmlCatalogConvert();
6441 test_ret += test_xmlCatalogDump();
6442 test_ret += test_xmlCatalogGetDefaults();
6443 test_ret += test_xmlCatalogIsEmpty();
6444 test_ret += test_xmlCatalogLocalResolve();
6445 test_ret += test_xmlCatalogLocalResolveURI();
6446 test_ret += test_xmlCatalogRemove();
6447 test_ret += test_xmlCatalogResolve();
6448 test_ret += test_xmlCatalogResolvePublic();
6449 test_ret += test_xmlCatalogResolveSystem();
6450 test_ret += test_xmlCatalogResolveURI();
6451 test_ret += test_xmlCatalogSetDefaultPrefer();
6452 test_ret += test_xmlCatalogSetDefaults();
6453 test_ret += test_xmlConvertSGMLCatalog();
6454 test_ret += test_xmlInitializeCatalog();
6455 test_ret += test_xmlLoadACatalog();
6456 test_ret += test_xmlLoadCatalog();
6457 test_ret += test_xmlLoadCatalogs();
6458 test_ret += test_xmlLoadSGMLSuperCatalog();
6459 test_ret += test_xmlNewCatalog();
6460 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006461
Daniel Veillard42595322004-11-08 10:52:06 +00006462 if (test_ret != 0)
6463 printf("Module catalog: %d errors\n", test_ret);
6464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006465}
6466
Daniel Veillardce682bc2004-11-05 17:22:25 +00006467#define gen_nb_const_xmlChRangeGroupPtr 1
6468static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6469 return(NULL);
6470}
6471static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6472}
6473
Daniel Veillardd93f6252004-11-02 15:53:51 +00006474static int
6475test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006477
Daniel Veillardce682bc2004-11-05 17:22:25 +00006478 int mem_base;
6479 int ret_val;
6480 unsigned int val; /* character to be validated */
6481 int n_val;
6482 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6483 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006484
Daniel Veillardce682bc2004-11-05 17:22:25 +00006485 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6486 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6487 mem_base = xmlMemBlocks();
6488 val = gen_unsigned_int(n_val, 0);
6489 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6490
William M. Brackf13f77f2004-11-12 16:03:48 +00006491 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006492 desret_int(ret_val);
6493 call_tests++;
6494 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006495 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006496 xmlResetLastError();
6497 if (mem_base != xmlMemBlocks()) {
6498 printf("Leak of %d blocks found in xmlCharInRange",
6499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006500 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006501 printf(" %d", n_val);
6502 printf(" %d", n_rptr);
6503 printf("\n");
6504 }
6505 }
6506 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006508
Daniel Veillard42595322004-11-08 10:52:06 +00006509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006510}
6511
6512
6513static int
6514test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006516
Daniel Veillard3d97e662004-11-04 10:49:00 +00006517 int mem_base;
6518 int ret_val;
6519 unsigned int ch; /* character to validate */
6520 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006521
Daniel Veillard3d97e662004-11-04 10:49:00 +00006522 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6523 mem_base = xmlMemBlocks();
6524 ch = gen_unsigned_int(n_ch, 0);
6525
6526 ret_val = xmlIsBaseChar(ch);
6527 desret_int(ret_val);
6528 call_tests++;
6529 des_unsigned_int(n_ch, ch, 0);
6530 xmlResetLastError();
6531 if (mem_base != xmlMemBlocks()) {
6532 printf("Leak of %d blocks found in xmlIsBaseChar",
6533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006534 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006535 printf(" %d", n_ch);
6536 printf("\n");
6537 }
6538 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006539 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006540
Daniel Veillard42595322004-11-08 10:52:06 +00006541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006542}
6543
6544
6545static int
6546test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006548
Daniel Veillard3d97e662004-11-04 10:49:00 +00006549 int mem_base;
6550 int ret_val;
6551 unsigned int ch; /* character to validate */
6552 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006553
Daniel Veillard3d97e662004-11-04 10:49:00 +00006554 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6555 mem_base = xmlMemBlocks();
6556 ch = gen_unsigned_int(n_ch, 0);
6557
6558 ret_val = xmlIsBlank(ch);
6559 desret_int(ret_val);
6560 call_tests++;
6561 des_unsigned_int(n_ch, ch, 0);
6562 xmlResetLastError();
6563 if (mem_base != xmlMemBlocks()) {
6564 printf("Leak of %d blocks found in xmlIsBlank",
6565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006566 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006567 printf(" %d", n_ch);
6568 printf("\n");
6569 }
6570 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006571 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006572
Daniel Veillard42595322004-11-08 10:52:06 +00006573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006574}
6575
6576
6577static int
6578test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006580
Daniel Veillard3d97e662004-11-04 10:49:00 +00006581 int mem_base;
6582 int ret_val;
6583 unsigned int ch; /* character to validate */
6584 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006585
Daniel Veillard3d97e662004-11-04 10:49:00 +00006586 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6587 mem_base = xmlMemBlocks();
6588 ch = gen_unsigned_int(n_ch, 0);
6589
6590 ret_val = xmlIsChar(ch);
6591 desret_int(ret_val);
6592 call_tests++;
6593 des_unsigned_int(n_ch, ch, 0);
6594 xmlResetLastError();
6595 if (mem_base != xmlMemBlocks()) {
6596 printf("Leak of %d blocks found in xmlIsChar",
6597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006598 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006599 printf(" %d", n_ch);
6600 printf("\n");
6601 }
6602 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006603 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006604
Daniel Veillard42595322004-11-08 10:52:06 +00006605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006606}
6607
6608
6609static int
6610test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006612
Daniel Veillard3d97e662004-11-04 10:49:00 +00006613 int mem_base;
6614 int ret_val;
6615 unsigned int ch; /* character to validate */
6616 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006617
Daniel Veillard3d97e662004-11-04 10:49:00 +00006618 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6619 mem_base = xmlMemBlocks();
6620 ch = gen_unsigned_int(n_ch, 0);
6621
6622 ret_val = xmlIsCombining(ch);
6623 desret_int(ret_val);
6624 call_tests++;
6625 des_unsigned_int(n_ch, ch, 0);
6626 xmlResetLastError();
6627 if (mem_base != xmlMemBlocks()) {
6628 printf("Leak of %d blocks found in xmlIsCombining",
6629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006630 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006631 printf(" %d", n_ch);
6632 printf("\n");
6633 }
6634 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006635 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006636
Daniel Veillard42595322004-11-08 10:52:06 +00006637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006638}
6639
6640
6641static int
6642test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006644
Daniel Veillard3d97e662004-11-04 10:49:00 +00006645 int mem_base;
6646 int ret_val;
6647 unsigned int ch; /* character to validate */
6648 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006649
Daniel Veillard3d97e662004-11-04 10:49:00 +00006650 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6651 mem_base = xmlMemBlocks();
6652 ch = gen_unsigned_int(n_ch, 0);
6653
6654 ret_val = xmlIsDigit(ch);
6655 desret_int(ret_val);
6656 call_tests++;
6657 des_unsigned_int(n_ch, ch, 0);
6658 xmlResetLastError();
6659 if (mem_base != xmlMemBlocks()) {
6660 printf("Leak of %d blocks found in xmlIsDigit",
6661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006662 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006663 printf(" %d", n_ch);
6664 printf("\n");
6665 }
6666 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006667 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006668
Daniel Veillard42595322004-11-08 10:52:06 +00006669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006670}
6671
6672
6673static int
6674test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006676
Daniel Veillard3d97e662004-11-04 10:49:00 +00006677 int mem_base;
6678 int ret_val;
6679 unsigned int ch; /* character to validate */
6680 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006681
Daniel Veillard3d97e662004-11-04 10:49:00 +00006682 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6683 mem_base = xmlMemBlocks();
6684 ch = gen_unsigned_int(n_ch, 0);
6685
6686 ret_val = xmlIsExtender(ch);
6687 desret_int(ret_val);
6688 call_tests++;
6689 des_unsigned_int(n_ch, ch, 0);
6690 xmlResetLastError();
6691 if (mem_base != xmlMemBlocks()) {
6692 printf("Leak of %d blocks found in xmlIsExtender",
6693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006694 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006695 printf(" %d", n_ch);
6696 printf("\n");
6697 }
6698 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006699 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006700
Daniel Veillard42595322004-11-08 10:52:06 +00006701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006702}
6703
6704
6705static int
6706test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006708
Daniel Veillard3d97e662004-11-04 10:49:00 +00006709 int mem_base;
6710 int ret_val;
6711 unsigned int ch; /* character to validate */
6712 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006713
Daniel Veillard3d97e662004-11-04 10:49:00 +00006714 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6715 mem_base = xmlMemBlocks();
6716 ch = gen_unsigned_int(n_ch, 0);
6717
6718 ret_val = xmlIsIdeographic(ch);
6719 desret_int(ret_val);
6720 call_tests++;
6721 des_unsigned_int(n_ch, ch, 0);
6722 xmlResetLastError();
6723 if (mem_base != xmlMemBlocks()) {
6724 printf("Leak of %d blocks found in xmlIsIdeographic",
6725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006726 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006727 printf(" %d", n_ch);
6728 printf("\n");
6729 }
6730 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006731 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006732
Daniel Veillard42595322004-11-08 10:52:06 +00006733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006734}
6735
6736
6737static int
6738test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006740
Daniel Veillard3d97e662004-11-04 10:49:00 +00006741 int mem_base;
6742 int ret_val;
6743 unsigned int ch; /* character to validate */
6744 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006745
Daniel Veillard3d97e662004-11-04 10:49:00 +00006746 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6747 mem_base = xmlMemBlocks();
6748 ch = gen_unsigned_int(n_ch, 0);
6749
6750 ret_val = xmlIsPubidChar(ch);
6751 desret_int(ret_val);
6752 call_tests++;
6753 des_unsigned_int(n_ch, ch, 0);
6754 xmlResetLastError();
6755 if (mem_base != xmlMemBlocks()) {
6756 printf("Leak of %d blocks found in xmlIsPubidChar",
6757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006758 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006759 printf(" %d", n_ch);
6760 printf("\n");
6761 }
6762 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006763 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006764
Daniel Veillard42595322004-11-08 10:52:06 +00006765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006766}
6767
6768static int
6769test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006771
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006772 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006773 test_ret += test_xmlCharInRange();
6774 test_ret += test_xmlIsBaseChar();
6775 test_ret += test_xmlIsBlank();
6776 test_ret += test_xmlIsChar();
6777 test_ret += test_xmlIsCombining();
6778 test_ret += test_xmlIsDigit();
6779 test_ret += test_xmlIsExtender();
6780 test_ret += test_xmlIsIdeographic();
6781 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006782
Daniel Veillard42595322004-11-08 10:52:06 +00006783 if (test_ret != 0)
6784 printf("Module chvalid: %d errors\n", test_ret);
6785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006786}
6787
6788static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006789test_xmlBoolToText(void) {
6790 int test_ret = 0;
6791
William M. Brack21e4ef22005-01-02 09:53:13 +00006792#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006793 int mem_base;
6794 const char * ret_val;
6795 int boolval; /* a bool to turn into text */
6796 int n_boolval;
6797
6798 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6799 mem_base = xmlMemBlocks();
6800 boolval = gen_int(n_boolval, 0);
6801
6802 ret_val = xmlBoolToText(boolval);
6803 desret_const_char_ptr(ret_val);
6804 call_tests++;
6805 des_int(n_boolval, boolval, 0);
6806 xmlResetLastError();
6807 if (mem_base != xmlMemBlocks()) {
6808 printf("Leak of %d blocks found in xmlBoolToText",
6809 xmlMemBlocks() - mem_base);
6810 test_ret++;
6811 printf(" %d", n_boolval);
6812 printf("\n");
6813 }
6814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006815 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006816#endif
6817
Daniel Veillarda82b1822004-11-08 16:24:57 +00006818 return(test_ret);
6819}
6820
6821
6822static int
6823test_xmlDebugCheckDocument(void) {
6824 int test_ret = 0;
6825
William M. Brack21e4ef22005-01-02 09:53:13 +00006826#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006827 int mem_base;
6828 int ret_val;
6829 FILE * output; /* the FILE * for the output */
6830 int n_output;
6831 xmlDocPtr doc; /* the document */
6832 int n_doc;
6833
6834 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6835 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6836 mem_base = xmlMemBlocks();
6837 output = gen_debug_FILE_ptr(n_output, 0);
6838 doc = gen_xmlDocPtr(n_doc, 1);
6839
6840 ret_val = xmlDebugCheckDocument(output, doc);
6841 desret_int(ret_val);
6842 call_tests++;
6843 des_debug_FILE_ptr(n_output, output, 0);
6844 des_xmlDocPtr(n_doc, doc, 1);
6845 xmlResetLastError();
6846 if (mem_base != xmlMemBlocks()) {
6847 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6848 xmlMemBlocks() - mem_base);
6849 test_ret++;
6850 printf(" %d", n_output);
6851 printf(" %d", n_doc);
6852 printf("\n");
6853 }
6854 }
6855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006856 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006857#endif
6858
Daniel Veillarda82b1822004-11-08 16:24:57 +00006859 return(test_ret);
6860}
6861
6862
6863static int
6864test_xmlDebugDumpAttr(void) {
6865 int test_ret = 0;
6866
William M. Brack21e4ef22005-01-02 09:53:13 +00006867#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006868 int mem_base;
6869 FILE * output; /* the FILE * for the output */
6870 int n_output;
6871 xmlAttrPtr attr; /* the attribute */
6872 int n_attr;
6873 int depth; /* the indentation level. */
6874 int n_depth;
6875
6876 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6877 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6878 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6879 mem_base = xmlMemBlocks();
6880 output = gen_debug_FILE_ptr(n_output, 0);
6881 attr = gen_xmlAttrPtr(n_attr, 1);
6882 depth = gen_int(n_depth, 2);
6883
6884 xmlDebugDumpAttr(output, attr, depth);
6885 call_tests++;
6886 des_debug_FILE_ptr(n_output, output, 0);
6887 des_xmlAttrPtr(n_attr, attr, 1);
6888 des_int(n_depth, depth, 2);
6889 xmlResetLastError();
6890 if (mem_base != xmlMemBlocks()) {
6891 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6892 xmlMemBlocks() - mem_base);
6893 test_ret++;
6894 printf(" %d", n_output);
6895 printf(" %d", n_attr);
6896 printf(" %d", n_depth);
6897 printf("\n");
6898 }
6899 }
6900 }
6901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006902 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006903#endif
6904
Daniel Veillarda82b1822004-11-08 16:24:57 +00006905 return(test_ret);
6906}
6907
6908
6909static int
6910test_xmlDebugDumpAttrList(void) {
6911 int test_ret = 0;
6912
William M. Brack21e4ef22005-01-02 09:53:13 +00006913#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006914 int mem_base;
6915 FILE * output; /* the FILE * for the output */
6916 int n_output;
6917 xmlAttrPtr attr; /* the attribute list */
6918 int n_attr;
6919 int depth; /* the indentation level. */
6920 int n_depth;
6921
6922 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6923 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6924 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6925 mem_base = xmlMemBlocks();
6926 output = gen_debug_FILE_ptr(n_output, 0);
6927 attr = gen_xmlAttrPtr(n_attr, 1);
6928 depth = gen_int(n_depth, 2);
6929
6930 xmlDebugDumpAttrList(output, attr, depth);
6931 call_tests++;
6932 des_debug_FILE_ptr(n_output, output, 0);
6933 des_xmlAttrPtr(n_attr, attr, 1);
6934 des_int(n_depth, depth, 2);
6935 xmlResetLastError();
6936 if (mem_base != xmlMemBlocks()) {
6937 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6938 xmlMemBlocks() - mem_base);
6939 test_ret++;
6940 printf(" %d", n_output);
6941 printf(" %d", n_attr);
6942 printf(" %d", n_depth);
6943 printf("\n");
6944 }
6945 }
6946 }
6947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006948 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006949#endif
6950
Daniel Veillarda82b1822004-11-08 16:24:57 +00006951 return(test_ret);
6952}
6953
6954
6955static int
6956test_xmlDebugDumpDTD(void) {
6957 int test_ret = 0;
6958
William M. Brack21e4ef22005-01-02 09:53:13 +00006959#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006960 int mem_base;
6961 FILE * output; /* the FILE * for the output */
6962 int n_output;
6963 xmlDtdPtr dtd; /* the DTD */
6964 int n_dtd;
6965
6966 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6967 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6968 mem_base = xmlMemBlocks();
6969 output = gen_debug_FILE_ptr(n_output, 0);
6970 dtd = gen_xmlDtdPtr(n_dtd, 1);
6971
6972 xmlDebugDumpDTD(output, dtd);
6973 call_tests++;
6974 des_debug_FILE_ptr(n_output, output, 0);
6975 des_xmlDtdPtr(n_dtd, dtd, 1);
6976 xmlResetLastError();
6977 if (mem_base != xmlMemBlocks()) {
6978 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6979 xmlMemBlocks() - mem_base);
6980 test_ret++;
6981 printf(" %d", n_output);
6982 printf(" %d", n_dtd);
6983 printf("\n");
6984 }
6985 }
6986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006987 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006988#endif
6989
Daniel Veillarda82b1822004-11-08 16:24:57 +00006990 return(test_ret);
6991}
6992
6993
6994static int
6995test_xmlDebugDumpDocument(void) {
6996 int test_ret = 0;
6997
William M. Brack21e4ef22005-01-02 09:53:13 +00006998#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006999 int mem_base;
7000 FILE * output; /* the FILE * for the output */
7001 int n_output;
7002 xmlDocPtr doc; /* the document */
7003 int n_doc;
7004
7005 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7006 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7007 mem_base = xmlMemBlocks();
7008 output = gen_debug_FILE_ptr(n_output, 0);
7009 doc = gen_xmlDocPtr(n_doc, 1);
7010
7011 xmlDebugDumpDocument(output, doc);
7012 call_tests++;
7013 des_debug_FILE_ptr(n_output, output, 0);
7014 des_xmlDocPtr(n_doc, doc, 1);
7015 xmlResetLastError();
7016 if (mem_base != xmlMemBlocks()) {
7017 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7018 xmlMemBlocks() - mem_base);
7019 test_ret++;
7020 printf(" %d", n_output);
7021 printf(" %d", n_doc);
7022 printf("\n");
7023 }
7024 }
7025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007026 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007027#endif
7028
Daniel Veillarda82b1822004-11-08 16:24:57 +00007029 return(test_ret);
7030}
7031
7032
7033static int
7034test_xmlDebugDumpDocumentHead(void) {
7035 int test_ret = 0;
7036
William M. Brack21e4ef22005-01-02 09:53:13 +00007037#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007038 int mem_base;
7039 FILE * output; /* the FILE * for the output */
7040 int n_output;
7041 xmlDocPtr doc; /* the document */
7042 int n_doc;
7043
7044 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7045 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7046 mem_base = xmlMemBlocks();
7047 output = gen_debug_FILE_ptr(n_output, 0);
7048 doc = gen_xmlDocPtr(n_doc, 1);
7049
7050 xmlDebugDumpDocumentHead(output, doc);
7051 call_tests++;
7052 des_debug_FILE_ptr(n_output, output, 0);
7053 des_xmlDocPtr(n_doc, doc, 1);
7054 xmlResetLastError();
7055 if (mem_base != xmlMemBlocks()) {
7056 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7057 xmlMemBlocks() - mem_base);
7058 test_ret++;
7059 printf(" %d", n_output);
7060 printf(" %d", n_doc);
7061 printf("\n");
7062 }
7063 }
7064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007065 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007066#endif
7067
Daniel Veillarda82b1822004-11-08 16:24:57 +00007068 return(test_ret);
7069}
7070
7071
7072static int
7073test_xmlDebugDumpEntities(void) {
7074 int test_ret = 0;
7075
William M. Brack21e4ef22005-01-02 09:53:13 +00007076#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007077 int mem_base;
7078 FILE * output; /* the FILE * for the output */
7079 int n_output;
7080 xmlDocPtr doc; /* the document */
7081 int n_doc;
7082
7083 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7084 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7085 mem_base = xmlMemBlocks();
7086 output = gen_debug_FILE_ptr(n_output, 0);
7087 doc = gen_xmlDocPtr(n_doc, 1);
7088
7089 xmlDebugDumpEntities(output, doc);
7090 call_tests++;
7091 des_debug_FILE_ptr(n_output, output, 0);
7092 des_xmlDocPtr(n_doc, doc, 1);
7093 xmlResetLastError();
7094 if (mem_base != xmlMemBlocks()) {
7095 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7096 xmlMemBlocks() - mem_base);
7097 test_ret++;
7098 printf(" %d", n_output);
7099 printf(" %d", n_doc);
7100 printf("\n");
7101 }
7102 }
7103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007104 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007105#endif
7106
Daniel Veillarda82b1822004-11-08 16:24:57 +00007107 return(test_ret);
7108}
7109
7110
7111static int
7112test_xmlDebugDumpNode(void) {
7113 int test_ret = 0;
7114
William M. Brack21e4ef22005-01-02 09:53:13 +00007115#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007116 int mem_base;
7117 FILE * output; /* the FILE * for the output */
7118 int n_output;
7119 xmlNodePtr node; /* the node */
7120 int n_node;
7121 int depth; /* the indentation level. */
7122 int n_depth;
7123
7124 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7125 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7126 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7127 mem_base = xmlMemBlocks();
7128 output = gen_debug_FILE_ptr(n_output, 0);
7129 node = gen_xmlNodePtr(n_node, 1);
7130 depth = gen_int(n_depth, 2);
7131
7132 xmlDebugDumpNode(output, node, depth);
7133 call_tests++;
7134 des_debug_FILE_ptr(n_output, output, 0);
7135 des_xmlNodePtr(n_node, node, 1);
7136 des_int(n_depth, depth, 2);
7137 xmlResetLastError();
7138 if (mem_base != xmlMemBlocks()) {
7139 printf("Leak of %d blocks found in xmlDebugDumpNode",
7140 xmlMemBlocks() - mem_base);
7141 test_ret++;
7142 printf(" %d", n_output);
7143 printf(" %d", n_node);
7144 printf(" %d", n_depth);
7145 printf("\n");
7146 }
7147 }
7148 }
7149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007150 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007151#endif
7152
Daniel Veillarda82b1822004-11-08 16:24:57 +00007153 return(test_ret);
7154}
7155
7156
7157static int
7158test_xmlDebugDumpNodeList(void) {
7159 int test_ret = 0;
7160
William M. Brack21e4ef22005-01-02 09:53:13 +00007161#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007162 int mem_base;
7163 FILE * output; /* the FILE * for the output */
7164 int n_output;
7165 xmlNodePtr node; /* the node list */
7166 int n_node;
7167 int depth; /* the indentation level. */
7168 int n_depth;
7169
7170 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7171 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7172 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7173 mem_base = xmlMemBlocks();
7174 output = gen_debug_FILE_ptr(n_output, 0);
7175 node = gen_xmlNodePtr(n_node, 1);
7176 depth = gen_int(n_depth, 2);
7177
7178 xmlDebugDumpNodeList(output, node, depth);
7179 call_tests++;
7180 des_debug_FILE_ptr(n_output, output, 0);
7181 des_xmlNodePtr(n_node, node, 1);
7182 des_int(n_depth, depth, 2);
7183 xmlResetLastError();
7184 if (mem_base != xmlMemBlocks()) {
7185 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7186 xmlMemBlocks() - mem_base);
7187 test_ret++;
7188 printf(" %d", n_output);
7189 printf(" %d", n_node);
7190 printf(" %d", n_depth);
7191 printf("\n");
7192 }
7193 }
7194 }
7195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007196 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007197#endif
7198
Daniel Veillarda82b1822004-11-08 16:24:57 +00007199 return(test_ret);
7200}
7201
7202
7203static int
7204test_xmlDebugDumpOneNode(void) {
7205 int test_ret = 0;
7206
William M. Brack21e4ef22005-01-02 09:53:13 +00007207#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007208 int mem_base;
7209 FILE * output; /* the FILE * for the output */
7210 int n_output;
7211 xmlNodePtr node; /* the node */
7212 int n_node;
7213 int depth; /* the indentation level. */
7214 int n_depth;
7215
7216 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7217 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7218 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7219 mem_base = xmlMemBlocks();
7220 output = gen_debug_FILE_ptr(n_output, 0);
7221 node = gen_xmlNodePtr(n_node, 1);
7222 depth = gen_int(n_depth, 2);
7223
7224 xmlDebugDumpOneNode(output, node, depth);
7225 call_tests++;
7226 des_debug_FILE_ptr(n_output, output, 0);
7227 des_xmlNodePtr(n_node, node, 1);
7228 des_int(n_depth, depth, 2);
7229 xmlResetLastError();
7230 if (mem_base != xmlMemBlocks()) {
7231 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7232 xmlMemBlocks() - mem_base);
7233 test_ret++;
7234 printf(" %d", n_output);
7235 printf(" %d", n_node);
7236 printf(" %d", n_depth);
7237 printf("\n");
7238 }
7239 }
7240 }
7241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007242 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007243#endif
7244
Daniel Veillarda82b1822004-11-08 16:24:57 +00007245 return(test_ret);
7246}
7247
7248
7249static int
7250test_xmlDebugDumpString(void) {
7251 int test_ret = 0;
7252
William M. Brack21e4ef22005-01-02 09:53:13 +00007253#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007254 int mem_base;
7255 FILE * output; /* the FILE * for the output */
7256 int n_output;
7257 xmlChar * str; /* the string */
7258 int n_str;
7259
7260 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7261 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7262 mem_base = xmlMemBlocks();
7263 output = gen_debug_FILE_ptr(n_output, 0);
7264 str = gen_const_xmlChar_ptr(n_str, 1);
7265
William M. Brackf13f77f2004-11-12 16:03:48 +00007266 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007267 call_tests++;
7268 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007269 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007270 xmlResetLastError();
7271 if (mem_base != xmlMemBlocks()) {
7272 printf("Leak of %d blocks found in xmlDebugDumpString",
7273 xmlMemBlocks() - mem_base);
7274 test_ret++;
7275 printf(" %d", n_output);
7276 printf(" %d", n_str);
7277 printf("\n");
7278 }
7279 }
7280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007281 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007282#endif
7283
Daniel Veillarda82b1822004-11-08 16:24:57 +00007284 return(test_ret);
7285}
7286
7287
7288static int
7289test_xmlLsCountNode(void) {
7290 int test_ret = 0;
7291
William M. Brack21e4ef22005-01-02 09:53:13 +00007292#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007293 int mem_base;
7294 int ret_val;
7295 xmlNodePtr node; /* the node to count */
7296 int n_node;
7297
7298 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7299 mem_base = xmlMemBlocks();
7300 node = gen_xmlNodePtr(n_node, 0);
7301
7302 ret_val = xmlLsCountNode(node);
7303 desret_int(ret_val);
7304 call_tests++;
7305 des_xmlNodePtr(n_node, node, 0);
7306 xmlResetLastError();
7307 if (mem_base != xmlMemBlocks()) {
7308 printf("Leak of %d blocks found in xmlLsCountNode",
7309 xmlMemBlocks() - mem_base);
7310 test_ret++;
7311 printf(" %d", n_node);
7312 printf("\n");
7313 }
7314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007315 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007316#endif
7317
Daniel Veillarda82b1822004-11-08 16:24:57 +00007318 return(test_ret);
7319}
7320
7321
7322static int
7323test_xmlLsOneNode(void) {
7324 int test_ret = 0;
7325
William M. Brack21e4ef22005-01-02 09:53:13 +00007326#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007327 int mem_base;
7328 FILE * output; /* the FILE * for the output */
7329 int n_output;
7330 xmlNodePtr node; /* the node to dump */
7331 int n_node;
7332
7333 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7334 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7335 mem_base = xmlMemBlocks();
7336 output = gen_debug_FILE_ptr(n_output, 0);
7337 node = gen_xmlNodePtr(n_node, 1);
7338
7339 xmlLsOneNode(output, node);
7340 call_tests++;
7341 des_debug_FILE_ptr(n_output, output, 0);
7342 des_xmlNodePtr(n_node, node, 1);
7343 xmlResetLastError();
7344 if (mem_base != xmlMemBlocks()) {
7345 printf("Leak of %d blocks found in xmlLsOneNode",
7346 xmlMemBlocks() - mem_base);
7347 test_ret++;
7348 printf(" %d", n_output);
7349 printf(" %d", n_node);
7350 printf("\n");
7351 }
7352 }
7353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007354 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007355#endif
7356
Daniel Veillarda82b1822004-11-08 16:24:57 +00007357 return(test_ret);
7358}
7359
7360
7361#define gen_nb_char_ptr 1
7362static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7363 return(NULL);
7364}
7365static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7366}
7367
7368static int
7369test_xmlShell(void) {
7370 int test_ret = 0;
7371
7372
7373 /* missing type support */
7374 return(test_ret);
7375}
7376
7377
Daniel Veillarda82b1822004-11-08 16:24:57 +00007378static int
7379test_xmlShellBase(void) {
7380 int test_ret = 0;
7381
William M. Brack21e4ef22005-01-02 09:53:13 +00007382#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007383 int mem_base;
7384 int ret_val;
7385 xmlShellCtxtPtr ctxt; /* the shell context */
7386 int n_ctxt;
7387 char * arg; /* unused */
7388 int n_arg;
7389 xmlNodePtr node; /* a node */
7390 int n_node;
7391 xmlNodePtr node2; /* unused */
7392 int n_node2;
7393
7394 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7395 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7396 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7397 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7398 mem_base = xmlMemBlocks();
7399 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7400 arg = gen_char_ptr(n_arg, 1);
7401 node = gen_xmlNodePtr(n_node, 2);
7402 node2 = gen_xmlNodePtr(n_node2, 3);
7403
7404 ret_val = xmlShellBase(ctxt, arg, node, node2);
7405 desret_int(ret_val);
7406 call_tests++;
7407 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7408 des_char_ptr(n_arg, arg, 1);
7409 des_xmlNodePtr(n_node, node, 2);
7410 des_xmlNodePtr(n_node2, node2, 3);
7411 xmlResetLastError();
7412 if (mem_base != xmlMemBlocks()) {
7413 printf("Leak of %d blocks found in xmlShellBase",
7414 xmlMemBlocks() - mem_base);
7415 test_ret++;
7416 printf(" %d", n_ctxt);
7417 printf(" %d", n_arg);
7418 printf(" %d", n_node);
7419 printf(" %d", n_node2);
7420 printf("\n");
7421 }
7422 }
7423 }
7424 }
7425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007426 function_tests++;
7427#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007428
Daniel Veillarda82b1822004-11-08 16:24:57 +00007429 return(test_ret);
7430}
7431
7432
7433static int
7434test_xmlShellCat(void) {
7435 int test_ret = 0;
7436
William M. Brack21e4ef22005-01-02 09:53:13 +00007437#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007438 int mem_base;
7439 int ret_val;
7440 xmlShellCtxtPtr ctxt; /* the shell context */
7441 int n_ctxt;
7442 char * arg; /* unused */
7443 int n_arg;
7444 xmlNodePtr node; /* a node */
7445 int n_node;
7446 xmlNodePtr node2; /* unused */
7447 int n_node2;
7448
7449 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7450 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7451 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7452 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7453 mem_base = xmlMemBlocks();
7454 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7455 arg = gen_char_ptr(n_arg, 1);
7456 node = gen_xmlNodePtr(n_node, 2);
7457 node2 = gen_xmlNodePtr(n_node2, 3);
7458
7459 ret_val = xmlShellCat(ctxt, arg, node, node2);
7460 desret_int(ret_val);
7461 call_tests++;
7462 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7463 des_char_ptr(n_arg, arg, 1);
7464 des_xmlNodePtr(n_node, node, 2);
7465 des_xmlNodePtr(n_node2, node2, 3);
7466 xmlResetLastError();
7467 if (mem_base != xmlMemBlocks()) {
7468 printf("Leak of %d blocks found in xmlShellCat",
7469 xmlMemBlocks() - mem_base);
7470 test_ret++;
7471 printf(" %d", n_ctxt);
7472 printf(" %d", n_arg);
7473 printf(" %d", n_node);
7474 printf(" %d", n_node2);
7475 printf("\n");
7476 }
7477 }
7478 }
7479 }
7480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007481 function_tests++;
7482#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007483
Daniel Veillarda82b1822004-11-08 16:24:57 +00007484 return(test_ret);
7485}
7486
7487
7488static int
7489test_xmlShellDir(void) {
7490 int test_ret = 0;
7491
William M. Brack21e4ef22005-01-02 09:53:13 +00007492#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007493 int mem_base;
7494 int ret_val;
7495 xmlShellCtxtPtr ctxt; /* the shell context */
7496 int n_ctxt;
7497 char * arg; /* unused */
7498 int n_arg;
7499 xmlNodePtr node; /* a node */
7500 int n_node;
7501 xmlNodePtr node2; /* unused */
7502 int n_node2;
7503
7504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7505 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7506 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7507 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7508 mem_base = xmlMemBlocks();
7509 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7510 arg = gen_char_ptr(n_arg, 1);
7511 node = gen_xmlNodePtr(n_node, 2);
7512 node2 = gen_xmlNodePtr(n_node2, 3);
7513
7514 ret_val = xmlShellDir(ctxt, arg, node, node2);
7515 desret_int(ret_val);
7516 call_tests++;
7517 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7518 des_char_ptr(n_arg, arg, 1);
7519 des_xmlNodePtr(n_node, node, 2);
7520 des_xmlNodePtr(n_node2, node2, 3);
7521 xmlResetLastError();
7522 if (mem_base != xmlMemBlocks()) {
7523 printf("Leak of %d blocks found in xmlShellDir",
7524 xmlMemBlocks() - mem_base);
7525 test_ret++;
7526 printf(" %d", n_ctxt);
7527 printf(" %d", n_arg);
7528 printf(" %d", n_node);
7529 printf(" %d", n_node2);
7530 printf("\n");
7531 }
7532 }
7533 }
7534 }
7535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007536 function_tests++;
7537#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007538
Daniel Veillarda82b1822004-11-08 16:24:57 +00007539 return(test_ret);
7540}
7541
7542
7543static int
7544test_xmlShellDu(void) {
7545 int test_ret = 0;
7546
William M. Brack21e4ef22005-01-02 09:53:13 +00007547#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007548 int mem_base;
7549 int ret_val;
7550 xmlShellCtxtPtr ctxt; /* the shell context */
7551 int n_ctxt;
7552 char * arg; /* unused */
7553 int n_arg;
7554 xmlNodePtr tree; /* a node defining a subtree */
7555 int n_tree;
7556 xmlNodePtr node2; /* unused */
7557 int n_node2;
7558
7559 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7560 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7561 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7562 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7563 mem_base = xmlMemBlocks();
7564 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7565 arg = gen_char_ptr(n_arg, 1);
7566 tree = gen_xmlNodePtr(n_tree, 2);
7567 node2 = gen_xmlNodePtr(n_node2, 3);
7568
7569 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7570 desret_int(ret_val);
7571 call_tests++;
7572 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7573 des_char_ptr(n_arg, arg, 1);
7574 des_xmlNodePtr(n_tree, tree, 2);
7575 des_xmlNodePtr(n_node2, node2, 3);
7576 xmlResetLastError();
7577 if (mem_base != xmlMemBlocks()) {
7578 printf("Leak of %d blocks found in xmlShellDu",
7579 xmlMemBlocks() - mem_base);
7580 test_ret++;
7581 printf(" %d", n_ctxt);
7582 printf(" %d", n_arg);
7583 printf(" %d", n_tree);
7584 printf(" %d", n_node2);
7585 printf("\n");
7586 }
7587 }
7588 }
7589 }
7590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007591 function_tests++;
7592#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007593
Daniel Veillarda82b1822004-11-08 16:24:57 +00007594 return(test_ret);
7595}
7596
7597
7598static int
7599test_xmlShellList(void) {
7600 int test_ret = 0;
7601
William M. Brack21e4ef22005-01-02 09:53:13 +00007602#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007603 int mem_base;
7604 int ret_val;
7605 xmlShellCtxtPtr ctxt; /* the shell context */
7606 int n_ctxt;
7607 char * arg; /* unused */
7608 int n_arg;
7609 xmlNodePtr node; /* a node */
7610 int n_node;
7611 xmlNodePtr node2; /* unused */
7612 int n_node2;
7613
7614 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7615 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7616 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7617 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7618 mem_base = xmlMemBlocks();
7619 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7620 arg = gen_char_ptr(n_arg, 1);
7621 node = gen_xmlNodePtr(n_node, 2);
7622 node2 = gen_xmlNodePtr(n_node2, 3);
7623
7624 ret_val = xmlShellList(ctxt, arg, node, node2);
7625 desret_int(ret_val);
7626 call_tests++;
7627 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7628 des_char_ptr(n_arg, arg, 1);
7629 des_xmlNodePtr(n_node, node, 2);
7630 des_xmlNodePtr(n_node2, node2, 3);
7631 xmlResetLastError();
7632 if (mem_base != xmlMemBlocks()) {
7633 printf("Leak of %d blocks found in xmlShellList",
7634 xmlMemBlocks() - mem_base);
7635 test_ret++;
7636 printf(" %d", n_ctxt);
7637 printf(" %d", n_arg);
7638 printf(" %d", n_node);
7639 printf(" %d", n_node2);
7640 printf("\n");
7641 }
7642 }
7643 }
7644 }
7645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007646 function_tests++;
7647#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007648
Daniel Veillarda82b1822004-11-08 16:24:57 +00007649 return(test_ret);
7650}
7651
7652
7653static int
7654test_xmlShellLoad(void) {
7655 int test_ret = 0;
7656
William M. Brack21e4ef22005-01-02 09:53:13 +00007657#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007658 int mem_base;
7659 int ret_val;
7660 xmlShellCtxtPtr ctxt; /* the shell context */
7661 int n_ctxt;
7662 char * filename; /* the file name */
7663 int n_filename;
7664 xmlNodePtr node; /* unused */
7665 int n_node;
7666 xmlNodePtr node2; /* unused */
7667 int n_node2;
7668
7669 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7670 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7671 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7672 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7673 mem_base = xmlMemBlocks();
7674 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7675 filename = gen_char_ptr(n_filename, 1);
7676 node = gen_xmlNodePtr(n_node, 2);
7677 node2 = gen_xmlNodePtr(n_node2, 3);
7678
7679 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7680 desret_int(ret_val);
7681 call_tests++;
7682 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7683 des_char_ptr(n_filename, filename, 1);
7684 des_xmlNodePtr(n_node, node, 2);
7685 des_xmlNodePtr(n_node2, node2, 3);
7686 xmlResetLastError();
7687 if (mem_base != xmlMemBlocks()) {
7688 printf("Leak of %d blocks found in xmlShellLoad",
7689 xmlMemBlocks() - mem_base);
7690 test_ret++;
7691 printf(" %d", n_ctxt);
7692 printf(" %d", n_filename);
7693 printf(" %d", n_node);
7694 printf(" %d", n_node2);
7695 printf("\n");
7696 }
7697 }
7698 }
7699 }
7700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007701 function_tests++;
7702#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007703
Daniel Veillarda82b1822004-11-08 16:24:57 +00007704 return(test_ret);
7705}
7706
7707
7708static int
7709test_xmlShellPrintXPathResult(void) {
7710 int test_ret = 0;
7711
William M. Brack21e4ef22005-01-02 09:53:13 +00007712#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007713 int mem_base;
7714 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7715 int n_list;
7716
7717 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7718 mem_base = xmlMemBlocks();
7719 list = gen_xmlXPathObjectPtr(n_list, 0);
7720
7721 xmlShellPrintXPathResult(list);
7722 call_tests++;
7723 des_xmlXPathObjectPtr(n_list, list, 0);
7724 xmlResetLastError();
7725 if (mem_base != xmlMemBlocks()) {
7726 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7727 xmlMemBlocks() - mem_base);
7728 test_ret++;
7729 printf(" %d", n_list);
7730 printf("\n");
7731 }
7732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007733 function_tests++;
7734#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007735
Daniel Veillarda82b1822004-11-08 16:24:57 +00007736 return(test_ret);
7737}
7738
7739
7740static int
7741test_xmlShellPwd(void) {
7742 int test_ret = 0;
7743
William M. Brack21e4ef22005-01-02 09:53:13 +00007744#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007745 int mem_base;
7746 int ret_val;
7747 xmlShellCtxtPtr ctxt; /* the shell context */
7748 int n_ctxt;
7749 char * buffer; /* the output buffer */
7750 int n_buffer;
7751 xmlNodePtr node; /* a node */
7752 int n_node;
7753 xmlNodePtr node2; /* unused */
7754 int n_node2;
7755
7756 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7757 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7758 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7759 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7760 mem_base = xmlMemBlocks();
7761 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7762 buffer = gen_char_ptr(n_buffer, 1);
7763 node = gen_xmlNodePtr(n_node, 2);
7764 node2 = gen_xmlNodePtr(n_node2, 3);
7765
7766 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7767 desret_int(ret_val);
7768 call_tests++;
7769 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7770 des_char_ptr(n_buffer, buffer, 1);
7771 des_xmlNodePtr(n_node, node, 2);
7772 des_xmlNodePtr(n_node2, node2, 3);
7773 xmlResetLastError();
7774 if (mem_base != xmlMemBlocks()) {
7775 printf("Leak of %d blocks found in xmlShellPwd",
7776 xmlMemBlocks() - mem_base);
7777 test_ret++;
7778 printf(" %d", n_ctxt);
7779 printf(" %d", n_buffer);
7780 printf(" %d", n_node);
7781 printf(" %d", n_node2);
7782 printf("\n");
7783 }
7784 }
7785 }
7786 }
7787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007788 function_tests++;
7789#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007790
Daniel Veillarda82b1822004-11-08 16:24:57 +00007791 return(test_ret);
7792}
7793
7794
7795static int
7796test_xmlShellSave(void) {
7797 int test_ret = 0;
7798
William M. Brack21e4ef22005-01-02 09:53:13 +00007799#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007800 int mem_base;
7801 int ret_val;
7802 xmlShellCtxtPtr ctxt; /* the shell context */
7803 int n_ctxt;
7804 char * filename; /* the file name (optional) */
7805 int n_filename;
7806 xmlNodePtr node; /* unused */
7807 int n_node;
7808 xmlNodePtr node2; /* unused */
7809 int n_node2;
7810
7811 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7812 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7813 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7814 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7815 mem_base = xmlMemBlocks();
7816 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7817 filename = gen_char_ptr(n_filename, 1);
7818 node = gen_xmlNodePtr(n_node, 2);
7819 node2 = gen_xmlNodePtr(n_node2, 3);
7820
7821 ret_val = xmlShellSave(ctxt, filename, node, node2);
7822 desret_int(ret_val);
7823 call_tests++;
7824 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7825 des_char_ptr(n_filename, filename, 1);
7826 des_xmlNodePtr(n_node, node, 2);
7827 des_xmlNodePtr(n_node2, node2, 3);
7828 xmlResetLastError();
7829 if (mem_base != xmlMemBlocks()) {
7830 printf("Leak of %d blocks found in xmlShellSave",
7831 xmlMemBlocks() - mem_base);
7832 test_ret++;
7833 printf(" %d", n_ctxt);
7834 printf(" %d", n_filename);
7835 printf(" %d", n_node);
7836 printf(" %d", n_node2);
7837 printf("\n");
7838 }
7839 }
7840 }
7841 }
7842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007843 function_tests++;
7844#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007845
Daniel Veillarda82b1822004-11-08 16:24:57 +00007846 return(test_ret);
7847}
7848
7849
7850static int
7851test_xmlShellValidate(void) {
7852 int test_ret = 0;
7853
William M. Brack21e4ef22005-01-02 09:53:13 +00007854#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007855 int mem_base;
7856 int ret_val;
7857 xmlShellCtxtPtr ctxt; /* the shell context */
7858 int n_ctxt;
7859 char * dtd; /* the DTD URI (optional) */
7860 int n_dtd;
7861 xmlNodePtr node; /* unused */
7862 int n_node;
7863 xmlNodePtr node2; /* unused */
7864 int n_node2;
7865
7866 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7867 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7868 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7869 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7870 mem_base = xmlMemBlocks();
7871 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7872 dtd = gen_char_ptr(n_dtd, 1);
7873 node = gen_xmlNodePtr(n_node, 2);
7874 node2 = gen_xmlNodePtr(n_node2, 3);
7875
7876 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7877 desret_int(ret_val);
7878 call_tests++;
7879 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7880 des_char_ptr(n_dtd, dtd, 1);
7881 des_xmlNodePtr(n_node, node, 2);
7882 des_xmlNodePtr(n_node2, node2, 3);
7883 xmlResetLastError();
7884 if (mem_base != xmlMemBlocks()) {
7885 printf("Leak of %d blocks found in xmlShellValidate",
7886 xmlMemBlocks() - mem_base);
7887 test_ret++;
7888 printf(" %d", n_ctxt);
7889 printf(" %d", n_dtd);
7890 printf(" %d", n_node);
7891 printf(" %d", n_node2);
7892 printf("\n");
7893 }
7894 }
7895 }
7896 }
7897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007898 function_tests++;
7899#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007900
Daniel Veillarda82b1822004-11-08 16:24:57 +00007901 return(test_ret);
7902}
7903
7904
7905static int
7906test_xmlShellWrite(void) {
7907 int test_ret = 0;
7908
William M. Brack21e4ef22005-01-02 09:53:13 +00007909#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007910 int mem_base;
7911 int ret_val;
7912 xmlShellCtxtPtr ctxt; /* the shell context */
7913 int n_ctxt;
7914 char * filename; /* the file name */
7915 int n_filename;
7916 xmlNodePtr node; /* a node in the tree */
7917 int n_node;
7918 xmlNodePtr node2; /* unused */
7919 int n_node2;
7920
7921 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7922 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7923 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7924 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7925 mem_base = xmlMemBlocks();
7926 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7927 filename = gen_char_ptr(n_filename, 1);
7928 node = gen_xmlNodePtr(n_node, 2);
7929 node2 = gen_xmlNodePtr(n_node2, 3);
7930
7931 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7932 desret_int(ret_val);
7933 call_tests++;
7934 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7935 des_char_ptr(n_filename, filename, 1);
7936 des_xmlNodePtr(n_node, node, 2);
7937 des_xmlNodePtr(n_node2, node2, 3);
7938 xmlResetLastError();
7939 if (mem_base != xmlMemBlocks()) {
7940 printf("Leak of %d blocks found in xmlShellWrite",
7941 xmlMemBlocks() - mem_base);
7942 test_ret++;
7943 printf(" %d", n_ctxt);
7944 printf(" %d", n_filename);
7945 printf(" %d", n_node);
7946 printf(" %d", n_node2);
7947 printf("\n");
7948 }
7949 }
7950 }
7951 }
7952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007953 function_tests++;
7954#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007955
Daniel Veillarda82b1822004-11-08 16:24:57 +00007956 return(test_ret);
7957}
7958
7959static int
7960test_debugXML(void) {
7961 int test_ret = 0;
7962
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007963 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007964 test_ret += test_xmlBoolToText();
7965 test_ret += test_xmlDebugCheckDocument();
7966 test_ret += test_xmlDebugDumpAttr();
7967 test_ret += test_xmlDebugDumpAttrList();
7968 test_ret += test_xmlDebugDumpDTD();
7969 test_ret += test_xmlDebugDumpDocument();
7970 test_ret += test_xmlDebugDumpDocumentHead();
7971 test_ret += test_xmlDebugDumpEntities();
7972 test_ret += test_xmlDebugDumpNode();
7973 test_ret += test_xmlDebugDumpNodeList();
7974 test_ret += test_xmlDebugDumpOneNode();
7975 test_ret += test_xmlDebugDumpString();
7976 test_ret += test_xmlLsCountNode();
7977 test_ret += test_xmlLsOneNode();
7978 test_ret += test_xmlShell();
7979 test_ret += test_xmlShellBase();
7980 test_ret += test_xmlShellCat();
7981 test_ret += test_xmlShellDir();
7982 test_ret += test_xmlShellDu();
7983 test_ret += test_xmlShellList();
7984 test_ret += test_xmlShellLoad();
7985 test_ret += test_xmlShellPrintXPathResult();
7986 test_ret += test_xmlShellPwd();
7987 test_ret += test_xmlShellSave();
7988 test_ret += test_xmlShellValidate();
7989 test_ret += test_xmlShellWrite();
7990
7991 if (test_ret != 0)
7992 printf("Module debugXML: %d errors\n", test_ret);
7993 return(test_ret);
7994}
7995
7996static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007997test_xmlDictCleanup(void) {
7998 int test_ret = 0;
7999
8000 int mem_base;
8001
8002 mem_base = xmlMemBlocks();
8003
8004 xmlDictCleanup();
8005 call_tests++;
8006 xmlResetLastError();
8007 if (mem_base != xmlMemBlocks()) {
8008 printf("Leak of %d blocks found in xmlDictCleanup",
8009 xmlMemBlocks() - mem_base);
8010 test_ret++;
8011 printf("\n");
8012 }
8013 function_tests++;
8014
8015 return(test_ret);
8016}
8017
8018
8019static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008020test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008022
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008023 int mem_base;
8024 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008025
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008026 mem_base = xmlMemBlocks();
8027
8028 ret_val = xmlDictCreate();
8029 desret_xmlDictPtr(ret_val);
8030 call_tests++;
8031 xmlResetLastError();
8032 if (mem_base != xmlMemBlocks()) {
8033 printf("Leak of %d blocks found in xmlDictCreate",
8034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008035 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008036 printf("\n");
8037 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008039
Daniel Veillard42595322004-11-08 10:52:06 +00008040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008041}
8042
8043
8044static int
8045test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008047
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008048 int mem_base;
8049 xmlDictPtr ret_val;
8050 xmlDictPtr sub; /* an existing dictionnary */
8051 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008052
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008053 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8054 mem_base = xmlMemBlocks();
8055 sub = gen_xmlDictPtr(n_sub, 0);
8056
8057 ret_val = xmlDictCreateSub(sub);
8058 desret_xmlDictPtr(ret_val);
8059 call_tests++;
8060 des_xmlDictPtr(n_sub, sub, 0);
8061 xmlResetLastError();
8062 if (mem_base != xmlMemBlocks()) {
8063 printf("Leak of %d blocks found in xmlDictCreateSub",
8064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008065 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008066 printf(" %d", n_sub);
8067 printf("\n");
8068 }
8069 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008070 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008071
Daniel Veillard42595322004-11-08 10:52:06 +00008072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008073}
8074
8075
8076static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008077test_xmlDictExists(void) {
8078 int test_ret = 0;
8079
8080 int mem_base;
8081 const xmlChar * ret_val;
8082 xmlDictPtr dict; /* the dictionnary */
8083 int n_dict;
8084 xmlChar * name; /* the name of the userdata */
8085 int n_name;
8086 int len; /* the length of the name, if -1 it is recomputed */
8087 int n_len;
8088
8089 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8090 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8091 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8092 mem_base = xmlMemBlocks();
8093 dict = gen_xmlDictPtr(n_dict, 0);
8094 name = gen_const_xmlChar_ptr(n_name, 1);
8095 len = gen_int(n_len, 2);
8096
8097 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8098 desret_const_xmlChar_ptr(ret_val);
8099 call_tests++;
8100 des_xmlDictPtr(n_dict, dict, 0);
8101 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8102 des_int(n_len, len, 2);
8103 xmlResetLastError();
8104 if (mem_base != xmlMemBlocks()) {
8105 printf("Leak of %d blocks found in xmlDictExists",
8106 xmlMemBlocks() - mem_base);
8107 test_ret++;
8108 printf(" %d", n_dict);
8109 printf(" %d", n_name);
8110 printf(" %d", n_len);
8111 printf("\n");
8112 }
8113 }
8114 }
8115 }
8116 function_tests++;
8117
8118 return(test_ret);
8119}
8120
8121
8122static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008123test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008125
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008126 int mem_base;
8127 const xmlChar * ret_val;
8128 xmlDictPtr dict; /* the dictionnary */
8129 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008130 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008131 int n_name;
8132 int len; /* the length of the name, if -1 it is recomputed */
8133 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008134
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008135 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8136 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8137 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8138 mem_base = xmlMemBlocks();
8139 dict = gen_xmlDictPtr(n_dict, 0);
8140 name = gen_const_xmlChar_ptr(n_name, 1);
8141 len = gen_int(n_len, 2);
8142
William M. Brackf13f77f2004-11-12 16:03:48 +00008143 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008144 desret_const_xmlChar_ptr(ret_val);
8145 call_tests++;
8146 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008147 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008148 des_int(n_len, len, 2);
8149 xmlResetLastError();
8150 if (mem_base != xmlMemBlocks()) {
8151 printf("Leak of %d blocks found in xmlDictLookup",
8152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008153 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008154 printf(" %d", n_dict);
8155 printf(" %d", n_name);
8156 printf(" %d", n_len);
8157 printf("\n");
8158 }
8159 }
8160 }
8161 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008162 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008163
Daniel Veillard42595322004-11-08 10:52:06 +00008164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008165}
8166
8167
8168static int
8169test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008171
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008172 int mem_base;
8173 int ret_val;
8174 xmlDictPtr dict; /* the dictionnary */
8175 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008176 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008177 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008178
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008179 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8180 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8181 mem_base = xmlMemBlocks();
8182 dict = gen_xmlDictPtr(n_dict, 0);
8183 str = gen_const_xmlChar_ptr(n_str, 1);
8184
William M. Brackf13f77f2004-11-12 16:03:48 +00008185 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008186 desret_int(ret_val);
8187 call_tests++;
8188 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008189 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008190 xmlResetLastError();
8191 if (mem_base != xmlMemBlocks()) {
8192 printf("Leak of %d blocks found in xmlDictOwns",
8193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008194 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008195 printf(" %d", n_dict);
8196 printf(" %d", n_str);
8197 printf("\n");
8198 }
8199 }
8200 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008202
Daniel Veillard42595322004-11-08 10:52:06 +00008203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008204}
8205
8206
8207static int
8208test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008210
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008211 int mem_base;
8212 const xmlChar * ret_val;
8213 xmlDictPtr dict; /* the dictionnary */
8214 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008215 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008216 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008217 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008218 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008219
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008220 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8221 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8222 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8223 mem_base = xmlMemBlocks();
8224 dict = gen_xmlDictPtr(n_dict, 0);
8225 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8226 name = gen_const_xmlChar_ptr(n_name, 2);
8227
William M. Brackf13f77f2004-11-12 16:03:48 +00008228 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008229 desret_const_xmlChar_ptr(ret_val);
8230 call_tests++;
8231 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008232 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8233 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008234 xmlResetLastError();
8235 if (mem_base != xmlMemBlocks()) {
8236 printf("Leak of %d blocks found in xmlDictQLookup",
8237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008238 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008239 printf(" %d", n_dict);
8240 printf(" %d", n_prefix);
8241 printf(" %d", n_name);
8242 printf("\n");
8243 }
8244 }
8245 }
8246 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008247 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008248
Daniel Veillard42595322004-11-08 10:52:06 +00008249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008250}
8251
8252
8253static int
8254test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008256
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008257 int mem_base;
8258 int ret_val;
8259 xmlDictPtr dict; /* the dictionnary */
8260 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008261
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008262 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8263 mem_base = xmlMemBlocks();
8264 dict = gen_xmlDictPtr(n_dict, 0);
8265
8266 ret_val = xmlDictReference(dict);
8267 xmlDictFree(dict);
8268 desret_int(ret_val);
8269 call_tests++;
8270 des_xmlDictPtr(n_dict, dict, 0);
8271 xmlResetLastError();
8272 if (mem_base != xmlMemBlocks()) {
8273 printf("Leak of %d blocks found in xmlDictReference",
8274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008275 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008276 printf(" %d", n_dict);
8277 printf("\n");
8278 }
8279 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008280 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008281
Daniel Veillard42595322004-11-08 10:52:06 +00008282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008283}
8284
8285
8286static int
8287test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008289
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008290 int mem_base;
8291 int ret_val;
8292 xmlDictPtr dict; /* the dictionnary */
8293 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008294
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008295 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8296 mem_base = xmlMemBlocks();
8297 dict = gen_xmlDictPtr(n_dict, 0);
8298
8299 ret_val = xmlDictSize(dict);
8300 desret_int(ret_val);
8301 call_tests++;
8302 des_xmlDictPtr(n_dict, dict, 0);
8303 xmlResetLastError();
8304 if (mem_base != xmlMemBlocks()) {
8305 printf("Leak of %d blocks found in xmlDictSize",
8306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008307 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008308 printf(" %d", n_dict);
8309 printf("\n");
8310 }
8311 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008312 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008313
Daniel Veillard42595322004-11-08 10:52:06 +00008314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008315}
8316
8317static int
8318test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008320
Daniel Veillard2ae13382005-01-25 23:45:06 +00008321 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8322 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008323 test_ret += test_xmlDictCreate();
8324 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008325 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008326 test_ret += test_xmlDictLookup();
8327 test_ret += test_xmlDictOwns();
8328 test_ret += test_xmlDictQLookup();
8329 test_ret += test_xmlDictReference();
8330 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008331
Daniel Veillard42595322004-11-08 10:52:06 +00008332 if (test_ret != 0)
8333 printf("Module dict: %d errors\n", test_ret);
8334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008335}
8336
8337static int
8338test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008340
William M. Brack21e4ef22005-01-02 09:53:13 +00008341#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008342#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008343 int mem_base;
8344 int ret_val;
8345 unsigned char * out; /* a pointer to an array of bytes to store the result */
8346 int n_out;
8347 int * outlen; /* the length of @out */
8348 int n_outlen;
8349 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8350 int n_in;
8351 int * inlen; /* the length of @in */
8352 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008353
Daniel Veillardce682bc2004-11-05 17:22:25 +00008354 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8355 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8356 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8357 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8358 mem_base = xmlMemBlocks();
8359 out = gen_unsigned_char_ptr(n_out, 0);
8360 outlen = gen_int_ptr(n_outlen, 1);
8361 in = gen_const_unsigned_char_ptr(n_in, 2);
8362 inlen = gen_int_ptr(n_inlen, 3);
8363
William M. Brackf13f77f2004-11-12 16:03:48 +00008364 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008365 desret_int(ret_val);
8366 call_tests++;
8367 des_unsigned_char_ptr(n_out, out, 0);
8368 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008369 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008370 des_int_ptr(n_inlen, inlen, 3);
8371 xmlResetLastError();
8372 if (mem_base != xmlMemBlocks()) {
8373 printf("Leak of %d blocks found in UTF8Toisolat1",
8374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008375 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008376 printf(" %d", n_out);
8377 printf(" %d", n_outlen);
8378 printf(" %d", n_in);
8379 printf(" %d", n_inlen);
8380 printf("\n");
8381 }
8382 }
8383 }
8384 }
8385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008386 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008387#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008388#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008389
Daniel Veillard42595322004-11-08 10:52:06 +00008390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008391}
8392
8393
8394static int
8395test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008397
Daniel Veillardce682bc2004-11-05 17:22:25 +00008398 int mem_base;
8399 int ret_val;
8400 unsigned char * out; /* a pointer to an array of bytes to store the result */
8401 int n_out;
8402 int * outlen; /* the length of @out */
8403 int n_outlen;
8404 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8405 int n_in;
8406 int * inlen; /* the length of @in */
8407 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008408
Daniel Veillardce682bc2004-11-05 17:22:25 +00008409 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8410 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8411 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8412 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8413 mem_base = xmlMemBlocks();
8414 out = gen_unsigned_char_ptr(n_out, 0);
8415 outlen = gen_int_ptr(n_outlen, 1);
8416 in = gen_const_unsigned_char_ptr(n_in, 2);
8417 inlen = gen_int_ptr(n_inlen, 3);
8418
William M. Brackf13f77f2004-11-12 16:03:48 +00008419 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008420 desret_int(ret_val);
8421 call_tests++;
8422 des_unsigned_char_ptr(n_out, out, 0);
8423 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008424 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008425 des_int_ptr(n_inlen, inlen, 3);
8426 xmlResetLastError();
8427 if (mem_base != xmlMemBlocks()) {
8428 printf("Leak of %d blocks found in isolat1ToUTF8",
8429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008430 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008431 printf(" %d", n_out);
8432 printf(" %d", n_outlen);
8433 printf(" %d", n_in);
8434 printf(" %d", n_inlen);
8435 printf("\n");
8436 }
8437 }
8438 }
8439 }
8440 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008442
Daniel Veillard42595322004-11-08 10:52:06 +00008443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008444}
8445
8446
8447static int
8448test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008450
8451 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008452 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008453 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008454 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008455 int n_alias;
8456
8457 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8458 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008459 name = gen_const_char_ptr(n_name, 0);
8460 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008461
William M. Brackf13f77f2004-11-12 16:03:48 +00008462 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008463 desret_int(ret_val);
8464 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008465 des_const_char_ptr(n_name, (const char *)name, 0);
8466 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008467 xmlResetLastError();
8468 }
8469 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008470 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008471
Daniel Veillard42595322004-11-08 10:52:06 +00008472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008473}
8474
8475
Daniel Veillardce682bc2004-11-05 17:22:25 +00008476#define gen_nb_xmlCharEncodingHandler_ptr 1
8477static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8478 return(NULL);
8479}
8480static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8481}
8482
Daniel Veillardd93f6252004-11-02 15:53:51 +00008483static int
8484test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008486
Daniel Veillardce682bc2004-11-05 17:22:25 +00008487 int mem_base;
8488 int ret_val;
8489 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8490 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008491
Daniel Veillardce682bc2004-11-05 17:22:25 +00008492 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8493 mem_base = xmlMemBlocks();
8494 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8495
8496 ret_val = xmlCharEncCloseFunc(handler);
8497 desret_int(ret_val);
8498 call_tests++;
8499 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8500 xmlResetLastError();
8501 if (mem_base != xmlMemBlocks()) {
8502 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008504 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008505 printf(" %d", n_handler);
8506 printf("\n");
8507 }
8508 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008509 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008510
Daniel Veillard42595322004-11-08 10:52:06 +00008511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008512}
8513
8514
8515static int
8516test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008518
Daniel Veillardce682bc2004-11-05 17:22:25 +00008519 int mem_base;
8520 int ret_val;
8521 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8522 int n_handler;
8523 xmlBufferPtr out; /* an xmlBuffer for the output. */
8524 int n_out;
8525 xmlBufferPtr in; /* an xmlBuffer for the input */
8526 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008527
Daniel Veillardce682bc2004-11-05 17:22:25 +00008528 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8529 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8530 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8531 mem_base = xmlMemBlocks();
8532 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8533 out = gen_xmlBufferPtr(n_out, 1);
8534 in = gen_xmlBufferPtr(n_in, 2);
8535
8536 ret_val = xmlCharEncFirstLine(handler, out, in);
8537 desret_int(ret_val);
8538 call_tests++;
8539 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8540 des_xmlBufferPtr(n_out, out, 1);
8541 des_xmlBufferPtr(n_in, in, 2);
8542 xmlResetLastError();
8543 if (mem_base != xmlMemBlocks()) {
8544 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008546 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008547 printf(" %d", n_handler);
8548 printf(" %d", n_out);
8549 printf(" %d", n_in);
8550 printf("\n");
8551 }
8552 }
8553 }
8554 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008555 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008556
Daniel Veillard42595322004-11-08 10:52:06 +00008557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008558}
8559
8560
8561static int
8562test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008564
Daniel Veillardce682bc2004-11-05 17:22:25 +00008565 int mem_base;
8566 int ret_val;
8567 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8568 int n_handler;
8569 xmlBufferPtr out; /* an xmlBuffer for the output. */
8570 int n_out;
8571 xmlBufferPtr in; /* an xmlBuffer for the input */
8572 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008573
Daniel Veillardce682bc2004-11-05 17:22:25 +00008574 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8575 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8576 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8577 mem_base = xmlMemBlocks();
8578 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8579 out = gen_xmlBufferPtr(n_out, 1);
8580 in = gen_xmlBufferPtr(n_in, 2);
8581
8582 ret_val = xmlCharEncInFunc(handler, out, in);
8583 desret_int(ret_val);
8584 call_tests++;
8585 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8586 des_xmlBufferPtr(n_out, out, 1);
8587 des_xmlBufferPtr(n_in, in, 2);
8588 xmlResetLastError();
8589 if (mem_base != xmlMemBlocks()) {
8590 printf("Leak of %d blocks found in xmlCharEncInFunc",
8591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008592 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008593 printf(" %d", n_handler);
8594 printf(" %d", n_out);
8595 printf(" %d", n_in);
8596 printf("\n");
8597 }
8598 }
8599 }
8600 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008602
Daniel Veillard42595322004-11-08 10:52:06 +00008603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008604}
8605
8606
8607static int
8608test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008610
Daniel Veillardce682bc2004-11-05 17:22:25 +00008611 int mem_base;
8612 int ret_val;
8613 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8614 int n_handler;
8615 xmlBufferPtr out; /* an xmlBuffer for the output. */
8616 int n_out;
8617 xmlBufferPtr in; /* an xmlBuffer for the input */
8618 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008619
Daniel Veillardce682bc2004-11-05 17:22:25 +00008620 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8621 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8622 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8623 mem_base = xmlMemBlocks();
8624 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8625 out = gen_xmlBufferPtr(n_out, 1);
8626 in = gen_xmlBufferPtr(n_in, 2);
8627
8628 ret_val = xmlCharEncOutFunc(handler, out, in);
8629 desret_int(ret_val);
8630 call_tests++;
8631 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8632 des_xmlBufferPtr(n_out, out, 1);
8633 des_xmlBufferPtr(n_in, in, 2);
8634 xmlResetLastError();
8635 if (mem_base != xmlMemBlocks()) {
8636 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008638 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008639 printf(" %d", n_handler);
8640 printf(" %d", n_out);
8641 printf(" %d", n_in);
8642 printf("\n");
8643 }
8644 }
8645 }
8646 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008648
Daniel Veillard42595322004-11-08 10:52:06 +00008649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008650}
8651
8652
8653static int
8654test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008656
8657
8658
8659 xmlCleanupCharEncodingHandlers();
8660 call_tests++;
8661 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008662 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008663
Daniel Veillard42595322004-11-08 10:52:06 +00008664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008665}
8666
8667
8668static int
8669test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008671
8672 int mem_base;
8673
8674 mem_base = xmlMemBlocks();
8675
8676 xmlCleanupEncodingAliases();
8677 call_tests++;
8678 xmlResetLastError();
8679 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008680 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008682 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008683 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008684 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008686
Daniel Veillard42595322004-11-08 10:52:06 +00008687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008688}
8689
8690
8691static int
8692test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008694
8695 int mem_base;
8696 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008697 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008698 int n_alias;
8699
8700 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008702 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008703
William M. Brackf13f77f2004-11-12 16:03:48 +00008704 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008705 desret_int(ret_val);
8706 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008707 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008708 xmlResetLastError();
8709 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008710 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008712 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008713 printf(" %d", n_alias);
8714 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008715 }
8716 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008717 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008718
Daniel Veillard42595322004-11-08 10:52:06 +00008719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008720}
8721
8722
8723static int
8724test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008726
Daniel Veillardce682bc2004-11-05 17:22:25 +00008727 int mem_base;
8728 xmlCharEncoding ret_val;
8729 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). */
8730 int n_in;
8731 int len; /* pointer to the length of the buffer */
8732 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008733
Daniel Veillardce682bc2004-11-05 17:22:25 +00008734 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8735 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8736 mem_base = xmlMemBlocks();
8737 in = gen_const_unsigned_char_ptr(n_in, 0);
8738 len = gen_int(n_len, 1);
8739
William M. Brackf13f77f2004-11-12 16:03:48 +00008740 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008741 desret_xmlCharEncoding(ret_val);
8742 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008743 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008744 des_int(n_len, len, 1);
8745 xmlResetLastError();
8746 if (mem_base != xmlMemBlocks()) {
8747 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008749 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008750 printf(" %d", n_in);
8751 printf(" %d", n_len);
8752 printf("\n");
8753 }
8754 }
8755 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008756 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008757
Daniel Veillard42595322004-11-08 10:52:06 +00008758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759}
8760
8761
8762static int
8763test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765
8766
8767 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008769}
8770
8771
8772static int
8773test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008775
8776
8777 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008779}
8780
8781
8782static int
8783test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008785
Daniel Veillard3d97e662004-11-04 10:49:00 +00008786 int mem_base;
8787 const char * ret_val;
8788 xmlCharEncoding enc; /* the encoding */
8789 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008790
Daniel Veillard3d97e662004-11-04 10:49:00 +00008791 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8792 mem_base = xmlMemBlocks();
8793 enc = gen_xmlCharEncoding(n_enc, 0);
8794
8795 ret_val = xmlGetCharEncodingName(enc);
8796 desret_const_char_ptr(ret_val);
8797 call_tests++;
8798 des_xmlCharEncoding(n_enc, enc, 0);
8799 xmlResetLastError();
8800 if (mem_base != xmlMemBlocks()) {
8801 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008803 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008804 printf(" %d", n_enc);
8805 printf("\n");
8806 }
8807 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008808 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008809
Daniel Veillard42595322004-11-08 10:52:06 +00008810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008811}
8812
8813
8814static int
8815test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008817
8818 int mem_base;
8819 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008820 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008821 int n_alias;
8822
8823 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8824 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008825 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008826
William M. Brackf13f77f2004-11-12 16:03:48 +00008827 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008828 desret_const_char_ptr(ret_val);
8829 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008830 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008831 xmlResetLastError();
8832 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008833 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008835 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008836 printf(" %d", n_alias);
8837 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008838 }
8839 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008840 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008841
Daniel Veillard42595322004-11-08 10:52:06 +00008842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008843}
8844
8845
8846static int
8847test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008849
8850
8851
8852 xmlInitCharEncodingHandlers();
8853 call_tests++;
8854 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008855 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008856
Daniel Veillard42595322004-11-08 10:52:06 +00008857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008858}
8859
8860
8861static int
8862test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008864
8865
8866 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008868}
8869
8870
8871static int
8872test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008874
Daniel Veillard3d97e662004-11-04 10:49:00 +00008875 int mem_base;
8876 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008877 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008878 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008879
Daniel Veillard3d97e662004-11-04 10:49:00 +00008880 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8881 mem_base = xmlMemBlocks();
8882 name = gen_const_char_ptr(n_name, 0);
8883
William M. Brackf13f77f2004-11-12 16:03:48 +00008884 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008885 desret_xmlCharEncoding(ret_val);
8886 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008887 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008888 xmlResetLastError();
8889 if (mem_base != xmlMemBlocks()) {
8890 printf("Leak of %d blocks found in xmlParseCharEncoding",
8891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008892 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008893 printf(" %d", n_name);
8894 printf("\n");
8895 }
8896 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008897 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008898
Daniel Veillard42595322004-11-08 10:52:06 +00008899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008900}
8901
8902
Daniel Veillardce682bc2004-11-05 17:22:25 +00008903#define gen_nb_xmlCharEncodingHandlerPtr 1
8904static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8905 return(NULL);
8906}
8907static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8908}
8909
Daniel Veillardd93f6252004-11-02 15:53:51 +00008910static int
8911test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008913
Daniel Veillardce682bc2004-11-05 17:22:25 +00008914 int mem_base;
8915 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8916 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008917
Daniel Veillardce682bc2004-11-05 17:22:25 +00008918 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8919 mem_base = xmlMemBlocks();
8920 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8921
8922 xmlRegisterCharEncodingHandler(handler);
8923 call_tests++;
8924 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8925 xmlResetLastError();
8926 if (mem_base != xmlMemBlocks()) {
8927 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008929 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008930 printf(" %d", n_handler);
8931 printf("\n");
8932 }
8933 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008934 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008935
Daniel Veillard42595322004-11-08 10:52:06 +00008936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008937}
8938
8939static int
8940test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008942
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008943 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008944 test_ret += test_UTF8Toisolat1();
8945 test_ret += test_isolat1ToUTF8();
8946 test_ret += test_xmlAddEncodingAlias();
8947 test_ret += test_xmlCharEncCloseFunc();
8948 test_ret += test_xmlCharEncFirstLine();
8949 test_ret += test_xmlCharEncInFunc();
8950 test_ret += test_xmlCharEncOutFunc();
8951 test_ret += test_xmlCleanupCharEncodingHandlers();
8952 test_ret += test_xmlCleanupEncodingAliases();
8953 test_ret += test_xmlDelEncodingAlias();
8954 test_ret += test_xmlDetectCharEncoding();
8955 test_ret += test_xmlFindCharEncodingHandler();
8956 test_ret += test_xmlGetCharEncodingHandler();
8957 test_ret += test_xmlGetCharEncodingName();
8958 test_ret += test_xmlGetEncodingAlias();
8959 test_ret += test_xmlInitCharEncodingHandlers();
8960 test_ret += test_xmlNewCharEncodingHandler();
8961 test_ret += test_xmlParseCharEncoding();
8962 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008963
Daniel Veillard42595322004-11-08 10:52:06 +00008964 if (test_ret != 0)
8965 printf("Module encoding: %d errors\n", test_ret);
8966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008967}
8968
8969static int
8970test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008972
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008973 int mem_base;
8974 xmlEntityPtr ret_val;
8975 xmlDocPtr doc; /* the document */
8976 int n_doc;
8977 xmlChar * name; /* the entity name */
8978 int n_name;
8979 int type; /* the entity type XML_xxx_yyy_ENTITY */
8980 int n_type;
8981 xmlChar * ExternalID; /* the entity external ID if available */
8982 int n_ExternalID;
8983 xmlChar * SystemID; /* the entity system ID if available */
8984 int n_SystemID;
8985 xmlChar * content; /* the entity content */
8986 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008987
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008988 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8989 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8990 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8991 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8992 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8993 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8994 mem_base = xmlMemBlocks();
8995 doc = gen_xmlDocPtr(n_doc, 0);
8996 name = gen_const_xmlChar_ptr(n_name, 1);
8997 type = gen_int(n_type, 2);
8998 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8999 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9000 content = gen_const_xmlChar_ptr(n_content, 5);
9001
William M. Brackf13f77f2004-11-12 16:03:48 +00009002 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009003 desret_xmlEntityPtr(ret_val);
9004 call_tests++;
9005 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009006 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009007 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009008 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9009 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9010 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009011 xmlResetLastError();
9012 if (mem_base != xmlMemBlocks()) {
9013 printf("Leak of %d blocks found in xmlAddDocEntity",
9014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009015 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009016 printf(" %d", n_doc);
9017 printf(" %d", n_name);
9018 printf(" %d", n_type);
9019 printf(" %d", n_ExternalID);
9020 printf(" %d", n_SystemID);
9021 printf(" %d", n_content);
9022 printf("\n");
9023 }
9024 }
9025 }
9026 }
9027 }
9028 }
9029 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009031
Daniel Veillard42595322004-11-08 10:52:06 +00009032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009033}
9034
9035
9036static int
9037test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009039
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009040 int mem_base;
9041 xmlEntityPtr ret_val;
9042 xmlDocPtr doc; /* the document */
9043 int n_doc;
9044 xmlChar * name; /* the entity name */
9045 int n_name;
9046 int type; /* the entity type XML_xxx_yyy_ENTITY */
9047 int n_type;
9048 xmlChar * ExternalID; /* the entity external ID if available */
9049 int n_ExternalID;
9050 xmlChar * SystemID; /* the entity system ID if available */
9051 int n_SystemID;
9052 xmlChar * content; /* the entity content */
9053 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009054
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009055 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9056 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9057 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9058 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9059 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9060 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9061 mem_base = xmlMemBlocks();
9062 doc = gen_xmlDocPtr(n_doc, 0);
9063 name = gen_const_xmlChar_ptr(n_name, 1);
9064 type = gen_int(n_type, 2);
9065 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9066 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9067 content = gen_const_xmlChar_ptr(n_content, 5);
9068
William M. Brackf13f77f2004-11-12 16:03:48 +00009069 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009070 desret_xmlEntityPtr(ret_val);
9071 call_tests++;
9072 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009073 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009074 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009075 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9076 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9077 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009078 xmlResetLastError();
9079 if (mem_base != xmlMemBlocks()) {
9080 printf("Leak of %d blocks found in xmlAddDtdEntity",
9081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009082 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009083 printf(" %d", n_doc);
9084 printf(" %d", n_name);
9085 printf(" %d", n_type);
9086 printf(" %d", n_ExternalID);
9087 printf(" %d", n_SystemID);
9088 printf(" %d", n_content);
9089 printf("\n");
9090 }
9091 }
9092 }
9093 }
9094 }
9095 }
9096 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009097 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009098
Daniel Veillard42595322004-11-08 10:52:06 +00009099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009100}
9101
9102
9103static int
9104test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009106
William M. Brack21e4ef22005-01-02 09:53:13 +00009107#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009108#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009109 int mem_base;
9110
9111 mem_base = xmlMemBlocks();
9112
9113 xmlCleanupPredefinedEntities();
9114 call_tests++;
9115 xmlResetLastError();
9116 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009117 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009119 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009120 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009122 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009123#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009124#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009125
Daniel Veillard42595322004-11-08 10:52:06 +00009126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009127}
9128
9129
Daniel Veillardce682bc2004-11-05 17:22:25 +00009130#define gen_nb_xmlEntitiesTablePtr 1
9131static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9132 return(NULL);
9133}
9134static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9135}
9136
Daniel Veillardd93f6252004-11-02 15:53:51 +00009137static int
9138test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009140
9141
9142 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009144}
9145
9146
9147static int
9148test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009150
9151
9152 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009154}
9155
9156
9157static int
9158test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009160
William M. Brack21e4ef22005-01-02 09:53:13 +00009161#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009162 int mem_base;
9163 xmlBufferPtr buf; /* An XML buffer. */
9164 int n_buf;
9165 xmlEntitiesTablePtr table; /* An entity table */
9166 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009167
Daniel Veillardce682bc2004-11-05 17:22:25 +00009168 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9169 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9170 mem_base = xmlMemBlocks();
9171 buf = gen_xmlBufferPtr(n_buf, 0);
9172 table = gen_xmlEntitiesTablePtr(n_table, 1);
9173
9174 xmlDumpEntitiesTable(buf, table);
9175 call_tests++;
9176 des_xmlBufferPtr(n_buf, buf, 0);
9177 des_xmlEntitiesTablePtr(n_table, table, 1);
9178 xmlResetLastError();
9179 if (mem_base != xmlMemBlocks()) {
9180 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009182 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009183 printf(" %d", n_buf);
9184 printf(" %d", n_table);
9185 printf("\n");
9186 }
9187 }
9188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009189 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009190#endif
9191
Daniel Veillard42595322004-11-08 10:52:06 +00009192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009193}
9194
9195
Daniel Veillardce682bc2004-11-05 17:22:25 +00009196#define gen_nb_xmlEntityPtr 1
9197static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9198 return(NULL);
9199}
9200static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9201}
9202
Daniel Veillardd93f6252004-11-02 15:53:51 +00009203static int
9204test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009206
William M. Brack21e4ef22005-01-02 09:53:13 +00009207#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009208 int mem_base;
9209 xmlBufferPtr buf; /* An XML buffer. */
9210 int n_buf;
9211 xmlEntityPtr ent; /* An entity table */
9212 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009213
Daniel Veillardce682bc2004-11-05 17:22:25 +00009214 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9215 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9216 mem_base = xmlMemBlocks();
9217 buf = gen_xmlBufferPtr(n_buf, 0);
9218 ent = gen_xmlEntityPtr(n_ent, 1);
9219
9220 xmlDumpEntityDecl(buf, ent);
9221 call_tests++;
9222 des_xmlBufferPtr(n_buf, buf, 0);
9223 des_xmlEntityPtr(n_ent, ent, 1);
9224 xmlResetLastError();
9225 if (mem_base != xmlMemBlocks()) {
9226 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009228 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009229 printf(" %d", n_buf);
9230 printf(" %d", n_ent);
9231 printf("\n");
9232 }
9233 }
9234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009235 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009236#endif
9237
Daniel Veillard42595322004-11-08 10:52:06 +00009238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009239}
9240
9241
9242static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009243test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009245
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009246 int mem_base;
9247 xmlChar * ret_val;
9248 xmlDocPtr doc; /* the document containing the string */
9249 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009250 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009251 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009252
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009253 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9254 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009256 doc = gen_xmlDocPtr(n_doc, 0);
9257 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009258
William M. Brackf13f77f2004-11-12 16:03:48 +00009259 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009260 desret_xmlChar_ptr(ret_val);
9261 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009262 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009263 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009264 xmlResetLastError();
9265 if (mem_base != xmlMemBlocks()) {
9266 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009268 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009269 printf(" %d", n_doc);
9270 printf(" %d", n_input);
9271 printf("\n");
9272 }
9273 }
9274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009276
Daniel Veillard42595322004-11-08 10:52:06 +00009277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009278}
9279
9280
9281static int
9282test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009284
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009285 int mem_base;
9286 xmlChar * ret_val;
9287 xmlDocPtr doc; /* the document containing the string */
9288 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009289 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009290 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009291
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009292 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9293 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009295 doc = gen_xmlDocPtr(n_doc, 0);
9296 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009297
William M. Brackf13f77f2004-11-12 16:03:48 +00009298 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009299 desret_xmlChar_ptr(ret_val);
9300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009301 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009302 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009303 xmlResetLastError();
9304 if (mem_base != xmlMemBlocks()) {
9305 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009307 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009308 printf(" %d", n_doc);
9309 printf(" %d", n_input);
9310 printf("\n");
9311 }
9312 }
9313 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009315
Daniel Veillard42595322004-11-08 10:52:06 +00009316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009317}
9318
9319
9320static int
9321test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009323
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009324 int mem_base;
9325 xmlEntityPtr ret_val;
9326 xmlDocPtr doc; /* the document referencing the entity */
9327 int n_doc;
9328 xmlChar * name; /* the entity name */
9329 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009330
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009331 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9332 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9333 mem_base = xmlMemBlocks();
9334 doc = gen_xmlDocPtr(n_doc, 0);
9335 name = gen_const_xmlChar_ptr(n_name, 1);
9336
William M. Brackf13f77f2004-11-12 16:03:48 +00009337 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009338 desret_xmlEntityPtr(ret_val);
9339 call_tests++;
9340 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009341 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009342 xmlResetLastError();
9343 if (mem_base != xmlMemBlocks()) {
9344 printf("Leak of %d blocks found in xmlGetDocEntity",
9345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009346 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009347 printf(" %d", n_doc);
9348 printf(" %d", n_name);
9349 printf("\n");
9350 }
9351 }
9352 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009353 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009354
Daniel Veillard42595322004-11-08 10:52:06 +00009355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009356}
9357
9358
9359static int
9360test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009362
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009363 int mem_base;
9364 xmlEntityPtr ret_val;
9365 xmlDocPtr doc; /* the document referencing the entity */
9366 int n_doc;
9367 xmlChar * name; /* the entity name */
9368 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009369
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009370 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9372 mem_base = xmlMemBlocks();
9373 doc = gen_xmlDocPtr(n_doc, 0);
9374 name = gen_const_xmlChar_ptr(n_name, 1);
9375
William M. Brackf13f77f2004-11-12 16:03:48 +00009376 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009377 desret_xmlEntityPtr(ret_val);
9378 call_tests++;
9379 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009380 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009381 xmlResetLastError();
9382 if (mem_base != xmlMemBlocks()) {
9383 printf("Leak of %d blocks found in xmlGetDtdEntity",
9384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009385 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009386 printf(" %d", n_doc);
9387 printf(" %d", n_name);
9388 printf("\n");
9389 }
9390 }
9391 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009393
Daniel Veillard42595322004-11-08 10:52:06 +00009394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009395}
9396
9397
9398static int
9399test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009401
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009402 int mem_base;
9403 xmlEntityPtr ret_val;
9404 xmlDocPtr doc; /* the document referencing the entity */
9405 int n_doc;
9406 xmlChar * name; /* the entity name */
9407 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009408
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009409 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9410 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9411 mem_base = xmlMemBlocks();
9412 doc = gen_xmlDocPtr(n_doc, 0);
9413 name = gen_const_xmlChar_ptr(n_name, 1);
9414
William M. Brackf13f77f2004-11-12 16:03:48 +00009415 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009416 desret_xmlEntityPtr(ret_val);
9417 call_tests++;
9418 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009419 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009420 xmlResetLastError();
9421 if (mem_base != xmlMemBlocks()) {
9422 printf("Leak of %d blocks found in xmlGetParameterEntity",
9423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009424 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009425 printf(" %d", n_doc);
9426 printf(" %d", n_name);
9427 printf("\n");
9428 }
9429 }
9430 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009431 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009432
Daniel Veillard42595322004-11-08 10:52:06 +00009433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009434}
9435
9436
9437static int
9438test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009440
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009441 int mem_base;
9442 xmlEntityPtr ret_val;
9443 xmlChar * name; /* the entity name */
9444 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009445
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009446 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9447 mem_base = xmlMemBlocks();
9448 name = gen_const_xmlChar_ptr(n_name, 0);
9449
William M. Brackf13f77f2004-11-12 16:03:48 +00009450 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009451 desret_xmlEntityPtr(ret_val);
9452 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009453 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009454 xmlResetLastError();
9455 if (mem_base != xmlMemBlocks()) {
9456 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009458 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009459 printf(" %d", n_name);
9460 printf("\n");
9461 }
9462 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009463 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009464
Daniel Veillard42595322004-11-08 10:52:06 +00009465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009466}
9467
9468
9469static int
9470test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009472
William M. Brack21e4ef22005-01-02 09:53:13 +00009473#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009474#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009475 int mem_base;
9476
9477 mem_base = xmlMemBlocks();
9478
9479 xmlInitializePredefinedEntities();
9480 call_tests++;
9481 xmlResetLastError();
9482 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009483 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009485 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009486 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009488 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009489#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009490#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009491
Daniel Veillard42595322004-11-08 10:52:06 +00009492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009493}
9494
9495static int
9496test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009498
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009499 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009500 test_ret += test_xmlAddDocEntity();
9501 test_ret += test_xmlAddDtdEntity();
9502 test_ret += test_xmlCleanupPredefinedEntities();
9503 test_ret += test_xmlCopyEntitiesTable();
9504 test_ret += test_xmlCreateEntitiesTable();
9505 test_ret += test_xmlDumpEntitiesTable();
9506 test_ret += test_xmlDumpEntityDecl();
9507 test_ret += test_xmlEncodeEntitiesReentrant();
9508 test_ret += test_xmlEncodeSpecialChars();
9509 test_ret += test_xmlGetDocEntity();
9510 test_ret += test_xmlGetDtdEntity();
9511 test_ret += test_xmlGetParameterEntity();
9512 test_ret += test_xmlGetPredefinedEntity();
9513 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009514
Daniel Veillard42595322004-11-08 10:52:06 +00009515 if (test_ret != 0)
9516 printf("Module entities: %d errors\n", test_ret);
9517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009518}
9519
9520static int
9521test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009523
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009524 int mem_base;
9525 int ret_val;
9526 xmlHashTablePtr table; /* the hash table */
9527 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009528 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009529 int n_name;
9530 void * userdata; /* a pointer to the userdata */
9531 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009532
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009533 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9534 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9535 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9536 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009537 table = gen_xmlHashTablePtr(n_table, 0);
9538 name = gen_const_xmlChar_ptr(n_name, 1);
9539 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009540
William M. Brackf13f77f2004-11-12 16:03:48 +00009541 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009542 desret_int(ret_val);
9543 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009544 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009545 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009546 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009547 xmlResetLastError();
9548 if (mem_base != xmlMemBlocks()) {
9549 printf("Leak of %d blocks found in xmlHashAddEntry",
9550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009551 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009552 printf(" %d", n_table);
9553 printf(" %d", n_name);
9554 printf(" %d", n_userdata);
9555 printf("\n");
9556 }
9557 }
9558 }
9559 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009560 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009561
Daniel Veillard42595322004-11-08 10:52:06 +00009562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009563}
9564
9565
9566static int
9567test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009569
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009570 int mem_base;
9571 int ret_val;
9572 xmlHashTablePtr table; /* the hash table */
9573 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009574 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009575 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009576 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009577 int n_name2;
9578 void * userdata; /* a pointer to the userdata */
9579 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009580
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009581 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9582 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9583 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9584 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9585 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009586 table = gen_xmlHashTablePtr(n_table, 0);
9587 name = gen_const_xmlChar_ptr(n_name, 1);
9588 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9589 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009590
William M. Brackf13f77f2004-11-12 16:03:48 +00009591 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009592 desret_int(ret_val);
9593 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009594 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009595 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9596 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009597 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009598 xmlResetLastError();
9599 if (mem_base != xmlMemBlocks()) {
9600 printf("Leak of %d blocks found in xmlHashAddEntry2",
9601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009602 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009603 printf(" %d", n_table);
9604 printf(" %d", n_name);
9605 printf(" %d", n_name2);
9606 printf(" %d", n_userdata);
9607 printf("\n");
9608 }
9609 }
9610 }
9611 }
9612 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009613 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009614
Daniel Veillard42595322004-11-08 10:52:06 +00009615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009616}
9617
9618
9619static int
9620test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009622
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009623 int mem_base;
9624 int ret_val;
9625 xmlHashTablePtr table; /* the hash table */
9626 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009627 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009628 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009629 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009630 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009631 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009632 int n_name3;
9633 void * userdata; /* a pointer to the userdata */
9634 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009635
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009636 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9637 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9638 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9639 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9640 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9641 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009642 table = gen_xmlHashTablePtr(n_table, 0);
9643 name = gen_const_xmlChar_ptr(n_name, 1);
9644 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9645 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9646 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009647
William M. Brackf13f77f2004-11-12 16:03:48 +00009648 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009649 desret_int(ret_val);
9650 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009651 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009652 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9653 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9654 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009655 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009656 xmlResetLastError();
9657 if (mem_base != xmlMemBlocks()) {
9658 printf("Leak of %d blocks found in xmlHashAddEntry3",
9659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009660 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009661 printf(" %d", n_table);
9662 printf(" %d", n_name);
9663 printf(" %d", n_name2);
9664 printf(" %d", n_name3);
9665 printf(" %d", n_userdata);
9666 printf("\n");
9667 }
9668 }
9669 }
9670 }
9671 }
9672 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009673 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009674
Daniel Veillard42595322004-11-08 10:52:06 +00009675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009676}
9677
9678
9679static int
9680test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009682
9683
9684 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009686}
9687
9688
9689static int
9690test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009692
9693
9694 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009696}
9697
9698
9699static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009700test_xmlHashCreateDict(void) {
9701 int test_ret = 0;
9702
9703
9704 /* missing type support */
9705 return(test_ret);
9706}
9707
9708
9709static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009710test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009712
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009713 int mem_base;
9714 void * ret_val;
9715 xmlHashTablePtr table; /* the hash table */
9716 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009717 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009718 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009719
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009720 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9721 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009723 table = gen_xmlHashTablePtr(n_table, 0);
9724 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009725
William M. Brackf13f77f2004-11-12 16:03:48 +00009726 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009727 desret_void_ptr(ret_val);
9728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009729 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009730 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009731 xmlResetLastError();
9732 if (mem_base != xmlMemBlocks()) {
9733 printf("Leak of %d blocks found in xmlHashLookup",
9734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009735 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009736 printf(" %d", n_table);
9737 printf(" %d", n_name);
9738 printf("\n");
9739 }
9740 }
9741 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009743
Daniel Veillard42595322004-11-08 10:52:06 +00009744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009745}
9746
9747
9748static int
9749test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009751
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009752 int mem_base;
9753 void * ret_val;
9754 xmlHashTablePtr table; /* the hash table */
9755 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009756 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009757 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009758 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009759 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009760
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009761 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9762 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9763 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009765 table = gen_xmlHashTablePtr(n_table, 0);
9766 name = gen_const_xmlChar_ptr(n_name, 1);
9767 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009768
William M. Brackf13f77f2004-11-12 16:03:48 +00009769 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009770 desret_void_ptr(ret_val);
9771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009772 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009773 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9774 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009775 xmlResetLastError();
9776 if (mem_base != xmlMemBlocks()) {
9777 printf("Leak of %d blocks found in xmlHashLookup2",
9778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009779 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009780 printf(" %d", n_table);
9781 printf(" %d", n_name);
9782 printf(" %d", n_name2);
9783 printf("\n");
9784 }
9785 }
9786 }
9787 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009788 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009789
Daniel Veillard42595322004-11-08 10:52:06 +00009790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009791}
9792
9793
9794static int
9795test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009797
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009798 int mem_base;
9799 void * ret_val;
9800 xmlHashTablePtr table; /* the hash table */
9801 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009802 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009803 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009804 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009805 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009806 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009807 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009808
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009809 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9810 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9811 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9812 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9813 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009814 table = gen_xmlHashTablePtr(n_table, 0);
9815 name = gen_const_xmlChar_ptr(n_name, 1);
9816 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9817 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009818
William M. Brackf13f77f2004-11-12 16:03:48 +00009819 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009820 desret_void_ptr(ret_val);
9821 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009822 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009823 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9824 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9825 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009826 xmlResetLastError();
9827 if (mem_base != xmlMemBlocks()) {
9828 printf("Leak of %d blocks found in xmlHashLookup3",
9829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009830 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009831 printf(" %d", n_table);
9832 printf(" %d", n_name);
9833 printf(" %d", n_name2);
9834 printf(" %d", n_name3);
9835 printf("\n");
9836 }
9837 }
9838 }
9839 }
9840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009842
Daniel Veillard42595322004-11-08 10:52:06 +00009843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009844}
9845
9846
9847static int
9848test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009850
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009851 int mem_base;
9852 void * ret_val;
9853 xmlHashTablePtr table; /* the hash table */
9854 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009855 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009856 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009857 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009858 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009859
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009860 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9861 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9862 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9863 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009864 table = gen_xmlHashTablePtr(n_table, 0);
9865 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9866 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009867
William M. Brackf13f77f2004-11-12 16:03:48 +00009868 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009869 desret_void_ptr(ret_val);
9870 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009871 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009872 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9873 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009874 xmlResetLastError();
9875 if (mem_base != xmlMemBlocks()) {
9876 printf("Leak of %d blocks found in xmlHashQLookup",
9877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009878 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009879 printf(" %d", n_table);
9880 printf(" %d", n_prefix);
9881 printf(" %d", n_name);
9882 printf("\n");
9883 }
9884 }
9885 }
9886 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009887 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009888
Daniel Veillard42595322004-11-08 10:52:06 +00009889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009890}
9891
9892
9893static int
9894test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009896
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009897 int mem_base;
9898 void * ret_val;
9899 xmlHashTablePtr table; /* the hash table */
9900 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009901 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009902 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009903 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009904 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009905 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009906 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009907 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009908 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009909
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9911 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9912 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9913 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9914 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009916 table = gen_xmlHashTablePtr(n_table, 0);
9917 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9918 name = gen_const_xmlChar_ptr(n_name, 2);
9919 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9920 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009921
William M. Brackf13f77f2004-11-12 16:03:48 +00009922 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009923 desret_void_ptr(ret_val);
9924 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009925 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009926 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9927 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9928 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9929 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009930 xmlResetLastError();
9931 if (mem_base != xmlMemBlocks()) {
9932 printf("Leak of %d blocks found in xmlHashQLookup2",
9933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009934 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009935 printf(" %d", n_table);
9936 printf(" %d", n_prefix);
9937 printf(" %d", n_name);
9938 printf(" %d", n_prefix2);
9939 printf(" %d", n_name2);
9940 printf("\n");
9941 }
9942 }
9943 }
9944 }
9945 }
9946 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009947 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009948
Daniel Veillard42595322004-11-08 10:52:06 +00009949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009950}
9951
9952
9953static int
9954test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009956
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009957 int mem_base;
9958 void * ret_val;
9959 xmlHashTablePtr table; /* the hash table */
9960 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009961 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009962 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009963 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009964 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009965 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009966 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009967 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009968 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009969 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009970 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009971 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009972 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009973
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009974 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9975 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9976 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9977 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9978 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9979 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9980 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009982 table = gen_xmlHashTablePtr(n_table, 0);
9983 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9984 name = gen_const_xmlChar_ptr(n_name, 2);
9985 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9986 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9987 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9988 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009989
William M. Brackf13f77f2004-11-12 16:03:48 +00009990 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 +00009991 desret_void_ptr(ret_val);
9992 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009993 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009994 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9995 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9996 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9997 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9998 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9999 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010000 xmlResetLastError();
10001 if (mem_base != xmlMemBlocks()) {
10002 printf("Leak of %d blocks found in xmlHashQLookup3",
10003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010004 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010005 printf(" %d", n_table);
10006 printf(" %d", n_prefix);
10007 printf(" %d", n_name);
10008 printf(" %d", n_prefix2);
10009 printf(" %d", n_name2);
10010 printf(" %d", n_prefix3);
10011 printf(" %d", n_name3);
10012 printf("\n");
10013 }
10014 }
10015 }
10016 }
10017 }
10018 }
10019 }
10020 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010021 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010022
Daniel Veillard42595322004-11-08 10:52:06 +000010023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010024}
10025
10026
10027static int
10028test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010030
Daniel Veillard42595322004-11-08 10:52:06 +000010031 int mem_base;
10032 int ret_val;
10033 xmlHashTablePtr table; /* the hash table */
10034 int n_table;
10035 xmlChar * name; /* the name of the userdata */
10036 int n_name;
10037 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10038 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010039
Daniel Veillard42595322004-11-08 10:52:06 +000010040 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10041 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10042 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10043 mem_base = xmlMemBlocks();
10044 table = gen_xmlHashTablePtr(n_table, 0);
10045 name = gen_const_xmlChar_ptr(n_name, 1);
10046 f = gen_xmlHashDeallocator(n_f, 2);
10047
William M. Brackf13f77f2004-11-12 16:03:48 +000010048 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010049 desret_int(ret_val);
10050 call_tests++;
10051 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010052 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010053 des_xmlHashDeallocator(n_f, f, 2);
10054 xmlResetLastError();
10055 if (mem_base != xmlMemBlocks()) {
10056 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10057 xmlMemBlocks() - mem_base);
10058 test_ret++;
10059 printf(" %d", n_table);
10060 printf(" %d", n_name);
10061 printf(" %d", n_f);
10062 printf("\n");
10063 }
10064 }
10065 }
10066 }
Daniel Veillard42595322004-11-08 10:52:06 +000010067 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010068
Daniel Veillard42595322004-11-08 10:52:06 +000010069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010070}
10071
10072
10073static int
10074test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010076
Daniel Veillard42595322004-11-08 10:52:06 +000010077 int mem_base;
10078 int ret_val;
10079 xmlHashTablePtr table; /* the hash table */
10080 int n_table;
10081 xmlChar * name; /* the name of the userdata */
10082 int n_name;
10083 xmlChar * name2; /* a second name of the userdata */
10084 int n_name2;
10085 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10086 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010087
Daniel Veillard42595322004-11-08 10:52:06 +000010088 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10089 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10090 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10091 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10092 mem_base = xmlMemBlocks();
10093 table = gen_xmlHashTablePtr(n_table, 0);
10094 name = gen_const_xmlChar_ptr(n_name, 1);
10095 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10096 f = gen_xmlHashDeallocator(n_f, 3);
10097
William M. Brackf13f77f2004-11-12 16:03:48 +000010098 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010099 desret_int(ret_val);
10100 call_tests++;
10101 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010102 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10103 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010104 des_xmlHashDeallocator(n_f, f, 3);
10105 xmlResetLastError();
10106 if (mem_base != xmlMemBlocks()) {
10107 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10108 xmlMemBlocks() - mem_base);
10109 test_ret++;
10110 printf(" %d", n_table);
10111 printf(" %d", n_name);
10112 printf(" %d", n_name2);
10113 printf(" %d", n_f);
10114 printf("\n");
10115 }
10116 }
10117 }
10118 }
10119 }
Daniel Veillard42595322004-11-08 10:52:06 +000010120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010121
Daniel Veillard42595322004-11-08 10:52:06 +000010122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010123}
10124
10125
10126static int
10127test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010129
Daniel Veillard42595322004-11-08 10:52:06 +000010130 int mem_base;
10131 int ret_val;
10132 xmlHashTablePtr table; /* the hash table */
10133 int n_table;
10134 xmlChar * name; /* the name of the userdata */
10135 int n_name;
10136 xmlChar * name2; /* a second name of the userdata */
10137 int n_name2;
10138 xmlChar * name3; /* a third name of the userdata */
10139 int n_name3;
10140 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10141 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010142
Daniel Veillard42595322004-11-08 10:52:06 +000010143 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10144 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10145 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10146 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10147 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10148 mem_base = xmlMemBlocks();
10149 table = gen_xmlHashTablePtr(n_table, 0);
10150 name = gen_const_xmlChar_ptr(n_name, 1);
10151 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10152 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10153 f = gen_xmlHashDeallocator(n_f, 4);
10154
William M. Brackf13f77f2004-11-12 16:03:48 +000010155 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010156 desret_int(ret_val);
10157 call_tests++;
10158 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010159 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10160 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10161 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010162 des_xmlHashDeallocator(n_f, f, 4);
10163 xmlResetLastError();
10164 if (mem_base != xmlMemBlocks()) {
10165 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10166 xmlMemBlocks() - mem_base);
10167 test_ret++;
10168 printf(" %d", n_table);
10169 printf(" %d", n_name);
10170 printf(" %d", n_name2);
10171 printf(" %d", n_name3);
10172 printf(" %d", n_f);
10173 printf("\n");
10174 }
10175 }
10176 }
10177 }
10178 }
10179 }
Daniel Veillard42595322004-11-08 10:52:06 +000010180 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010181
Daniel Veillard42595322004-11-08 10:52:06 +000010182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010183}
10184
10185
10186static int
10187test_xmlHashScan(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_xmlHashScan3(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_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010209
10210
10211 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010213}
10214
10215
10216static int
10217test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010219
10220
10221 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010223}
10224
10225
10226static int
10227test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010229
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010230 int mem_base;
10231 int ret_val;
10232 xmlHashTablePtr table; /* the hash table */
10233 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010234
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010235 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010237 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010238
10239 ret_val = xmlHashSize(table);
10240 desret_int(ret_val);
10241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010242 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010243 xmlResetLastError();
10244 if (mem_base != xmlMemBlocks()) {
10245 printf("Leak of %d blocks found in xmlHashSize",
10246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010247 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010248 printf(" %d", n_table);
10249 printf("\n");
10250 }
10251 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010252 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010253
Daniel Veillard42595322004-11-08 10:52:06 +000010254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010255}
10256
10257
10258static int
10259test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010261
Daniel Veillard42595322004-11-08 10:52:06 +000010262 int mem_base;
10263 int ret_val;
10264 xmlHashTablePtr table; /* the hash table */
10265 int n_table;
10266 xmlChar * name; /* the name of the userdata */
10267 int n_name;
10268 void * userdata; /* a pointer to the userdata */
10269 int n_userdata;
10270 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10271 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010272
Daniel Veillard42595322004-11-08 10:52:06 +000010273 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10274 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10275 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10276 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10277 mem_base = xmlMemBlocks();
10278 table = gen_xmlHashTablePtr(n_table, 0);
10279 name = gen_const_xmlChar_ptr(n_name, 1);
10280 userdata = gen_userdata(n_userdata, 2);
10281 f = gen_xmlHashDeallocator(n_f, 3);
10282
William M. Brackf13f77f2004-11-12 16:03:48 +000010283 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010284 desret_int(ret_val);
10285 call_tests++;
10286 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010287 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010288 des_userdata(n_userdata, userdata, 2);
10289 des_xmlHashDeallocator(n_f, f, 3);
10290 xmlResetLastError();
10291 if (mem_base != xmlMemBlocks()) {
10292 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10293 xmlMemBlocks() - mem_base);
10294 test_ret++;
10295 printf(" %d", n_table);
10296 printf(" %d", n_name);
10297 printf(" %d", n_userdata);
10298 printf(" %d", n_f);
10299 printf("\n");
10300 }
10301 }
10302 }
10303 }
10304 }
Daniel Veillard42595322004-11-08 10:52:06 +000010305 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010306
Daniel Veillard42595322004-11-08 10:52:06 +000010307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010308}
10309
10310
10311static int
10312test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010314
Daniel Veillard42595322004-11-08 10:52:06 +000010315 int mem_base;
10316 int ret_val;
10317 xmlHashTablePtr table; /* the hash table */
10318 int n_table;
10319 xmlChar * name; /* the name of the userdata */
10320 int n_name;
10321 xmlChar * name2; /* a second name of the userdata */
10322 int n_name2;
10323 void * userdata; /* a pointer to the userdata */
10324 int n_userdata;
10325 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10326 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010327
Daniel Veillard42595322004-11-08 10:52:06 +000010328 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10329 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10330 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10331 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10332 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10333 mem_base = xmlMemBlocks();
10334 table = gen_xmlHashTablePtr(n_table, 0);
10335 name = gen_const_xmlChar_ptr(n_name, 1);
10336 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10337 userdata = gen_userdata(n_userdata, 3);
10338 f = gen_xmlHashDeallocator(n_f, 4);
10339
William M. Brackf13f77f2004-11-12 16:03:48 +000010340 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010341 desret_int(ret_val);
10342 call_tests++;
10343 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010344 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10345 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010346 des_userdata(n_userdata, userdata, 3);
10347 des_xmlHashDeallocator(n_f, f, 4);
10348 xmlResetLastError();
10349 if (mem_base != xmlMemBlocks()) {
10350 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10351 xmlMemBlocks() - mem_base);
10352 test_ret++;
10353 printf(" %d", n_table);
10354 printf(" %d", n_name);
10355 printf(" %d", n_name2);
10356 printf(" %d", n_userdata);
10357 printf(" %d", n_f);
10358 printf("\n");
10359 }
10360 }
10361 }
10362 }
10363 }
10364 }
Daniel Veillard42595322004-11-08 10:52:06 +000010365 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010366
Daniel Veillard42595322004-11-08 10:52:06 +000010367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010368}
10369
10370
10371static int
10372test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010374
Daniel Veillard42595322004-11-08 10:52:06 +000010375 int mem_base;
10376 int ret_val;
10377 xmlHashTablePtr table; /* the hash table */
10378 int n_table;
10379 xmlChar * name; /* the name of the userdata */
10380 int n_name;
10381 xmlChar * name2; /* a second name of the userdata */
10382 int n_name2;
10383 xmlChar * name3; /* a third name of the userdata */
10384 int n_name3;
10385 void * userdata; /* a pointer to the userdata */
10386 int n_userdata;
10387 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10388 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010389
Daniel Veillard42595322004-11-08 10:52:06 +000010390 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10391 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10392 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10393 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10394 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10395 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10396 mem_base = xmlMemBlocks();
10397 table = gen_xmlHashTablePtr(n_table, 0);
10398 name = gen_const_xmlChar_ptr(n_name, 1);
10399 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10400 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10401 userdata = gen_userdata(n_userdata, 4);
10402 f = gen_xmlHashDeallocator(n_f, 5);
10403
William M. Brackf13f77f2004-11-12 16:03:48 +000010404 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010405 desret_int(ret_val);
10406 call_tests++;
10407 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010408 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10409 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10410 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010411 des_userdata(n_userdata, userdata, 4);
10412 des_xmlHashDeallocator(n_f, f, 5);
10413 xmlResetLastError();
10414 if (mem_base != xmlMemBlocks()) {
10415 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10416 xmlMemBlocks() - mem_base);
10417 test_ret++;
10418 printf(" %d", n_table);
10419 printf(" %d", n_name);
10420 printf(" %d", n_name2);
10421 printf(" %d", n_name3);
10422 printf(" %d", n_userdata);
10423 printf(" %d", n_f);
10424 printf("\n");
10425 }
10426 }
10427 }
10428 }
10429 }
10430 }
10431 }
Daniel Veillard42595322004-11-08 10:52:06 +000010432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010433
Daniel Veillard42595322004-11-08 10:52:06 +000010434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010435}
10436
10437static int
10438test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010440
Daniel Veillard2ae13382005-01-25 23:45:06 +000010441 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010442 test_ret += test_xmlHashAddEntry();
10443 test_ret += test_xmlHashAddEntry2();
10444 test_ret += test_xmlHashAddEntry3();
10445 test_ret += test_xmlHashCopy();
10446 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010447 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010448 test_ret += test_xmlHashLookup();
10449 test_ret += test_xmlHashLookup2();
10450 test_ret += test_xmlHashLookup3();
10451 test_ret += test_xmlHashQLookup();
10452 test_ret += test_xmlHashQLookup2();
10453 test_ret += test_xmlHashQLookup3();
10454 test_ret += test_xmlHashRemoveEntry();
10455 test_ret += test_xmlHashRemoveEntry2();
10456 test_ret += test_xmlHashRemoveEntry3();
10457 test_ret += test_xmlHashScan();
10458 test_ret += test_xmlHashScan3();
10459 test_ret += test_xmlHashScanFull();
10460 test_ret += test_xmlHashScanFull3();
10461 test_ret += test_xmlHashSize();
10462 test_ret += test_xmlHashUpdateEntry();
10463 test_ret += test_xmlHashUpdateEntry2();
10464 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010465
Daniel Veillard42595322004-11-08 10:52:06 +000010466 if (test_ret != 0)
10467 printf("Module hash: %d errors\n", test_ret);
10468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010469}
10470
Daniel Veillardce682bc2004-11-05 17:22:25 +000010471#define gen_nb_xmlLinkPtr 1
10472static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10473 return(NULL);
10474}
10475static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10476}
10477
Daniel Veillardd93f6252004-11-02 15:53:51 +000010478static int
10479test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010481
Daniel Veillardce682bc2004-11-05 17:22:25 +000010482 int mem_base;
10483 void * ret_val;
10484 xmlLinkPtr lk; /* a link */
10485 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010486
Daniel Veillardce682bc2004-11-05 17:22:25 +000010487 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10488 mem_base = xmlMemBlocks();
10489 lk = gen_xmlLinkPtr(n_lk, 0);
10490
10491 ret_val = xmlLinkGetData(lk);
10492 desret_void_ptr(ret_val);
10493 call_tests++;
10494 des_xmlLinkPtr(n_lk, lk, 0);
10495 xmlResetLastError();
10496 if (mem_base != xmlMemBlocks()) {
10497 printf("Leak of %d blocks found in xmlLinkGetData",
10498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010499 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010500 printf(" %d", n_lk);
10501 printf("\n");
10502 }
10503 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010505
Daniel Veillard42595322004-11-08 10:52:06 +000010506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010507}
10508
10509
10510static int
10511test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010513
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010514 int mem_base;
10515 int ret_val;
10516 xmlListPtr l; /* a list */
10517 int n_l;
10518 void * data; /* the data */
10519 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010520
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010521 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10522 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010524 l = gen_xmlListPtr(n_l, 0);
10525 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010526
10527 ret_val = xmlListAppend(l, data);
10528 desret_int(ret_val);
10529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010530 des_xmlListPtr(n_l, l, 0);
10531 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010532 xmlResetLastError();
10533 if (mem_base != xmlMemBlocks()) {
10534 printf("Leak of %d blocks found in xmlListAppend",
10535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010536 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010537 printf(" %d", n_l);
10538 printf(" %d", n_data);
10539 printf("\n");
10540 }
10541 }
10542 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010543 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010544
Daniel Veillard42595322004-11-08 10:52:06 +000010545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010546}
10547
10548
10549static int
10550test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010552
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010553 int mem_base;
10554 xmlListPtr l; /* a list */
10555 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010556
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010557 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10558 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010559 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010560
10561 xmlListClear(l);
10562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010563 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010564 xmlResetLastError();
10565 if (mem_base != xmlMemBlocks()) {
10566 printf("Leak of %d blocks found in xmlListClear",
10567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010568 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010569 printf(" %d", n_l);
10570 printf("\n");
10571 }
10572 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010574
Daniel Veillard42595322004-11-08 10:52:06 +000010575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576}
10577
10578
Daniel Veillardce682bc2004-11-05 17:22:25 +000010579#define gen_nb_const_xmlListPtr 1
10580static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10581 return(NULL);
10582}
10583static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10584}
10585
Daniel Veillardd93f6252004-11-02 15:53:51 +000010586static int
10587test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010589
Daniel Veillardce682bc2004-11-05 17:22:25 +000010590 int mem_base;
10591 int ret_val;
10592 xmlListPtr cur; /* the new list */
10593 int n_cur;
10594 xmlListPtr old; /* the old list */
10595 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010596
Daniel Veillardce682bc2004-11-05 17:22:25 +000010597 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10598 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10599 mem_base = xmlMemBlocks();
10600 cur = gen_xmlListPtr(n_cur, 0);
10601 old = gen_const_xmlListPtr(n_old, 1);
10602
William M. Brackf13f77f2004-11-12 16:03:48 +000010603 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010604 desret_int(ret_val);
10605 call_tests++;
10606 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010607 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010608 xmlResetLastError();
10609 if (mem_base != xmlMemBlocks()) {
10610 printf("Leak of %d blocks found in xmlListCopy",
10611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010612 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010613 printf(" %d", n_cur);
10614 printf(" %d", n_old);
10615 printf("\n");
10616 }
10617 }
10618 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010620
Daniel Veillard42595322004-11-08 10:52:06 +000010621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010622}
10623
10624
10625static int
10626test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628
10629
10630 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010632}
10633
10634
10635static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010636test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010638
10639
10640 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010642}
10643
10644
10645static int
10646test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010648
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010649 int mem_base;
10650 int ret_val;
10651 xmlListPtr l; /* a list */
10652 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010653
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010654 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10655 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010656 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010657
10658 ret_val = xmlListEmpty(l);
10659 desret_int(ret_val);
10660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010661 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010662 xmlResetLastError();
10663 if (mem_base != xmlMemBlocks()) {
10664 printf("Leak of %d blocks found in xmlListEmpty",
10665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010666 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010667 printf(" %d", n_l);
10668 printf("\n");
10669 }
10670 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010671 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010672
Daniel Veillard42595322004-11-08 10:52:06 +000010673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010674}
10675
10676
10677static int
10678test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010680
10681
10682 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010684}
10685
10686
10687static int
10688test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010690
10691
10692 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010694}
10695
10696
10697static int
10698test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010700
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010701 int mem_base;
10702 int ret_val;
10703 xmlListPtr l; /* a list */
10704 int n_l;
10705 void * data; /* the data */
10706 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010707
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010708 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10709 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10710 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010711 l = gen_xmlListPtr(n_l, 0);
10712 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010713
10714 ret_val = xmlListInsert(l, data);
10715 desret_int(ret_val);
10716 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010717 des_xmlListPtr(n_l, l, 0);
10718 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010719 xmlResetLastError();
10720 if (mem_base != xmlMemBlocks()) {
10721 printf("Leak of %d blocks found in xmlListInsert",
10722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010723 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010724 printf(" %d", n_l);
10725 printf(" %d", n_data);
10726 printf("\n");
10727 }
10728 }
10729 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010731
Daniel Veillard42595322004-11-08 10:52:06 +000010732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010733}
10734
10735
10736static int
10737test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010739
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010740 int mem_base;
10741 xmlListPtr l1; /* the original list */
10742 int n_l1;
10743 xmlListPtr l2; /* the new list */
10744 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010745
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010746 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10747 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010749 l1 = gen_xmlListPtr(n_l1, 0);
10750 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010751
10752 xmlListMerge(l1, l2);
10753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010754 des_xmlListPtr(n_l1, l1, 0);
10755 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010756 xmlResetLastError();
10757 if (mem_base != xmlMemBlocks()) {
10758 printf("Leak of %d blocks found in xmlListMerge",
10759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010760 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010761 printf(" %d", n_l1);
10762 printf(" %d", n_l2);
10763 printf("\n");
10764 }
10765 }
10766 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010767 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010768
Daniel Veillard42595322004-11-08 10:52:06 +000010769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010770}
10771
10772
10773static int
10774test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010776
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010777 int mem_base;
10778 xmlListPtr l; /* a list */
10779 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010781 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010783 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010784
10785 xmlListPopBack(l);
10786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010787 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010788 xmlResetLastError();
10789 if (mem_base != xmlMemBlocks()) {
10790 printf("Leak of %d blocks found in xmlListPopBack",
10791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010792 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010793 printf(" %d", n_l);
10794 printf("\n");
10795 }
10796 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010798
Daniel Veillard42595322004-11-08 10:52:06 +000010799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010800}
10801
10802
10803static int
10804test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010806
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010807 int mem_base;
10808 xmlListPtr l; /* a list */
10809 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010810
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010811 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010813 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010814
10815 xmlListPopFront(l);
10816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010817 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010818 xmlResetLastError();
10819 if (mem_base != xmlMemBlocks()) {
10820 printf("Leak of %d blocks found in xmlListPopFront",
10821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010822 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010823 printf(" %d", n_l);
10824 printf("\n");
10825 }
10826 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010828
Daniel Veillard42595322004-11-08 10:52:06 +000010829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010830}
10831
10832
10833static int
10834test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010836
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010837 int mem_base;
10838 int ret_val;
10839 xmlListPtr l; /* a list */
10840 int n_l;
10841 void * data; /* new data */
10842 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010843
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010844 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10845 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010847 l = gen_xmlListPtr(n_l, 0);
10848 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010849
10850 ret_val = xmlListPushBack(l, data);
10851 desret_int(ret_val);
10852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010853 des_xmlListPtr(n_l, l, 0);
10854 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010855 xmlResetLastError();
10856 if (mem_base != xmlMemBlocks()) {
10857 printf("Leak of %d blocks found in xmlListPushBack",
10858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010859 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010860 printf(" %d", n_l);
10861 printf(" %d", n_data);
10862 printf("\n");
10863 }
10864 }
10865 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010867
Daniel Veillard42595322004-11-08 10:52:06 +000010868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010869}
10870
10871
10872static int
10873test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010875
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010876 int mem_base;
10877 int ret_val;
10878 xmlListPtr l; /* a list */
10879 int n_l;
10880 void * data; /* new data */
10881 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010882
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010883 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10884 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10885 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010886 l = gen_xmlListPtr(n_l, 0);
10887 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010888
10889 ret_val = xmlListPushFront(l, data);
10890 desret_int(ret_val);
10891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010892 des_xmlListPtr(n_l, l, 0);
10893 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010894 xmlResetLastError();
10895 if (mem_base != xmlMemBlocks()) {
10896 printf("Leak of %d blocks found in xmlListPushFront",
10897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010898 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010899 printf(" %d", n_l);
10900 printf(" %d", n_data);
10901 printf("\n");
10902 }
10903 }
10904 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010905 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010906
Daniel Veillard42595322004-11-08 10:52:06 +000010907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010908}
10909
10910
10911static int
10912test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010914
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010915 int mem_base;
10916 int ret_val;
10917 xmlListPtr l; /* a list */
10918 int n_l;
10919 void * data; /* list data */
10920 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010921
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010922 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10923 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10924 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010925 l = gen_xmlListPtr(n_l, 0);
10926 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010927
10928 ret_val = xmlListRemoveAll(l, data);
10929 desret_int(ret_val);
10930 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010931 des_xmlListPtr(n_l, l, 0);
10932 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010933 xmlResetLastError();
10934 if (mem_base != xmlMemBlocks()) {
10935 printf("Leak of %d blocks found in xmlListRemoveAll",
10936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010937 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010938 printf(" %d", n_l);
10939 printf(" %d", n_data);
10940 printf("\n");
10941 }
10942 }
10943 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010944 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010945
Daniel Veillard42595322004-11-08 10:52:06 +000010946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010947}
10948
10949
10950static int
10951test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010953
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010954 int mem_base;
10955 int ret_val;
10956 xmlListPtr l; /* a list */
10957 int n_l;
10958 void * data; /* list data */
10959 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010960
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010961 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10962 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10963 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010964 l = gen_xmlListPtr(n_l, 0);
10965 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010966
10967 ret_val = xmlListRemoveFirst(l, data);
10968 desret_int(ret_val);
10969 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010970 des_xmlListPtr(n_l, l, 0);
10971 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010972 xmlResetLastError();
10973 if (mem_base != xmlMemBlocks()) {
10974 printf("Leak of %d blocks found in xmlListRemoveFirst",
10975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010976 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010977 printf(" %d", n_l);
10978 printf(" %d", n_data);
10979 printf("\n");
10980 }
10981 }
10982 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010983 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010984
Daniel Veillard42595322004-11-08 10:52:06 +000010985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010986}
10987
10988
10989static int
10990test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010992
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010993 int mem_base;
10994 int ret_val;
10995 xmlListPtr l; /* a list */
10996 int n_l;
10997 void * data; /* list data */
10998 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010999
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011000 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11001 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11002 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011003 l = gen_xmlListPtr(n_l, 0);
11004 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011005
11006 ret_val = xmlListRemoveLast(l, data);
11007 desret_int(ret_val);
11008 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011009 des_xmlListPtr(n_l, l, 0);
11010 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011011 xmlResetLastError();
11012 if (mem_base != xmlMemBlocks()) {
11013 printf("Leak of %d blocks found in xmlListRemoveLast",
11014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011015 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011016 printf(" %d", n_l);
11017 printf(" %d", n_data);
11018 printf("\n");
11019 }
11020 }
11021 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011022 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011023
Daniel Veillard42595322004-11-08 10:52:06 +000011024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011025}
11026
11027
11028static int
11029test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011031
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011032 int mem_base;
11033 xmlListPtr l; /* a list */
11034 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011035
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011036 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11037 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011038 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011039
11040 xmlListReverse(l);
11041 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011042 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011043 xmlResetLastError();
11044 if (mem_base != xmlMemBlocks()) {
11045 printf("Leak of %d blocks found in xmlListReverse",
11046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011047 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011048 printf(" %d", n_l);
11049 printf("\n");
11050 }
11051 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011052 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011053
Daniel Veillard42595322004-11-08 10:52:06 +000011054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011055}
11056
11057
11058static int
11059test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011061
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011062 int mem_base;
11063 void * ret_val;
11064 xmlListPtr l; /* a list */
11065 int n_l;
11066 void * data; /* a search value */
11067 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011068
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011069 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11070 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11071 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011072 l = gen_xmlListPtr(n_l, 0);
11073 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011074
11075 ret_val = xmlListReverseSearch(l, data);
11076 desret_void_ptr(ret_val);
11077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011078 des_xmlListPtr(n_l, l, 0);
11079 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011080 xmlResetLastError();
11081 if (mem_base != xmlMemBlocks()) {
11082 printf("Leak of %d blocks found in xmlListReverseSearch",
11083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011084 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011085 printf(" %d", n_l);
11086 printf(" %d", n_data);
11087 printf("\n");
11088 }
11089 }
11090 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011091 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011092
Daniel Veillard42595322004-11-08 10:52:06 +000011093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011094}
11095
11096
11097static int
11098test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011100
11101
11102 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011104}
11105
11106
11107static int
11108test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011110
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011111 int mem_base;
11112 void * ret_val;
11113 xmlListPtr l; /* a list */
11114 int n_l;
11115 void * data; /* a search value */
11116 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011117
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011118 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11119 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11120 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011121 l = gen_xmlListPtr(n_l, 0);
11122 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011123
11124 ret_val = xmlListSearch(l, data);
11125 desret_void_ptr(ret_val);
11126 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011127 des_xmlListPtr(n_l, l, 0);
11128 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011129 xmlResetLastError();
11130 if (mem_base != xmlMemBlocks()) {
11131 printf("Leak of %d blocks found in xmlListSearch",
11132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011133 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011134 printf(" %d", n_l);
11135 printf(" %d", n_data);
11136 printf("\n");
11137 }
11138 }
11139 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011141
Daniel Veillard42595322004-11-08 10:52:06 +000011142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011143}
11144
11145
11146static int
11147test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011149
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011150 int mem_base;
11151 int ret_val;
11152 xmlListPtr l; /* a list */
11153 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011154
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011155 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11156 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011157 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011158
11159 ret_val = xmlListSize(l);
11160 desret_int(ret_val);
11161 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011162 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011163 xmlResetLastError();
11164 if (mem_base != xmlMemBlocks()) {
11165 printf("Leak of %d blocks found in xmlListSize",
11166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011167 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011168 printf(" %d", n_l);
11169 printf("\n");
11170 }
11171 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011172 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011173
Daniel Veillard42595322004-11-08 10:52:06 +000011174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011175}
11176
11177
11178static int
11179test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011181
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011182 int mem_base;
11183 xmlListPtr l; /* a list */
11184 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011185
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011186 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011188 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011189
11190 xmlListSort(l);
11191 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011192 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011193 xmlResetLastError();
11194 if (mem_base != xmlMemBlocks()) {
11195 printf("Leak of %d blocks found in xmlListSort",
11196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011197 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011198 printf(" %d", n_l);
11199 printf("\n");
11200 }
11201 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011203
Daniel Veillard42595322004-11-08 10:52:06 +000011204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011205}
11206
11207
11208static int
11209test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011211
11212
11213 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011215}
11216
11217static int
11218test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011220
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011221 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011222 test_ret += test_xmlLinkGetData();
11223 test_ret += test_xmlListAppend();
11224 test_ret += test_xmlListClear();
11225 test_ret += test_xmlListCopy();
11226 test_ret += test_xmlListCreate();
11227 test_ret += test_xmlListDup();
11228 test_ret += test_xmlListEmpty();
11229 test_ret += test_xmlListEnd();
11230 test_ret += test_xmlListFront();
11231 test_ret += test_xmlListInsert();
11232 test_ret += test_xmlListMerge();
11233 test_ret += test_xmlListPopBack();
11234 test_ret += test_xmlListPopFront();
11235 test_ret += test_xmlListPushBack();
11236 test_ret += test_xmlListPushFront();
11237 test_ret += test_xmlListRemoveAll();
11238 test_ret += test_xmlListRemoveFirst();
11239 test_ret += test_xmlListRemoveLast();
11240 test_ret += test_xmlListReverse();
11241 test_ret += test_xmlListReverseSearch();
11242 test_ret += test_xmlListReverseWalk();
11243 test_ret += test_xmlListSearch();
11244 test_ret += test_xmlListSize();
11245 test_ret += test_xmlListSort();
11246 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011247
Daniel Veillard42595322004-11-08 10:52:06 +000011248 if (test_ret != 0)
11249 printf("Module list: %d errors\n", test_ret);
11250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011251}
11252
11253static int
11254test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011256
William M. Brack21e4ef22005-01-02 09:53:13 +000011257#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011258 int mem_base;
11259 int ret_val;
11260 void * ctx; /* an FTP context */
11261 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011262
Daniel Veillard27f20102004-11-05 11:50:11 +000011263 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11264 mem_base = xmlMemBlocks();
11265 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11266
11267 ret_val = xmlNanoFTPCheckResponse(ctx);
11268 desret_int(ret_val);
11269 call_tests++;
11270 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11271 xmlResetLastError();
11272 if (mem_base != xmlMemBlocks()) {
11273 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011275 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011276 printf(" %d", n_ctx);
11277 printf("\n");
11278 }
11279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011280 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011281#endif
11282
Daniel Veillard42595322004-11-08 10:52:06 +000011283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011284}
11285
11286
11287static int
11288test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011290
William M. Brack21e4ef22005-01-02 09:53:13 +000011291#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011292 int mem_base;
11293
11294 mem_base = xmlMemBlocks();
11295
11296 xmlNanoFTPCleanup();
11297 call_tests++;
11298 xmlResetLastError();
11299 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011300 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011302 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011303 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011305 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011306#endif
11307
Daniel Veillard42595322004-11-08 10:52:06 +000011308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011309}
11310
11311
11312static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011313test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011315
William M. Brack21e4ef22005-01-02 09:53:13 +000011316#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011317 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011318 int ret_val;
11319 void * ctx; /* an FTP context */
11320 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011321
Daniel Veillard27f20102004-11-05 11:50:11 +000011322 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011323 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011324 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011325
Daniel Veillard27f20102004-11-05 11:50:11 +000011326 ret_val = xmlNanoFTPCloseConnection(ctx);
11327 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011328 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011329 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011330 xmlResetLastError();
11331 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011332 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011334 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011335 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011336 printf("\n");
11337 }
11338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011339 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011340#endif
11341
Daniel Veillard42595322004-11-08 10:52:06 +000011342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011343}
11344
11345
11346static int
11347test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011349
William M. Brack21e4ef22005-01-02 09:53:13 +000011350#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011351 int mem_base;
11352 int ret_val;
11353 void * ctx; /* an FTP context */
11354 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011355 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011356 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011357
Daniel Veillard27f20102004-11-05 11:50:11 +000011358 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11359 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11360 mem_base = xmlMemBlocks();
11361 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11362 directory = gen_const_char_ptr(n_directory, 1);
11363
William M. Brackf13f77f2004-11-12 16:03:48 +000011364 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011365 desret_int(ret_val);
11366 call_tests++;
11367 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011368 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011369 xmlResetLastError();
11370 if (mem_base != xmlMemBlocks()) {
11371 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011373 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011374 printf(" %d", n_ctx);
11375 printf(" %d", n_directory);
11376 printf("\n");
11377 }
11378 }
11379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011380 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011381#endif
11382
Daniel Veillard42595322004-11-08 10:52:06 +000011383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011384}
11385
11386
11387static int
11388test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011390
William M. Brack21e4ef22005-01-02 09:53:13 +000011391#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011392 int mem_base;
11393 int ret_val;
11394 void * ctx; /* an FTP context */
11395 int n_ctx;
11396 const char * file; /* a file or directory on the server */
11397 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011398
Daniel Veillard27f20102004-11-05 11:50:11 +000011399 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11400 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11401 mem_base = xmlMemBlocks();
11402 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11403 file = gen_filepath(n_file, 1);
11404
11405 ret_val = xmlNanoFTPDele(ctx, file);
11406 desret_int(ret_val);
11407 call_tests++;
11408 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11409 des_filepath(n_file, file, 1);
11410 xmlResetLastError();
11411 if (mem_base != xmlMemBlocks()) {
11412 printf("Leak of %d blocks found in xmlNanoFTPDele",
11413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011414 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011415 printf(" %d", n_ctx);
11416 printf(" %d", n_file);
11417 printf("\n");
11418 }
11419 }
11420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011421 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011422#endif
11423
Daniel Veillard42595322004-11-08 10:52:06 +000011424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011425}
11426
11427
11428static int
11429test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011431
11432
11433 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011435}
11436
11437
11438static int
11439test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011441
William M. Brack21e4ef22005-01-02 09:53:13 +000011442#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011443 int mem_base;
11444 int ret_val;
11445 void * ctx; /* an FTP context */
11446 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011447
Daniel Veillard27f20102004-11-05 11:50:11 +000011448 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11449 mem_base = xmlMemBlocks();
11450 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11451
11452 ret_val = xmlNanoFTPGetConnection(ctx);
11453 desret_int(ret_val);
11454 call_tests++;
11455 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11456 xmlResetLastError();
11457 if (mem_base != xmlMemBlocks()) {
11458 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011460 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011461 printf(" %d", n_ctx);
11462 printf("\n");
11463 }
11464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011465 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011466#endif
11467
Daniel Veillard42595322004-11-08 10:52:06 +000011468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011469}
11470
11471
11472static int
11473test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011475
William M. Brack21e4ef22005-01-02 09:53:13 +000011476#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011477 int mem_base;
11478 int ret_val;
11479 void * ctx; /* an FTP context */
11480 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011481
Daniel Veillard27f20102004-11-05 11:50:11 +000011482 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11483 mem_base = xmlMemBlocks();
11484 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11485
11486 ret_val = xmlNanoFTPGetResponse(ctx);
11487 desret_int(ret_val);
11488 call_tests++;
11489 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11490 xmlResetLastError();
11491 if (mem_base != xmlMemBlocks()) {
11492 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011494 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011495 printf(" %d", n_ctx);
11496 printf("\n");
11497 }
11498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011499 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011500#endif
11501
Daniel Veillard42595322004-11-08 10:52:06 +000011502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011503}
11504
11505
11506static int
11507test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011509
William M. Brack21e4ef22005-01-02 09:53:13 +000011510#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011511 int mem_base;
11512 int ret_val;
11513 void * ctx; /* an FTP context */
11514 int n_ctx;
11515 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11516 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011517
Daniel Veillard27f20102004-11-05 11:50:11 +000011518 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11519 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11520 mem_base = xmlMemBlocks();
11521 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11522 filename = gen_filepath(n_filename, 1);
11523
11524 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11525 desret_int(ret_val);
11526 call_tests++;
11527 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11528 des_filepath(n_filename, filename, 1);
11529 xmlResetLastError();
11530 if (mem_base != xmlMemBlocks()) {
11531 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011533 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011534 printf(" %d", n_ctx);
11535 printf(" %d", n_filename);
11536 printf("\n");
11537 }
11538 }
11539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011540 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011541#endif
11542
Daniel Veillard42595322004-11-08 10:52:06 +000011543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011544}
11545
11546
11547static int
11548test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011550
William M. Brack21e4ef22005-01-02 09:53:13 +000011551#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011552 int mem_base;
11553
11554 mem_base = xmlMemBlocks();
11555
11556 xmlNanoFTPInit();
11557 call_tests++;
11558 xmlResetLastError();
11559 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011560 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011562 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011563 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011565 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011566#endif
11567
Daniel Veillard42595322004-11-08 10:52:06 +000011568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011569}
11570
11571
11572static int
11573test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011575
11576
11577 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011579}
11580
11581
11582static int
11583test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011585
William M. Brack015ccb22005-02-13 08:18:52 +000011586#if defined(LIBXML_FTP_ENABLED)
11587 int mem_base;
11588 void * ret_val;
11589 const char * URL; /* The URL used to initialize the context */
11590 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011591
William M. Brack015ccb22005-02-13 08:18:52 +000011592 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11593 mem_base = xmlMemBlocks();
11594 URL = gen_filepath(n_URL, 0);
11595
11596 ret_val = xmlNanoFTPNewCtxt(URL);
11597 desret_xmlNanoFTPCtxtPtr(ret_val);
11598 call_tests++;
11599 des_filepath(n_URL, URL, 0);
11600 xmlResetLastError();
11601 if (mem_base != xmlMemBlocks()) {
11602 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
11603 xmlMemBlocks() - mem_base);
11604 test_ret++;
11605 printf(" %d", n_URL);
11606 printf("\n");
11607 }
11608 }
11609 function_tests++;
11610#endif
11611
Daniel Veillard42595322004-11-08 10:52:06 +000011612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011613}
11614
11615
11616static int
11617test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011619
William M. Brack21e4ef22005-01-02 09:53:13 +000011620#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011621 int mem_base;
11622 void * ret_val;
11623 const char * URL; /* the URL to the resource */
11624 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011625
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011626 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011628 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011629
11630 ret_val = xmlNanoFTPOpen(URL);
William M. Brack015ccb22005-02-13 08:18:52 +000011631 desret_xmlNanoFTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011632 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011633 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011634 xmlResetLastError();
11635 if (mem_base != xmlMemBlocks()) {
11636 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011638 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011639 printf(" %d", n_URL);
11640 printf("\n");
11641 }
11642 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011643 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011644#endif
11645
Daniel Veillard42595322004-11-08 10:52:06 +000011646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011647}
11648
11649
11650static int
11651test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011653
William M. Brack21e4ef22005-01-02 09:53:13 +000011654#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011655 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011656 int n_host;
11657 int port; /* the proxy port */
11658 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011659 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011660 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011661 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011662 int n_passwd;
11663 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11664 int n_type;
11665
11666 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11667 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11668 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11669 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11670 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011671 host = gen_const_char_ptr(n_host, 0);
11672 port = gen_int(n_port, 1);
11673 user = gen_const_char_ptr(n_user, 2);
11674 passwd = gen_const_char_ptr(n_passwd, 3);
11675 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011676
William M. Brackf13f77f2004-11-12 16:03:48 +000011677 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011678 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011679 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011680 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011681 des_const_char_ptr(n_user, (const char *)user, 2);
11682 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011683 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011684 xmlResetLastError();
11685 }
11686 }
11687 }
11688 }
11689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011690 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011691#endif
11692
Daniel Veillard42595322004-11-08 10:52:06 +000011693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011694}
11695
11696
11697static int
11698test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011700
William M. Brack21e4ef22005-01-02 09:53:13 +000011701#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011702 int mem_base;
11703 int ret_val;
11704 void * ctx; /* an FTP context */
11705 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011706
Daniel Veillard27f20102004-11-05 11:50:11 +000011707 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11708 mem_base = xmlMemBlocks();
11709 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11710
11711 ret_val = xmlNanoFTPQuit(ctx);
11712 desret_int(ret_val);
11713 call_tests++;
11714 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11715 xmlResetLastError();
11716 if (mem_base != xmlMemBlocks()) {
11717 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011719 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011720 printf(" %d", n_ctx);
11721 printf("\n");
11722 }
11723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011724 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011725#endif
11726
Daniel Veillard42595322004-11-08 10:52:06 +000011727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011728}
11729
11730
11731static int
11732test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011734
William M. Brack21e4ef22005-01-02 09:53:13 +000011735#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011736 int mem_base;
11737 int ret_val;
11738 void * ctx; /* the FTP context */
11739 int n_ctx;
11740 void * dest; /* a buffer */
11741 int n_dest;
11742 int len; /* the buffer length */
11743 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011744
Daniel Veillard27f20102004-11-05 11:50:11 +000011745 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11746 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11747 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11748 mem_base = xmlMemBlocks();
11749 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11750 dest = gen_void_ptr(n_dest, 1);
11751 len = gen_int(n_len, 2);
11752
11753 ret_val = xmlNanoFTPRead(ctx, dest, len);
11754 desret_int(ret_val);
11755 call_tests++;
11756 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11757 des_void_ptr(n_dest, dest, 1);
11758 des_int(n_len, len, 2);
11759 xmlResetLastError();
11760 if (mem_base != xmlMemBlocks()) {
11761 printf("Leak of %d blocks found in xmlNanoFTPRead",
11762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011763 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011764 printf(" %d", n_ctx);
11765 printf(" %d", n_dest);
11766 printf(" %d", n_len);
11767 printf("\n");
11768 }
11769 }
11770 }
11771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011772 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011773#endif
11774
Daniel Veillard42595322004-11-08 10:52:06 +000011775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011776}
11777
11778
11779static int
11780test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011782
William M. Brack21e4ef22005-01-02 09:53:13 +000011783#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011784 const char * URL; /* The proxy URL used to initialize the proxy context */
11785 int n_URL;
11786
11787 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011788 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011789
11790 xmlNanoFTPScanProxy(URL);
11791 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011792 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793 xmlResetLastError();
11794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011795 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011796#endif
11797
Daniel Veillard42595322004-11-08 10:52:06 +000011798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011799}
11800
11801
11802static int
11803test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011805
William M. Brack21e4ef22005-01-02 09:53:13 +000011806#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011807 int mem_base;
11808 int ret_val;
11809 void * ctx; /* an FTP context */
11810 int n_ctx;
11811 const char * URL; /* The URL used to update the context */
11812 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011813
Daniel Veillard27f20102004-11-05 11:50:11 +000011814 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11815 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11816 mem_base = xmlMemBlocks();
11817 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11818 URL = gen_filepath(n_URL, 1);
11819
11820 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11821 desret_int(ret_val);
11822 call_tests++;
11823 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11824 des_filepath(n_URL, URL, 1);
11825 xmlResetLastError();
11826 if (mem_base != xmlMemBlocks()) {
11827 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011829 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011830 printf(" %d", n_ctx);
11831 printf(" %d", n_URL);
11832 printf("\n");
11833 }
11834 }
11835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011836 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011837#endif
11838
Daniel Veillard42595322004-11-08 10:52:06 +000011839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011840}
11841
11842static int
11843test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011845
William M. Brack015ccb22005-02-13 08:18:52 +000011846 if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011847 test_ret += test_xmlNanoFTPCheckResponse();
11848 test_ret += test_xmlNanoFTPCleanup();
11849 test_ret += test_xmlNanoFTPCloseConnection();
11850 test_ret += test_xmlNanoFTPCwd();
11851 test_ret += test_xmlNanoFTPDele();
11852 test_ret += test_xmlNanoFTPGet();
11853 test_ret += test_xmlNanoFTPGetConnection();
11854 test_ret += test_xmlNanoFTPGetResponse();
11855 test_ret += test_xmlNanoFTPGetSocket();
11856 test_ret += test_xmlNanoFTPInit();
11857 test_ret += test_xmlNanoFTPList();
11858 test_ret += test_xmlNanoFTPNewCtxt();
11859 test_ret += test_xmlNanoFTPOpen();
11860 test_ret += test_xmlNanoFTPProxy();
11861 test_ret += test_xmlNanoFTPQuit();
11862 test_ret += test_xmlNanoFTPRead();
11863 test_ret += test_xmlNanoFTPScanProxy();
11864 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011865
Daniel Veillard42595322004-11-08 10:52:06 +000011866 if (test_ret != 0)
11867 printf("Module nanoftp: %d errors\n", test_ret);
11868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011869}
11870
11871static int
11872test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011874
William M. Brack21e4ef22005-01-02 09:53:13 +000011875#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011876 int mem_base;
11877 const char * ret_val;
11878 void * ctx; /* the HTTP context */
11879 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011880
Daniel Veillard27f20102004-11-05 11:50:11 +000011881 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11882 mem_base = xmlMemBlocks();
11883 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11884
11885 ret_val = xmlNanoHTTPAuthHeader(ctx);
11886 desret_const_char_ptr(ret_val);
11887 call_tests++;
11888 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11889 xmlResetLastError();
11890 if (mem_base != xmlMemBlocks()) {
11891 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011893 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011894 printf(" %d", n_ctx);
11895 printf("\n");
11896 }
11897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011898 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011899#endif
11900
Daniel Veillard42595322004-11-08 10:52:06 +000011901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011902}
11903
11904
11905static int
11906test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011908
William M. Brack21e4ef22005-01-02 09:53:13 +000011909#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011910 int mem_base;
11911
11912 mem_base = xmlMemBlocks();
11913
11914 xmlNanoHTTPCleanup();
11915 call_tests++;
11916 xmlResetLastError();
11917 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011918 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011920 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011921 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011923 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011924#endif
11925
Daniel Veillard42595322004-11-08 10:52:06 +000011926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011927}
11928
11929
11930static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011931test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011933
William M. Brack21e4ef22005-01-02 09:53:13 +000011934#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011935 int mem_base;
11936 int ret_val;
11937 void * ctx; /* the HTTP context */
11938 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011939
Daniel Veillard27f20102004-11-05 11:50:11 +000011940 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11941 mem_base = xmlMemBlocks();
11942 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11943
11944 ret_val = xmlNanoHTTPContentLength(ctx);
11945 desret_int(ret_val);
11946 call_tests++;
11947 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11948 xmlResetLastError();
11949 if (mem_base != xmlMemBlocks()) {
11950 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011952 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011953 printf(" %d", n_ctx);
11954 printf("\n");
11955 }
11956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011957 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011958#endif
11959
Daniel Veillard42595322004-11-08 10:52:06 +000011960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011961}
11962
11963
11964static int
11965test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011967
William M. Brack21e4ef22005-01-02 09:53:13 +000011968#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011969 int mem_base;
11970 const char * ret_val;
11971 void * ctx; /* the HTTP context */
11972 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011973
Daniel Veillard27f20102004-11-05 11:50:11 +000011974 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11975 mem_base = xmlMemBlocks();
11976 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11977
11978 ret_val = xmlNanoHTTPEncoding(ctx);
11979 desret_const_char_ptr(ret_val);
11980 call_tests++;
11981 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11982 xmlResetLastError();
11983 if (mem_base != xmlMemBlocks()) {
11984 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011986 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011987 printf(" %d", n_ctx);
11988 printf("\n");
11989 }
11990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011991 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011992#endif
11993
Daniel Veillard42595322004-11-08 10:52:06 +000011994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011995}
11996
11997
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011998#define gen_nb_char_ptr_ptr 1
11999static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12000 return(NULL);
12001}
12002static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12003}
12004
Daniel Veillardd93f6252004-11-02 15:53:51 +000012005static int
12006test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012008
William M. Brack21e4ef22005-01-02 09:53:13 +000012009#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012010 int mem_base;
12011 int ret_val;
12012 const char * URL; /* The URL to load */
12013 int n_URL;
12014 const char * filename; /* the filename where the content should be saved */
12015 int n_filename;
12016 char ** contentType; /* if available the Content-Type information will be returned at that location */
12017 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012018
William M. Brack015ccb22005-02-13 08:18:52 +000012019 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
12020 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012021 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12022 mem_base = xmlMemBlocks();
William M. Brack015ccb22005-02-13 08:18:52 +000012023 URL = gen_fileoutput(n_URL, 0);
12024 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012025 contentType = gen_char_ptr_ptr(n_contentType, 2);
12026
12027 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12028 desret_int(ret_val);
12029 call_tests++;
William M. Brack015ccb22005-02-13 08:18:52 +000012030 des_fileoutput(n_URL, URL, 0);
12031 des_fileoutput(n_filename, filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012032 des_char_ptr_ptr(n_contentType, contentType, 2);
12033 xmlResetLastError();
12034 if (mem_base != xmlMemBlocks()) {
12035 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012037 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012038 printf(" %d", n_URL);
12039 printf(" %d", n_filename);
12040 printf(" %d", n_contentType);
12041 printf("\n");
12042 }
12043 }
12044 }
12045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012046 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012047#endif
12048
Daniel Veillard42595322004-11-08 10:52:06 +000012049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012050}
12051
12052
12053static int
12054test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012056
William M. Brack21e4ef22005-01-02 09:53:13 +000012057#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012058 int mem_base;
12059
12060 mem_base = xmlMemBlocks();
12061
12062 xmlNanoHTTPInit();
12063 call_tests++;
12064 xmlResetLastError();
12065 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012066 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012068 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012069 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012071 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012072#endif
12073
Daniel Veillard42595322004-11-08 10:52:06 +000012074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012075}
12076
12077
12078static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012079test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012081
William M. Brack21e4ef22005-01-02 09:53:13 +000012082#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012083 int mem_base;
12084 const char * ret_val;
12085 void * ctx; /* the HTTP context */
12086 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012087
Daniel Veillard27f20102004-11-05 11:50:11 +000012088 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12089 mem_base = xmlMemBlocks();
12090 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12091
12092 ret_val = xmlNanoHTTPMimeType(ctx);
12093 desret_const_char_ptr(ret_val);
12094 call_tests++;
12095 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12096 xmlResetLastError();
12097 if (mem_base != xmlMemBlocks()) {
12098 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012100 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012101 printf(" %d", n_ctx);
12102 printf("\n");
12103 }
12104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012105 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012106#endif
12107
Daniel Veillard42595322004-11-08 10:52:06 +000012108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012109}
12110
12111
12112static int
12113test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012115
William M. Brack21e4ef22005-01-02 09:53:13 +000012116#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012117 int mem_base;
12118 void * ret_val;
12119 const char * URL; /* The URL to load */
12120 int n_URL;
12121 char ** contentType; /* if available the Content-Type information will be returned at that location */
12122 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012123
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012124 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12125 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12126 mem_base = xmlMemBlocks();
12127 URL = gen_filepath(n_URL, 0);
12128 contentType = gen_char_ptr_ptr(n_contentType, 1);
12129
12130 ret_val = xmlNanoHTTPOpen(URL, contentType);
William M. Brack015ccb22005-02-13 08:18:52 +000012131 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012132 call_tests++;
12133 des_filepath(n_URL, URL, 0);
12134 des_char_ptr_ptr(n_contentType, contentType, 1);
12135 xmlResetLastError();
12136 if (mem_base != xmlMemBlocks()) {
12137 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012139 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012140 printf(" %d", n_URL);
12141 printf(" %d", n_contentType);
12142 printf("\n");
12143 }
12144 }
12145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012146 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012147#endif
12148
Daniel Veillard42595322004-11-08 10:52:06 +000012149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012150}
12151
12152
12153static int
12154test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012156
William M. Brack21e4ef22005-01-02 09:53:13 +000012157#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012158 int mem_base;
12159 void * ret_val;
12160 const char * URL; /* The URL to load */
12161 int n_URL;
12162 char ** contentType; /* if available the Content-Type information will be returned at that location */
12163 int n_contentType;
12164 char ** redir; /* if available the redirected URL will be returned */
12165 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012166
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012167 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12168 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12169 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12170 mem_base = xmlMemBlocks();
12171 URL = gen_filepath(n_URL, 0);
12172 contentType = gen_char_ptr_ptr(n_contentType, 1);
12173 redir = gen_char_ptr_ptr(n_redir, 2);
12174
12175 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
William M. Brack015ccb22005-02-13 08:18:52 +000012176 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012177 call_tests++;
12178 des_filepath(n_URL, URL, 0);
12179 des_char_ptr_ptr(n_contentType, contentType, 1);
12180 des_char_ptr_ptr(n_redir, redir, 2);
12181 xmlResetLastError();
12182 if (mem_base != xmlMemBlocks()) {
12183 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012185 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012186 printf(" %d", n_URL);
12187 printf(" %d", n_contentType);
12188 printf(" %d", n_redir);
12189 printf("\n");
12190 }
12191 }
12192 }
12193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012194 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012195#endif
12196
Daniel Veillard42595322004-11-08 10:52:06 +000012197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012198}
12199
12200
12201static int
12202test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012204
William M. Brack21e4ef22005-01-02 09:53:13 +000012205#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012206 int mem_base;
12207 int ret_val;
12208 void * ctx; /* the HTTP context */
12209 int n_ctx;
12210 void * dest; /* a buffer */
12211 int n_dest;
12212 int len; /* the buffer length */
12213 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012214
Daniel Veillard27f20102004-11-05 11:50:11 +000012215 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12216 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12217 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12218 mem_base = xmlMemBlocks();
12219 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12220 dest = gen_void_ptr(n_dest, 1);
12221 len = gen_int(n_len, 2);
12222
12223 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12224 desret_int(ret_val);
12225 call_tests++;
12226 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12227 des_void_ptr(n_dest, dest, 1);
12228 des_int(n_len, len, 2);
12229 xmlResetLastError();
12230 if (mem_base != xmlMemBlocks()) {
12231 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012233 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012234 printf(" %d", n_ctx);
12235 printf(" %d", n_dest);
12236 printf(" %d", n_len);
12237 printf("\n");
12238 }
12239 }
12240 }
12241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012242 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012243#endif
12244
Daniel Veillard42595322004-11-08 10:52:06 +000012245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012246}
12247
12248
12249static int
12250test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012252
12253
12254 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012256}
12257
12258
12259static int
12260test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012262
William M. Brack21e4ef22005-01-02 09:53:13 +000012263#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012264 int mem_base;
12265 int ret_val;
12266 void * ctx; /* the HTTP context */
12267 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012268
Daniel Veillard27f20102004-11-05 11:50:11 +000012269 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12270 mem_base = xmlMemBlocks();
12271 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12272
12273 ret_val = xmlNanoHTTPReturnCode(ctx);
12274 desret_int(ret_val);
12275 call_tests++;
12276 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12277 xmlResetLastError();
12278 if (mem_base != xmlMemBlocks()) {
12279 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012281 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012282 printf(" %d", n_ctx);
12283 printf("\n");
12284 }
12285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012286 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012287#endif
12288
Daniel Veillard42595322004-11-08 10:52:06 +000012289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012290}
12291
12292
12293static int
12294test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012296
William M. Brack21e4ef22005-01-02 09:53:13 +000012297#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012298 int mem_base;
12299 int ret_val;
12300 void * ctxt; /* the HTTP context */
12301 int n_ctxt;
12302 const char * filename; /* the filename where the content should be saved */
12303 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012304
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012305 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12306 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012308 ctxt = gen_void_ptr(n_ctxt, 0);
12309 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012310
12311 ret_val = xmlNanoHTTPSave(ctxt, filename);
12312 desret_int(ret_val);
12313 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012314 des_void_ptr(n_ctxt, ctxt, 0);
12315 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012316 xmlResetLastError();
12317 if (mem_base != xmlMemBlocks()) {
12318 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012320 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012321 printf(" %d", n_ctxt);
12322 printf(" %d", n_filename);
12323 printf("\n");
12324 }
12325 }
12326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012327 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012328#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012329
Daniel Veillard42595322004-11-08 10:52:06 +000012330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012331}
12332
12333
12334static int
12335test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012337
William M. Brack21e4ef22005-01-02 09:53:13 +000012338#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012339 const char * URL; /* The proxy URL used to initialize the proxy context */
12340 int n_URL;
12341
12342 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012343 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012344
12345 xmlNanoHTTPScanProxy(URL);
12346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012347 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012348 xmlResetLastError();
12349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012350 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012351#endif
12352
Daniel Veillard42595322004-11-08 10:52:06 +000012353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012354}
12355
12356static int
12357test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359
William M. Brack015ccb22005-02-13 08:18:52 +000012360 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012361 test_ret += test_xmlNanoHTTPAuthHeader();
12362 test_ret += test_xmlNanoHTTPCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +000012363 test_ret += test_xmlNanoHTTPContentLength();
12364 test_ret += test_xmlNanoHTTPEncoding();
12365 test_ret += test_xmlNanoHTTPFetch();
12366 test_ret += test_xmlNanoHTTPInit();
Daniel Veillard42595322004-11-08 10:52:06 +000012367 test_ret += test_xmlNanoHTTPMimeType();
12368 test_ret += test_xmlNanoHTTPOpen();
12369 test_ret += test_xmlNanoHTTPOpenRedir();
12370 test_ret += test_xmlNanoHTTPRead();
12371 test_ret += test_xmlNanoHTTPRedir();
12372 test_ret += test_xmlNanoHTTPReturnCode();
12373 test_ret += test_xmlNanoHTTPSave();
12374 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012375
Daniel Veillard42595322004-11-08 10:52:06 +000012376 if (test_ret != 0)
12377 printf("Module nanohttp: %d errors\n", test_ret);
12378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012379}
12380
12381static int
12382test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012384
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012385 int mem_base;
12386 long ret_val;
12387 xmlParserCtxtPtr ctxt; /* an XML parser context */
12388 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012389
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012390 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12391 mem_base = xmlMemBlocks();
12392 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12393
12394 ret_val = xmlByteConsumed(ctxt);
12395 desret_long(ret_val);
12396 call_tests++;
12397 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12398 xmlResetLastError();
12399 if (mem_base != xmlMemBlocks()) {
12400 printf("Leak of %d blocks found in xmlByteConsumed",
12401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012402 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012403 printf(" %d", n_ctxt);
12404 printf("\n");
12405 }
12406 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012407 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012408
Daniel Veillard42595322004-11-08 10:52:06 +000012409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012410}
12411
12412
12413static int
12414test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012416
Daniel Veillardce682bc2004-11-05 17:22:25 +000012417 int mem_base;
12418 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12419 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012420
Daniel Veillardce682bc2004-11-05 17:22:25 +000012421 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12422 mem_base = xmlMemBlocks();
12423 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12424
12425 xmlClearNodeInfoSeq(seq);
12426 call_tests++;
12427 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12428 xmlResetLastError();
12429 if (mem_base != xmlMemBlocks()) {
12430 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012432 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012433 printf(" %d", n_seq);
12434 printf("\n");
12435 }
12436 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012437 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012438
Daniel Veillard42595322004-11-08 10:52:06 +000012439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012440}
12441
12442
12443static int
12444test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012446
12447 int mem_base;
12448 xmlParserCtxtPtr ctxt; /* an XML parser context */
12449 int n_ctxt;
12450
12451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012453 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012454
12455 xmlClearParserCtxt(ctxt);
12456 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012457 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012458 xmlResetLastError();
12459 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012460 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012462 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012463 printf(" %d", n_ctxt);
12464 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012465 }
12466 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012467 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012468
Daniel Veillard42595322004-11-08 10:52:06 +000012469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012470}
12471
12472
12473static int
12474test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012476
Daniel Veillard34099b42004-11-04 17:34:35 +000012477 int mem_base;
12478 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012479 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012480 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012481
Daniel Veillard34099b42004-11-04 17:34:35 +000012482 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12483 mem_base = xmlMemBlocks();
12484 cur = gen_const_xmlChar_ptr(n_cur, 0);
12485
William M. Brackf13f77f2004-11-12 16:03:48 +000012486 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012487 desret_xmlParserCtxtPtr(ret_val);
12488 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012489 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012490 xmlResetLastError();
12491 if (mem_base != xmlMemBlocks()) {
12492 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012494 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012495 printf(" %d", n_cur);
12496 printf("\n");
12497 }
12498 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012500
Daniel Veillard42595322004-11-08 10:52:06 +000012501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012502}
12503
12504
12505static int
12506test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012508
William M. Brack21e4ef22005-01-02 09:53:13 +000012509#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012510 int mem_base;
12511 xmlParserCtxtPtr ret_val;
12512 xmlSAXHandlerPtr sax; /* a SAX handler */
12513 int n_sax;
12514 void * user_data; /* The user data returned on SAX callbacks */
12515 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012516 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012517 int n_chunk;
12518 int size; /* number of chars in the array */
12519 int n_size;
12520 const char * filename; /* an optional file name or URI */
12521 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012522
Daniel Veillard34099b42004-11-04 17:34:35 +000012523 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12524 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12525 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12526 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012527 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012528 mem_base = xmlMemBlocks();
12529 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12530 user_data = gen_userdata(n_user_data, 1);
12531 chunk = gen_const_char_ptr(n_chunk, 2);
12532 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012533 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012534
William M. Brackf13f77f2004-11-12 16:03:48 +000012535 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012536 desret_xmlParserCtxtPtr(ret_val);
12537 call_tests++;
12538 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12539 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012540 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012541 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012542 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012543 xmlResetLastError();
12544 if (mem_base != xmlMemBlocks()) {
12545 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012547 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012548 printf(" %d", n_sax);
12549 printf(" %d", n_user_data);
12550 printf(" %d", n_chunk);
12551 printf(" %d", n_size);
12552 printf(" %d", n_filename);
12553 printf("\n");
12554 }
12555 }
12556 }
12557 }
12558 }
12559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012560 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012561#endif
12562
Daniel Veillard42595322004-11-08 10:52:06 +000012563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012564}
12565
12566
12567static int
12568test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570
12571 int mem_base;
12572 xmlDocPtr ret_val;
12573 xmlParserCtxtPtr ctxt; /* an XML parser context */
12574 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012575 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012576 int n_cur;
12577 const char * URL; /* the base URL to use for the document */
12578 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012579 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012580 int n_encoding;
12581 int options; /* a combination of xmlParserOption */
12582 int n_options;
12583
12584 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12585 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12586 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12587 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012588 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012590 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12591 cur = gen_const_xmlChar_ptr(n_cur, 1);
12592 URL = gen_filepath(n_URL, 2);
12593 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012594 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012595
William M. Brackf13f77f2004-11-12 16:03:48 +000012596 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012597 desret_xmlDocPtr(ret_val);
12598 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012599 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012600 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012601 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012602 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012603 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012604 xmlResetLastError();
12605 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012606 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012608 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012609 printf(" %d", n_ctxt);
12610 printf(" %d", n_cur);
12611 printf(" %d", n_URL);
12612 printf(" %d", n_encoding);
12613 printf(" %d", n_options);
12614 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012615 }
12616 }
12617 }
12618 }
12619 }
12620 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012621 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012622
Daniel Veillard42595322004-11-08 10:52:06 +000012623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012624}
12625
12626
12627static int
12628test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012629 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012630
12631 int mem_base;
12632 xmlDocPtr ret_val;
12633 xmlParserCtxtPtr ctxt; /* an XML parser context */
12634 int n_ctxt;
12635 const char * filename; /* a file or URL */
12636 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012637 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012638 int n_encoding;
12639 int options; /* a combination of xmlParserOption */
12640 int n_options;
12641
12642 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12643 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12644 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012645 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012646 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012647 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12648 filename = gen_filepath(n_filename, 1);
12649 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012650 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012651
William M. Brackf13f77f2004-11-12 16:03:48 +000012652 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012653 desret_xmlDocPtr(ret_val);
12654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012655 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12656 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012657 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012658 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012659 xmlResetLastError();
12660 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012661 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012663 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012664 printf(" %d", n_ctxt);
12665 printf(" %d", n_filename);
12666 printf(" %d", n_encoding);
12667 printf(" %d", n_options);
12668 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 }
12670 }
12671 }
12672 }
12673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012675
Daniel Veillard42595322004-11-08 10:52:06 +000012676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012677}
12678
12679
12680static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012681test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012683
12684 int mem_base;
12685 xmlDocPtr ret_val;
12686 xmlParserCtxtPtr ctxt; /* an XML parser context */
12687 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012688 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689 int n_buffer;
12690 int size; /* the size of the array */
12691 int n_size;
12692 const char * URL; /* the base URL to use for the document */
12693 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012694 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695 int n_encoding;
12696 int options; /* a combination of xmlParserOption */
12697 int n_options;
12698
12699 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12700 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12701 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12702 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12703 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012704 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012706 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12707 buffer = gen_const_char_ptr(n_buffer, 1);
12708 size = gen_int(n_size, 2);
12709 URL = gen_filepath(n_URL, 3);
12710 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012711 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012712
William M. Brackf13f77f2004-11-12 16:03:48 +000012713 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012714 desret_xmlDocPtr(ret_val);
12715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012716 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012717 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012718 des_int(n_size, size, 2);
12719 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012720 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012721 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012722 xmlResetLastError();
12723 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012724 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012726 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012727 printf(" %d", n_ctxt);
12728 printf(" %d", n_buffer);
12729 printf(" %d", n_size);
12730 printf(" %d", n_URL);
12731 printf(" %d", n_encoding);
12732 printf(" %d", n_options);
12733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012734 }
12735 }
12736 }
12737 }
12738 }
12739 }
12740 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012742
Daniel Veillard42595322004-11-08 10:52:06 +000012743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012744}
12745
12746
12747static int
12748test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012750
12751 int mem_base;
12752 xmlParserCtxtPtr ctxt; /* an XML parser context */
12753 int n_ctxt;
12754
12755 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12756 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012757 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012758
12759 xmlCtxtReset(ctxt);
12760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012761 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012762 xmlResetLastError();
12763 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012764 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012766 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012767 printf(" %d", n_ctxt);
12768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012769 }
12770 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012772
Daniel Veillard42595322004-11-08 10:52:06 +000012773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012774}
12775
12776
12777static int
12778test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012780
12781 int mem_base;
12782 int ret_val;
12783 xmlParserCtxtPtr ctxt; /* an XML parser context */
12784 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012785 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012786 int n_chunk;
12787 int size; /* number of chars in the array */
12788 int n_size;
12789 const char * filename; /* an optional file name or URI */
12790 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012791 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012792 int n_encoding;
12793
12794 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12795 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12796 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12797 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12798 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12799 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012800 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12801 chunk = gen_const_char_ptr(n_chunk, 1);
12802 size = gen_int(n_size, 2);
12803 filename = gen_filepath(n_filename, 3);
12804 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805
William M. Brackf13f77f2004-11-12 16:03:48 +000012806 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012807 desret_int(ret_val);
12808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012809 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012810 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012811 des_int(n_size, size, 2);
12812 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012813 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814 xmlResetLastError();
12815 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012816 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012818 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012819 printf(" %d", n_ctxt);
12820 printf(" %d", n_chunk);
12821 printf(" %d", n_size);
12822 printf(" %d", n_filename);
12823 printf(" %d", n_encoding);
12824 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012825 }
12826 }
12827 }
12828 }
12829 }
12830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012832
Daniel Veillard42595322004-11-08 10:52:06 +000012833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834}
12835
12836
12837static int
12838test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012840
12841 int mem_base;
12842 int ret_val;
12843 xmlParserCtxtPtr ctxt; /* an XML parser context */
12844 int n_ctxt;
12845 int options; /* a combination of xmlParserOption */
12846 int n_options;
12847
12848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012849 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012851 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012852 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012853
12854 ret_val = xmlCtxtUseOptions(ctxt, options);
12855 desret_int(ret_val);
12856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012857 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012858 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012859 xmlResetLastError();
12860 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012861 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012863 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012864 printf(" %d", n_ctxt);
12865 printf(" %d", n_options);
12866 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012867 }
12868 }
12869 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012870 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012871
Daniel Veillard42595322004-11-08 10:52:06 +000012872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012873}
12874
12875
12876static int
12877test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012879
12880
12881 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012883}
12884
12885
12886static int
12887test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012889
William M. Brack21e4ef22005-01-02 09:53:13 +000012890#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012891#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012892 int mem_base;
12893 int ret_val;
12894 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12895 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012896 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012897 int n_name;
12898 void * result; /* location to store the result */
12899 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012900
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12902 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12903 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012905 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12906 name = gen_const_char_ptr(n_name, 1);
12907 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012908
William M. Brackf13f77f2004-11-12 16:03:48 +000012909 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012910 desret_int(ret_val);
12911 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012912 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012913 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012914 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012915 xmlResetLastError();
12916 if (mem_base != xmlMemBlocks()) {
12917 printf("Leak of %d blocks found in xmlGetFeature",
12918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012919 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012920 printf(" %d", n_ctxt);
12921 printf(" %d", n_name);
12922 printf(" %d", n_result);
12923 printf("\n");
12924 }
12925 }
12926 }
12927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012928 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012929#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012930#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012931
Daniel Veillard42595322004-11-08 10:52:06 +000012932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012933}
12934
12935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012936#define gen_nb_const_char_ptr_ptr 1
12937static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12938 return(NULL);
12939}
12940static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12941}
12942
Daniel Veillardd93f6252004-11-02 15:53:51 +000012943static int
12944test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012946
William M. Brack21e4ef22005-01-02 09:53:13 +000012947#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012948#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012949 int mem_base;
12950 int ret_val;
12951 int * len; /* the length of the features name array (input/output) */
12952 int n_len;
12953 char ** result; /* an array of string to be filled with the features name. */
12954 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012955
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012956 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
12957 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
12958 mem_base = xmlMemBlocks();
12959 len = gen_int_ptr(n_len, 0);
12960 result = gen_const_char_ptr_ptr(n_result, 1);
12961
William M. Brackf13f77f2004-11-12 16:03:48 +000012962 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012963 desret_int(ret_val);
12964 call_tests++;
12965 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012966 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012967 xmlResetLastError();
12968 if (mem_base != xmlMemBlocks()) {
12969 printf("Leak of %d blocks found in xmlGetFeaturesList",
12970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012971 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012972 printf(" %d", n_len);
12973 printf(" %d", n_result);
12974 printf("\n");
12975 }
12976 }
12977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012978 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012979#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012980#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012981
Daniel Veillard42595322004-11-08 10:52:06 +000012982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012983}
12984
12985
12986static int
12987test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012989
William M. Brack21e4ef22005-01-02 09:53:13 +000012990#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012991#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000012992 int mem_base;
12993 xmlDtdPtr ret_val;
12994 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12995 int n_sax;
12996 xmlParserInputBufferPtr input; /* an Input Buffer */
12997 int n_input;
12998 xmlCharEncoding enc; /* the charset encoding if known */
12999 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013000
Daniel Veillard34099b42004-11-04 17:34:35 +000013001 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13002 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13003 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13004 mem_base = xmlMemBlocks();
13005 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13006 input = gen_xmlParserInputBufferPtr(n_input, 1);
13007 enc = gen_xmlCharEncoding(n_enc, 2);
13008
13009 ret_val = xmlIOParseDTD(sax, input, enc);
13010 input = NULL;
13011 desret_xmlDtdPtr(ret_val);
13012 call_tests++;
13013 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13014 des_xmlParserInputBufferPtr(n_input, input, 1);
13015 des_xmlCharEncoding(n_enc, enc, 2);
13016 xmlResetLastError();
13017 if (mem_base != xmlMemBlocks()) {
13018 printf("Leak of %d blocks found in xmlIOParseDTD",
13019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013020 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013021 printf(" %d", n_sax);
13022 printf(" %d", n_input);
13023 printf(" %d", n_enc);
13024 printf("\n");
13025 }
13026 }
13027 }
13028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013029 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013030#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013031#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013032
Daniel Veillard42595322004-11-08 10:52:06 +000013033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013034}
13035
13036
13037static int
13038test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013040
Daniel Veillardce682bc2004-11-05 17:22:25 +000013041 int mem_base;
13042 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13043 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013044
Daniel Veillardce682bc2004-11-05 17:22:25 +000013045 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13046 mem_base = xmlMemBlocks();
13047 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13048
13049 xmlInitNodeInfoSeq(seq);
13050 call_tests++;
13051 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13052 xmlResetLastError();
13053 if (mem_base != xmlMemBlocks()) {
13054 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013056 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013057 printf(" %d", n_seq);
13058 printf("\n");
13059 }
13060 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013061 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013062
Daniel Veillard42595322004-11-08 10:52:06 +000013063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013064}
13065
13066
13067static int
13068test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013070
13071 int mem_base;
13072
13073 mem_base = xmlMemBlocks();
13074
13075 xmlInitParser();
13076 call_tests++;
13077 xmlResetLastError();
13078 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013079 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013081 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013082 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013083 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013084 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013085
Daniel Veillard42595322004-11-08 10:52:06 +000013086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013087}
13088
13089
13090static int
13091test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013093
13094 int mem_base;
13095 int ret_val;
13096 xmlParserCtxtPtr ctxt; /* an XML parser context */
13097 int n_ctxt;
13098
13099 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013101 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013102
13103 ret_val = xmlInitParserCtxt(ctxt);
13104 desret_int(ret_val);
13105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013106 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013107 xmlResetLastError();
13108 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013109 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013111 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013112 printf(" %d", n_ctxt);
13113 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013114 }
13115 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013116 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013117
Daniel Veillard42595322004-11-08 10:52:06 +000013118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013119}
13120
13121
13122static int
13123test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013125
13126 int mem_base;
13127 int ret_val;
13128 int val; /* int 0 or 1 */
13129 int n_val;
13130
13131 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13132 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013133 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013134
13135 ret_val = xmlKeepBlanksDefault(val);
13136 desret_int(ret_val);
13137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013138 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013139 xmlResetLastError();
13140 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013141 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013143 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013144 printf(" %d", n_val);
13145 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013146 }
13147 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013149
Daniel Veillard42595322004-11-08 10:52:06 +000013150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013151}
13152
13153
13154static int
13155test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013157
13158 int mem_base;
13159 int ret_val;
13160 int val; /* int 0 or 1 */
13161 int n_val;
13162
13163 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13164 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013165 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013166
13167 ret_val = xmlLineNumbersDefault(val);
13168 desret_int(ret_val);
13169 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013170 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013171 xmlResetLastError();
13172 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013173 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013175 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013176 printf(" %d", n_val);
13177 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178 }
13179 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013180 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013181
Daniel Veillard42595322004-11-08 10:52:06 +000013182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013183}
13184
13185
13186static int
13187test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013189
Daniel Veillard42595322004-11-08 10:52:06 +000013190 int mem_base;
13191 xmlParserInputPtr ret_val;
13192 const char * URL; /* the URL for the entity to load */
13193 int n_URL;
13194 char * ID; /* the Public ID for the entity to load */
13195 int n_ID;
13196 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13197 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013198
Daniel Veillard42595322004-11-08 10:52:06 +000013199 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13200 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13201 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13202 mem_base = xmlMemBlocks();
13203 URL = gen_filepath(n_URL, 0);
13204 ID = gen_const_char_ptr(n_ID, 1);
13205 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13206
William M. Brackf13f77f2004-11-12 16:03:48 +000013207 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013208 desret_xmlParserInputPtr(ret_val);
13209 call_tests++;
13210 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013211 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013212 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13213 xmlResetLastError();
13214 if (mem_base != xmlMemBlocks()) {
13215 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13216 xmlMemBlocks() - mem_base);
13217 test_ret++;
13218 printf(" %d", n_URL);
13219 printf(" %d", n_ID);
13220 printf(" %d", n_ctxt);
13221 printf("\n");
13222 }
13223 }
13224 }
13225 }
Daniel Veillard42595322004-11-08 10:52:06 +000013226 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013227
Daniel Veillard42595322004-11-08 10:52:06 +000013228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013229}
13230
13231
13232static int
13233test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013235
Daniel Veillard42595322004-11-08 10:52:06 +000013236 int mem_base;
13237 xmlParserInputPtr ret_val;
13238 xmlParserCtxtPtr ctxt; /* an XML parser context */
13239 int n_ctxt;
13240 xmlParserInputBufferPtr input; /* an I/O Input */
13241 int n_input;
13242 xmlCharEncoding enc; /* the charset encoding if known */
13243 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013244
Daniel Veillard42595322004-11-08 10:52:06 +000013245 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13246 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13247 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13248 mem_base = xmlMemBlocks();
13249 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13250 input = gen_xmlParserInputBufferPtr(n_input, 1);
13251 enc = gen_xmlCharEncoding(n_enc, 2);
13252
13253 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13254 if (ret_val != NULL) input = NULL;
13255 desret_xmlParserInputPtr(ret_val);
13256 call_tests++;
13257 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13258 des_xmlParserInputBufferPtr(n_input, input, 1);
13259 des_xmlCharEncoding(n_enc, enc, 2);
13260 xmlResetLastError();
13261 if (mem_base != xmlMemBlocks()) {
13262 printf("Leak of %d blocks found in xmlNewIOInputStream",
13263 xmlMemBlocks() - mem_base);
13264 test_ret++;
13265 printf(" %d", n_ctxt);
13266 printf(" %d", n_input);
13267 printf(" %d", n_enc);
13268 printf("\n");
13269 }
13270 }
13271 }
13272 }
Daniel Veillard42595322004-11-08 10:52:06 +000013273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013274
Daniel Veillard42595322004-11-08 10:52:06 +000013275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013276}
13277
13278
13279static int
13280test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013282
Daniel Veillard34099b42004-11-04 17:34:35 +000013283 int mem_base;
13284 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013285
Daniel Veillard34099b42004-11-04 17:34:35 +000013286 mem_base = xmlMemBlocks();
13287
13288 ret_val = xmlNewParserCtxt();
13289 desret_xmlParserCtxtPtr(ret_val);
13290 call_tests++;
13291 xmlResetLastError();
13292 if (mem_base != xmlMemBlocks()) {
13293 printf("Leak of %d blocks found in xmlNewParserCtxt",
13294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013295 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013296 printf("\n");
13297 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013299
Daniel Veillard42595322004-11-08 10:52:06 +000013300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013301}
13302
13303
Daniel Veillardce682bc2004-11-05 17:22:25 +000013304#define gen_nb_xmlNodePtr_ptr 1
13305static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13306 return(NULL);
13307}
13308static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13309}
13310
Daniel Veillardd93f6252004-11-02 15:53:51 +000013311static int
13312test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013314
William M. Brack21e4ef22005-01-02 09:53:13 +000013315#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013316#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013317 int mem_base;
13318 int ret_val;
13319 xmlDocPtr doc; /* the document the chunk pertains to */
13320 int n_doc;
13321 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13322 int n_sax;
13323 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13324 int n_user_data;
13325 int depth; /* Used for loop detection, use 0 */
13326 int n_depth;
13327 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13328 int n_string;
13329 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13330 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013331
Daniel Veillardce682bc2004-11-05 17:22:25 +000013332 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13333 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13334 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13335 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13336 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13337 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13338 mem_base = xmlMemBlocks();
13339 doc = gen_xmlDocPtr(n_doc, 0);
13340 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13341 user_data = gen_userdata(n_user_data, 2);
13342 depth = gen_int(n_depth, 3);
13343 string = gen_const_xmlChar_ptr(n_string, 4);
13344 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013345
13346#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013347 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013348#endif
13349
Daniel Veillardce682bc2004-11-05 17:22:25 +000013350
William M. Brackf13f77f2004-11-12 16:03:48 +000013351 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013352 desret_int(ret_val);
13353 call_tests++;
13354 des_xmlDocPtr(n_doc, doc, 0);
13355 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13356 des_userdata(n_user_data, user_data, 2);
13357 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013358 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013359 des_xmlNodePtr_ptr(n_lst, lst, 5);
13360 xmlResetLastError();
13361 if (mem_base != xmlMemBlocks()) {
13362 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013364 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013365 printf(" %d", n_doc);
13366 printf(" %d", n_sax);
13367 printf(" %d", n_user_data);
13368 printf(" %d", n_depth);
13369 printf(" %d", n_string);
13370 printf(" %d", n_lst);
13371 printf("\n");
13372 }
13373 }
13374 }
13375 }
13376 }
13377 }
13378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013379 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013380#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013381#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013382
Daniel Veillard42595322004-11-08 10:52:06 +000013383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013384}
13385
13386
13387static int
13388test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013390
William M. Brack21e4ef22005-01-02 09:53:13 +000013391#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013392#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013393 int mem_base;
13394 int ret_val;
13395 xmlDocPtr doc; /* the document the chunk pertains to */
13396 int n_doc;
13397 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13398 int n_sax;
13399 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13400 int n_user_data;
13401 int depth; /* Used for loop detection, use 0 */
13402 int n_depth;
13403 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13404 int n_string;
13405 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13406 int n_lst;
13407 int recover; /* return nodes even if the data is broken (use 0) */
13408 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013409
Daniel Veillardce682bc2004-11-05 17:22:25 +000013410 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13411 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13412 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13413 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13414 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13415 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13416 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13417 mem_base = xmlMemBlocks();
13418 doc = gen_xmlDocPtr(n_doc, 0);
13419 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13420 user_data = gen_userdata(n_user_data, 2);
13421 depth = gen_int(n_depth, 3);
13422 string = gen_const_xmlChar_ptr(n_string, 4);
13423 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13424 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013425
13426#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013427 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013428#endif
13429
Daniel Veillardce682bc2004-11-05 17:22:25 +000013430
William M. Brackf13f77f2004-11-12 16:03:48 +000013431 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013432 desret_int(ret_val);
13433 call_tests++;
13434 des_xmlDocPtr(n_doc, doc, 0);
13435 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13436 des_userdata(n_user_data, user_data, 2);
13437 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013438 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013439 des_xmlNodePtr_ptr(n_lst, lst, 5);
13440 des_int(n_recover, recover, 6);
13441 xmlResetLastError();
13442 if (mem_base != xmlMemBlocks()) {
13443 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013445 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013446 printf(" %d", n_doc);
13447 printf(" %d", n_sax);
13448 printf(" %d", n_user_data);
13449 printf(" %d", n_depth);
13450 printf(" %d", n_string);
13451 printf(" %d", n_lst);
13452 printf(" %d", n_recover);
13453 printf("\n");
13454 }
13455 }
13456 }
13457 }
13458 }
13459 }
13460 }
13461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013462 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013463#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013464#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013465
Daniel Veillard42595322004-11-08 10:52:06 +000013466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013467}
13468
13469
13470static int
13471test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013473
William M. Brack21e4ef22005-01-02 09:53:13 +000013474#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013475 int mem_base;
13476 int ret_val;
13477 xmlParserCtxtPtr ctxt; /* an XML parser context */
13478 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013479 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013480 int n_chunk;
13481 int size; /* the size in byte of the chunk */
13482 int n_size;
13483 int terminate; /* last chunk indicator */
13484 int n_terminate;
13485
13486 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13487 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13488 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13489 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013491 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13492 chunk = gen_const_char_ptr(n_chunk, 1);
13493 size = gen_int(n_size, 2);
13494 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013495
William M. Brackf13f77f2004-11-12 16:03:48 +000013496 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013497 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013498 desret_int(ret_val);
13499 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013500 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013501 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013502 des_int(n_size, size, 2);
13503 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013504 xmlResetLastError();
13505 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013506 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013508 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013509 printf(" %d", n_ctxt);
13510 printf(" %d", n_chunk);
13511 printf(" %d", n_size);
13512 printf(" %d", n_terminate);
13513 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013514 }
13515 }
13516 }
13517 }
13518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013519 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013520#endif
13521
Daniel Veillard42595322004-11-08 10:52:06 +000013522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013523}
13524
13525
13526static int
13527test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013529
Daniel Veillardce682bc2004-11-05 17:22:25 +000013530 int mem_base;
13531 int ret_val;
13532 xmlParserCtxtPtr ctx; /* the existing parsing context */
13533 int n_ctx;
13534 xmlChar * URL; /* the URL for the entity to load */
13535 int n_URL;
13536 xmlChar * ID; /* the System ID for the entity to load */
13537 int n_ID;
13538 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13539 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013540
Daniel Veillardce682bc2004-11-05 17:22:25 +000013541 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13542 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13543 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13544 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13545 mem_base = xmlMemBlocks();
13546 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13547 URL = gen_const_xmlChar_ptr(n_URL, 1);
13548 ID = gen_const_xmlChar_ptr(n_ID, 2);
13549 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13550
William M. Brackf13f77f2004-11-12 16:03:48 +000013551 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013552 desret_int(ret_val);
13553 call_tests++;
13554 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013555 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13556 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013557 des_xmlNodePtr_ptr(n_lst, lst, 3);
13558 xmlResetLastError();
13559 if (mem_base != xmlMemBlocks()) {
13560 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013562 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013563 printf(" %d", n_ctx);
13564 printf(" %d", n_URL);
13565 printf(" %d", n_ID);
13566 printf(" %d", n_lst);
13567 printf("\n");
13568 }
13569 }
13570 }
13571 }
13572 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013574
Daniel Veillard42595322004-11-08 10:52:06 +000013575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013576}
13577
13578
13579static int
13580test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013582
William M. Brack21e4ef22005-01-02 09:53:13 +000013583#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013584#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013585 int mem_base;
13586 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013587 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013588 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013589 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013590 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013591
Daniel Veillard34099b42004-11-04 17:34:35 +000013592 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13593 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13594 mem_base = xmlMemBlocks();
13595 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13596 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13597
William M. Brackf13f77f2004-11-12 16:03:48 +000013598 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013599 desret_xmlDtdPtr(ret_val);
13600 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013601 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13602 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013603 xmlResetLastError();
13604 if (mem_base != xmlMemBlocks()) {
13605 printf("Leak of %d blocks found in xmlParseDTD",
13606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013607 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013608 printf(" %d", n_ExternalID);
13609 printf(" %d", n_SystemID);
13610 printf("\n");
13611 }
13612 }
13613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013614 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013615#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013616#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013617
Daniel Veillard42595322004-11-08 10:52:06 +000013618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013619}
13620
13621
13622static int
13623test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013625
William M. Brack21e4ef22005-01-02 09:53:13 +000013626#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013627#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013628 int mem_base;
13629 xmlDocPtr ret_val;
13630 xmlChar * cur; /* a pointer to an array of xmlChar */
13631 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013632
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013633 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013634 mem_base = xmlMemBlocks();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013635 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013636
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013637 ret_val = xmlParseDoc((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013638 desret_xmlDocPtr(ret_val);
13639 call_tests++;
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013640 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013641 xmlResetLastError();
13642 if (mem_base != xmlMemBlocks()) {
13643 printf("Leak of %d blocks found in xmlParseDoc",
13644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013645 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013646 printf(" %d", n_cur);
13647 printf("\n");
13648 }
13649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013650 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013651#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013652#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013653
Daniel Veillard42595322004-11-08 10:52:06 +000013654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013655}
13656
13657
13658static int
13659test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013661
13662 int mem_base;
13663 int ret_val;
13664 xmlParserCtxtPtr ctxt; /* an XML parser context */
13665 int n_ctxt;
13666
13667 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013669 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013670
13671 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013672 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013673 desret_int(ret_val);
13674 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013675 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013676 xmlResetLastError();
13677 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013678 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013680 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013681 printf(" %d", n_ctxt);
13682 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013683 }
13684 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013686
Daniel Veillard42595322004-11-08 10:52:06 +000013687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013688}
13689
13690
13691static int
13692test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013694
William M. Brack21e4ef22005-01-02 09:53:13 +000013695#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013696#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697 int mem_base;
13698 xmlDocPtr ret_val;
13699 const char * filename; /* the filename */
13700 int n_filename;
13701
13702 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13703 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013704 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013705
13706 ret_val = xmlParseEntity(filename);
13707 desret_xmlDocPtr(ret_val);
13708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013709 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013710 xmlResetLastError();
13711 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013712 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013714 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013715 printf(" %d", n_filename);
13716 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013717 }
13718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013719 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013720#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013721#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013722
Daniel Veillard42595322004-11-08 10:52:06 +000013723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013724}
13725
13726
13727static int
13728test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013730
13731 int mem_base;
13732 int ret_val;
13733 xmlParserCtxtPtr ctxt; /* an XML parser context */
13734 int n_ctxt;
13735
13736 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013738 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013739
13740 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013741 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013742 desret_int(ret_val);
13743 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013744 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013745 xmlResetLastError();
13746 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013747 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013749 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013750 printf(" %d", n_ctxt);
13751 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013752 }
13753 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013754 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013755
Daniel Veillard42595322004-11-08 10:52:06 +000013756 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013757}
13758
13759
13760static int
13761test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013762 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013763
William M. Brack21e4ef22005-01-02 09:53:13 +000013764#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013765#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013766 int mem_base;
13767 int ret_val;
13768 xmlDocPtr doc; /* the document the chunk pertains to */
13769 int n_doc;
13770 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13771 int n_sax;
13772 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13773 int n_user_data;
13774 int depth; /* Used for loop detection, use 0 */
13775 int n_depth;
13776 xmlChar * URL; /* the URL for the entity to load */
13777 int n_URL;
13778 xmlChar * ID; /* the System ID for the entity to load */
13779 int n_ID;
13780 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13781 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013782
Daniel Veillardce682bc2004-11-05 17:22:25 +000013783 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13784 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13785 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13786 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13787 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13788 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13789 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13790 mem_base = xmlMemBlocks();
13791 doc = gen_xmlDocPtr(n_doc, 0);
13792 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13793 user_data = gen_userdata(n_user_data, 2);
13794 depth = gen_int(n_depth, 3);
13795 URL = gen_const_xmlChar_ptr(n_URL, 4);
13796 ID = gen_const_xmlChar_ptr(n_ID, 5);
13797 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13798
William M. Brackf13f77f2004-11-12 16:03:48 +000013799 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013800 desret_int(ret_val);
13801 call_tests++;
13802 des_xmlDocPtr(n_doc, doc, 0);
13803 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13804 des_userdata(n_user_data, user_data, 2);
13805 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013806 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13807 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013808 des_xmlNodePtr_ptr(n_lst, lst, 6);
13809 xmlResetLastError();
13810 if (mem_base != xmlMemBlocks()) {
13811 printf("Leak of %d blocks found in xmlParseExternalEntity",
13812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013813 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013814 printf(" %d", n_doc);
13815 printf(" %d", n_sax);
13816 printf(" %d", n_user_data);
13817 printf(" %d", n_depth);
13818 printf(" %d", n_URL);
13819 printf(" %d", n_ID);
13820 printf(" %d", n_lst);
13821 printf("\n");
13822 }
13823 }
13824 }
13825 }
13826 }
13827 }
13828 }
13829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013830 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013831#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013832#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013833
Daniel Veillard42595322004-11-08 10:52:06 +000013834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013835}
13836
13837
13838static int
13839test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013841
William M. Brack21e4ef22005-01-02 09:53:13 +000013842#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013843#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013844 int mem_base;
13845 xmlDocPtr ret_val;
13846 const char * filename; /* the filename */
13847 int n_filename;
13848
13849 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013851 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013852
13853 ret_val = xmlParseFile(filename);
13854 desret_xmlDocPtr(ret_val);
13855 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013856 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857 xmlResetLastError();
13858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013859 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013862 printf(" %d", n_filename);
13863 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013864 }
13865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013866 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013867#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013868#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013869
Daniel Veillard42595322004-11-08 10:52:06 +000013870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013871}
13872
13873
13874static int
13875test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013877
Daniel Veillard57b25162004-11-06 14:50:18 +000013878 int mem_base;
13879 xmlParserErrors ret_val;
13880 xmlNodePtr node; /* the context node */
13881 int n_node;
13882 char * data; /* the input string */
13883 int n_data;
13884 int datalen; /* the input string length in bytes */
13885 int n_datalen;
13886 int options; /* a combination of xmlParserOption */
13887 int n_options;
13888 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13889 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013890
Daniel Veillard57b25162004-11-06 14:50:18 +000013891 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13892 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13893 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013894 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013895 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13896 mem_base = xmlMemBlocks();
13897 node = gen_xmlNodePtr(n_node, 0);
13898 data = gen_const_char_ptr(n_data, 1);
13899 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013900 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013901 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13902
William M. Brackf13f77f2004-11-12 16:03:48 +000013903 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013904 desret_xmlParserErrors(ret_val);
13905 call_tests++;
13906 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013907 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013908 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013909 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013910 des_xmlNodePtr_ptr(n_lst, lst, 4);
13911 xmlResetLastError();
13912 if (mem_base != xmlMemBlocks()) {
13913 printf("Leak of %d blocks found in xmlParseInNodeContext",
13914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013915 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013916 printf(" %d", n_node);
13917 printf(" %d", n_data);
13918 printf(" %d", n_datalen);
13919 printf(" %d", n_options);
13920 printf(" %d", n_lst);
13921 printf("\n");
13922 }
13923 }
13924 }
13925 }
13926 }
13927 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013928 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013929
Daniel Veillard42595322004-11-08 10:52:06 +000013930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013931}
13932
13933
13934static int
13935test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013937
William M. Brack21e4ef22005-01-02 09:53:13 +000013938#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013939#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013940 int mem_base;
13941 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013942 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013943 int n_buffer;
13944 int size; /* the size of the array */
13945 int n_size;
13946
13947 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13948 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13949 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013950 buffer = gen_const_char_ptr(n_buffer, 0);
13951 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
William M. Brackf13f77f2004-11-12 16:03:48 +000013953 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013954 desret_xmlDocPtr(ret_val);
13955 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013956 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013957 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013958 xmlResetLastError();
13959 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013960 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013962 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013963 printf(" %d", n_buffer);
13964 printf(" %d", n_size);
13965 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013966 }
13967 }
13968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013969 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013970#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013971#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013972
Daniel Veillard42595322004-11-08 10:52:06 +000013973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013974}
13975
13976
Daniel Veillardce682bc2004-11-05 17:22:25 +000013977#define gen_nb_const_xmlParserNodeInfoPtr 1
13978static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13979 return(NULL);
13980}
13981static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13982}
13983
Daniel Veillardd93f6252004-11-02 15:53:51 +000013984static int
13985test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013987
Daniel Veillardce682bc2004-11-05 17:22:25 +000013988 int mem_base;
13989 xmlParserCtxtPtr ctxt; /* an XML parser context */
13990 int n_ctxt;
13991 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13992 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013993
Daniel Veillardce682bc2004-11-05 17:22:25 +000013994 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13995 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
13996 mem_base = xmlMemBlocks();
13997 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13998 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
13999
William M. Brackf13f77f2004-11-12 16:03:48 +000014000 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014001 call_tests++;
14002 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014003 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014004 xmlResetLastError();
14005 if (mem_base != xmlMemBlocks()) {
14006 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014008 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014009 printf(" %d", n_ctxt);
14010 printf(" %d", n_info);
14011 printf("\n");
14012 }
14013 }
14014 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014015 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014016
Daniel Veillard42595322004-11-08 10:52:06 +000014017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014018}
14019
14020
Daniel Veillardce682bc2004-11-05 17:22:25 +000014021#define gen_nb_const_xmlParserCtxtPtr 1
14022static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14023 return(NULL);
14024}
14025static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14026}
14027
Daniel Veillarda521d282004-11-09 14:59:59 +000014028#define gen_nb_const_xmlNodePtr 1
14029static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14030 return(NULL);
14031}
14032static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14033}
14034
Daniel Veillardd93f6252004-11-02 15:53:51 +000014035static int
14036test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014038
William M. Brack094dd862004-11-14 14:28:34 +000014039 int mem_base;
14040 const xmlParserNodeInfo * ret_val;
14041 xmlParserCtxtPtr ctx; /* an XML parser context */
14042 int n_ctx;
14043 xmlNodePtr node; /* an XML node within the tree */
14044 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014045
William M. Brack094dd862004-11-14 14:28:34 +000014046 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14047 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14048 mem_base = xmlMemBlocks();
14049 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14050 node = gen_const_xmlNodePtr(n_node, 1);
14051
14052 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14053 desret_const_xmlParserNodeInfo_ptr(ret_val);
14054 call_tests++;
14055 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14056 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14057 xmlResetLastError();
14058 if (mem_base != xmlMemBlocks()) {
14059 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14060 xmlMemBlocks() - mem_base);
14061 test_ret++;
14062 printf(" %d", n_ctx);
14063 printf(" %d", n_node);
14064 printf("\n");
14065 }
14066 }
14067 }
14068 function_tests++;
14069
Daniel Veillard42595322004-11-08 10:52:06 +000014070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014071}
14072
14073
Daniel Veillardce682bc2004-11-05 17:22:25 +000014074#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14075static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14076 return(NULL);
14077}
14078static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14079}
14080
Daniel Veillardd93f6252004-11-02 15:53:51 +000014081static int
14082test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014084
William M. Brack094dd862004-11-14 14:28:34 +000014085 int mem_base;
14086 unsigned long ret_val;
14087 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14088 int n_seq;
14089 xmlNodePtr node; /* an XML node pointer */
14090 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014091
William M. Brack094dd862004-11-14 14:28:34 +000014092 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14093 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14094 mem_base = xmlMemBlocks();
14095 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14096 node = gen_const_xmlNodePtr(n_node, 1);
14097
14098 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14099 desret_unsigned_long(ret_val);
14100 call_tests++;
14101 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14102 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14103 xmlResetLastError();
14104 if (mem_base != xmlMemBlocks()) {
14105 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14106 xmlMemBlocks() - mem_base);
14107 test_ret++;
14108 printf(" %d", n_seq);
14109 printf(" %d", n_node);
14110 printf("\n");
14111 }
14112 }
14113 }
14114 function_tests++;
14115
Daniel Veillard42595322004-11-08 10:52:06 +000014116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014117}
14118
14119
Daniel Veillardce682bc2004-11-05 17:22:25 +000014120#define gen_nb_xmlParserInputPtr 1
14121static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14122 return(NULL);
14123}
14124static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14125}
14126
Daniel Veillardd93f6252004-11-02 15:53:51 +000014127static int
14128test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014130
Daniel Veillardce682bc2004-11-05 17:22:25 +000014131 int mem_base;
14132 int ret_val;
14133 xmlParserInputPtr in; /* an XML parser input */
14134 int n_in;
14135 int len; /* an indicative size for the lookahead */
14136 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014137
Daniel Veillardce682bc2004-11-05 17:22:25 +000014138 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14139 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14140 mem_base = xmlMemBlocks();
14141 in = gen_xmlParserInputPtr(n_in, 0);
14142 len = gen_int(n_len, 1);
14143
14144 ret_val = xmlParserInputGrow(in, len);
14145 desret_int(ret_val);
14146 call_tests++;
14147 des_xmlParserInputPtr(n_in, in, 0);
14148 des_int(n_len, len, 1);
14149 xmlResetLastError();
14150 if (mem_base != xmlMemBlocks()) {
14151 printf("Leak of %d blocks found in xmlParserInputGrow",
14152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014153 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014154 printf(" %d", n_in);
14155 printf(" %d", n_len);
14156 printf("\n");
14157 }
14158 }
14159 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014161
Daniel Veillard42595322004-11-08 10:52:06 +000014162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014163}
14164
14165
14166static int
14167test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014169
Daniel Veillardce682bc2004-11-05 17:22:25 +000014170 int mem_base;
14171 int ret_val;
14172 xmlParserInputPtr in; /* an XML parser input */
14173 int n_in;
14174 int len; /* an indicative size for the lookahead */
14175 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014176
Daniel Veillardce682bc2004-11-05 17:22:25 +000014177 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14178 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14179 mem_base = xmlMemBlocks();
14180 in = gen_xmlParserInputPtr(n_in, 0);
14181 len = gen_int(n_len, 1);
14182
14183 ret_val = xmlParserInputRead(in, len);
14184 desret_int(ret_val);
14185 call_tests++;
14186 des_xmlParserInputPtr(n_in, in, 0);
14187 des_int(n_len, len, 1);
14188 xmlResetLastError();
14189 if (mem_base != xmlMemBlocks()) {
14190 printf("Leak of %d blocks found in xmlParserInputRead",
14191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014192 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014193 printf(" %d", n_in);
14194 printf(" %d", n_len);
14195 printf("\n");
14196 }
14197 }
14198 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014199 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014200
Daniel Veillard42595322004-11-08 10:52:06 +000014201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014202}
14203
14204
14205static int
14206test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014208
14209 int mem_base;
14210 int ret_val;
14211 int val; /* int 0 or 1 */
14212 int n_val;
14213
14214 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14215 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014216 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014217
14218 ret_val = xmlPedanticParserDefault(val);
14219 desret_int(ret_val);
14220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014221 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014222 xmlResetLastError();
14223 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014224 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014226 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014227 printf(" %d", n_val);
14228 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014229 }
14230 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014231 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014232
Daniel Veillard42595322004-11-08 10:52:06 +000014233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014234}
14235
14236
14237static int
14238test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014240
14241 int mem_base;
14242 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014243 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014244 int n_cur;
14245 const char * URL; /* the base URL to use for the document */
14246 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014247 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014248 int n_encoding;
14249 int options; /* a combination of xmlParserOption */
14250 int n_options;
14251
14252 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14253 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14254 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014255 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014257 cur = gen_const_xmlChar_ptr(n_cur, 0);
14258 URL = gen_filepath(n_URL, 1);
14259 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014260 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014261
William M. Brackf13f77f2004-11-12 16:03:48 +000014262 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014263 desret_xmlDocPtr(ret_val);
14264 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014265 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014266 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014267 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014268 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014269 xmlResetLastError();
14270 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014271 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014274 printf(" %d", n_cur);
14275 printf(" %d", n_URL);
14276 printf(" %d", n_encoding);
14277 printf(" %d", n_options);
14278 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014279 }
14280 }
14281 }
14282 }
14283 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014284 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014285
Daniel Veillard42595322004-11-08 10:52:06 +000014286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014287}
14288
14289
14290static int
14291test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014293
14294 int mem_base;
14295 xmlDocPtr ret_val;
14296 const char * filename; /* a file or URL */
14297 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014298 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014299 int n_encoding;
14300 int options; /* a combination of xmlParserOption */
14301 int n_options;
14302
14303 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14304 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014305 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014307 filename = gen_filepath(n_filename, 0);
14308 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014309 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014310
William M. Brackf13f77f2004-11-12 16:03:48 +000014311 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014312 desret_xmlDocPtr(ret_val);
14313 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014314 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014315 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014316 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014317 xmlResetLastError();
14318 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014319 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014321 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014322 printf(" %d", n_filename);
14323 printf(" %d", n_encoding);
14324 printf(" %d", n_options);
14325 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014326 }
14327 }
14328 }
14329 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014330 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014331
Daniel Veillard42595322004-11-08 10:52:06 +000014332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014333}
14334
14335
14336static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014339
14340 int mem_base;
14341 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014342 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014343 int n_buffer;
14344 int size; /* the size of the array */
14345 int n_size;
14346 const char * URL; /* the base URL to use for the document */
14347 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014348 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014349 int n_encoding;
14350 int options; /* a combination of xmlParserOption */
14351 int n_options;
14352
14353 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14354 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14355 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14356 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014357 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014359 buffer = gen_const_char_ptr(n_buffer, 0);
14360 size = gen_int(n_size, 1);
14361 URL = gen_filepath(n_URL, 2);
14362 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014363 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364
William M. Brackf13f77f2004-11-12 16:03:48 +000014365 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014366 desret_xmlDocPtr(ret_val);
14367 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014368 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014369 des_int(n_size, size, 1);
14370 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014371 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014372 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014373 xmlResetLastError();
14374 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014375 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014377 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014378 printf(" %d", n_buffer);
14379 printf(" %d", n_size);
14380 printf(" %d", n_URL);
14381 printf(" %d", n_encoding);
14382 printf(" %d", n_options);
14383 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014384 }
14385 }
14386 }
14387 }
14388 }
14389 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014391
Daniel Veillard42595322004-11-08 10:52:06 +000014392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014393}
14394
14395
14396static int
14397test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014399
William M. Brack21e4ef22005-01-02 09:53:13 +000014400#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014401#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014402 int mem_base;
14403 xmlDocPtr ret_val;
14404 xmlChar * cur; /* a pointer to an array of xmlChar */
14405 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014406
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014407 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014409 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014410
14411 ret_val = xmlRecoverDoc(cur);
14412 desret_xmlDocPtr(ret_val);
14413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014414 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014415 xmlResetLastError();
14416 if (mem_base != xmlMemBlocks()) {
14417 printf("Leak of %d blocks found in xmlRecoverDoc",
14418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014419 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014420 printf(" %d", n_cur);
14421 printf("\n");
14422 }
14423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014424 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014425#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014426#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014427
Daniel Veillard42595322004-11-08 10:52:06 +000014428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014429}
14430
14431
14432static int
14433test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014435
William M. Brack21e4ef22005-01-02 09:53:13 +000014436#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014437#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 int mem_base;
14439 xmlDocPtr ret_val;
14440 const char * filename; /* the filename */
14441 int n_filename;
14442
14443 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14444 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014445 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014446
14447 ret_val = xmlRecoverFile(filename);
14448 desret_xmlDocPtr(ret_val);
14449 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014450 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014451 xmlResetLastError();
14452 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014453 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014455 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014456 printf(" %d", n_filename);
14457 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014458 }
14459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014460 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014461#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014462#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014463
Daniel Veillard42595322004-11-08 10:52:06 +000014464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014465}
14466
14467
14468static int
14469test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014471
William M. Brack21e4ef22005-01-02 09:53:13 +000014472#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014473#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014474 int mem_base;
14475 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014476 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014477 int n_buffer;
14478 int size; /* the size of the array */
14479 int n_size;
14480
14481 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14482 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14483 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014484 buffer = gen_const_char_ptr(n_buffer, 0);
14485 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014486
William M. Brackf13f77f2004-11-12 16:03:48 +000014487 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014488 desret_xmlDocPtr(ret_val);
14489 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014490 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014491 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014492 xmlResetLastError();
14493 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014494 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014496 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014497 printf(" %d", n_buffer);
14498 printf(" %d", n_size);
14499 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014500 }
14501 }
14502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014503 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014504#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014505#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014506
Daniel Veillard42595322004-11-08 10:52:06 +000014507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014508}
14509
14510
14511static int
14512test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014514
William M. Brack21e4ef22005-01-02 09:53:13 +000014515#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014516#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014517 int mem_base;
14518 xmlDtdPtr ret_val;
14519 xmlSAXHandlerPtr sax; /* the SAX handler block */
14520 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014521 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014522 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014523 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014524 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014525
Daniel Veillard34099b42004-11-04 17:34:35 +000014526 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14527 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14528 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14529 mem_base = xmlMemBlocks();
14530 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14531 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14532 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14533
William M. Brackf13f77f2004-11-12 16:03:48 +000014534 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014535 desret_xmlDtdPtr(ret_val);
14536 call_tests++;
14537 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014538 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14539 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014540 xmlResetLastError();
14541 if (mem_base != xmlMemBlocks()) {
14542 printf("Leak of %d blocks found in xmlSAXParseDTD",
14543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014544 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014545 printf(" %d", n_sax);
14546 printf(" %d", n_ExternalID);
14547 printf(" %d", n_SystemID);
14548 printf("\n");
14549 }
14550 }
14551 }
14552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014553 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014554#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014555#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014556
Daniel Veillard42595322004-11-08 10:52:06 +000014557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014558}
14559
14560
14561static int
14562test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014564
William M. Brack21e4ef22005-01-02 09:53:13 +000014565#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014566#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014567 int mem_base;
14568 xmlDocPtr ret_val;
14569 xmlSAXHandlerPtr sax; /* the SAX handler block */
14570 int n_sax;
14571 xmlChar * cur; /* a pointer to an array of xmlChar */
14572 int n_cur;
14573 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14574 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014575
Daniel Veillard34099b42004-11-04 17:34:35 +000014576 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014577 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000014578 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14579 mem_base = xmlMemBlocks();
14580 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014581 cur = gen_const_xmlChar_ptr(n_cur, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014582 recovery = gen_int(n_recovery, 2);
14583
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014584 ret_val = xmlSAXParseDoc(sax, (const xmlChar *)cur, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014585 desret_xmlDocPtr(ret_val);
14586 call_tests++;
14587 des_xmlSAXHandlerPtr(n_sax, sax, 0);
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014588 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014589 des_int(n_recovery, recovery, 2);
14590 xmlResetLastError();
14591 if (mem_base != xmlMemBlocks()) {
14592 printf("Leak of %d blocks found in xmlSAXParseDoc",
14593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014594 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014595 printf(" %d", n_sax);
14596 printf(" %d", n_cur);
14597 printf(" %d", n_recovery);
14598 printf("\n");
14599 }
14600 }
14601 }
14602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014603 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014604#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014605#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014606
Daniel Veillard42595322004-11-08 10:52:06 +000014607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014608}
14609
14610
14611static int
14612test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014614
William M. Brack21e4ef22005-01-02 09:53:13 +000014615#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014616#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014617 int mem_base;
14618 xmlDocPtr ret_val;
14619 xmlSAXHandlerPtr sax; /* the SAX handler block */
14620 int n_sax;
14621 const char * filename; /* the filename */
14622 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014623
Daniel Veillard34099b42004-11-04 17:34:35 +000014624 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14625 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14626 mem_base = xmlMemBlocks();
14627 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14628 filename = gen_filepath(n_filename, 1);
14629
14630 ret_val = xmlSAXParseEntity(sax, filename);
14631 desret_xmlDocPtr(ret_val);
14632 call_tests++;
14633 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14634 des_filepath(n_filename, filename, 1);
14635 xmlResetLastError();
14636 if (mem_base != xmlMemBlocks()) {
14637 printf("Leak of %d blocks found in xmlSAXParseEntity",
14638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014639 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014640 printf(" %d", n_sax);
14641 printf(" %d", n_filename);
14642 printf("\n");
14643 }
14644 }
14645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014646 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014647#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014648#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014649
Daniel Veillard42595322004-11-08 10:52:06 +000014650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014651}
14652
14653
14654static int
14655test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014657
William M. Brack21e4ef22005-01-02 09:53:13 +000014658#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014659#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014660 int mem_base;
14661 xmlDocPtr ret_val;
14662 xmlSAXHandlerPtr sax; /* the SAX handler block */
14663 int n_sax;
14664 const char * filename; /* the filename */
14665 int n_filename;
14666 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14667 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014668
Daniel Veillard34099b42004-11-04 17:34:35 +000014669 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14670 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14671 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14672 mem_base = xmlMemBlocks();
14673 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14674 filename = gen_filepath(n_filename, 1);
14675 recovery = gen_int(n_recovery, 2);
14676
14677 ret_val = xmlSAXParseFile(sax, filename, recovery);
14678 desret_xmlDocPtr(ret_val);
14679 call_tests++;
14680 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14681 des_filepath(n_filename, filename, 1);
14682 des_int(n_recovery, recovery, 2);
14683 xmlResetLastError();
14684 if (mem_base != xmlMemBlocks()) {
14685 printf("Leak of %d blocks found in xmlSAXParseFile",
14686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014687 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014688 printf(" %d", n_sax);
14689 printf(" %d", n_filename);
14690 printf(" %d", n_recovery);
14691 printf("\n");
14692 }
14693 }
14694 }
14695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014696 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014697#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014698#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014699
Daniel Veillard42595322004-11-08 10:52:06 +000014700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014701}
14702
14703
14704static int
14705test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014707
William M. Brack21e4ef22005-01-02 09:53:13 +000014708#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014709#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014710 int mem_base;
14711 xmlDocPtr ret_val;
14712 xmlSAXHandlerPtr sax; /* the SAX handler block */
14713 int n_sax;
14714 const char * filename; /* the filename */
14715 int n_filename;
14716 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14717 int n_recovery;
14718 void * data; /* the userdata */
14719 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014720
Daniel Veillard34099b42004-11-04 17:34:35 +000014721 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14722 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14723 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14724 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14725 mem_base = xmlMemBlocks();
14726 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14727 filename = gen_filepath(n_filename, 1);
14728 recovery = gen_int(n_recovery, 2);
14729 data = gen_userdata(n_data, 3);
14730
14731 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14732 desret_xmlDocPtr(ret_val);
14733 call_tests++;
14734 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14735 des_filepath(n_filename, filename, 1);
14736 des_int(n_recovery, recovery, 2);
14737 des_userdata(n_data, data, 3);
14738 xmlResetLastError();
14739 if (mem_base != xmlMemBlocks()) {
14740 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014742 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014743 printf(" %d", n_sax);
14744 printf(" %d", n_filename);
14745 printf(" %d", n_recovery);
14746 printf(" %d", n_data);
14747 printf("\n");
14748 }
14749 }
14750 }
14751 }
14752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014753 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014754#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014755#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014756
Daniel Veillard42595322004-11-08 10:52:06 +000014757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014758}
14759
14760
14761static int
14762test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014764
William M. Brack21e4ef22005-01-02 09:53:13 +000014765#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014766#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014767 int mem_base;
14768 xmlDocPtr ret_val;
14769 xmlSAXHandlerPtr sax; /* the SAX handler block */
14770 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014771 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014772 int n_buffer;
14773 int size; /* the size of the array */
14774 int n_size;
14775 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14776 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014777
Daniel Veillard34099b42004-11-04 17:34:35 +000014778 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14779 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14780 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14781 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14782 mem_base = xmlMemBlocks();
14783 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14784 buffer = gen_const_char_ptr(n_buffer, 1);
14785 size = gen_int(n_size, 2);
14786 recovery = gen_int(n_recovery, 3);
14787
William M. Brackf13f77f2004-11-12 16:03:48 +000014788 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014789 desret_xmlDocPtr(ret_val);
14790 call_tests++;
14791 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014792 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014793 des_int(n_size, size, 2);
14794 des_int(n_recovery, recovery, 3);
14795 xmlResetLastError();
14796 if (mem_base != xmlMemBlocks()) {
14797 printf("Leak of %d blocks found in xmlSAXParseMemory",
14798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014799 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014800 printf(" %d", n_sax);
14801 printf(" %d", n_buffer);
14802 printf(" %d", n_size);
14803 printf(" %d", n_recovery);
14804 printf("\n");
14805 }
14806 }
14807 }
14808 }
14809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014810 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014811#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014812#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014813
Daniel Veillard42595322004-11-08 10:52:06 +000014814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014815}
14816
14817
14818static int
14819test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014821
William M. Brack21e4ef22005-01-02 09:53:13 +000014822#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014823#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014824 int mem_base;
14825 xmlDocPtr ret_val;
14826 xmlSAXHandlerPtr sax; /* the SAX handler block */
14827 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014828 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014829 int n_buffer;
14830 int size; /* the size of the array */
14831 int n_size;
14832 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14833 int n_recovery;
14834 void * data; /* the userdata */
14835 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014836
Daniel Veillard34099b42004-11-04 17:34:35 +000014837 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14838 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14839 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14840 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14841 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14842 mem_base = xmlMemBlocks();
14843 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14844 buffer = gen_const_char_ptr(n_buffer, 1);
14845 size = gen_int(n_size, 2);
14846 recovery = gen_int(n_recovery, 3);
14847 data = gen_userdata(n_data, 4);
14848
William M. Brackf13f77f2004-11-12 16:03:48 +000014849 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014850 desret_xmlDocPtr(ret_val);
14851 call_tests++;
14852 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014853 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014854 des_int(n_size, size, 2);
14855 des_int(n_recovery, recovery, 3);
14856 des_userdata(n_data, data, 4);
14857 xmlResetLastError();
14858 if (mem_base != xmlMemBlocks()) {
14859 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014861 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014862 printf(" %d", n_sax);
14863 printf(" %d", n_buffer);
14864 printf(" %d", n_size);
14865 printf(" %d", n_recovery);
14866 printf(" %d", n_data);
14867 printf("\n");
14868 }
14869 }
14870 }
14871 }
14872 }
14873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014874 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014875#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014876#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014877
Daniel Veillard42595322004-11-08 10:52:06 +000014878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014879}
14880
14881
14882static int
14883test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014885
William M. Brack21e4ef22005-01-02 09:53:13 +000014886#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014887#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014888 int mem_base;
14889 int ret_val;
14890 xmlSAXHandlerPtr sax; /* a SAX handler */
14891 int n_sax;
14892 void * user_data; /* The user data returned on SAX callbacks */
14893 int n_user_data;
14894 const char * filename; /* a file name */
14895 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014896
Daniel Veillard34099b42004-11-04 17:34:35 +000014897 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14898 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14899 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14900 mem_base = xmlMemBlocks();
14901 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14902 user_data = gen_userdata(n_user_data, 1);
14903 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014904
14905#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014906 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014907#endif
14908
Daniel Veillard34099b42004-11-04 17:34:35 +000014909
14910 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14911 desret_int(ret_val);
14912 call_tests++;
14913 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14914 des_userdata(n_user_data, user_data, 1);
14915 des_filepath(n_filename, filename, 2);
14916 xmlResetLastError();
14917 if (mem_base != xmlMemBlocks()) {
14918 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014920 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014921 printf(" %d", n_sax);
14922 printf(" %d", n_user_data);
14923 printf(" %d", n_filename);
14924 printf("\n");
14925 }
14926 }
14927 }
14928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014929 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014930#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014931#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014932
Daniel Veillard42595322004-11-08 10:52:06 +000014933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014934}
14935
14936
14937static int
14938test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014940
William M. Brack21e4ef22005-01-02 09:53:13 +000014941#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014942#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014943 int mem_base;
14944 int ret_val;
14945 xmlSAXHandlerPtr sax; /* a SAX handler */
14946 int n_sax;
14947 void * user_data; /* The user data returned on SAX callbacks */
14948 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014949 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 int n_buffer;
14951 int size; /* the length of the XML document in bytes */
14952 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014953
Daniel Veillard34099b42004-11-04 17:34:35 +000014954 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14955 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14956 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14957 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14958 mem_base = xmlMemBlocks();
14959 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14960 user_data = gen_userdata(n_user_data, 1);
14961 buffer = gen_const_char_ptr(n_buffer, 2);
14962 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014963
14964#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014965 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014966#endif
14967
Daniel Veillard34099b42004-11-04 17:34:35 +000014968
William M. Brackf13f77f2004-11-12 16:03:48 +000014969 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000014970 desret_int(ret_val);
14971 call_tests++;
14972 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14973 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014974 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014975 des_int(n_size, size, 3);
14976 xmlResetLastError();
14977 if (mem_base != xmlMemBlocks()) {
14978 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014980 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014981 printf(" %d", n_sax);
14982 printf(" %d", n_user_data);
14983 printf(" %d", n_buffer);
14984 printf(" %d", n_size);
14985 printf("\n");
14986 }
14987 }
14988 }
14989 }
14990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014991 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014992#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014993#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014994
Daniel Veillard42595322004-11-08 10:52:06 +000014995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014996}
14997
14998
14999static int
15000test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015002
15003
15004 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015006}
15007
15008
15009static int
15010test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015012
William M. Brack21e4ef22005-01-02 09:53:13 +000015013#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015014#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015015 int mem_base;
15016 int ret_val;
15017 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15018 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015019 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015020 int n_name;
15021 void * value; /* pointer to the location of the new value */
15022 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015023
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015024 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15025 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15026 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015028 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15029 name = gen_const_char_ptr(n_name, 1);
15030 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015031
William M. Brackf13f77f2004-11-12 16:03:48 +000015032 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015033 desret_int(ret_val);
15034 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015035 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015036 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015037 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015038 xmlResetLastError();
15039 if (mem_base != xmlMemBlocks()) {
15040 printf("Leak of %d blocks found in xmlSetFeature",
15041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015042 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015043 printf(" %d", n_ctxt);
15044 printf(" %d", n_name);
15045 printf(" %d", n_value);
15046 printf("\n");
15047 }
15048 }
15049 }
15050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015051 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015052#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015053#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015054
Daniel Veillard42595322004-11-08 10:52:06 +000015055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015056}
15057
15058
15059static int
15060test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015062
William M. Brack21e4ef22005-01-02 09:53:13 +000015063#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015064#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015065 int mem_base;
15066 xmlParserCtxtPtr ctxt; /* an XML parser context */
15067 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015068 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015069 int n_buffer;
15070 const char * filename; /* a file name */
15071 int n_filename;
15072
15073 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15074 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15075 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015077 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15078 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15079 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015080
William M. Brackf13f77f2004-11-12 16:03:48 +000015081 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015082 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015083 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015084 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015085 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015086 xmlResetLastError();
15087 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015088 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015090 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015091 printf(" %d", n_ctxt);
15092 printf(" %d", n_buffer);
15093 printf(" %d", n_filename);
15094 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015095 }
15096 }
15097 }
15098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015099 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015100#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015101#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015102
Daniel Veillard42595322004-11-08 10:52:06 +000015103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015104}
15105
15106
15107static int
15108test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015110
William M. Brack21e4ef22005-01-02 09:53:13 +000015111#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015112#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015113 int mem_base;
15114 xmlParserCtxtPtr ctxt; /* an XML parser context */
15115 int n_ctxt;
15116
15117 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015119 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015120
15121 xmlStopParser(ctxt);
15122 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015123 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015124 xmlResetLastError();
15125 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015126 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015128 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015129 printf(" %d", n_ctxt);
15130 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015131 }
15132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015133 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015134#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015135#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015136
Daniel Veillard42595322004-11-08 10:52:06 +000015137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015138}
15139
15140
15141static int
15142test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015144
15145 int mem_base;
15146 int ret_val;
15147 int val; /* int 0 or 1 */
15148 int n_val;
15149
15150 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015152 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015153
15154 ret_val = xmlSubstituteEntitiesDefault(val);
15155 desret_int(ret_val);
15156 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015157 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015158 xmlResetLastError();
15159 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015160 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015162 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015163 printf(" %d", n_val);
15164 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015165 }
15166 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015168
Daniel Veillard42595322004-11-08 10:52:06 +000015169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015170}
15171
15172static int
15173test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015175
William M. Brack094dd862004-11-14 14:28:34 +000015176 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015177 test_ret += test_xmlByteConsumed();
15178 test_ret += test_xmlClearNodeInfoSeq();
15179 test_ret += test_xmlClearParserCtxt();
15180 test_ret += test_xmlCreateDocParserCtxt();
15181 test_ret += test_xmlCreatePushParserCtxt();
15182 test_ret += test_xmlCtxtReadDoc();
15183 test_ret += test_xmlCtxtReadFile();
15184 test_ret += test_xmlCtxtReadMemory();
15185 test_ret += test_xmlCtxtReset();
15186 test_ret += test_xmlCtxtResetPush();
15187 test_ret += test_xmlCtxtUseOptions();
15188 test_ret += test_xmlGetExternalEntityLoader();
15189 test_ret += test_xmlGetFeature();
15190 test_ret += test_xmlGetFeaturesList();
15191 test_ret += test_xmlIOParseDTD();
15192 test_ret += test_xmlInitNodeInfoSeq();
15193 test_ret += test_xmlInitParser();
15194 test_ret += test_xmlInitParserCtxt();
15195 test_ret += test_xmlKeepBlanksDefault();
15196 test_ret += test_xmlLineNumbersDefault();
15197 test_ret += test_xmlLoadExternalEntity();
15198 test_ret += test_xmlNewIOInputStream();
15199 test_ret += test_xmlNewParserCtxt();
15200 test_ret += test_xmlParseBalancedChunkMemory();
15201 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15202 test_ret += test_xmlParseChunk();
15203 test_ret += test_xmlParseCtxtExternalEntity();
15204 test_ret += test_xmlParseDTD();
15205 test_ret += test_xmlParseDoc();
15206 test_ret += test_xmlParseDocument();
15207 test_ret += test_xmlParseEntity();
15208 test_ret += test_xmlParseExtParsedEnt();
15209 test_ret += test_xmlParseExternalEntity();
15210 test_ret += test_xmlParseFile();
15211 test_ret += test_xmlParseInNodeContext();
15212 test_ret += test_xmlParseMemory();
15213 test_ret += test_xmlParserAddNodeInfo();
15214 test_ret += test_xmlParserFindNodeInfo();
15215 test_ret += test_xmlParserFindNodeInfoIndex();
15216 test_ret += test_xmlParserInputGrow();
15217 test_ret += test_xmlParserInputRead();
15218 test_ret += test_xmlPedanticParserDefault();
15219 test_ret += test_xmlReadDoc();
15220 test_ret += test_xmlReadFile();
15221 test_ret += test_xmlReadMemory();
15222 test_ret += test_xmlRecoverDoc();
15223 test_ret += test_xmlRecoverFile();
15224 test_ret += test_xmlRecoverMemory();
15225 test_ret += test_xmlSAXParseDTD();
15226 test_ret += test_xmlSAXParseDoc();
15227 test_ret += test_xmlSAXParseEntity();
15228 test_ret += test_xmlSAXParseFile();
15229 test_ret += test_xmlSAXParseFileWithData();
15230 test_ret += test_xmlSAXParseMemory();
15231 test_ret += test_xmlSAXParseMemoryWithData();
15232 test_ret += test_xmlSAXUserParseFile();
15233 test_ret += test_xmlSAXUserParseMemory();
15234 test_ret += test_xmlSetExternalEntityLoader();
15235 test_ret += test_xmlSetFeature();
15236 test_ret += test_xmlSetupParserForBuffer();
15237 test_ret += test_xmlStopParser();
15238 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015239
Daniel Veillard42595322004-11-08 10:52:06 +000015240 if (test_ret != 0)
15241 printf("Module parser: %d errors\n", test_ret);
15242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015243}
15244
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015245static int
15246test_htmlCreateFileParserCtxt(void) {
15247 int test_ret = 0;
15248
William M. Brack21e4ef22005-01-02 09:53:13 +000015249#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015250 int mem_base;
15251 htmlParserCtxtPtr ret_val;
15252 const char * filename; /* the filename */
15253 int n_filename;
15254 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15255 int n_encoding;
15256
15257 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15258 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15259 mem_base = xmlMemBlocks();
15260 filename = gen_fileoutput(n_filename, 0);
15261 encoding = gen_const_char_ptr(n_encoding, 1);
15262
William M. Brackf13f77f2004-11-12 16:03:48 +000015263 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015264 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015265 call_tests++;
15266 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015267 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015268 xmlResetLastError();
15269 if (mem_base != xmlMemBlocks()) {
15270 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15271 xmlMemBlocks() - mem_base);
15272 test_ret++;
15273 printf(" %d", n_filename);
15274 printf(" %d", n_encoding);
15275 printf("\n");
15276 }
15277 }
15278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015279 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015280#endif
15281
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015282 return(test_ret);
15283}
15284
15285
15286static int
15287test_htmlInitAutoClose(void) {
15288 int test_ret = 0;
15289
William M. Brack21e4ef22005-01-02 09:53:13 +000015290#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015291 int mem_base;
15292
15293 mem_base = xmlMemBlocks();
15294
15295 htmlInitAutoClose();
15296 call_tests++;
15297 xmlResetLastError();
15298 if (mem_base != xmlMemBlocks()) {
15299 printf("Leak of %d blocks found in htmlInitAutoClose",
15300 xmlMemBlocks() - mem_base);
15301 test_ret++;
15302 printf("\n");
15303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015304 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015305#endif
15306
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015307 return(test_ret);
15308}
15309
15310
15311static int
15312test_inputPop(void) {
15313 int test_ret = 0;
15314
15315 int mem_base;
15316 xmlParserInputPtr ret_val;
15317 xmlParserCtxtPtr ctxt; /* an XML parser context */
15318 int n_ctxt;
15319
15320 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15321 mem_base = xmlMemBlocks();
15322 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15323
15324 ret_val = inputPop(ctxt);
15325 desret_xmlParserInputPtr(ret_val);
15326 call_tests++;
15327 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15328 xmlResetLastError();
15329 if (mem_base != xmlMemBlocks()) {
15330 printf("Leak of %d blocks found in inputPop",
15331 xmlMemBlocks() - mem_base);
15332 test_ret++;
15333 printf(" %d", n_ctxt);
15334 printf("\n");
15335 }
15336 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015337 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015338
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015339 return(test_ret);
15340}
15341
15342
15343static int
15344test_inputPush(void) {
15345 int test_ret = 0;
15346
15347 int mem_base;
15348 int ret_val;
15349 xmlParserCtxtPtr ctxt; /* an XML parser context */
15350 int n_ctxt;
15351 xmlParserInputPtr value; /* the parser input */
15352 int n_value;
15353
15354 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15355 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15356 mem_base = xmlMemBlocks();
15357 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15358 value = gen_xmlParserInputPtr(n_value, 1);
15359
15360 ret_val = inputPush(ctxt, value);
15361 desret_int(ret_val);
15362 call_tests++;
15363 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15364 des_xmlParserInputPtr(n_value, value, 1);
15365 xmlResetLastError();
15366 if (mem_base != xmlMemBlocks()) {
15367 printf("Leak of %d blocks found in inputPush",
15368 xmlMemBlocks() - mem_base);
15369 test_ret++;
15370 printf(" %d", n_ctxt);
15371 printf(" %d", n_value);
15372 printf("\n");
15373 }
15374 }
15375 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015376 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015377
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015378 return(test_ret);
15379}
15380
15381
15382static int
15383test_namePop(void) {
15384 int test_ret = 0;
15385
15386 int mem_base;
15387 const xmlChar * ret_val;
15388 xmlParserCtxtPtr ctxt; /* an XML parser context */
15389 int n_ctxt;
15390
15391 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15392 mem_base = xmlMemBlocks();
15393 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15394
15395 ret_val = namePop(ctxt);
15396 desret_const_xmlChar_ptr(ret_val);
15397 call_tests++;
15398 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15399 xmlResetLastError();
15400 if (mem_base != xmlMemBlocks()) {
15401 printf("Leak of %d blocks found in namePop",
15402 xmlMemBlocks() - mem_base);
15403 test_ret++;
15404 printf(" %d", n_ctxt);
15405 printf("\n");
15406 }
15407 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015408 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015409
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015410 return(test_ret);
15411}
15412
15413
15414static int
15415test_namePush(void) {
15416 int test_ret = 0;
15417
15418 int mem_base;
15419 int ret_val;
15420 xmlParserCtxtPtr ctxt; /* an XML parser context */
15421 int n_ctxt;
15422 xmlChar * value; /* the element name */
15423 int n_value;
15424
15425 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15426 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15427 mem_base = xmlMemBlocks();
15428 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15429 value = gen_const_xmlChar_ptr(n_value, 1);
15430
William M. Brackf13f77f2004-11-12 16:03:48 +000015431 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015432 desret_int(ret_val);
15433 call_tests++;
15434 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015435 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015436 xmlResetLastError();
15437 if (mem_base != xmlMemBlocks()) {
15438 printf("Leak of %d blocks found in namePush",
15439 xmlMemBlocks() - mem_base);
15440 test_ret++;
15441 printf(" %d", n_ctxt);
15442 printf(" %d", n_value);
15443 printf("\n");
15444 }
15445 }
15446 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015448
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015449 return(test_ret);
15450}
15451
15452
15453static int
15454test_nodePop(void) {
15455 int test_ret = 0;
15456
15457 int mem_base;
15458 xmlNodePtr ret_val;
15459 xmlParserCtxtPtr ctxt; /* an XML parser context */
15460 int n_ctxt;
15461
15462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15463 mem_base = xmlMemBlocks();
15464 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15465
15466 ret_val = nodePop(ctxt);
15467 desret_xmlNodePtr(ret_val);
15468 call_tests++;
15469 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15470 xmlResetLastError();
15471 if (mem_base != xmlMemBlocks()) {
15472 printf("Leak of %d blocks found in nodePop",
15473 xmlMemBlocks() - mem_base);
15474 test_ret++;
15475 printf(" %d", n_ctxt);
15476 printf("\n");
15477 }
15478 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015480
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015481 return(test_ret);
15482}
15483
15484
15485static int
15486test_nodePush(void) {
15487 int test_ret = 0;
15488
15489 int mem_base;
15490 int ret_val;
15491 xmlParserCtxtPtr ctxt; /* an XML parser context */
15492 int n_ctxt;
15493 xmlNodePtr value; /* the element node */
15494 int n_value;
15495
15496 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15497 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15498 mem_base = xmlMemBlocks();
15499 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15500 value = gen_xmlNodePtr(n_value, 1);
15501
15502 ret_val = nodePush(ctxt, value);
15503 desret_int(ret_val);
15504 call_tests++;
15505 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15506 des_xmlNodePtr(n_value, value, 1);
15507 xmlResetLastError();
15508 if (mem_base != xmlMemBlocks()) {
15509 printf("Leak of %d blocks found in nodePush",
15510 xmlMemBlocks() - mem_base);
15511 test_ret++;
15512 printf(" %d", n_ctxt);
15513 printf(" %d", n_value);
15514 printf("\n");
15515 }
15516 }
15517 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015519
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015520 return(test_ret);
15521}
15522
15523
15524static int
15525test_xmlCheckLanguageID(void) {
15526 int test_ret = 0;
15527
15528 int mem_base;
15529 int ret_val;
15530 xmlChar * lang; /* pointer to the string value */
15531 int n_lang;
15532
15533 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15534 mem_base = xmlMemBlocks();
15535 lang = gen_const_xmlChar_ptr(n_lang, 0);
15536
William M. Brackf13f77f2004-11-12 16:03:48 +000015537 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015538 desret_int(ret_val);
15539 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015540 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015541 xmlResetLastError();
15542 if (mem_base != xmlMemBlocks()) {
15543 printf("Leak of %d blocks found in xmlCheckLanguageID",
15544 xmlMemBlocks() - mem_base);
15545 test_ret++;
15546 printf(" %d", n_lang);
15547 printf("\n");
15548 }
15549 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015551
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015552 return(test_ret);
15553}
15554
15555
15556static int
15557test_xmlCopyChar(void) {
15558 int test_ret = 0;
15559
15560 int mem_base;
15561 int ret_val;
15562 int len; /* Ignored, compatibility */
15563 int n_len;
15564 xmlChar * out; /* pointer to an array of xmlChar */
15565 int n_out;
15566 int val; /* the char value */
15567 int n_val;
15568
15569 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15570 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15571 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15572 mem_base = xmlMemBlocks();
15573 len = gen_int(n_len, 0);
15574 out = gen_xmlChar_ptr(n_out, 1);
15575 val = gen_int(n_val, 2);
15576
15577 ret_val = xmlCopyChar(len, out, val);
15578 desret_int(ret_val);
15579 call_tests++;
15580 des_int(n_len, len, 0);
15581 des_xmlChar_ptr(n_out, out, 1);
15582 des_int(n_val, val, 2);
15583 xmlResetLastError();
15584 if (mem_base != xmlMemBlocks()) {
15585 printf("Leak of %d blocks found in xmlCopyChar",
15586 xmlMemBlocks() - mem_base);
15587 test_ret++;
15588 printf(" %d", n_len);
15589 printf(" %d", n_out);
15590 printf(" %d", n_val);
15591 printf("\n");
15592 }
15593 }
15594 }
15595 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015596 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015597
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015598 return(test_ret);
15599}
15600
15601
15602static int
15603test_xmlCopyCharMultiByte(void) {
15604 int test_ret = 0;
15605
15606 int mem_base;
15607 int ret_val;
15608 xmlChar * out; /* pointer to an array of xmlChar */
15609 int n_out;
15610 int val; /* the char value */
15611 int n_val;
15612
15613 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15614 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15615 mem_base = xmlMemBlocks();
15616 out = gen_xmlChar_ptr(n_out, 0);
15617 val = gen_int(n_val, 1);
15618
15619 ret_val = xmlCopyCharMultiByte(out, val);
15620 desret_int(ret_val);
15621 call_tests++;
15622 des_xmlChar_ptr(n_out, out, 0);
15623 des_int(n_val, val, 1);
15624 xmlResetLastError();
15625 if (mem_base != xmlMemBlocks()) {
15626 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15627 xmlMemBlocks() - mem_base);
15628 test_ret++;
15629 printf(" %d", n_out);
15630 printf(" %d", n_val);
15631 printf("\n");
15632 }
15633 }
15634 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015635 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015636
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015637 return(test_ret);
15638}
15639
15640
15641static int
15642test_xmlCreateEntityParserCtxt(void) {
15643 int test_ret = 0;
15644
15645 int mem_base;
15646 xmlParserCtxtPtr ret_val;
15647 xmlChar * URL; /* the entity URL */
15648 int n_URL;
15649 xmlChar * ID; /* the entity PUBLIC ID */
15650 int n_ID;
15651 xmlChar * base; /* a possible base for the target URI */
15652 int n_base;
15653
15654 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15655 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15656 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15657 mem_base = xmlMemBlocks();
15658 URL = gen_const_xmlChar_ptr(n_URL, 0);
15659 ID = gen_const_xmlChar_ptr(n_ID, 1);
15660 base = gen_const_xmlChar_ptr(n_base, 2);
15661
William M. Brackf13f77f2004-11-12 16:03:48 +000015662 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015663 desret_xmlParserCtxtPtr(ret_val);
15664 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015665 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15666 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15667 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015668 xmlResetLastError();
15669 if (mem_base != xmlMemBlocks()) {
15670 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15671 xmlMemBlocks() - mem_base);
15672 test_ret++;
15673 printf(" %d", n_URL);
15674 printf(" %d", n_ID);
15675 printf(" %d", n_base);
15676 printf("\n");
15677 }
15678 }
15679 }
15680 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015681 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015682
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015683 return(test_ret);
15684}
15685
15686
15687static int
15688test_xmlCreateFileParserCtxt(void) {
15689 int test_ret = 0;
15690
15691 int mem_base;
15692 xmlParserCtxtPtr ret_val;
15693 const char * filename; /* the filename */
15694 int n_filename;
15695
15696 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15697 mem_base = xmlMemBlocks();
15698 filename = gen_fileoutput(n_filename, 0);
15699
15700 ret_val = xmlCreateFileParserCtxt(filename);
15701 desret_xmlParserCtxtPtr(ret_val);
15702 call_tests++;
15703 des_fileoutput(n_filename, filename, 0);
15704 xmlResetLastError();
15705 if (mem_base != xmlMemBlocks()) {
15706 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15707 xmlMemBlocks() - mem_base);
15708 test_ret++;
15709 printf(" %d", n_filename);
15710 printf("\n");
15711 }
15712 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015713 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015714
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015715 return(test_ret);
15716}
15717
15718
15719static int
15720test_xmlCreateMemoryParserCtxt(void) {
15721 int test_ret = 0;
15722
15723 int mem_base;
15724 xmlParserCtxtPtr ret_val;
15725 char * buffer; /* a pointer to a char array */
15726 int n_buffer;
15727 int size; /* the size of the array */
15728 int n_size;
15729
15730 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15731 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15732 mem_base = xmlMemBlocks();
15733 buffer = gen_const_char_ptr(n_buffer, 0);
15734 size = gen_int(n_size, 1);
15735
William M. Brackf13f77f2004-11-12 16:03:48 +000015736 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015737 desret_xmlParserCtxtPtr(ret_val);
15738 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015739 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015740 des_int(n_size, size, 1);
15741 xmlResetLastError();
15742 if (mem_base != xmlMemBlocks()) {
15743 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15744 xmlMemBlocks() - mem_base);
15745 test_ret++;
15746 printf(" %d", n_buffer);
15747 printf(" %d", n_size);
15748 printf("\n");
15749 }
15750 }
15751 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015753
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015754 return(test_ret);
15755}
15756
15757
15758static int
15759test_xmlCreateURLParserCtxt(void) {
15760 int test_ret = 0;
15761
15762 int mem_base;
15763 xmlParserCtxtPtr ret_val;
15764 const char * filename; /* the filename or URL */
15765 int n_filename;
15766 int options; /* a combination of xmlParserOption */
15767 int n_options;
15768
15769 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15770 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15771 mem_base = xmlMemBlocks();
15772 filename = gen_fileoutput(n_filename, 0);
15773 options = gen_int(n_options, 1);
15774
15775 ret_val = xmlCreateURLParserCtxt(filename, options);
15776 desret_xmlParserCtxtPtr(ret_val);
15777 call_tests++;
15778 des_fileoutput(n_filename, filename, 0);
15779 des_int(n_options, options, 1);
15780 xmlResetLastError();
15781 if (mem_base != xmlMemBlocks()) {
15782 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15783 xmlMemBlocks() - mem_base);
15784 test_ret++;
15785 printf(" %d", n_filename);
15786 printf(" %d", n_options);
15787 printf("\n");
15788 }
15789 }
15790 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015791 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015792
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015793 return(test_ret);
15794}
15795
15796
15797static int
15798test_xmlCurrentChar(void) {
15799 int test_ret = 0;
15800
15801 int mem_base;
15802 int ret_val;
15803 xmlParserCtxtPtr ctxt; /* the XML parser context */
15804 int n_ctxt;
15805 int * len; /* pointer to the length of the char read */
15806 int n_len;
15807
15808 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15809 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15810 mem_base = xmlMemBlocks();
15811 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15812 len = gen_int_ptr(n_len, 1);
15813
15814 ret_val = xmlCurrentChar(ctxt, len);
15815 desret_int(ret_val);
15816 call_tests++;
15817 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15818 des_int_ptr(n_len, len, 1);
15819 xmlResetLastError();
15820 if (mem_base != xmlMemBlocks()) {
15821 printf("Leak of %d blocks found in xmlCurrentChar",
15822 xmlMemBlocks() - mem_base);
15823 test_ret++;
15824 printf(" %d", n_ctxt);
15825 printf(" %d", n_len);
15826 printf("\n");
15827 }
15828 }
15829 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015831
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015832 return(test_ret);
15833}
15834
15835
15836static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015837test_xmlErrMemory(void) {
15838 int test_ret = 0;
15839
15840 int mem_base;
15841 xmlParserCtxtPtr ctxt; /* an XML parser context */
15842 int n_ctxt;
15843 char * extra; /* extra informations */
15844 int n_extra;
15845
15846 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15847 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15848 mem_base = xmlMemBlocks();
15849 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15850 extra = gen_const_char_ptr(n_extra, 1);
15851
William M. Brackf13f77f2004-11-12 16:03:48 +000015852 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015853 call_tests++;
15854 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015855 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015856 xmlResetLastError();
15857 if (mem_base != xmlMemBlocks()) {
15858 printf("Leak of %d blocks found in xmlErrMemory",
15859 xmlMemBlocks() - mem_base);
15860 test_ret++;
15861 printf(" %d", n_ctxt);
15862 printf(" %d", n_extra);
15863 printf("\n");
15864 }
15865 }
15866 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015868
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015869 return(test_ret);
15870}
15871
15872
15873static int
15874test_xmlIsLetter(void) {
15875 int test_ret = 0;
15876
15877 int mem_base;
15878 int ret_val;
15879 int c; /* an unicode character (int) */
15880 int n_c;
15881
15882 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15883 mem_base = xmlMemBlocks();
15884 c = gen_int(n_c, 0);
15885
15886 ret_val = xmlIsLetter(c);
15887 desret_int(ret_val);
15888 call_tests++;
15889 des_int(n_c, c, 0);
15890 xmlResetLastError();
15891 if (mem_base != xmlMemBlocks()) {
15892 printf("Leak of %d blocks found in xmlIsLetter",
15893 xmlMemBlocks() - mem_base);
15894 test_ret++;
15895 printf(" %d", n_c);
15896 printf("\n");
15897 }
15898 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015900
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015901 return(test_ret);
15902}
15903
15904
15905static int
15906test_xmlNewEntityInputStream(void) {
15907 int test_ret = 0;
15908
15909 int mem_base;
15910 xmlParserInputPtr ret_val;
15911 xmlParserCtxtPtr ctxt; /* an XML parser context */
15912 int n_ctxt;
15913 xmlEntityPtr entity; /* an Entity pointer */
15914 int n_entity;
15915
15916 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15917 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15918 mem_base = xmlMemBlocks();
15919 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15920 entity = gen_xmlEntityPtr(n_entity, 1);
15921
15922 ret_val = xmlNewEntityInputStream(ctxt, entity);
15923 desret_xmlParserInputPtr(ret_val);
15924 call_tests++;
15925 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15926 des_xmlEntityPtr(n_entity, entity, 1);
15927 xmlResetLastError();
15928 if (mem_base != xmlMemBlocks()) {
15929 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15930 xmlMemBlocks() - mem_base);
15931 test_ret++;
15932 printf(" %d", n_ctxt);
15933 printf(" %d", n_entity);
15934 printf("\n");
15935 }
15936 }
15937 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015939
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015940 return(test_ret);
15941}
15942
15943
15944static int
15945test_xmlNewInputFromFile(void) {
15946 int test_ret = 0;
15947
15948 int mem_base;
15949 xmlParserInputPtr ret_val;
15950 xmlParserCtxtPtr ctxt; /* an XML parser context */
15951 int n_ctxt;
15952 const char * filename; /* the filename to use as entity */
15953 int n_filename;
15954
15955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15956 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15957 mem_base = xmlMemBlocks();
15958 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15959 filename = gen_filepath(n_filename, 1);
15960
15961 ret_val = xmlNewInputFromFile(ctxt, filename);
15962 desret_xmlParserInputPtr(ret_val);
15963 call_tests++;
15964 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15965 des_filepath(n_filename, filename, 1);
15966 xmlResetLastError();
15967 if (mem_base != xmlMemBlocks()) {
15968 printf("Leak of %d blocks found in xmlNewInputFromFile",
15969 xmlMemBlocks() - mem_base);
15970 test_ret++;
15971 printf(" %d", n_ctxt);
15972 printf(" %d", n_filename);
15973 printf("\n");
15974 }
15975 }
15976 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015978
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015979 return(test_ret);
15980}
15981
15982
15983static int
15984test_xmlNewInputStream(void) {
15985 int test_ret = 0;
15986
15987 int mem_base;
15988 xmlParserInputPtr ret_val;
15989 xmlParserCtxtPtr ctxt; /* an XML parser context */
15990 int n_ctxt;
15991
15992 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15993 mem_base = xmlMemBlocks();
15994 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15995
15996 ret_val = xmlNewInputStream(ctxt);
15997 desret_xmlParserInputPtr(ret_val);
15998 call_tests++;
15999 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16000 xmlResetLastError();
16001 if (mem_base != xmlMemBlocks()) {
16002 printf("Leak of %d blocks found in xmlNewInputStream",
16003 xmlMemBlocks() - mem_base);
16004 test_ret++;
16005 printf(" %d", n_ctxt);
16006 printf("\n");
16007 }
16008 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016009 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016010
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016011 return(test_ret);
16012}
16013
16014
16015static int
16016test_xmlNewStringInputStream(void) {
16017 int test_ret = 0;
16018
16019 int mem_base;
16020 xmlParserInputPtr ret_val;
16021 xmlParserCtxtPtr ctxt; /* an XML parser context */
16022 int n_ctxt;
16023 xmlChar * buffer; /* an memory buffer */
16024 int n_buffer;
16025
16026 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16027 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16028 mem_base = xmlMemBlocks();
16029 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16030 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16031
William M. Brackf13f77f2004-11-12 16:03:48 +000016032 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016033 desret_xmlParserInputPtr(ret_val);
16034 call_tests++;
16035 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016036 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016037 xmlResetLastError();
16038 if (mem_base != xmlMemBlocks()) {
16039 printf("Leak of %d blocks found in xmlNewStringInputStream",
16040 xmlMemBlocks() - mem_base);
16041 test_ret++;
16042 printf(" %d", n_ctxt);
16043 printf(" %d", n_buffer);
16044 printf("\n");
16045 }
16046 }
16047 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016049
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016050 return(test_ret);
16051}
16052
16053
16054static int
16055test_xmlNextChar(void) {
16056 int test_ret = 0;
16057
16058 int mem_base;
16059 xmlParserCtxtPtr ctxt; /* the XML parser context */
16060 int n_ctxt;
16061
16062 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16063 mem_base = xmlMemBlocks();
16064 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16065
16066 xmlNextChar(ctxt);
16067 call_tests++;
16068 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16069 xmlResetLastError();
16070 if (mem_base != xmlMemBlocks()) {
16071 printf("Leak of %d blocks found in xmlNextChar",
16072 xmlMemBlocks() - mem_base);
16073 test_ret++;
16074 printf(" %d", n_ctxt);
16075 printf("\n");
16076 }
16077 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016078 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016079
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016080 return(test_ret);
16081}
16082
16083
16084static int
16085test_xmlParserInputShrink(void) {
16086 int test_ret = 0;
16087
16088 int mem_base;
16089 xmlParserInputPtr in; /* an XML parser input */
16090 int n_in;
16091
16092 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16093 mem_base = xmlMemBlocks();
16094 in = gen_xmlParserInputPtr(n_in, 0);
16095
16096 xmlParserInputShrink(in);
16097 call_tests++;
16098 des_xmlParserInputPtr(n_in, in, 0);
16099 xmlResetLastError();
16100 if (mem_base != xmlMemBlocks()) {
16101 printf("Leak of %d blocks found in xmlParserInputShrink",
16102 xmlMemBlocks() - mem_base);
16103 test_ret++;
16104 printf(" %d", n_in);
16105 printf("\n");
16106 }
16107 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016109
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016110 return(test_ret);
16111}
16112
16113
16114static int
16115test_xmlPopInput(void) {
16116 int test_ret = 0;
16117
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016118 int mem_base;
16119 xmlChar ret_val;
16120 xmlParserCtxtPtr ctxt; /* an XML parser context */
16121 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016122
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016123 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16124 mem_base = xmlMemBlocks();
16125 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16126
16127 ret_val = xmlPopInput(ctxt);
16128 desret_xmlChar(ret_val);
16129 call_tests++;
16130 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16131 xmlResetLastError();
16132 if (mem_base != xmlMemBlocks()) {
16133 printf("Leak of %d blocks found in xmlPopInput",
16134 xmlMemBlocks() - mem_base);
16135 test_ret++;
16136 printf(" %d", n_ctxt);
16137 printf("\n");
16138 }
16139 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016141
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016142 return(test_ret);
16143}
16144
16145
16146static int
16147test_xmlPushInput(void) {
16148 int test_ret = 0;
16149
16150 int mem_base;
16151 xmlParserCtxtPtr ctxt; /* an XML parser context */
16152 int n_ctxt;
16153 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16154 int n_input;
16155
16156 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16157 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16158 mem_base = xmlMemBlocks();
16159 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16160 input = gen_xmlParserInputPtr(n_input, 1);
16161
16162 xmlPushInput(ctxt, input);
16163 call_tests++;
16164 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16165 des_xmlParserInputPtr(n_input, input, 1);
16166 xmlResetLastError();
16167 if (mem_base != xmlMemBlocks()) {
16168 printf("Leak of %d blocks found in xmlPushInput",
16169 xmlMemBlocks() - mem_base);
16170 test_ret++;
16171 printf(" %d", n_ctxt);
16172 printf(" %d", n_input);
16173 printf("\n");
16174 }
16175 }
16176 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016178
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016179 return(test_ret);
16180}
16181
16182
16183static int
16184test_xmlSetEntityReferenceFunc(void) {
16185 int test_ret = 0;
16186
16187
16188 /* missing type support */
16189 return(test_ret);
16190}
16191
16192
16193static int
16194test_xmlSplitQName(void) {
16195 int test_ret = 0;
16196
16197 int mem_base;
16198 xmlChar * ret_val;
16199 xmlParserCtxtPtr ctxt; /* an XML parser context */
16200 int n_ctxt;
16201 xmlChar * name; /* an XML parser context */
16202 int n_name;
16203 xmlChar ** prefix; /* a xmlChar ** */
16204 int n_prefix;
16205
16206 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16207 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16208 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16209 mem_base = xmlMemBlocks();
16210 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16211 name = gen_const_xmlChar_ptr(n_name, 1);
16212 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16213
William M. Brackf13f77f2004-11-12 16:03:48 +000016214 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016215 desret_xmlChar_ptr(ret_val);
16216 call_tests++;
16217 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016218 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016219 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16220 xmlResetLastError();
16221 if (mem_base != xmlMemBlocks()) {
16222 printf("Leak of %d blocks found in xmlSplitQName",
16223 xmlMemBlocks() - mem_base);
16224 test_ret++;
16225 printf(" %d", n_ctxt);
16226 printf(" %d", n_name);
16227 printf(" %d", n_prefix);
16228 printf("\n");
16229 }
16230 }
16231 }
16232 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016233 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016234
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016235 return(test_ret);
16236}
16237
16238
16239static int
16240test_xmlStringCurrentChar(void) {
16241 int test_ret = 0;
16242
16243 int mem_base;
16244 int ret_val;
16245 xmlParserCtxtPtr ctxt; /* the XML parser context */
16246 int n_ctxt;
16247 xmlChar * cur; /* pointer to the beginning of the char */
16248 int n_cur;
16249 int * len; /* pointer to the length of the char read */
16250 int n_len;
16251
16252 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16253 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16254 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16255 mem_base = xmlMemBlocks();
16256 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16257 cur = gen_const_xmlChar_ptr(n_cur, 1);
16258 len = gen_int_ptr(n_len, 2);
16259
William M. Brackf13f77f2004-11-12 16:03:48 +000016260 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016261 desret_int(ret_val);
16262 call_tests++;
16263 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016264 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016265 des_int_ptr(n_len, len, 2);
16266 xmlResetLastError();
16267 if (mem_base != xmlMemBlocks()) {
16268 printf("Leak of %d blocks found in xmlStringCurrentChar",
16269 xmlMemBlocks() - mem_base);
16270 test_ret++;
16271 printf(" %d", n_ctxt);
16272 printf(" %d", n_cur);
16273 printf(" %d", n_len);
16274 printf("\n");
16275 }
16276 }
16277 }
16278 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016279 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016280
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016281 return(test_ret);
16282}
16283
16284
16285static int
16286test_xmlStringDecodeEntities(void) {
16287 int test_ret = 0;
16288
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016289 int mem_base;
16290 xmlChar * ret_val;
16291 xmlParserCtxtPtr ctxt; /* the parser context */
16292 int n_ctxt;
16293 xmlChar * str; /* the input string */
16294 int n_str;
16295 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16296 int n_what;
16297 xmlChar end; /* an end marker xmlChar, 0 if none */
16298 int n_end;
16299 xmlChar end2; /* an end marker xmlChar, 0 if none */
16300 int n_end2;
16301 xmlChar end3; /* an end marker xmlChar, 0 if none */
16302 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016303
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016304 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16305 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16306 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16307 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16308 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16309 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16310 mem_base = xmlMemBlocks();
16311 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16312 str = gen_const_xmlChar_ptr(n_str, 1);
16313 what = gen_int(n_what, 2);
16314 end = gen_xmlChar(n_end, 3);
16315 end2 = gen_xmlChar(n_end2, 4);
16316 end3 = gen_xmlChar(n_end3, 5);
16317
William M. Brackf13f77f2004-11-12 16:03:48 +000016318 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016319 desret_xmlChar_ptr(ret_val);
16320 call_tests++;
16321 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016322 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016323 des_int(n_what, what, 2);
16324 des_xmlChar(n_end, end, 3);
16325 des_xmlChar(n_end2, end2, 4);
16326 des_xmlChar(n_end3, end3, 5);
16327 xmlResetLastError();
16328 if (mem_base != xmlMemBlocks()) {
16329 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16330 xmlMemBlocks() - mem_base);
16331 test_ret++;
16332 printf(" %d", n_ctxt);
16333 printf(" %d", n_str);
16334 printf(" %d", n_what);
16335 printf(" %d", n_end);
16336 printf(" %d", n_end2);
16337 printf(" %d", n_end3);
16338 printf("\n");
16339 }
16340 }
16341 }
16342 }
16343 }
16344 }
16345 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016347
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016348 return(test_ret);
16349}
16350
16351
16352static int
16353test_xmlStringLenDecodeEntities(void) {
16354 int test_ret = 0;
16355
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016356 int mem_base;
16357 xmlChar * ret_val;
16358 xmlParserCtxtPtr ctxt; /* the parser context */
16359 int n_ctxt;
16360 xmlChar * str; /* the input string */
16361 int n_str;
16362 int len; /* the string length */
16363 int n_len;
16364 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16365 int n_what;
16366 xmlChar end; /* an end marker xmlChar, 0 if none */
16367 int n_end;
16368 xmlChar end2; /* an end marker xmlChar, 0 if none */
16369 int n_end2;
16370 xmlChar end3; /* an end marker xmlChar, 0 if none */
16371 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016372
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016373 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16374 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16375 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16376 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16377 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16378 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16379 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16380 mem_base = xmlMemBlocks();
16381 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16382 str = gen_const_xmlChar_ptr(n_str, 1);
16383 len = gen_int(n_len, 2);
16384 what = gen_int(n_what, 3);
16385 end = gen_xmlChar(n_end, 4);
16386 end2 = gen_xmlChar(n_end2, 5);
16387 end3 = gen_xmlChar(n_end3, 6);
16388
William M. Brackf13f77f2004-11-12 16:03:48 +000016389 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016390 desret_xmlChar_ptr(ret_val);
16391 call_tests++;
16392 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016393 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016394 des_int(n_len, len, 2);
16395 des_int(n_what, what, 3);
16396 des_xmlChar(n_end, end, 4);
16397 des_xmlChar(n_end2, end2, 5);
16398 des_xmlChar(n_end3, end3, 6);
16399 xmlResetLastError();
16400 if (mem_base != xmlMemBlocks()) {
16401 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16402 xmlMemBlocks() - mem_base);
16403 test_ret++;
16404 printf(" %d", n_ctxt);
16405 printf(" %d", n_str);
16406 printf(" %d", n_len);
16407 printf(" %d", n_what);
16408 printf(" %d", n_end);
16409 printf(" %d", n_end2);
16410 printf(" %d", n_end3);
16411 printf("\n");
16412 }
16413 }
16414 }
16415 }
16416 }
16417 }
16418 }
16419 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016420 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016421
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016422 return(test_ret);
16423}
16424
16425
16426static int
16427test_xmlSwitchEncoding(void) {
16428 int test_ret = 0;
16429
16430 int mem_base;
16431 int ret_val;
16432 xmlParserCtxtPtr ctxt; /* the parser context */
16433 int n_ctxt;
16434 xmlCharEncoding enc; /* the encoding value (number) */
16435 int n_enc;
16436
16437 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16438 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16439 mem_base = xmlMemBlocks();
16440 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16441 enc = gen_xmlCharEncoding(n_enc, 1);
16442
16443 ret_val = xmlSwitchEncoding(ctxt, enc);
16444 desret_int(ret_val);
16445 call_tests++;
16446 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16447 des_xmlCharEncoding(n_enc, enc, 1);
16448 xmlResetLastError();
16449 if (mem_base != xmlMemBlocks()) {
16450 printf("Leak of %d blocks found in xmlSwitchEncoding",
16451 xmlMemBlocks() - mem_base);
16452 test_ret++;
16453 printf(" %d", n_ctxt);
16454 printf(" %d", n_enc);
16455 printf("\n");
16456 }
16457 }
16458 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016460
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016461 return(test_ret);
16462}
16463
16464
16465static int
16466test_xmlSwitchInputEncoding(void) {
16467 int test_ret = 0;
16468
16469 int mem_base;
16470 int ret_val;
16471 xmlParserCtxtPtr ctxt; /* the parser context */
16472 int n_ctxt;
16473 xmlParserInputPtr input; /* the input stream */
16474 int n_input;
16475 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16476 int n_handler;
16477
16478 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16479 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16480 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16481 mem_base = xmlMemBlocks();
16482 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16483 input = gen_xmlParserInputPtr(n_input, 1);
16484 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16485
16486 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16487 desret_int(ret_val);
16488 call_tests++;
16489 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16490 des_xmlParserInputPtr(n_input, input, 1);
16491 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16492 xmlResetLastError();
16493 if (mem_base != xmlMemBlocks()) {
16494 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16495 xmlMemBlocks() - mem_base);
16496 test_ret++;
16497 printf(" %d", n_ctxt);
16498 printf(" %d", n_input);
16499 printf(" %d", n_handler);
16500 printf("\n");
16501 }
16502 }
16503 }
16504 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016505 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016506
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016507 return(test_ret);
16508}
16509
16510
16511static int
16512test_xmlSwitchToEncoding(void) {
16513 int test_ret = 0;
16514
16515 int mem_base;
16516 int ret_val;
16517 xmlParserCtxtPtr ctxt; /* the parser context */
16518 int n_ctxt;
16519 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16520 int n_handler;
16521
16522 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16523 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16524 mem_base = xmlMemBlocks();
16525 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16526 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16527
16528 ret_val = xmlSwitchToEncoding(ctxt, handler);
16529 desret_int(ret_val);
16530 call_tests++;
16531 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16532 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16533 xmlResetLastError();
16534 if (mem_base != xmlMemBlocks()) {
16535 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16536 xmlMemBlocks() - mem_base);
16537 test_ret++;
16538 printf(" %d", n_ctxt);
16539 printf(" %d", n_handler);
16540 printf("\n");
16541 }
16542 }
16543 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016545
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016546 return(test_ret);
16547}
16548
16549static int
16550test_parserInternals(void) {
16551 int test_ret = 0;
16552
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016553 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016554 test_ret += test_htmlCreateFileParserCtxt();
16555 test_ret += test_htmlInitAutoClose();
16556 test_ret += test_inputPop();
16557 test_ret += test_inputPush();
16558 test_ret += test_namePop();
16559 test_ret += test_namePush();
16560 test_ret += test_nodePop();
16561 test_ret += test_nodePush();
16562 test_ret += test_xmlCheckLanguageID();
16563 test_ret += test_xmlCopyChar();
16564 test_ret += test_xmlCopyCharMultiByte();
16565 test_ret += test_xmlCreateEntityParserCtxt();
16566 test_ret += test_xmlCreateFileParserCtxt();
16567 test_ret += test_xmlCreateMemoryParserCtxt();
16568 test_ret += test_xmlCreateURLParserCtxt();
16569 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016570 test_ret += test_xmlErrMemory();
16571 test_ret += test_xmlIsLetter();
16572 test_ret += test_xmlNewEntityInputStream();
16573 test_ret += test_xmlNewInputFromFile();
16574 test_ret += test_xmlNewInputStream();
16575 test_ret += test_xmlNewStringInputStream();
16576 test_ret += test_xmlNextChar();
16577 test_ret += test_xmlParserInputShrink();
16578 test_ret += test_xmlPopInput();
16579 test_ret += test_xmlPushInput();
16580 test_ret += test_xmlSetEntityReferenceFunc();
16581 test_ret += test_xmlSplitQName();
16582 test_ret += test_xmlStringCurrentChar();
16583 test_ret += test_xmlStringDecodeEntities();
16584 test_ret += test_xmlStringLenDecodeEntities();
16585 test_ret += test_xmlSwitchEncoding();
16586 test_ret += test_xmlSwitchInputEncoding();
16587 test_ret += test_xmlSwitchToEncoding();
16588
16589 if (test_ret != 0)
16590 printf("Module parserInternals: %d errors\n", test_ret);
16591 return(test_ret);
16592}
16593
Daniel Veillardd93f6252004-11-02 15:53:51 +000016594static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016595test_xmlPatternFromRoot(void) {
16596 int test_ret = 0;
16597
16598#if defined(LIBXML_PATTERN_ENABLED)
16599 int mem_base;
16600 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016601 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016602 int n_comp;
16603
16604 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16605 mem_base = xmlMemBlocks();
16606 comp = gen_xmlPatternPtr(n_comp, 0);
16607
16608 ret_val = xmlPatternFromRoot(comp);
16609 desret_int(ret_val);
16610 call_tests++;
16611 des_xmlPatternPtr(n_comp, comp, 0);
16612 xmlResetLastError();
16613 if (mem_base != xmlMemBlocks()) {
16614 printf("Leak of %d blocks found in xmlPatternFromRoot",
16615 xmlMemBlocks() - mem_base);
16616 test_ret++;
16617 printf(" %d", n_comp);
16618 printf("\n");
16619 }
16620 }
16621 function_tests++;
16622#endif
16623
16624 return(test_ret);
16625}
16626
16627
16628static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016629test_xmlPatternGetStreamCtxt(void) {
16630 int test_ret = 0;
16631
16632
16633 /* missing type support */
16634 return(test_ret);
16635}
16636
16637
16638static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016639test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016641
William M. Brack21e4ef22005-01-02 09:53:13 +000016642#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016643 int mem_base;
16644 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016645 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016646 int n_comp;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016647 xmlNodePtr node; /* a node */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016648 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016649
Daniel Veillardce682bc2004-11-05 17:22:25 +000016650 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16651 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16652 mem_base = xmlMemBlocks();
16653 comp = gen_xmlPatternPtr(n_comp, 0);
16654 node = gen_xmlNodePtr(n_node, 1);
16655
16656 ret_val = xmlPatternMatch(comp, node);
16657 desret_int(ret_val);
16658 call_tests++;
16659 des_xmlPatternPtr(n_comp, comp, 0);
16660 des_xmlNodePtr(n_node, node, 1);
16661 xmlResetLastError();
16662 if (mem_base != xmlMemBlocks()) {
16663 printf("Leak of %d blocks found in xmlPatternMatch",
16664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016665 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016666 printf(" %d", n_comp);
16667 printf(" %d", n_node);
16668 printf("\n");
16669 }
16670 }
16671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016672 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016673#endif
16674
Daniel Veillard42595322004-11-08 10:52:06 +000016675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016676}
16677
16678
16679static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016680test_xmlPatternMaxDepth(void) {
16681 int test_ret = 0;
16682
16683#if defined(LIBXML_PATTERN_ENABLED)
16684 int mem_base;
16685 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016686 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016687 int n_comp;
16688
16689 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16690 mem_base = xmlMemBlocks();
16691 comp = gen_xmlPatternPtr(n_comp, 0);
16692
16693 ret_val = xmlPatternMaxDepth(comp);
16694 desret_int(ret_val);
16695 call_tests++;
16696 des_xmlPatternPtr(n_comp, comp, 0);
16697 xmlResetLastError();
16698 if (mem_base != xmlMemBlocks()) {
16699 printf("Leak of %d blocks found in xmlPatternMaxDepth",
16700 xmlMemBlocks() - mem_base);
16701 test_ret++;
16702 printf(" %d", n_comp);
16703 printf("\n");
16704 }
16705 }
16706 function_tests++;
16707#endif
16708
16709 return(test_ret);
16710}
16711
16712
16713static int
16714test_xmlPatternStreamable(void) {
16715 int test_ret = 0;
16716
16717#if defined(LIBXML_PATTERN_ENABLED)
16718 int mem_base;
16719 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016720 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016721 int n_comp;
16722
16723 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16724 mem_base = xmlMemBlocks();
16725 comp = gen_xmlPatternPtr(n_comp, 0);
16726
16727 ret_val = xmlPatternStreamable(comp);
16728 desret_int(ret_val);
16729 call_tests++;
16730 des_xmlPatternPtr(n_comp, comp, 0);
16731 xmlResetLastError();
16732 if (mem_base != xmlMemBlocks()) {
16733 printf("Leak of %d blocks found in xmlPatternStreamable",
16734 xmlMemBlocks() - mem_base);
16735 test_ret++;
16736 printf(" %d", n_comp);
16737 printf("\n");
16738 }
16739 }
16740 function_tests++;
16741#endif
16742
16743 return(test_ret);
16744}
16745
16746
16747static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016748test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016750
16751
16752 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016754}
16755
William M. Brackba1d3172005-03-25 03:05:46 +000016756#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016757
16758#define gen_nb_xmlStreamCtxtPtr 1
16759static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16760 return(NULL);
16761}
16762static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16763}
William M. Brackba1d3172005-03-25 03:05:46 +000016764#endif
16765
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016766
16767static int
16768test_xmlStreamPop(void) {
16769 int test_ret = 0;
16770
16771#if defined(LIBXML_PATTERN_ENABLED)
16772 int mem_base;
16773 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016774 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016775 int n_stream;
16776
16777 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16778 mem_base = xmlMemBlocks();
16779 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16780
16781 ret_val = xmlStreamPop(stream);
16782 desret_int(ret_val);
16783 call_tests++;
16784 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16785 xmlResetLastError();
16786 if (mem_base != xmlMemBlocks()) {
16787 printf("Leak of %d blocks found in xmlStreamPop",
16788 xmlMemBlocks() - mem_base);
16789 test_ret++;
16790 printf(" %d", n_stream);
16791 printf("\n");
16792 }
16793 }
16794 function_tests++;
16795#endif
16796
16797 return(test_ret);
16798}
16799
16800
16801static int
16802test_xmlStreamPush(void) {
16803 int test_ret = 0;
16804
16805#if defined(LIBXML_PATTERN_ENABLED)
16806 int mem_base;
16807 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016808 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016809 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016810 xmlChar * name; /* the current name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016811 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016812 xmlChar * ns; /* the namespace name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016813 int n_ns;
16814
16815 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16816 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16817 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16818 mem_base = xmlMemBlocks();
16819 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16820 name = gen_const_xmlChar_ptr(n_name, 1);
16821 ns = gen_const_xmlChar_ptr(n_ns, 2);
16822
16823 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16824 desret_int(ret_val);
16825 call_tests++;
16826 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16827 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16828 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16829 xmlResetLastError();
16830 if (mem_base != xmlMemBlocks()) {
16831 printf("Leak of %d blocks found in xmlStreamPush",
16832 xmlMemBlocks() - mem_base);
16833 test_ret++;
16834 printf(" %d", n_stream);
16835 printf(" %d", n_name);
16836 printf(" %d", n_ns);
16837 printf("\n");
16838 }
16839 }
16840 }
16841 }
16842 function_tests++;
16843#endif
16844
16845 return(test_ret);
16846}
16847
Daniel Veillardb5839c32005-02-19 18:27:14 +000016848
16849static int
16850test_xmlStreamPushAttr(void) {
16851 int test_ret = 0;
16852
16853#if defined(LIBXML_PATTERN_ENABLED)
16854 int mem_base;
16855 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016856 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016857 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016858 xmlChar * name; /* the current name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016859 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016860 xmlChar * ns; /* the namespace name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016861 int n_ns;
16862
16863 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16864 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16865 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16866 mem_base = xmlMemBlocks();
16867 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16868 name = gen_const_xmlChar_ptr(n_name, 1);
16869 ns = gen_const_xmlChar_ptr(n_ns, 2);
16870
16871 ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns);
16872 desret_int(ret_val);
16873 call_tests++;
16874 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16875 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16876 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16877 xmlResetLastError();
16878 if (mem_base != xmlMemBlocks()) {
16879 printf("Leak of %d blocks found in xmlStreamPushAttr",
16880 xmlMemBlocks() - mem_base);
16881 test_ret++;
16882 printf(" %d", n_stream);
16883 printf(" %d", n_name);
16884 printf(" %d", n_ns);
16885 printf("\n");
16886 }
16887 }
16888 }
16889 }
16890 function_tests++;
16891#endif
16892
16893 return(test_ret);
16894}
16895
Daniel Veillardd93f6252004-11-02 15:53:51 +000016896static int
16897test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016899
Daniel Veillardb5839c32005-02-19 18:27:14 +000016900 if (quiet == 0) printf("Testing pattern : 7 of 12 functions ...\n");
16901 test_ret += test_xmlPatternFromRoot();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016902 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016903 test_ret += test_xmlPatternMatch();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016904 test_ret += test_xmlPatternMaxDepth();
16905 test_ret += test_xmlPatternStreamable();
Daniel Veillard42595322004-11-08 10:52:06 +000016906 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016907 test_ret += test_xmlStreamPop();
16908 test_ret += test_xmlStreamPush();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016909 test_ret += test_xmlStreamPushAttr();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016910
Daniel Veillard42595322004-11-08 10:52:06 +000016911 if (test_ret != 0)
16912 printf("Module pattern: %d errors\n", test_ret);
16913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016914}
Daniel Veillarda521d282004-11-09 14:59:59 +000016915#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016916
Daniel Veillardce682bc2004-11-05 17:22:25 +000016917#define gen_nb_xmlRelaxNGPtr 1
16918static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16919 return(NULL);
16920}
16921static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16922}
Daniel Veillarda521d282004-11-09 14:59:59 +000016923#endif
16924
Daniel Veillardce682bc2004-11-05 17:22:25 +000016925
Daniel Veillardd93f6252004-11-02 15:53:51 +000016926static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016927test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016929
William M. Brack21e4ef22005-01-02 09:53:13 +000016930#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016931 int mem_base;
16932 FILE * output; /* the file output */
16933 int n_output;
16934 xmlRelaxNGPtr schema; /* a schema structure */
16935 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016936
Daniel Veillardce682bc2004-11-05 17:22:25 +000016937 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16938 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16939 mem_base = xmlMemBlocks();
16940 output = gen_FILE_ptr(n_output, 0);
16941 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16942
16943 xmlRelaxNGDump(output, schema);
16944 call_tests++;
16945 des_FILE_ptr(n_output, output, 0);
16946 des_xmlRelaxNGPtr(n_schema, schema, 1);
16947 xmlResetLastError();
16948 if (mem_base != xmlMemBlocks()) {
16949 printf("Leak of %d blocks found in xmlRelaxNGDump",
16950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016951 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016952 printf(" %d", n_output);
16953 printf(" %d", n_schema);
16954 printf("\n");
16955 }
16956 }
16957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016958 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016959#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016960
Daniel Veillard42595322004-11-08 10:52:06 +000016961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016962}
16963
16964
16965static int
16966test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016968
William M. Brack21e4ef22005-01-02 09:53:13 +000016969#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016970 int mem_base;
16971 FILE * output; /* the file output */
16972 int n_output;
16973 xmlRelaxNGPtr schema; /* a schema structure */
16974 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016975
Daniel Veillardce682bc2004-11-05 17:22:25 +000016976 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16977 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16978 mem_base = xmlMemBlocks();
16979 output = gen_FILE_ptr(n_output, 0);
16980 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16981
16982 xmlRelaxNGDumpTree(output, schema);
16983 call_tests++;
16984 des_FILE_ptr(n_output, output, 0);
16985 des_xmlRelaxNGPtr(n_schema, schema, 1);
16986 xmlResetLastError();
16987 if (mem_base != xmlMemBlocks()) {
16988 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016990 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016991 printf(" %d", n_output);
16992 printf(" %d", n_schema);
16993 printf("\n");
16994 }
16995 }
16996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016997 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016998#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016999
Daniel Veillard42595322004-11-08 10:52:06 +000017000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017001}
17002
Daniel Veillarda521d282004-11-09 14:59:59 +000017003#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017004
Daniel Veillardce682bc2004-11-05 17:22:25 +000017005#define gen_nb_xmlRelaxNGParserCtxtPtr 1
17006static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17007 return(NULL);
17008}
17009static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr 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
17015#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
17016static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17017 return(NULL);
17018}
17019static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17020}
Daniel Veillarda521d282004-11-09 14:59:59 +000017021#endif
17022
17023#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017024
17025#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17026static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17027 return(NULL);
17028}
17029static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17030}
Daniel Veillarda521d282004-11-09 14:59:59 +000017031#endif
17032
17033#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017035#define gen_nb_void_ptr_ptr 1
17036static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17037 return(NULL);
17038}
17039static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17040}
Daniel Veillarda521d282004-11-09 14:59:59 +000017041#endif
17042
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017043
Daniel Veillardd93f6252004-11-02 15:53:51 +000017044static int
17045test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017047
William M. Brack21e4ef22005-01-02 09:53:13 +000017048#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017049 int mem_base;
17050 int ret_val;
17051 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17052 int n_ctxt;
17053 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17054 int n_err;
17055 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17056 int n_warn;
17057 void ** ctx; /* contextual data for the callbacks result */
17058 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017059
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017060 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17061 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17062 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17063 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17064 mem_base = xmlMemBlocks();
17065 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17066 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17067 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17068 ctx = gen_void_ptr_ptr(n_ctx, 3);
17069
17070 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17071 desret_int(ret_val);
17072 call_tests++;
17073 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17074 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17075 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17076 des_void_ptr_ptr(n_ctx, ctx, 3);
17077 xmlResetLastError();
17078 if (mem_base != xmlMemBlocks()) {
17079 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017081 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017082 printf(" %d", n_ctxt);
17083 printf(" %d", n_err);
17084 printf(" %d", n_warn);
17085 printf(" %d", n_ctx);
17086 printf("\n");
17087 }
17088 }
17089 }
17090 }
17091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017092 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017093#endif
17094
Daniel Veillard42595322004-11-08 10:52:06 +000017095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017096}
17097
Daniel Veillarda521d282004-11-09 14:59:59 +000017098#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017099
Daniel Veillardce682bc2004-11-05 17:22:25 +000017100#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17101static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17102 return(NULL);
17103}
17104static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17105}
Daniel Veillarda521d282004-11-09 14:59:59 +000017106#endif
17107
Daniel Veillardce682bc2004-11-05 17:22:25 +000017108
Daniel Veillardd93f6252004-11-02 15:53:51 +000017109static int
17110test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017112
William M. Brack21e4ef22005-01-02 09:53:13 +000017113#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017114 int mem_base;
17115 int ret_val;
17116 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17117 int n_ctxt;
17118 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17119 int n_err;
17120 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17121 int n_warn;
17122 void ** ctx; /* the functions context result */
17123 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017124
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017125 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17126 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17127 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17128 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17129 mem_base = xmlMemBlocks();
17130 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17131 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17132 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17133 ctx = gen_void_ptr_ptr(n_ctx, 3);
17134
17135 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17136 desret_int(ret_val);
17137 call_tests++;
17138 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17139 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17140 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17141 des_void_ptr_ptr(n_ctx, ctx, 3);
17142 xmlResetLastError();
17143 if (mem_base != xmlMemBlocks()) {
17144 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017146 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017147 printf(" %d", n_ctxt);
17148 printf(" %d", n_err);
17149 printf(" %d", n_warn);
17150 printf(" %d", n_ctx);
17151 printf("\n");
17152 }
17153 }
17154 }
17155 }
17156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017157 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017158#endif
17159
Daniel Veillard42595322004-11-08 10:52:06 +000017160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017161}
17162
17163
17164static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017165test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017166 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017167
William M. Brack21e4ef22005-01-02 09:53:13 +000017168#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017169 int mem_base;
17170 int ret_val;
17171
17172 mem_base = xmlMemBlocks();
17173
17174 ret_val = xmlRelaxNGInitTypes();
17175 desret_int(ret_val);
17176 call_tests++;
17177 xmlResetLastError();
17178 if (mem_base != xmlMemBlocks()) {
17179 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017181 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017182 printf("\n");
17183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017184 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017185#endif
17186
Daniel Veillard42595322004-11-08 10:52:06 +000017187 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017188}
17189
17190
17191static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017192test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017194
William M. Brack21e4ef22005-01-02 09:53:13 +000017195#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017196 int mem_base;
17197 xmlRelaxNGParserCtxtPtr ret_val;
17198 xmlDocPtr doc; /* a preparsed document tree */
17199 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017200
Daniel Veillard42595322004-11-08 10:52:06 +000017201 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17202 mem_base = xmlMemBlocks();
17203 doc = gen_xmlDocPtr(n_doc, 0);
17204
17205 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17206 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17207 call_tests++;
17208 des_xmlDocPtr(n_doc, doc, 0);
17209 xmlResetLastError();
17210 if (mem_base != xmlMemBlocks()) {
17211 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17212 xmlMemBlocks() - mem_base);
17213 test_ret++;
17214 printf(" %d", n_doc);
17215 printf("\n");
17216 }
17217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017218 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017219#endif
17220
Daniel Veillard42595322004-11-08 10:52:06 +000017221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017222}
17223
17224
17225static int
17226test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017228
William M. Brack21e4ef22005-01-02 09:53:13 +000017229#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017230 int mem_base;
17231 xmlRelaxNGParserCtxtPtr ret_val;
17232 char * buffer; /* a pointer to a char array containing the schemas */
17233 int n_buffer;
17234 int size; /* the size of the array */
17235 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017236
Daniel Veillard42595322004-11-08 10:52:06 +000017237 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17238 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17239 mem_base = xmlMemBlocks();
17240 buffer = gen_const_char_ptr(n_buffer, 0);
17241 size = gen_int(n_size, 1);
17242
William M. Brackf13f77f2004-11-12 16:03:48 +000017243 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017244 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17245 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017246 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017247 des_int(n_size, size, 1);
17248 xmlResetLastError();
17249 if (mem_base != xmlMemBlocks()) {
17250 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17251 xmlMemBlocks() - mem_base);
17252 test_ret++;
17253 printf(" %d", n_buffer);
17254 printf(" %d", n_size);
17255 printf("\n");
17256 }
17257 }
17258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017259 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017260#endif
17261
Daniel Veillard42595322004-11-08 10:52:06 +000017262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017263}
17264
17265
17266static int
17267test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017269
William M. Brack21e4ef22005-01-02 09:53:13 +000017270#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017271 int mem_base;
17272 xmlRelaxNGParserCtxtPtr ret_val;
17273 char * URL; /* the location of the schema */
17274 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017275
Daniel Veillard42595322004-11-08 10:52:06 +000017276 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17277 mem_base = xmlMemBlocks();
17278 URL = gen_const_char_ptr(n_URL, 0);
17279
William M. Brackf13f77f2004-11-12 16:03:48 +000017280 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017281 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17282 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017283 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017284 xmlResetLastError();
17285 if (mem_base != xmlMemBlocks()) {
17286 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17287 xmlMemBlocks() - mem_base);
17288 test_ret++;
17289 printf(" %d", n_URL);
17290 printf("\n");
17291 }
17292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017293 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017294#endif
17295
Daniel Veillard42595322004-11-08 10:52:06 +000017296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017297}
17298
17299
17300static int
17301test_xmlRelaxNGNewValidCtxt(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_xmlRelaxNGParse(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_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017323
17324
17325 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017327}
17328
17329
17330static int
17331test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017333
17334
17335 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017337}
17338
17339
17340static int
17341test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017343
William M. Brack21e4ef22005-01-02 09:53:13 +000017344#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017345 int mem_base;
17346 int ret_val;
17347 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17348 int n_ctxt;
17349 xmlDocPtr doc; /* a parsed document tree */
17350 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017351
Daniel Veillardce682bc2004-11-05 17:22:25 +000017352 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17353 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17354 mem_base = xmlMemBlocks();
17355 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17356 doc = gen_xmlDocPtr(n_doc, 1);
17357
17358 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17359 desret_int(ret_val);
17360 call_tests++;
17361 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17362 des_xmlDocPtr(n_doc, doc, 1);
17363 xmlResetLastError();
17364 if (mem_base != xmlMemBlocks()) {
17365 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017367 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017368 printf(" %d", n_ctxt);
17369 printf(" %d", n_doc);
17370 printf("\n");
17371 }
17372 }
17373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017374 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017375#endif
17376
Daniel Veillard42595322004-11-08 10:52:06 +000017377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017378}
17379
17380
17381static int
17382test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017384
William M. Brack21e4ef22005-01-02 09:53:13 +000017385#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017386 int mem_base;
17387 int ret_val;
17388 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17389 int n_ctxt;
17390 xmlDocPtr doc; /* a document instance */
17391 int n_doc;
17392 xmlNodePtr elem; /* an element instance */
17393 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017394
Daniel Veillardce682bc2004-11-05 17:22:25 +000017395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17396 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17397 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17398 mem_base = xmlMemBlocks();
17399 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17400 doc = gen_xmlDocPtr(n_doc, 1);
17401 elem = gen_xmlNodePtr(n_elem, 2);
17402
17403 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17404 desret_int(ret_val);
17405 call_tests++;
17406 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17407 des_xmlDocPtr(n_doc, doc, 1);
17408 des_xmlNodePtr(n_elem, elem, 2);
17409 xmlResetLastError();
17410 if (mem_base != xmlMemBlocks()) {
17411 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017413 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017414 printf(" %d", n_ctxt);
17415 printf(" %d", n_doc);
17416 printf(" %d", n_elem);
17417 printf("\n");
17418 }
17419 }
17420 }
17421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017422 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017423#endif
17424
Daniel Veillard42595322004-11-08 10:52:06 +000017425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017426}
17427
17428
17429static int
17430test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017432
William M. Brack21e4ef22005-01-02 09:53:13 +000017433#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017434 int mem_base;
17435 int ret_val;
17436 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17437 int n_ctxt;
17438 xmlDocPtr doc; /* a document instance */
17439 int n_doc;
17440 xmlNodePtr elem; /* an element instance */
17441 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017442
Daniel Veillardce682bc2004-11-05 17:22:25 +000017443 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17444 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17445 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17446 mem_base = xmlMemBlocks();
17447 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17448 doc = gen_xmlDocPtr(n_doc, 1);
17449 elem = gen_xmlNodePtr(n_elem, 2);
17450
17451 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17452 desret_int(ret_val);
17453 call_tests++;
17454 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17455 des_xmlDocPtr(n_doc, doc, 1);
17456 des_xmlNodePtr(n_elem, elem, 2);
17457 xmlResetLastError();
17458 if (mem_base != xmlMemBlocks()) {
17459 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017461 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017462 printf(" %d", n_ctxt);
17463 printf(" %d", n_doc);
17464 printf(" %d", n_elem);
17465 printf("\n");
17466 }
17467 }
17468 }
17469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017470 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017471#endif
17472
Daniel Veillard42595322004-11-08 10:52:06 +000017473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017474}
17475
17476
17477static int
17478test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017480
William M. Brack21e4ef22005-01-02 09:53:13 +000017481#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017482 int mem_base;
17483 int ret_val;
17484 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17485 int n_ctxt;
17486 xmlChar * data; /* some character data read */
17487 int n_data;
17488 int len; /* the lenght of the data */
17489 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017490
Daniel Veillardce682bc2004-11-05 17:22:25 +000017491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17492 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17493 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17494 mem_base = xmlMemBlocks();
17495 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17496 data = gen_const_xmlChar_ptr(n_data, 1);
17497 len = gen_int(n_len, 2);
17498
William M. Brackf13f77f2004-11-12 16:03:48 +000017499 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017500 desret_int(ret_val);
17501 call_tests++;
17502 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017503 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017504 des_int(n_len, len, 2);
17505 xmlResetLastError();
17506 if (mem_base != xmlMemBlocks()) {
17507 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017509 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017510 printf(" %d", n_ctxt);
17511 printf(" %d", n_data);
17512 printf(" %d", n_len);
17513 printf("\n");
17514 }
17515 }
17516 }
17517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017518 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017519#endif
17520
Daniel Veillard42595322004-11-08 10:52:06 +000017521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017522}
17523
17524
17525static int
17526test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017528
William M. Brack21e4ef22005-01-02 09:53:13 +000017529#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017530 int mem_base;
17531 int ret_val;
17532 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17533 int n_ctxt;
17534 xmlDocPtr doc; /* a document instance */
17535 int n_doc;
17536 xmlNodePtr elem; /* an element instance */
17537 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017538
Daniel Veillardce682bc2004-11-05 17:22:25 +000017539 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17540 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17541 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17542 mem_base = xmlMemBlocks();
17543 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17544 doc = gen_xmlDocPtr(n_doc, 1);
17545 elem = gen_xmlNodePtr(n_elem, 2);
17546
17547 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17548 desret_int(ret_val);
17549 call_tests++;
17550 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17551 des_xmlDocPtr(n_doc, doc, 1);
17552 des_xmlNodePtr(n_elem, elem, 2);
17553 xmlResetLastError();
17554 if (mem_base != xmlMemBlocks()) {
17555 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017557 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017558 printf(" %d", n_ctxt);
17559 printf(" %d", n_doc);
17560 printf(" %d", n_elem);
17561 printf("\n");
17562 }
17563 }
17564 }
17565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017566 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017567#endif
17568
Daniel Veillard42595322004-11-08 10:52:06 +000017569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017570}
17571
17572
17573static int
17574test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017576
William M. Brack21e4ef22005-01-02 09:53:13 +000017577#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017578 int mem_base;
17579 int ret_val;
17580 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17581 int n_ctxt;
17582 int flags; /* a set of flags values */
17583 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017584
Daniel Veillardce682bc2004-11-05 17:22:25 +000017585 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17586 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17587 mem_base = xmlMemBlocks();
17588 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17589 flags = gen_int(n_flags, 1);
17590
17591 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17592 desret_int(ret_val);
17593 call_tests++;
17594 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17595 des_int(n_flags, flags, 1);
17596 xmlResetLastError();
17597 if (mem_base != xmlMemBlocks()) {
17598 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017600 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017601 printf(" %d", n_ctxt);
17602 printf(" %d", n_flags);
17603 printf("\n");
17604 }
17605 }
17606 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017607 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017608#endif
17609
Daniel Veillard42595322004-11-08 10:52:06 +000017610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017611}
17612
17613static int
17614test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017617 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017618 test_ret += test_xmlRelaxNGDump();
17619 test_ret += test_xmlRelaxNGDumpTree();
17620 test_ret += test_xmlRelaxNGGetParserErrors();
17621 test_ret += test_xmlRelaxNGGetValidErrors();
17622 test_ret += test_xmlRelaxNGInitTypes();
17623 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17624 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17625 test_ret += test_xmlRelaxNGNewParserCtxt();
17626 test_ret += test_xmlRelaxNGNewValidCtxt();
17627 test_ret += test_xmlRelaxNGParse();
17628 test_ret += test_xmlRelaxNGSetParserErrors();
17629 test_ret += test_xmlRelaxNGSetValidErrors();
17630 test_ret += test_xmlRelaxNGValidateDoc();
17631 test_ret += test_xmlRelaxNGValidateFullElement();
17632 test_ret += test_xmlRelaxNGValidatePopElement();
17633 test_ret += test_xmlRelaxNGValidatePushCData();
17634 test_ret += test_xmlRelaxNGValidatePushElement();
17635 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017636
Daniel Veillard42595322004-11-08 10:52:06 +000017637 if (test_ret != 0)
17638 printf("Module relaxng: %d errors\n", test_ret);
17639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017640}
17641static int
17642test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017644
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017645 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017646
Daniel Veillard42595322004-11-08 10:52:06 +000017647 if (test_ret != 0)
17648 printf("Module schemasInternals: %d errors\n", test_ret);
17649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017650}
17651
17652static int
17653test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017655
17656 int mem_base;
17657 xmlNodePtr ret_val;
17658 xmlNodePtr parent; /* the parent node */
17659 int n_parent;
17660 xmlNodePtr cur; /* the child node */
17661 int n_cur;
17662
Daniel Veillarda03e3652004-11-02 18:45:30 +000017663 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017664 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17665 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017666 parent = gen_xmlNodePtr(n_parent, 0);
17667 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017668
17669 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017670 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017671 desret_xmlNodePtr(ret_val);
17672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017673 des_xmlNodePtr(n_parent, parent, 0);
17674 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017675 xmlResetLastError();
17676 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017677 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017679 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017680 printf(" %d", n_parent);
17681 printf(" %d", n_cur);
17682 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017683 }
17684 }
17685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017687
Daniel Veillard42595322004-11-08 10:52:06 +000017688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017689}
17690
17691
17692static int
17693test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017695
17696 int mem_base;
17697 xmlNodePtr ret_val;
17698 xmlNodePtr parent; /* the parent node */
17699 int n_parent;
17700 xmlNodePtr cur; /* the first node in the list */
17701 int n_cur;
17702
Daniel Veillarda03e3652004-11-02 18:45:30 +000017703 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017704 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017706 parent = gen_xmlNodePtr(n_parent, 0);
17707 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017708
17709 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017710 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017711 desret_xmlNodePtr(ret_val);
17712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017713 des_xmlNodePtr(n_parent, parent, 0);
17714 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017715 xmlResetLastError();
17716 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017717 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017719 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017720 printf(" %d", n_parent);
17721 printf(" %d", n_cur);
17722 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017723 }
17724 }
17725 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017726 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017727
Daniel Veillard42595322004-11-08 10:52:06 +000017728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017729}
17730
17731
17732static int
17733test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735
17736 int mem_base;
17737 xmlNodePtr ret_val;
17738 xmlNodePtr cur; /* the child node */
17739 int n_cur;
17740 xmlNodePtr elem; /* the new node */
17741 int n_elem;
17742
17743 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017744 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017745 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017746 cur = gen_xmlNodePtr(n_cur, 0);
17747 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017748
17749 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017750 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017751 desret_xmlNodePtr(ret_val);
17752 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017753 des_xmlNodePtr(n_cur, cur, 0);
17754 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017755 xmlResetLastError();
17756 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017757 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017759 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017760 printf(" %d", n_cur);
17761 printf(" %d", n_elem);
17762 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017763 }
17764 }
17765 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017766 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017767
Daniel Veillard42595322004-11-08 10:52:06 +000017768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017769}
17770
17771
17772static int
17773test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017775
William M. Brack21e4ef22005-01-02 09:53:13 +000017776#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017777 int mem_base;
17778 xmlNodePtr ret_val;
17779 xmlNodePtr cur; /* the child node */
17780 int n_cur;
17781 xmlNodePtr elem; /* the new node */
17782 int n_elem;
17783
17784 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017785 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017787 cur = gen_xmlNodePtr(n_cur, 0);
17788 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017789
17790 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017791 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017792 desret_xmlNodePtr(ret_val);
17793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017794 des_xmlNodePtr(n_cur, cur, 0);
17795 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017796 xmlResetLastError();
17797 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017798 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017800 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017801 printf(" %d", n_cur);
17802 printf(" %d", n_elem);
17803 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017804 }
17805 }
17806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017807 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017808#endif
17809
Daniel Veillard42595322004-11-08 10:52:06 +000017810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017811}
17812
17813
17814static int
17815test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017817
17818 int mem_base;
17819 xmlNodePtr ret_val;
17820 xmlNodePtr cur; /* the child node */
17821 int n_cur;
17822 xmlNodePtr elem; /* the new node */
17823 int n_elem;
17824
17825 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017826 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017828 cur = gen_xmlNodePtr(n_cur, 0);
17829 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017830
17831 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017832 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017833 desret_xmlNodePtr(ret_val);
17834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017835 des_xmlNodePtr(n_cur, cur, 0);
17836 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017837 xmlResetLastError();
17838 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017839 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017842 printf(" %d", n_cur);
17843 printf(" %d", n_elem);
17844 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017845 }
17846 }
17847 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017848 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017849
Daniel Veillard42595322004-11-08 10:52:06 +000017850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017851}
17852
17853
17854static int
17855test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017857
William M. Brack21e4ef22005-01-02 09:53:13 +000017858#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017859#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017860 int mem_base;
17861 xmlBufferPtr buf; /* the XML buffer output */
17862 int n_buf;
17863 xmlDocPtr doc; /* the document */
17864 int n_doc;
17865 xmlAttrPtr attr; /* the attribute node */
17866 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017867 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017868 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017869
Daniel Veillardce244ad2004-11-05 10:03:46 +000017870 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17871 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17872 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17873 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17874 mem_base = xmlMemBlocks();
17875 buf = gen_xmlBufferPtr(n_buf, 0);
17876 doc = gen_xmlDocPtr(n_doc, 1);
17877 attr = gen_xmlAttrPtr(n_attr, 2);
17878 string = gen_const_xmlChar_ptr(n_string, 3);
17879
William M. Brackf13f77f2004-11-12 16:03:48 +000017880 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017881 call_tests++;
17882 des_xmlBufferPtr(n_buf, buf, 0);
17883 des_xmlDocPtr(n_doc, doc, 1);
17884 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017885 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017886 xmlResetLastError();
17887 if (mem_base != xmlMemBlocks()) {
17888 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017890 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017891 printf(" %d", n_buf);
17892 printf(" %d", n_doc);
17893 printf(" %d", n_attr);
17894 printf(" %d", n_string);
17895 printf("\n");
17896 }
17897 }
17898 }
17899 }
17900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017901 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017902#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017903#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017904
Daniel Veillard42595322004-11-08 10:52:06 +000017905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017906}
17907
17908
17909static int
17910test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017912
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017913 int mem_base;
17914 int ret_val;
17915 xmlBufferPtr buf; /* the buffer to dump */
17916 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017917 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017918 int n_str;
17919 int len; /* the number of #xmlChar to add */
17920 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017921
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017922 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17923 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17924 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017926 buf = gen_xmlBufferPtr(n_buf, 0);
17927 str = gen_const_xmlChar_ptr(n_str, 1);
17928 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017929
William M. Brackf13f77f2004-11-12 16:03:48 +000017930 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017931 desret_int(ret_val);
17932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017933 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017934 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017935 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017936 xmlResetLastError();
17937 if (mem_base != xmlMemBlocks()) {
17938 printf("Leak of %d blocks found in xmlBufferAdd",
17939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017940 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017941 printf(" %d", n_buf);
17942 printf(" %d", n_str);
17943 printf(" %d", n_len);
17944 printf("\n");
17945 }
17946 }
17947 }
17948 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017950
Daniel Veillard42595322004-11-08 10:52:06 +000017951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017952}
17953
17954
17955static int
17956test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017958
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017959 int mem_base;
17960 int ret_val;
17961 xmlBufferPtr buf; /* the buffer */
17962 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017963 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017964 int n_str;
17965 int len; /* the number of #xmlChar to add */
17966 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017967
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017968 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17969 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17970 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017972 buf = gen_xmlBufferPtr(n_buf, 0);
17973 str = gen_const_xmlChar_ptr(n_str, 1);
17974 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017975
William M. Brackf13f77f2004-11-12 16:03:48 +000017976 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017977 desret_int(ret_val);
17978 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017979 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017980 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017981 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017982 xmlResetLastError();
17983 if (mem_base != xmlMemBlocks()) {
17984 printf("Leak of %d blocks found in xmlBufferAddHead",
17985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017986 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017987 printf(" %d", n_buf);
17988 printf(" %d", n_str);
17989 printf(" %d", n_len);
17990 printf("\n");
17991 }
17992 }
17993 }
17994 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017996
Daniel Veillard42595322004-11-08 10:52:06 +000017997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017998}
17999
18000
18001static int
18002test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018004
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018005 int mem_base;
18006 int ret_val;
18007 xmlBufferPtr buf; /* the buffer to dump */
18008 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018009 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018010 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018012 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18013 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18014 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018015 buf = gen_xmlBufferPtr(n_buf, 0);
18016 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018017
William M. Brackf13f77f2004-11-12 16:03:48 +000018018 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018019 desret_int(ret_val);
18020 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018021 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018022 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018023 xmlResetLastError();
18024 if (mem_base != xmlMemBlocks()) {
18025 printf("Leak of %d blocks found in xmlBufferCCat",
18026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018027 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018028 printf(" %d", n_buf);
18029 printf(" %d", n_str);
18030 printf("\n");
18031 }
18032 }
18033 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018035
Daniel Veillard42595322004-11-08 10:52:06 +000018036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018037}
18038
18039
18040static int
18041test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018043
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018044 int mem_base;
18045 int ret_val;
18046 xmlBufferPtr buf; /* the buffer to add to */
18047 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018048 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018049 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018050
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018051 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18052 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018054 buf = gen_xmlBufferPtr(n_buf, 0);
18055 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018056
William M. Brackf13f77f2004-11-12 16:03:48 +000018057 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018058 desret_int(ret_val);
18059 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018060 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018061 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018062 xmlResetLastError();
18063 if (mem_base != xmlMemBlocks()) {
18064 printf("Leak of %d blocks found in xmlBufferCat",
18065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018066 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018067 printf(" %d", n_buf);
18068 printf(" %d", n_str);
18069 printf("\n");
18070 }
18071 }
18072 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018074
Daniel Veillard42595322004-11-08 10:52:06 +000018075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018076}
18077
18078
Daniel Veillardce682bc2004-11-05 17:22:25 +000018079#define gen_nb_const_xmlBufferPtr 1
18080static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18081 return(NULL);
18082}
18083static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18084}
18085
Daniel Veillardd93f6252004-11-02 15:53:51 +000018086static int
18087test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018089
Daniel Veillardce682bc2004-11-05 17:22:25 +000018090 int mem_base;
18091 const xmlChar * ret_val;
18092 xmlBufferPtr buf; /* the buffer */
18093 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018094
Daniel Veillardce682bc2004-11-05 17:22:25 +000018095 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18096 mem_base = xmlMemBlocks();
18097 buf = gen_const_xmlBufferPtr(n_buf, 0);
18098
William M. Brackf13f77f2004-11-12 16:03:48 +000018099 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018100 desret_const_xmlChar_ptr(ret_val);
18101 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018102 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018103 xmlResetLastError();
18104 if (mem_base != xmlMemBlocks()) {
18105 printf("Leak of %d blocks found in xmlBufferContent",
18106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018107 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018108 printf(" %d", n_buf);
18109 printf("\n");
18110 }
18111 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018112 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018113
Daniel Veillard42595322004-11-08 10:52:06 +000018114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018115}
18116
18117
18118static int
18119test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018121
Daniel Veillard3d95c732004-11-06 22:25:14 +000018122 int mem_base;
18123 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018124
Daniel Veillard3d95c732004-11-06 22:25:14 +000018125 mem_base = xmlMemBlocks();
18126
18127 ret_val = xmlBufferCreate();
18128 desret_xmlBufferPtr(ret_val);
18129 call_tests++;
18130 xmlResetLastError();
18131 if (mem_base != xmlMemBlocks()) {
18132 printf("Leak of %d blocks found in xmlBufferCreate",
18133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018134 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018135 printf("\n");
18136 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018137 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018138
Daniel Veillard42595322004-11-08 10:52:06 +000018139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018140}
18141
18142
18143static int
18144test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
18147
18148 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018150}
18151
18152
18153static int
18154test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018156
18157
18158 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018160}
18161
18162
18163static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018164test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018166
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018167 int mem_base;
18168 xmlBufferPtr buf; /* the buffer */
18169 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018170
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018171 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18172 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018173 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018174
18175 xmlBufferEmpty(buf);
18176 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018177 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018178 xmlResetLastError();
18179 if (mem_base != xmlMemBlocks()) {
18180 printf("Leak of %d blocks found in xmlBufferEmpty",
18181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018182 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018183 printf(" %d", n_buf);
18184 printf("\n");
18185 }
18186 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018187 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018188
Daniel Veillard42595322004-11-08 10:52:06 +000018189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018190}
18191
18192
18193static int
18194test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018196
Daniel Veillard3d97e662004-11-04 10:49:00 +000018197 int mem_base;
18198 int ret_val;
18199 xmlBufferPtr buf; /* the buffer */
18200 int n_buf;
18201 unsigned int len; /* the minimum free size to allocate */
18202 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018203
Daniel Veillard3d97e662004-11-04 10:49:00 +000018204 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18205 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18206 mem_base = xmlMemBlocks();
18207 buf = gen_xmlBufferPtr(n_buf, 0);
18208 len = gen_unsigned_int(n_len, 1);
18209
18210 ret_val = xmlBufferGrow(buf, len);
18211 desret_int(ret_val);
18212 call_tests++;
18213 des_xmlBufferPtr(n_buf, buf, 0);
18214 des_unsigned_int(n_len, len, 1);
18215 xmlResetLastError();
18216 if (mem_base != xmlMemBlocks()) {
18217 printf("Leak of %d blocks found in xmlBufferGrow",
18218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018219 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018220 printf(" %d", n_buf);
18221 printf(" %d", n_len);
18222 printf("\n");
18223 }
18224 }
18225 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018226 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018227
Daniel Veillard42595322004-11-08 10:52:06 +000018228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018229}
18230
18231
18232static int
18233test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018235
Daniel Veillardce682bc2004-11-05 17:22:25 +000018236 int mem_base;
18237 int ret_val;
18238 xmlBufferPtr buf; /* the buffer */
18239 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018240
Daniel Veillardce682bc2004-11-05 17:22:25 +000018241 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18242 mem_base = xmlMemBlocks();
18243 buf = gen_const_xmlBufferPtr(n_buf, 0);
18244
William M. Brackf13f77f2004-11-12 16:03:48 +000018245 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018246 desret_int(ret_val);
18247 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018248 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018249 xmlResetLastError();
18250 if (mem_base != xmlMemBlocks()) {
18251 printf("Leak of %d blocks found in xmlBufferLength",
18252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018253 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018254 printf(" %d", n_buf);
18255 printf("\n");
18256 }
18257 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018259
Daniel Veillard42595322004-11-08 10:52:06 +000018260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018261}
18262
18263
18264static int
18265test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018267
Daniel Veillard3d97e662004-11-04 10:49:00 +000018268 int mem_base;
18269 int ret_val;
18270 xmlBufferPtr buf; /* the buffer to resize */
18271 int n_buf;
18272 unsigned int size; /* the desired size */
18273 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018274
Daniel Veillard3d97e662004-11-04 10:49:00 +000018275 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18276 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18277 mem_base = xmlMemBlocks();
18278 buf = gen_xmlBufferPtr(n_buf, 0);
18279 size = gen_unsigned_int(n_size, 1);
18280
18281 ret_val = xmlBufferResize(buf, size);
18282 desret_int(ret_val);
18283 call_tests++;
18284 des_xmlBufferPtr(n_buf, buf, 0);
18285 des_unsigned_int(n_size, size, 1);
18286 xmlResetLastError();
18287 if (mem_base != xmlMemBlocks()) {
18288 printf("Leak of %d blocks found in xmlBufferResize",
18289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018290 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018291 printf(" %d", n_buf);
18292 printf(" %d", n_size);
18293 printf("\n");
18294 }
18295 }
18296 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018297 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018298
Daniel Veillard42595322004-11-08 10:52:06 +000018299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018300}
18301
18302
18303static int
18304test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018306
Daniel Veillard57b25162004-11-06 14:50:18 +000018307 int mem_base;
18308 xmlBufferPtr buf; /* the buffer to tune */
18309 int n_buf;
18310 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18311 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018312
Daniel Veillard57b25162004-11-06 14:50:18 +000018313 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18314 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18315 mem_base = xmlMemBlocks();
18316 buf = gen_xmlBufferPtr(n_buf, 0);
18317 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18318
18319 xmlBufferSetAllocationScheme(buf, scheme);
18320 call_tests++;
18321 des_xmlBufferPtr(n_buf, buf, 0);
18322 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18323 xmlResetLastError();
18324 if (mem_base != xmlMemBlocks()) {
18325 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018327 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018328 printf(" %d", n_buf);
18329 printf(" %d", n_scheme);
18330 printf("\n");
18331 }
18332 }
18333 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018334 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018335
Daniel Veillard42595322004-11-08 10:52:06 +000018336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018337}
18338
18339
18340static int
18341test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018343
Daniel Veillard3d97e662004-11-04 10:49:00 +000018344 int mem_base;
18345 int ret_val;
18346 xmlBufferPtr buf; /* the buffer to dump */
18347 int n_buf;
18348 unsigned int len; /* the number of xmlChar to remove */
18349 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018350
Daniel Veillard3d97e662004-11-04 10:49:00 +000018351 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18352 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18353 mem_base = xmlMemBlocks();
18354 buf = gen_xmlBufferPtr(n_buf, 0);
18355 len = gen_unsigned_int(n_len, 1);
18356
18357 ret_val = xmlBufferShrink(buf, len);
18358 desret_int(ret_val);
18359 call_tests++;
18360 des_xmlBufferPtr(n_buf, buf, 0);
18361 des_unsigned_int(n_len, len, 1);
18362 xmlResetLastError();
18363 if (mem_base != xmlMemBlocks()) {
18364 printf("Leak of %d blocks found in xmlBufferShrink",
18365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018366 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018367 printf(" %d", n_buf);
18368 printf(" %d", n_len);
18369 printf("\n");
18370 }
18371 }
18372 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018373 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018374
Daniel Veillard42595322004-11-08 10:52:06 +000018375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018376}
18377
18378
18379static int
18380test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018382
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018383 int mem_base;
18384 xmlBufferPtr buf; /* the XML buffer */
18385 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018386 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018387 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018388
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018389 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18390 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18391 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018392 buf = gen_xmlBufferPtr(n_buf, 0);
18393 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018394
William M. Brackf13f77f2004-11-12 16:03:48 +000018395 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018396 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018397 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018398 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018399 xmlResetLastError();
18400 if (mem_base != xmlMemBlocks()) {
18401 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018403 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018404 printf(" %d", n_buf);
18405 printf(" %d", n_string);
18406 printf("\n");
18407 }
18408 }
18409 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018410 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018411
Daniel Veillard42595322004-11-08 10:52:06 +000018412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018413}
18414
18415
18416static int
18417test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018419
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018420 int mem_base;
18421 xmlBufferPtr buf; /* the XML buffer output */
18422 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018423 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018424 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018425
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018426 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18427 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018429 buf = gen_xmlBufferPtr(n_buf, 0);
18430 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018431
William M. Brackf13f77f2004-11-12 16:03:48 +000018432 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018434 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018435 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018436 xmlResetLastError();
18437 if (mem_base != xmlMemBlocks()) {
18438 printf("Leak of %d blocks found in xmlBufferWriteChar",
18439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018440 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018441 printf(" %d", n_buf);
18442 printf(" %d", n_string);
18443 printf("\n");
18444 }
18445 }
18446 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018448
Daniel Veillard42595322004-11-08 10:52:06 +000018449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018450}
18451
18452
18453static int
18454test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018456
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018457 int mem_base;
18458 xmlBufferPtr buf; /* the XML buffer output */
18459 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018460 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018461 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018462
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018463 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18464 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018466 buf = gen_xmlBufferPtr(n_buf, 0);
18467 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018468
William M. Brackf13f77f2004-11-12 16:03:48 +000018469 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018470 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018471 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018472 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018473 xmlResetLastError();
18474 if (mem_base != xmlMemBlocks()) {
18475 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018477 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018478 printf(" %d", n_buf);
18479 printf(" %d", n_string);
18480 printf("\n");
18481 }
18482 }
18483 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018485
Daniel Veillard42595322004-11-08 10:52:06 +000018486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018487}
18488
18489
18490static int
18491test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018493
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018494 int mem_base;
18495 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018496 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018497 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018498 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018499 int n_prefix;
18500 xmlChar * memory; /* preallocated memory */
18501 int n_memory;
18502 int len; /* preallocated memory length */
18503 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018504
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018505 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18506 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18507 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18508 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018510 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18511 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18512 memory = gen_xmlChar_ptr(n_memory, 2);
18513 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018514
William M. Brackf13f77f2004-11-12 16:03:48 +000018515 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018516 if ((ret_val != NULL) && (ret_val != ncname) &&
18517 (ret_val != prefix) && (ret_val != memory))
18518 xmlFree(ret_val);
18519 ret_val = NULL;
18520 desret_xmlChar_ptr(ret_val);
18521 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018522 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18523 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018524 des_xmlChar_ptr(n_memory, memory, 2);
18525 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018526 xmlResetLastError();
18527 if (mem_base != xmlMemBlocks()) {
18528 printf("Leak of %d blocks found in xmlBuildQName",
18529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018530 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018531 printf(" %d", n_ncname);
18532 printf(" %d", n_prefix);
18533 printf(" %d", n_memory);
18534 printf(" %d", n_len);
18535 printf("\n");
18536 }
18537 }
18538 }
18539 }
18540 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018542
Daniel Veillard42595322004-11-08 10:52:06 +000018543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018544}
18545
18546
18547static int
18548test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018550
William M. Brack21e4ef22005-01-02 09:53:13 +000018551#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018552 int mem_base;
18553 xmlDocPtr ret_val;
18554 xmlDocPtr doc; /* the document */
18555 int n_doc;
18556 int recursive; /* if not zero do a recursive copy. */
18557 int n_recursive;
18558
18559 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18560 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018562 doc = gen_xmlDocPtr(n_doc, 0);
18563 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018564
18565 ret_val = xmlCopyDoc(doc, recursive);
18566 desret_xmlDocPtr(ret_val);
18567 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018568 des_xmlDocPtr(n_doc, doc, 0);
18569 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018570 xmlResetLastError();
18571 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018572 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018574 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018575 printf(" %d", n_doc);
18576 printf(" %d", n_recursive);
18577 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018578 }
18579 }
18580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018581 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018582#endif
18583
Daniel Veillard42595322004-11-08 10:52:06 +000018584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018585}
18586
18587
18588static int
18589test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018591
William M. Brack21e4ef22005-01-02 09:53:13 +000018592#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018593 int mem_base;
18594 xmlDtdPtr ret_val;
18595 xmlDtdPtr dtd; /* the dtd */
18596 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018597
Daniel Veillard27f20102004-11-05 11:50:11 +000018598 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18599 mem_base = xmlMemBlocks();
18600 dtd = gen_xmlDtdPtr(n_dtd, 0);
18601
18602 ret_val = xmlCopyDtd(dtd);
18603 desret_xmlDtdPtr(ret_val);
18604 call_tests++;
18605 des_xmlDtdPtr(n_dtd, dtd, 0);
18606 xmlResetLastError();
18607 if (mem_base != xmlMemBlocks()) {
18608 printf("Leak of %d blocks found in xmlCopyDtd",
18609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018610 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018611 printf(" %d", n_dtd);
18612 printf("\n");
18613 }
18614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018615 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018616#endif
18617
Daniel Veillard42595322004-11-08 10:52:06 +000018618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018619}
18620
18621
18622static int
18623test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018625
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018626 int mem_base;
18627 xmlNsPtr ret_val;
18628 xmlNsPtr cur; /* the namespace */
18629 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018630
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018631 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18632 mem_base = xmlMemBlocks();
18633 cur = gen_xmlNsPtr(n_cur, 0);
18634
18635 ret_val = xmlCopyNamespace(cur);
18636 if (ret_val != NULL) xmlFreeNs(ret_val);
18637 desret_xmlNsPtr(ret_val);
18638 call_tests++;
18639 des_xmlNsPtr(n_cur, cur, 0);
18640 xmlResetLastError();
18641 if (mem_base != xmlMemBlocks()) {
18642 printf("Leak of %d blocks found in xmlCopyNamespace",
18643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018644 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018645 printf(" %d", n_cur);
18646 printf("\n");
18647 }
18648 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018649 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018650
Daniel Veillard42595322004-11-08 10:52:06 +000018651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018652}
18653
18654
18655static int
18656test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018658
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018659 int mem_base;
18660 xmlNsPtr ret_val;
18661 xmlNsPtr cur; /* the first namespace */
18662 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018663
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018664 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18665 mem_base = xmlMemBlocks();
18666 cur = gen_xmlNsPtr(n_cur, 0);
18667
18668 ret_val = xmlCopyNamespaceList(cur);
18669 if (ret_val != NULL) xmlFreeNsList(ret_val);
18670 desret_xmlNsPtr(ret_val);
18671 call_tests++;
18672 des_xmlNsPtr(n_cur, cur, 0);
18673 xmlResetLastError();
18674 if (mem_base != xmlMemBlocks()) {
18675 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018677 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018678 printf(" %d", n_cur);
18679 printf("\n");
18680 }
18681 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018683
Daniel Veillard42595322004-11-08 10:52:06 +000018684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018685}
18686
18687
18688static int
18689test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018691
Daniel Veillardce682bc2004-11-05 17:22:25 +000018692 int mem_base;
18693 xmlNodePtr ret_val;
18694 xmlNodePtr node; /* the node */
18695 int n_node;
18696 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18697 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018698
Daniel Veillardce682bc2004-11-05 17:22:25 +000018699 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18700 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18701 mem_base = xmlMemBlocks();
18702 node = gen_const_xmlNodePtr(n_node, 0);
18703 extended = gen_int(n_extended, 1);
18704
William M. Brackf13f77f2004-11-12 16:03:48 +000018705 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018706 desret_xmlNodePtr(ret_val);
18707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018708 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018709 des_int(n_extended, extended, 1);
18710 xmlResetLastError();
18711 if (mem_base != xmlMemBlocks()) {
18712 printf("Leak of %d blocks found in xmlCopyNode",
18713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018714 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018715 printf(" %d", n_node);
18716 printf(" %d", n_extended);
18717 printf("\n");
18718 }
18719 }
18720 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018722
Daniel Veillard42595322004-11-08 10:52:06 +000018723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018724}
18725
18726
18727static int
18728test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018730
Daniel Veillardce682bc2004-11-05 17:22:25 +000018731 int mem_base;
18732 xmlNodePtr ret_val;
18733 xmlNodePtr node; /* the first node in the list. */
18734 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018735
Daniel Veillardce682bc2004-11-05 17:22:25 +000018736 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18737 mem_base = xmlMemBlocks();
18738 node = gen_const_xmlNodePtr(n_node, 0);
18739
William M. Brackf13f77f2004-11-12 16:03:48 +000018740 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018741 desret_xmlNodePtr(ret_val);
18742 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018743 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018744 xmlResetLastError();
18745 if (mem_base != xmlMemBlocks()) {
18746 printf("Leak of %d blocks found in xmlCopyNodeList",
18747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018748 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018749 printf(" %d", n_node);
18750 printf("\n");
18751 }
18752 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018753 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018754
Daniel Veillard42595322004-11-08 10:52:06 +000018755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018756}
18757
18758
18759static int
18760test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018762
Daniel Veillard57b25162004-11-06 14:50:18 +000018763 int mem_base;
18764 xmlAttrPtr ret_val;
18765 xmlNodePtr target; /* the element where the attribute will be grafted */
18766 int n_target;
18767 xmlAttrPtr cur; /* the attribute */
18768 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018769
Daniel Veillard57b25162004-11-06 14:50:18 +000018770 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18771 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18772 mem_base = xmlMemBlocks();
18773 target = gen_xmlNodePtr(n_target, 0);
18774 cur = gen_xmlAttrPtr(n_cur, 1);
18775
18776 ret_val = xmlCopyProp(target, cur);
18777 desret_xmlAttrPtr(ret_val);
18778 call_tests++;
18779 des_xmlNodePtr(n_target, target, 0);
18780 des_xmlAttrPtr(n_cur, cur, 1);
18781 xmlResetLastError();
18782 if (mem_base != xmlMemBlocks()) {
18783 printf("Leak of %d blocks found in xmlCopyProp",
18784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018785 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018786 printf(" %d", n_target);
18787 printf(" %d", n_cur);
18788 printf("\n");
18789 }
18790 }
18791 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018792 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018793
Daniel Veillard42595322004-11-08 10:52:06 +000018794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018795}
18796
18797
18798static int
18799test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018801
Daniel Veillard57b25162004-11-06 14:50:18 +000018802 int mem_base;
18803 xmlAttrPtr ret_val;
18804 xmlNodePtr target; /* the element where the attributes will be grafted */
18805 int n_target;
18806 xmlAttrPtr cur; /* the first attribute */
18807 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018808
Daniel Veillard57b25162004-11-06 14:50:18 +000018809 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18810 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18811 mem_base = xmlMemBlocks();
18812 target = gen_xmlNodePtr(n_target, 0);
18813 cur = gen_xmlAttrPtr(n_cur, 1);
18814
18815 ret_val = xmlCopyPropList(target, cur);
18816 desret_xmlAttrPtr(ret_val);
18817 call_tests++;
18818 des_xmlNodePtr(n_target, target, 0);
18819 des_xmlAttrPtr(n_cur, cur, 1);
18820 xmlResetLastError();
18821 if (mem_base != xmlMemBlocks()) {
18822 printf("Leak of %d blocks found in xmlCopyPropList",
18823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018824 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018825 printf(" %d", n_target);
18826 printf(" %d", n_cur);
18827 printf("\n");
18828 }
18829 }
18830 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018832
Daniel Veillard42595322004-11-08 10:52:06 +000018833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018834}
18835
18836
18837static int
18838test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018840
Daniel Veillard34099b42004-11-04 17:34:35 +000018841 int mem_base;
18842 xmlDtdPtr ret_val;
18843 xmlDocPtr doc; /* the document pointer */
18844 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018845 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018846 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018847 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018848 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018849 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018850 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018851
Daniel Veillard34099b42004-11-04 17:34:35 +000018852 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18853 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18854 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18855 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18856 mem_base = xmlMemBlocks();
18857 doc = gen_xmlDocPtr(n_doc, 0);
18858 name = gen_const_xmlChar_ptr(n_name, 1);
18859 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18860 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18861
William M. Brackf13f77f2004-11-12 16:03:48 +000018862 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018863 desret_xmlDtdPtr(ret_val);
18864 call_tests++;
18865 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018866 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18867 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18868 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018869 xmlResetLastError();
18870 if (mem_base != xmlMemBlocks()) {
18871 printf("Leak of %d blocks found in xmlCreateIntSubset",
18872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018873 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018874 printf(" %d", n_doc);
18875 printf(" %d", n_name);
18876 printf(" %d", n_ExternalID);
18877 printf(" %d", n_SystemID);
18878 printf("\n");
18879 }
18880 }
18881 }
18882 }
18883 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018884 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018885
Daniel Veillard42595322004-11-08 10:52:06 +000018886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018887}
18888
18889
18890static int
18891test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018893
Daniel Veillardce682bc2004-11-05 17:22:25 +000018894 int mem_base;
18895 xmlNodePtr ret_val;
18896 xmlNodePtr node; /* the node */
18897 int n_node;
18898 xmlDocPtr doc; /* the document */
18899 int n_doc;
18900 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18901 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018902
Daniel Veillardce682bc2004-11-05 17:22:25 +000018903 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18904 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18905 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18906 mem_base = xmlMemBlocks();
18907 node = gen_const_xmlNodePtr(n_node, 0);
18908 doc = gen_xmlDocPtr(n_doc, 1);
18909 extended = gen_int(n_extended, 2);
18910
William M. Brackf13f77f2004-11-12 16:03:48 +000018911 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018912 desret_xmlNodePtr(ret_val);
18913 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018914 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018915 des_xmlDocPtr(n_doc, doc, 1);
18916 des_int(n_extended, extended, 2);
18917 xmlResetLastError();
18918 if (mem_base != xmlMemBlocks()) {
18919 printf("Leak of %d blocks found in xmlDocCopyNode",
18920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018921 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018922 printf(" %d", n_node);
18923 printf(" %d", n_doc);
18924 printf(" %d", n_extended);
18925 printf("\n");
18926 }
18927 }
18928 }
18929 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018930 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018931
Daniel Veillard42595322004-11-08 10:52:06 +000018932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018933}
18934
18935
18936static int
18937test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018939
Daniel Veillardce682bc2004-11-05 17:22:25 +000018940 int mem_base;
18941 xmlNodePtr ret_val;
18942 xmlDocPtr doc; /* the target document */
18943 int n_doc;
18944 xmlNodePtr node; /* the first node in the list. */
18945 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018946
Daniel Veillardce682bc2004-11-05 17:22:25 +000018947 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18948 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18949 mem_base = xmlMemBlocks();
18950 doc = gen_xmlDocPtr(n_doc, 0);
18951 node = gen_const_xmlNodePtr(n_node, 1);
18952
William M. Brackf13f77f2004-11-12 16:03:48 +000018953 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018954 desret_xmlNodePtr(ret_val);
18955 call_tests++;
18956 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018957 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018958 xmlResetLastError();
18959 if (mem_base != xmlMemBlocks()) {
18960 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018962 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018963 printf(" %d", n_doc);
18964 printf(" %d", n_node);
18965 printf("\n");
18966 }
18967 }
18968 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018969 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018970
Daniel Veillard42595322004-11-08 10:52:06 +000018971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018972}
18973
18974
18975static int
18976test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018978
William M. Brack21e4ef22005-01-02 09:53:13 +000018979#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018980 int mem_base;
18981 int ret_val;
18982 FILE * f; /* the FILE* */
18983 int n_f;
18984 xmlDocPtr cur; /* the document */
18985 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018986
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018987 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18988 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18989 mem_base = xmlMemBlocks();
18990 f = gen_FILE_ptr(n_f, 0);
18991 cur = gen_xmlDocPtr(n_cur, 1);
18992
18993 ret_val = xmlDocDump(f, cur);
18994 desret_int(ret_val);
18995 call_tests++;
18996 des_FILE_ptr(n_f, f, 0);
18997 des_xmlDocPtr(n_cur, cur, 1);
18998 xmlResetLastError();
18999 if (mem_base != xmlMemBlocks()) {
19000 printf("Leak of %d blocks found in xmlDocDump",
19001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019002 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019003 printf(" %d", n_f);
19004 printf(" %d", n_cur);
19005 printf("\n");
19006 }
19007 }
19008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019009 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019010#endif
19011
Daniel Veillard42595322004-11-08 10:52:06 +000019012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019013}
19014
19015
19016static int
19017test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019019
William M. Brack21e4ef22005-01-02 09:53:13 +000019020#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019021 int mem_base;
19022 xmlDocPtr cur; /* the document */
19023 int n_cur;
19024 xmlChar ** mem; /* OUT: the memory pointer */
19025 int n_mem;
19026 int * size; /* OUT: the memory length */
19027 int n_size;
19028 int format; /* should formatting spaces been added */
19029 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019030
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019031 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19032 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19033 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19034 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19035 mem_base = xmlMemBlocks();
19036 cur = gen_xmlDocPtr(n_cur, 0);
19037 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19038 size = gen_int_ptr(n_size, 2);
19039 format = gen_int(n_format, 3);
19040
19041 xmlDocDumpFormatMemory(cur, mem, size, format);
19042 call_tests++;
19043 des_xmlDocPtr(n_cur, cur, 0);
19044 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19045 des_int_ptr(n_size, size, 2);
19046 des_int(n_format, format, 3);
19047 xmlResetLastError();
19048 if (mem_base != xmlMemBlocks()) {
19049 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019051 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019052 printf(" %d", n_cur);
19053 printf(" %d", n_mem);
19054 printf(" %d", n_size);
19055 printf(" %d", n_format);
19056 printf("\n");
19057 }
19058 }
19059 }
19060 }
19061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019062 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019063#endif
19064
Daniel Veillard42595322004-11-08 10:52:06 +000019065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019066}
19067
19068
19069static int
19070test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019072
William M. Brack21e4ef22005-01-02 09:53:13 +000019073#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019074 int mem_base;
19075 xmlDocPtr out_doc; /* Document to generate XML text from */
19076 int n_out_doc;
19077 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19078 int n_doc_txt_ptr;
19079 int * doc_txt_len; /* Length of the generated XML text */
19080 int n_doc_txt_len;
19081 char * txt_encoding; /* Character encoding to use when generating XML text */
19082 int n_txt_encoding;
19083 int format; /* should formatting spaces been added */
19084 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019085
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019086 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19087 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19088 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19089 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19090 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19091 mem_base = xmlMemBlocks();
19092 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19093 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19094 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19095 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19096 format = gen_int(n_format, 4);
19097
William M. Brackf13f77f2004-11-12 16:03:48 +000019098 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019099 call_tests++;
19100 des_xmlDocPtr(n_out_doc, out_doc, 0);
19101 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19102 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019103 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019104 des_int(n_format, format, 4);
19105 xmlResetLastError();
19106 if (mem_base != xmlMemBlocks()) {
19107 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019109 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019110 printf(" %d", n_out_doc);
19111 printf(" %d", n_doc_txt_ptr);
19112 printf(" %d", n_doc_txt_len);
19113 printf(" %d", n_txt_encoding);
19114 printf(" %d", n_format);
19115 printf("\n");
19116 }
19117 }
19118 }
19119 }
19120 }
19121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019122 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019123#endif
19124
Daniel Veillard42595322004-11-08 10:52:06 +000019125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019126}
19127
19128
19129static int
19130test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019132
William M. Brack21e4ef22005-01-02 09:53:13 +000019133#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019134 int mem_base;
19135 xmlDocPtr cur; /* the document */
19136 int n_cur;
19137 xmlChar ** mem; /* OUT: the memory pointer */
19138 int n_mem;
19139 int * size; /* OUT: the memory length */
19140 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019141
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019142 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19143 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19144 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19145 mem_base = xmlMemBlocks();
19146 cur = gen_xmlDocPtr(n_cur, 0);
19147 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19148 size = gen_int_ptr(n_size, 2);
19149
19150 xmlDocDumpMemory(cur, mem, size);
19151 call_tests++;
19152 des_xmlDocPtr(n_cur, cur, 0);
19153 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19154 des_int_ptr(n_size, size, 2);
19155 xmlResetLastError();
19156 if (mem_base != xmlMemBlocks()) {
19157 printf("Leak of %d blocks found in xmlDocDumpMemory",
19158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019159 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019160 printf(" %d", n_cur);
19161 printf(" %d", n_mem);
19162 printf(" %d", n_size);
19163 printf("\n");
19164 }
19165 }
19166 }
19167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019168 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019169#endif
19170
Daniel Veillard42595322004-11-08 10:52:06 +000019171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019172}
19173
19174
19175static int
19176test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019178
William M. Brack21e4ef22005-01-02 09:53:13 +000019179#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019180 int mem_base;
19181 xmlDocPtr out_doc; /* Document to generate XML text from */
19182 int n_out_doc;
19183 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19184 int n_doc_txt_ptr;
19185 int * doc_txt_len; /* Length of the generated XML text */
19186 int n_doc_txt_len;
19187 char * txt_encoding; /* Character encoding to use when generating XML text */
19188 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019189
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019190 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19191 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19192 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19193 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19194 mem_base = xmlMemBlocks();
19195 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19196 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19197 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19198 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19199
William M. Brackf13f77f2004-11-12 16:03:48 +000019200 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019201 call_tests++;
19202 des_xmlDocPtr(n_out_doc, out_doc, 0);
19203 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19204 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019205 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019206 xmlResetLastError();
19207 if (mem_base != xmlMemBlocks()) {
19208 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019210 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019211 printf(" %d", n_out_doc);
19212 printf(" %d", n_doc_txt_ptr);
19213 printf(" %d", n_doc_txt_len);
19214 printf(" %d", n_txt_encoding);
19215 printf("\n");
19216 }
19217 }
19218 }
19219 }
19220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019221 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019222#endif
19223
Daniel Veillard42595322004-11-08 10:52:06 +000019224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019225}
19226
19227
19228static int
19229test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019231
William M. Brack21e4ef22005-01-02 09:53:13 +000019232#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019233 int mem_base;
19234 int ret_val;
19235 FILE * f; /* the FILE* */
19236 int n_f;
19237 xmlDocPtr cur; /* the document */
19238 int n_cur;
19239 int format; /* should formatting spaces been added */
19240 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019241
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019242 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19243 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19244 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19245 mem_base = xmlMemBlocks();
19246 f = gen_FILE_ptr(n_f, 0);
19247 cur = gen_xmlDocPtr(n_cur, 1);
19248 format = gen_int(n_format, 2);
19249
19250 ret_val = xmlDocFormatDump(f, cur, format);
19251 desret_int(ret_val);
19252 call_tests++;
19253 des_FILE_ptr(n_f, f, 0);
19254 des_xmlDocPtr(n_cur, cur, 1);
19255 des_int(n_format, format, 2);
19256 xmlResetLastError();
19257 if (mem_base != xmlMemBlocks()) {
19258 printf("Leak of %d blocks found in xmlDocFormatDump",
19259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019260 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019261 printf(" %d", n_f);
19262 printf(" %d", n_cur);
19263 printf(" %d", n_format);
19264 printf("\n");
19265 }
19266 }
19267 }
19268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019269 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019270#endif
19271
Daniel Veillard42595322004-11-08 10:52:06 +000019272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019273}
19274
19275
19276static int
19277test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019279
19280 int mem_base;
19281 xmlNodePtr ret_val;
19282 xmlDocPtr doc; /* the document */
19283 int n_doc;
19284
19285 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019287 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019288
19289 ret_val = xmlDocGetRootElement(doc);
19290 desret_xmlNodePtr(ret_val);
19291 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019292 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019293 xmlResetLastError();
19294 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019295 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019297 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019298 printf(" %d", n_doc);
19299 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019300 }
19301 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019302 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019303
Daniel Veillard42595322004-11-08 10:52:06 +000019304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019305}
19306
19307
19308static int
19309test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019311
William M. Brack21e4ef22005-01-02 09:53:13 +000019312#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019313 int mem_base;
19314 xmlNodePtr ret_val;
19315 xmlDocPtr doc; /* the document */
19316 int n_doc;
19317 xmlNodePtr root; /* the new document root element */
19318 int n_root;
19319
19320 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019321 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019322 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019323 doc = gen_xmlDocPtr(n_doc, 0);
19324 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019325
19326 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019327 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019328 desret_xmlNodePtr(ret_val);
19329 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019330 des_xmlDocPtr(n_doc, doc, 0);
19331 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019332 xmlResetLastError();
19333 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019334 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019336 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019337 printf(" %d", n_doc);
19338 printf(" %d", n_root);
19339 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019340 }
19341 }
19342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019343 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019344#endif
19345
Daniel Veillard42595322004-11-08 10:52:06 +000019346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019347}
19348
19349
19350static int
19351test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019353
William M. Brack21e4ef22005-01-02 09:53:13 +000019354#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019355 int mem_base;
19356 FILE * f; /* the FILE * for the output */
19357 int n_f;
19358 xmlDocPtr doc; /* the document */
19359 int n_doc;
19360 xmlNodePtr cur; /* the current node */
19361 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019362
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019363 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19364 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19365 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19366 mem_base = xmlMemBlocks();
19367 f = gen_FILE_ptr(n_f, 0);
19368 doc = gen_xmlDocPtr(n_doc, 1);
19369 cur = gen_xmlNodePtr(n_cur, 2);
19370
19371 xmlElemDump(f, doc, cur);
19372 call_tests++;
19373 des_FILE_ptr(n_f, f, 0);
19374 des_xmlDocPtr(n_doc, doc, 1);
19375 des_xmlNodePtr(n_cur, cur, 2);
19376 xmlResetLastError();
19377 if (mem_base != xmlMemBlocks()) {
19378 printf("Leak of %d blocks found in xmlElemDump",
19379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019380 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019381 printf(" %d", n_f);
19382 printf(" %d", n_doc);
19383 printf(" %d", n_cur);
19384 printf("\n");
19385 }
19386 }
19387 }
19388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019389 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019390#endif
19391
Daniel Veillard42595322004-11-08 10:52:06 +000019392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019393}
19394
19395
19396static int
19397test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019399
Daniel Veillard57b25162004-11-06 14:50:18 +000019400 int mem_base;
19401 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019402
Daniel Veillard57b25162004-11-06 14:50:18 +000019403 mem_base = xmlMemBlocks();
19404
19405 ret_val = xmlGetBufferAllocationScheme();
19406 desret_xmlBufferAllocationScheme(ret_val);
19407 call_tests++;
19408 xmlResetLastError();
19409 if (mem_base != xmlMemBlocks()) {
19410 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019412 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019413 printf("\n");
19414 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019415 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019416
Daniel Veillard42595322004-11-08 10:52:06 +000019417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418}
19419
19420
19421static int
19422test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019424
19425 int mem_base;
19426 int ret_val;
19427
19428 mem_base = xmlMemBlocks();
19429
19430 ret_val = xmlGetCompressMode();
19431 desret_int(ret_val);
19432 call_tests++;
19433 xmlResetLastError();
19434 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019435 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019437 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019438 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019439 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019440 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019441
Daniel Veillard42595322004-11-08 10:52:06 +000019442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019443}
19444
19445
19446static int
19447test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019449
19450 int mem_base;
19451 int ret_val;
19452 xmlDocPtr doc; /* the document */
19453 int n_doc;
19454
19455 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019457 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458
19459 ret_val = xmlGetDocCompressMode(doc);
19460 desret_int(ret_val);
19461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019462 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019463 xmlResetLastError();
19464 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019465 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019467 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019468 printf(" %d", n_doc);
19469 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019470 }
19471 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019473
Daniel Veillard42595322004-11-08 10:52:06 +000019474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019475}
19476
19477
19478static int
19479test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019481
Daniel Veillard34099b42004-11-04 17:34:35 +000019482 int mem_base;
19483 xmlDtdPtr ret_val;
19484 xmlDocPtr doc; /* the document pointer */
19485 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019486
Daniel Veillard34099b42004-11-04 17:34:35 +000019487 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19488 mem_base = xmlMemBlocks();
19489 doc = gen_xmlDocPtr(n_doc, 0);
19490
19491 ret_val = xmlGetIntSubset(doc);
19492 desret_xmlDtdPtr(ret_val);
19493 call_tests++;
19494 des_xmlDocPtr(n_doc, doc, 0);
19495 xmlResetLastError();
19496 if (mem_base != xmlMemBlocks()) {
19497 printf("Leak of %d blocks found in xmlGetIntSubset",
19498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019499 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019500 printf(" %d", n_doc);
19501 printf("\n");
19502 }
19503 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019505
Daniel Veillard42595322004-11-08 10:52:06 +000019506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507}
19508
19509
19510static int
19511test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019513
19514 int mem_base;
19515 xmlNodePtr ret_val;
19516 xmlNodePtr parent; /* the parent node */
19517 int n_parent;
19518
19519 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019521 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019522
19523 ret_val = xmlGetLastChild(parent);
19524 desret_xmlNodePtr(ret_val);
19525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019526 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019527 xmlResetLastError();
19528 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019529 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019531 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019532 printf(" %d", n_parent);
19533 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019534 }
19535 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019536 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019537
Daniel Veillard42595322004-11-08 10:52:06 +000019538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019539}
19540
19541
19542static int
19543test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019545
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019546 int mem_base;
19547 long ret_val;
19548 xmlNodePtr node; /* valid node */
19549 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019550
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019551 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19552 mem_base = xmlMemBlocks();
19553 node = gen_xmlNodePtr(n_node, 0);
19554
19555 ret_val = xmlGetLineNo(node);
19556 desret_long(ret_val);
19557 call_tests++;
19558 des_xmlNodePtr(n_node, node, 0);
19559 xmlResetLastError();
19560 if (mem_base != xmlMemBlocks()) {
19561 printf("Leak of %d blocks found in xmlGetLineNo",
19562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019563 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019564 printf(" %d", n_node);
19565 printf("\n");
19566 }
19567 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019569
Daniel Veillard42595322004-11-08 10:52:06 +000019570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019571}
19572
19573
19574static int
19575test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019577
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019578 int mem_base;
19579 xmlChar * ret_val;
19580 xmlNodePtr node; /* the node */
19581 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019582 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019583 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019584
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019585 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19586 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19587 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019588 node = gen_xmlNodePtr(n_node, 0);
19589 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019590
William M. Brackf13f77f2004-11-12 16:03:48 +000019591 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019592 desret_xmlChar_ptr(ret_val);
19593 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019594 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019595 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019596 xmlResetLastError();
19597 if (mem_base != xmlMemBlocks()) {
19598 printf("Leak of %d blocks found in xmlGetNoNsProp",
19599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019600 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019601 printf(" %d", n_node);
19602 printf(" %d", n_name);
19603 printf("\n");
19604 }
19605 }
19606 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019607 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019608
Daniel Veillard42595322004-11-08 10:52:06 +000019609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019610}
19611
19612
19613static int
19614test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019616
William M. Brack21e4ef22005-01-02 09:53:13 +000019617#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019618 int mem_base;
19619 xmlChar * ret_val;
19620 xmlNodePtr node; /* a node */
19621 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019622
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019623 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19624 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019625 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019626
19627 ret_val = xmlGetNodePath(node);
19628 desret_xmlChar_ptr(ret_val);
19629 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019630 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019631 xmlResetLastError();
19632 if (mem_base != xmlMemBlocks()) {
19633 printf("Leak of %d blocks found in xmlGetNodePath",
19634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019635 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019636 printf(" %d", n_node);
19637 printf("\n");
19638 }
19639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019640 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019641#endif
19642
Daniel Veillard42595322004-11-08 10:52:06 +000019643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019644}
19645
19646
19647static int
19648test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019650
19651
19652 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019654}
19655
19656
19657static int
19658test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019660
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019661 int mem_base;
19662 xmlChar * ret_val;
19663 xmlNodePtr node; /* the node */
19664 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019665 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019666 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019667 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019668 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019669
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019670 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19671 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19672 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019674 node = gen_xmlNodePtr(n_node, 0);
19675 name = gen_const_xmlChar_ptr(n_name, 1);
19676 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019677
William M. Brackf13f77f2004-11-12 16:03:48 +000019678 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019679 desret_xmlChar_ptr(ret_val);
19680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019681 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019682 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19683 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019684 xmlResetLastError();
19685 if (mem_base != xmlMemBlocks()) {
19686 printf("Leak of %d blocks found in xmlGetNsProp",
19687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019688 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019689 printf(" %d", n_node);
19690 printf(" %d", n_name);
19691 printf(" %d", n_nameSpace);
19692 printf("\n");
19693 }
19694 }
19695 }
19696 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019698
Daniel Veillard42595322004-11-08 10:52:06 +000019699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019700}
19701
19702
19703static int
19704test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019706
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019707 int mem_base;
19708 xmlChar * ret_val;
19709 xmlNodePtr node; /* the node */
19710 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019711 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019712 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019713
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019714 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19715 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019717 node = gen_xmlNodePtr(n_node, 0);
19718 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019719
William M. Brackf13f77f2004-11-12 16:03:48 +000019720 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019721 desret_xmlChar_ptr(ret_val);
19722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019723 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019724 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019725 xmlResetLastError();
19726 if (mem_base != xmlMemBlocks()) {
19727 printf("Leak of %d blocks found in xmlGetProp",
19728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019729 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019730 printf(" %d", n_node);
19731 printf(" %d", n_name);
19732 printf("\n");
19733 }
19734 }
19735 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019737
Daniel Veillard42595322004-11-08 10:52:06 +000019738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019739}
19740
19741
19742static int
19743test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019745
Daniel Veillard57b25162004-11-06 14:50:18 +000019746 int mem_base;
19747 xmlAttrPtr ret_val;
19748 xmlNodePtr node; /* the node */
19749 int n_node;
19750 xmlChar * name; /* the attribute name */
19751 int n_name;
19752 xmlChar * nameSpace; /* the URI of the namespace */
19753 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019754
Daniel Veillard57b25162004-11-06 14:50:18 +000019755 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19756 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19757 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19758 mem_base = xmlMemBlocks();
19759 node = gen_xmlNodePtr(n_node, 0);
19760 name = gen_const_xmlChar_ptr(n_name, 1);
19761 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19762
William M. Brackf13f77f2004-11-12 16:03:48 +000019763 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019764 desret_xmlAttrPtr(ret_val);
19765 call_tests++;
19766 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019767 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19768 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019769 xmlResetLastError();
19770 if (mem_base != xmlMemBlocks()) {
19771 printf("Leak of %d blocks found in xmlHasNsProp",
19772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019773 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019774 printf(" %d", n_node);
19775 printf(" %d", n_name);
19776 printf(" %d", n_nameSpace);
19777 printf("\n");
19778 }
19779 }
19780 }
19781 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019782 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019783
Daniel Veillard42595322004-11-08 10:52:06 +000019784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019785}
19786
19787
19788static int
19789test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019791
Daniel Veillard57b25162004-11-06 14:50:18 +000019792 int mem_base;
19793 xmlAttrPtr ret_val;
19794 xmlNodePtr node; /* the node */
19795 int n_node;
19796 xmlChar * name; /* the attribute name */
19797 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019798
Daniel Veillard57b25162004-11-06 14:50:18 +000019799 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19800 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19801 mem_base = xmlMemBlocks();
19802 node = gen_xmlNodePtr(n_node, 0);
19803 name = gen_const_xmlChar_ptr(n_name, 1);
19804
William M. Brackf13f77f2004-11-12 16:03:48 +000019805 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019806 desret_xmlAttrPtr(ret_val);
19807 call_tests++;
19808 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019809 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019810 xmlResetLastError();
19811 if (mem_base != xmlMemBlocks()) {
19812 printf("Leak of %d blocks found in xmlHasProp",
19813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019814 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019815 printf(" %d", n_node);
19816 printf(" %d", n_name);
19817 printf("\n");
19818 }
19819 }
19820 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019822
Daniel Veillard42595322004-11-08 10:52:06 +000019823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019824}
19825
19826
19827static int
19828test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019830
19831 int mem_base;
19832 int ret_val;
19833 xmlNodePtr node; /* the node */
19834 int n_node;
19835
19836 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019838 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019839
19840 ret_val = xmlIsBlankNode(node);
19841 desret_int(ret_val);
19842 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019843 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019844 xmlResetLastError();
19845 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019846 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019848 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019849 printf(" %d", n_node);
19850 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019851 }
19852 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019853 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019854
Daniel Veillard42595322004-11-08 10:52:06 +000019855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019856}
19857
19858
19859static int
19860test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019862
19863 int mem_base;
19864 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019865 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019866 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019867 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019868 int n_publicID;
19869
19870 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19871 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019873 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19874 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019875
William M. Brackf13f77f2004-11-12 16:03:48 +000019876 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019877 desret_int(ret_val);
19878 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019879 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19880 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019881 xmlResetLastError();
19882 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019883 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019885 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019886 printf(" %d", n_systemID);
19887 printf(" %d", n_publicID);
19888 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019889 }
19890 }
19891 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019893
Daniel Veillard42595322004-11-08 10:52:06 +000019894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895}
19896
19897
19898static int
19899test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019901
19902 int mem_base;
19903 xmlNodePtr ret_val;
19904 xmlDocPtr doc; /* the document */
19905 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019906 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019907 int n_content;
19908 int len; /* the length of the block */
19909 int n_len;
19910
19911 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19912 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19913 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19914 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019915 doc = gen_xmlDocPtr(n_doc, 0);
19916 content = gen_const_xmlChar_ptr(n_content, 1);
19917 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019918
William M. Brackf13f77f2004-11-12 16:03:48 +000019919 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019920 desret_xmlNodePtr(ret_val);
19921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019922 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019923 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019924 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019925 xmlResetLastError();
19926 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019927 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019929 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019930 printf(" %d", n_doc);
19931 printf(" %d", n_content);
19932 printf(" %d", n_len);
19933 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019934 }
19935 }
19936 }
19937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019939
Daniel Veillard42595322004-11-08 10:52:06 +000019940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019941}
19942
19943
19944static int
19945test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019947
19948 int mem_base;
19949 xmlNodePtr ret_val;
19950 xmlDocPtr doc; /* the document */
19951 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019952 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019953 int n_name;
19954
19955 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19956 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019958 doc = gen_xmlDocPtr(n_doc, 0);
19959 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019960
William M. Brackf13f77f2004-11-12 16:03:48 +000019961 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019962 desret_xmlNodePtr(ret_val);
19963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019964 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019965 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019966 xmlResetLastError();
19967 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019968 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019970 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019971 printf(" %d", n_doc);
19972 printf(" %d", n_name);
19973 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019974 }
19975 }
19976 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019978
Daniel Veillard42595322004-11-08 10:52:06 +000019979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019980}
19981
19982
19983static int
19984test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019986
William M. Brack21e4ef22005-01-02 09:53:13 +000019987#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019988#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019989 int mem_base;
19990 xmlNodePtr ret_val;
19991 xmlNodePtr parent; /* the parent node */
19992 int n_parent;
19993 xmlNsPtr ns; /* a namespace if any */
19994 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019995 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019996 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019997 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019998 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019999
Daniel Veillard27f20102004-11-05 11:50:11 +000020000 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20001 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20002 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20003 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20004 mem_base = xmlMemBlocks();
20005 parent = gen_xmlNodePtr(n_parent, 0);
20006 ns = gen_xmlNsPtr(n_ns, 1);
20007 name = gen_const_xmlChar_ptr(n_name, 2);
20008 content = gen_const_xmlChar_ptr(n_content, 3);
20009
William M. Brackf13f77f2004-11-12 16:03:48 +000020010 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020011 desret_xmlNodePtr(ret_val);
20012 call_tests++;
20013 des_xmlNodePtr(n_parent, parent, 0);
20014 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020015 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20016 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020017 xmlResetLastError();
20018 if (mem_base != xmlMemBlocks()) {
20019 printf("Leak of %d blocks found in xmlNewChild",
20020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020021 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020022 printf(" %d", n_parent);
20023 printf(" %d", n_ns);
20024 printf(" %d", n_name);
20025 printf(" %d", n_content);
20026 printf("\n");
20027 }
20028 }
20029 }
20030 }
20031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020032 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020033#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020034#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020035
Daniel Veillard42595322004-11-08 10:52:06 +000020036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020037}
20038
20039
20040static int
20041test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020043
20044 int mem_base;
20045 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020046 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020047 int n_content;
20048
20049 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020051 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020052
William M. Brackf13f77f2004-11-12 16:03:48 +000020053 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020054 desret_xmlNodePtr(ret_val);
20055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020056 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020057 xmlResetLastError();
20058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020059 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020062 printf(" %d", n_content);
20063 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020064 }
20065 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020067
Daniel Veillard42595322004-11-08 10:52:06 +000020068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069}
20070
20071
20072static int
20073test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020075
20076 int mem_base;
20077 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020078 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020079 int n_version;
20080
20081 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20082 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020083 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020084
William M. Brackf13f77f2004-11-12 16:03:48 +000020085 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020086 desret_xmlDocPtr(ret_val);
20087 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020088 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020089 xmlResetLastError();
20090 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020091 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020093 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020094 printf(" %d", n_version);
20095 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020096 }
20097 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020098 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020099
Daniel Veillard42595322004-11-08 10:52:06 +000020100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020101}
20102
20103
20104static int
20105test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020107
20108 int mem_base;
20109 xmlNodePtr ret_val;
20110 xmlDocPtr doc; /* the document */
20111 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020112 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020113 int n_content;
20114
20115 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20116 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20117 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020118 doc = gen_xmlDocPtr(n_doc, 0);
20119 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020120
William M. Brackf13f77f2004-11-12 16:03:48 +000020121 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020122 desret_xmlNodePtr(ret_val);
20123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020124 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020125 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020126 xmlResetLastError();
20127 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020128 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020130 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020131 printf(" %d", n_doc);
20132 printf(" %d", n_content);
20133 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020134 }
20135 }
20136 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020137 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020138
Daniel Veillard42595322004-11-08 10:52:06 +000020139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020140}
20141
20142
20143static int
20144test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020146
William M. Brack21e4ef22005-01-02 09:53:13 +000020147#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000020148 int mem_base;
20149 xmlNodePtr ret_val;
20150 xmlDocPtr doc; /* the document owning the fragment */
20151 int n_doc;
20152
20153 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20154 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020155 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020156
20157 ret_val = xmlNewDocFragment(doc);
20158 desret_xmlNodePtr(ret_val);
20159 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020160 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020161 xmlResetLastError();
20162 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020163 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020165 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020166 printf(" %d", n_doc);
20167 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020168 }
20169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020170 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020171#endif
20172
Daniel Veillard42595322004-11-08 10:52:06 +000020173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020174}
20175
20176
20177static int
20178test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020180
Daniel Veillard27f20102004-11-05 11:50:11 +000020181 int mem_base;
20182 xmlNodePtr ret_val;
20183 xmlDocPtr doc; /* the document */
20184 int n_doc;
20185 xmlNsPtr ns; /* namespace if any */
20186 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020187 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020188 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020189 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020190 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020191
Daniel Veillard27f20102004-11-05 11:50:11 +000020192 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20193 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20195 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20196 mem_base = xmlMemBlocks();
20197 doc = gen_xmlDocPtr(n_doc, 0);
20198 ns = gen_xmlNsPtr(n_ns, 1);
20199 name = gen_const_xmlChar_ptr(n_name, 2);
20200 content = gen_const_xmlChar_ptr(n_content, 3);
20201
William M. Brackf13f77f2004-11-12 16:03:48 +000020202 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020203 desret_xmlNodePtr(ret_val);
20204 call_tests++;
20205 des_xmlDocPtr(n_doc, doc, 0);
20206 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020207 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20208 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020209 xmlResetLastError();
20210 if (mem_base != xmlMemBlocks()) {
20211 printf("Leak of %d blocks found in xmlNewDocNode",
20212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020213 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020214 printf(" %d", n_doc);
20215 printf(" %d", n_ns);
20216 printf(" %d", n_name);
20217 printf(" %d", n_content);
20218 printf("\n");
20219 }
20220 }
20221 }
20222 }
20223 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020224 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020225
Daniel Veillard42595322004-11-08 10:52:06 +000020226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020227}
20228
20229
20230static int
20231test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020233
Daniel Veillard27f20102004-11-05 11:50:11 +000020234 int mem_base;
20235 xmlNodePtr ret_val;
20236 xmlDocPtr doc; /* the document */
20237 int n_doc;
20238 xmlNsPtr ns; /* namespace if any */
20239 int n_ns;
20240 xmlChar * name; /* the node name */
20241 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020242 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020243 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020244
Daniel Veillard27f20102004-11-05 11:50:11 +000020245 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20246 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20247 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20248 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20249 mem_base = xmlMemBlocks();
20250 doc = gen_xmlDocPtr(n_doc, 0);
20251 ns = gen_xmlNsPtr(n_ns, 1);
20252 name = gen_eaten_name(n_name, 2);
20253 content = gen_const_xmlChar_ptr(n_content, 3);
20254
William M. Brackf13f77f2004-11-12 16:03:48 +000020255 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020256 desret_xmlNodePtr(ret_val);
20257 call_tests++;
20258 des_xmlDocPtr(n_doc, doc, 0);
20259 des_xmlNsPtr(n_ns, ns, 1);
20260 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020261 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020262 xmlResetLastError();
20263 if (mem_base != xmlMemBlocks()) {
20264 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020266 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020267 printf(" %d", n_doc);
20268 printf(" %d", n_ns);
20269 printf(" %d", n_name);
20270 printf(" %d", n_content);
20271 printf("\n");
20272 }
20273 }
20274 }
20275 }
20276 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020277 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020278
Daniel Veillard42595322004-11-08 10:52:06 +000020279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020280}
20281
20282
20283static int
20284test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020286
20287 int mem_base;
20288 xmlNodePtr ret_val;
20289 xmlDocPtr doc; /* the target document */
20290 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020291 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020292 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020293 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020294 int n_content;
20295
20296 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20297 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20298 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020300 doc = gen_xmlDocPtr(n_doc, 0);
20301 name = gen_const_xmlChar_ptr(n_name, 1);
20302 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020303
William M. Brackf13f77f2004-11-12 16:03:48 +000020304 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020305 desret_xmlNodePtr(ret_val);
20306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020307 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020308 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20309 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020310 xmlResetLastError();
20311 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020312 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020314 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020315 printf(" %d", n_doc);
20316 printf(" %d", n_name);
20317 printf(" %d", n_content);
20318 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020319 }
20320 }
20321 }
20322 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020323 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020324
Daniel Veillard42595322004-11-08 10:52:06 +000020325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020326}
20327
20328
20329static int
20330test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020332
Daniel Veillard57b25162004-11-06 14:50:18 +000020333 int mem_base;
20334 xmlAttrPtr ret_val;
20335 xmlDocPtr doc; /* the document */
20336 int n_doc;
20337 xmlChar * name; /* the name of the attribute */
20338 int n_name;
20339 xmlChar * value; /* the value of the attribute */
20340 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020341
Daniel Veillard57b25162004-11-06 14:50:18 +000020342 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20343 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20344 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20345 mem_base = xmlMemBlocks();
20346 doc = gen_xmlDocPtr(n_doc, 0);
20347 name = gen_const_xmlChar_ptr(n_name, 1);
20348 value = gen_const_xmlChar_ptr(n_value, 2);
20349
William M. Brackf13f77f2004-11-12 16:03:48 +000020350 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020351 desret_xmlAttrPtr(ret_val);
20352 call_tests++;
20353 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020354 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20355 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020356 xmlResetLastError();
20357 if (mem_base != xmlMemBlocks()) {
20358 printf("Leak of %d blocks found in xmlNewDocProp",
20359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020360 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020361 printf(" %d", n_doc);
20362 printf(" %d", n_name);
20363 printf(" %d", n_value);
20364 printf("\n");
20365 }
20366 }
20367 }
20368 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020369 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020370
Daniel Veillard42595322004-11-08 10:52:06 +000020371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020372}
20373
20374
20375static int
20376test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020378
William M. Brack21e4ef22005-01-02 09:53:13 +000020379#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020380#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020381 int mem_base;
20382 xmlNodePtr ret_val;
20383 xmlDocPtr doc; /* the document */
20384 int n_doc;
20385 xmlNsPtr ns; /* namespace if any */
20386 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020387 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020388 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020389 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020390 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020391
Daniel Veillard27f20102004-11-05 11:50:11 +000020392 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20393 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20394 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20395 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20396 mem_base = xmlMemBlocks();
20397 doc = gen_xmlDocPtr(n_doc, 0);
20398 ns = gen_xmlNsPtr(n_ns, 1);
20399 name = gen_const_xmlChar_ptr(n_name, 2);
20400 content = gen_const_xmlChar_ptr(n_content, 3);
20401
William M. Brackf13f77f2004-11-12 16:03:48 +000020402 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020403 desret_xmlNodePtr(ret_val);
20404 call_tests++;
20405 des_xmlDocPtr(n_doc, doc, 0);
20406 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020407 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20408 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020409 xmlResetLastError();
20410 if (mem_base != xmlMemBlocks()) {
20411 printf("Leak of %d blocks found in xmlNewDocRawNode",
20412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020413 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020414 printf(" %d", n_doc);
20415 printf(" %d", n_ns);
20416 printf(" %d", n_name);
20417 printf(" %d", n_content);
20418 printf("\n");
20419 }
20420 }
20421 }
20422 }
20423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020424 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020425#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020426#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020427
Daniel Veillard42595322004-11-08 10:52:06 +000020428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020429}
20430
20431
20432static int
20433test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020435
20436 int mem_base;
20437 xmlNodePtr ret_val;
20438 xmlDocPtr doc; /* the document */
20439 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020440 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020441 int n_content;
20442
20443 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20444 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020446 doc = gen_xmlDocPtr(n_doc, 0);
20447 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020448
William M. Brackf13f77f2004-11-12 16:03:48 +000020449 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020450 desret_xmlNodePtr(ret_val);
20451 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020452 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020453 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020454 xmlResetLastError();
20455 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020456 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020458 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020459 printf(" %d", n_doc);
20460 printf(" %d", n_content);
20461 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020462 }
20463 }
20464 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020465 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020466
Daniel Veillard42595322004-11-08 10:52:06 +000020467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020468}
20469
20470
20471static int
20472test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020474
20475 int mem_base;
20476 xmlNodePtr ret_val;
20477 xmlDocPtr doc; /* the document */
20478 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020479 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020480 int n_content;
20481 int len; /* the text len. */
20482 int n_len;
20483
20484 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20485 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20486 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020488 doc = gen_xmlDocPtr(n_doc, 0);
20489 content = gen_const_xmlChar_ptr(n_content, 1);
20490 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020491
William M. Brackf13f77f2004-11-12 16:03:48 +000020492 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020493 desret_xmlNodePtr(ret_val);
20494 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020495 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020496 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020497 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020498 xmlResetLastError();
20499 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020500 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020502 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020503 printf(" %d", n_doc);
20504 printf(" %d", n_content);
20505 printf(" %d", n_len);
20506 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020507 }
20508 }
20509 }
20510 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020511 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020512
Daniel Veillard42595322004-11-08 10:52:06 +000020513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020514}
20515
20516
20517static int
20518test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020520
Daniel Veillard34099b42004-11-04 17:34:35 +000020521 int mem_base;
20522 xmlDtdPtr ret_val;
20523 xmlDocPtr doc; /* the document pointer */
20524 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020525 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020526 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020527 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020528 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020529 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020530 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020531
Daniel Veillard34099b42004-11-04 17:34:35 +000020532 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20533 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20534 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20535 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20536 mem_base = xmlMemBlocks();
20537 doc = gen_xmlDocPtr(n_doc, 0);
20538 name = gen_const_xmlChar_ptr(n_name, 1);
20539 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20540 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20541
William M. Brackf13f77f2004-11-12 16:03:48 +000020542 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020543 desret_xmlDtdPtr(ret_val);
20544 call_tests++;
20545 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020546 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20547 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20548 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020549 xmlResetLastError();
20550 if (mem_base != xmlMemBlocks()) {
20551 printf("Leak of %d blocks found in xmlNewDtd",
20552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020553 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020554 printf(" %d", n_doc);
20555 printf(" %d", n_name);
20556 printf(" %d", n_ExternalID);
20557 printf(" %d", n_SystemID);
20558 printf("\n");
20559 }
20560 }
20561 }
20562 }
20563 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020564 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020565
Daniel Veillard42595322004-11-08 10:52:06 +000020566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020567}
20568
20569
20570static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020571test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020573
Daniel Veillard27f20102004-11-05 11:50:11 +000020574 int mem_base;
20575 xmlNodePtr ret_val;
20576 xmlNsPtr ns; /* namespace if any */
20577 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020578 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020579 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020580
Daniel Veillard27f20102004-11-05 11:50:11 +000020581 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20582 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20583 mem_base = xmlMemBlocks();
20584 ns = gen_xmlNsPtr(n_ns, 0);
20585 name = gen_const_xmlChar_ptr(n_name, 1);
20586
William M. Brackf13f77f2004-11-12 16:03:48 +000020587 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020588 desret_xmlNodePtr(ret_val);
20589 call_tests++;
20590 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020591 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020592 xmlResetLastError();
20593 if (mem_base != xmlMemBlocks()) {
20594 printf("Leak of %d blocks found in xmlNewNode",
20595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020596 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020597 printf(" %d", n_ns);
20598 printf(" %d", n_name);
20599 printf("\n");
20600 }
20601 }
20602 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020603 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020604
Daniel Veillard42595322004-11-08 10:52:06 +000020605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020606}
20607
20608
20609static int
20610test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020612
Daniel Veillard27f20102004-11-05 11:50:11 +000020613 int mem_base;
20614 xmlNodePtr ret_val;
20615 xmlNsPtr ns; /* namespace if any */
20616 int n_ns;
20617 xmlChar * name; /* the node name */
20618 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020619
Daniel Veillard27f20102004-11-05 11:50:11 +000020620 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20621 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20622 mem_base = xmlMemBlocks();
20623 ns = gen_xmlNsPtr(n_ns, 0);
20624 name = gen_eaten_name(n_name, 1);
20625
20626 ret_val = xmlNewNodeEatName(ns, name);
20627 desret_xmlNodePtr(ret_val);
20628 call_tests++;
20629 des_xmlNsPtr(n_ns, ns, 0);
20630 des_eaten_name(n_name, name, 1);
20631 xmlResetLastError();
20632 if (mem_base != xmlMemBlocks()) {
20633 printf("Leak of %d blocks found in xmlNewNodeEatName",
20634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020635 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020636 printf(" %d", n_ns);
20637 printf(" %d", n_name);
20638 printf("\n");
20639 }
20640 }
20641 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020643
Daniel Veillard42595322004-11-08 10:52:06 +000020644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020645}
20646
20647
20648static int
20649test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020651
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020652 int mem_base;
20653 xmlNsPtr ret_val;
20654 xmlNodePtr node; /* the element carrying the namespace */
20655 int n_node;
20656 xmlChar * href; /* the URI associated */
20657 int n_href;
20658 xmlChar * prefix; /* the prefix for the namespace */
20659 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020660
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020661 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20662 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20663 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20664 mem_base = xmlMemBlocks();
20665 node = gen_xmlNodePtr(n_node, 0);
20666 href = gen_const_xmlChar_ptr(n_href, 1);
20667 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20668
William M. Brackf13f77f2004-11-12 16:03:48 +000020669 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020670 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20671 desret_xmlNsPtr(ret_val);
20672 call_tests++;
20673 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020674 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20675 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020676 xmlResetLastError();
20677 if (mem_base != xmlMemBlocks()) {
20678 printf("Leak of %d blocks found in xmlNewNs",
20679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020680 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020681 printf(" %d", n_node);
20682 printf(" %d", n_href);
20683 printf(" %d", n_prefix);
20684 printf("\n");
20685 }
20686 }
20687 }
20688 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020689 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020690
Daniel Veillard42595322004-11-08 10:52:06 +000020691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020692}
20693
20694
20695static int
20696test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020698
Daniel Veillard57b25162004-11-06 14:50:18 +000020699 int mem_base;
20700 xmlAttrPtr ret_val;
20701 xmlNodePtr node; /* the holding node */
20702 int n_node;
20703 xmlNsPtr ns; /* the namespace */
20704 int n_ns;
20705 xmlChar * name; /* the name of the attribute */
20706 int n_name;
20707 xmlChar * value; /* the value of the attribute */
20708 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020709
Daniel Veillard57b25162004-11-06 14:50:18 +000020710 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20711 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20712 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20713 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20714 mem_base = xmlMemBlocks();
20715 node = gen_xmlNodePtr(n_node, 0);
20716 ns = gen_xmlNsPtr(n_ns, 1);
20717 name = gen_const_xmlChar_ptr(n_name, 2);
20718 value = gen_const_xmlChar_ptr(n_value, 3);
20719
William M. Brackf13f77f2004-11-12 16:03:48 +000020720 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020721 desret_xmlAttrPtr(ret_val);
20722 call_tests++;
20723 des_xmlNodePtr(n_node, node, 0);
20724 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020725 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20726 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020727 xmlResetLastError();
20728 if (mem_base != xmlMemBlocks()) {
20729 printf("Leak of %d blocks found in xmlNewNsProp",
20730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020731 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020732 printf(" %d", n_node);
20733 printf(" %d", n_ns);
20734 printf(" %d", n_name);
20735 printf(" %d", n_value);
20736 printf("\n");
20737 }
20738 }
20739 }
20740 }
20741 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020743
Daniel Veillard42595322004-11-08 10:52:06 +000020744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020745}
20746
20747
20748static int
20749test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020751
Daniel Veillard57b25162004-11-06 14:50:18 +000020752 int mem_base;
20753 xmlAttrPtr ret_val;
20754 xmlNodePtr node; /* the holding node */
20755 int n_node;
20756 xmlNsPtr ns; /* the namespace */
20757 int n_ns;
20758 xmlChar * name; /* the name of the attribute */
20759 int n_name;
20760 xmlChar * value; /* the value of the attribute */
20761 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020762
Daniel Veillard57b25162004-11-06 14:50:18 +000020763 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20764 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20765 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20766 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20767 mem_base = xmlMemBlocks();
20768 node = gen_xmlNodePtr(n_node, 0);
20769 ns = gen_xmlNsPtr(n_ns, 1);
20770 name = gen_eaten_name(n_name, 2);
20771 value = gen_const_xmlChar_ptr(n_value, 3);
20772
William M. Brackf13f77f2004-11-12 16:03:48 +000020773 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020774 desret_xmlAttrPtr(ret_val);
20775 call_tests++;
20776 des_xmlNodePtr(n_node, node, 0);
20777 des_xmlNsPtr(n_ns, ns, 1);
20778 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020779 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020780 xmlResetLastError();
20781 if (mem_base != xmlMemBlocks()) {
20782 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020784 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020785 printf(" %d", n_node);
20786 printf(" %d", n_ns);
20787 printf(" %d", n_name);
20788 printf(" %d", n_value);
20789 printf("\n");
20790 }
20791 }
20792 }
20793 }
20794 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020796
Daniel Veillard42595322004-11-08 10:52:06 +000020797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020798}
20799
20800
20801static int
20802test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020804
20805 int mem_base;
20806 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020807 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020808 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020809 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020810 int n_content;
20811
20812 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20813 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020815 name = gen_const_xmlChar_ptr(n_name, 0);
20816 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020817
William M. Brackf13f77f2004-11-12 16:03:48 +000020818 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020819 desret_xmlNodePtr(ret_val);
20820 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020821 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20822 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020823 xmlResetLastError();
20824 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020825 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020827 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020828 printf(" %d", n_name);
20829 printf(" %d", n_content);
20830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831 }
20832 }
20833 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020834 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020835
Daniel Veillard42595322004-11-08 10:52:06 +000020836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020837}
20838
20839
20840static int
20841test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020843
William M. Brack21e4ef22005-01-02 09:53:13 +000020844#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020845#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020846 int mem_base;
20847 xmlAttrPtr ret_val;
20848 xmlNodePtr node; /* the holding node */
20849 int n_node;
20850 xmlChar * name; /* the name of the attribute */
20851 int n_name;
20852 xmlChar * value; /* the value of the attribute */
20853 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020854
Daniel Veillard57b25162004-11-06 14:50:18 +000020855 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20856 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20857 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20858 mem_base = xmlMemBlocks();
20859 node = gen_xmlNodePtr(n_node, 0);
20860 name = gen_const_xmlChar_ptr(n_name, 1);
20861 value = gen_const_xmlChar_ptr(n_value, 2);
20862
William M. Brackf13f77f2004-11-12 16:03:48 +000020863 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020864 desret_xmlAttrPtr(ret_val);
20865 call_tests++;
20866 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020867 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20868 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020869 xmlResetLastError();
20870 if (mem_base != xmlMemBlocks()) {
20871 printf("Leak of %d blocks found in xmlNewProp",
20872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020873 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020874 printf(" %d", n_node);
20875 printf(" %d", n_name);
20876 printf(" %d", n_value);
20877 printf("\n");
20878 }
20879 }
20880 }
20881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020882 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020883#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020884#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020885
Daniel Veillard42595322004-11-08 10:52:06 +000020886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020887}
20888
20889
20890static int
20891test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020893
20894 int mem_base;
20895 xmlNodePtr ret_val;
20896 xmlDocPtr doc; /* the document */
20897 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020898 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020899 int n_name;
20900
20901 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20902 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20903 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020904 doc = gen_xmlDocPtr(n_doc, 0);
20905 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020906
William M. Brackf13f77f2004-11-12 16:03:48 +000020907 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020908 desret_xmlNodePtr(ret_val);
20909 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020910 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020911 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020912 xmlResetLastError();
20913 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020914 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020916 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020917 printf(" %d", n_doc);
20918 printf(" %d", n_name);
20919 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020920 }
20921 }
20922 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020923 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020924
Daniel Veillard42595322004-11-08 10:52:06 +000020925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020926}
20927
20928
20929static int
20930test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020932
20933 int mem_base;
20934 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020935 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020936 int n_content;
20937
20938 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020940 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020941
William M. Brackf13f77f2004-11-12 16:03:48 +000020942 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020943 desret_xmlNodePtr(ret_val);
20944 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020945 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020946 xmlResetLastError();
20947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020948 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020951 printf(" %d", n_content);
20952 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020953 }
20954 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020955 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020956
Daniel Veillard42595322004-11-08 10:52:06 +000020957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020958}
20959
20960
20961static int
20962test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020964
William M. Brack21e4ef22005-01-02 09:53:13 +000020965#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020966#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020967 int mem_base;
20968 xmlNodePtr ret_val;
20969 xmlNodePtr parent; /* the parent node */
20970 int n_parent;
20971 xmlNsPtr ns; /* a namespace if any */
20972 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020973 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020974 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020975 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020976 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020977
Daniel Veillard27f20102004-11-05 11:50:11 +000020978 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20979 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20980 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20981 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20982 mem_base = xmlMemBlocks();
20983 parent = gen_xmlNodePtr(n_parent, 0);
20984 ns = gen_xmlNsPtr(n_ns, 1);
20985 name = gen_const_xmlChar_ptr(n_name, 2);
20986 content = gen_const_xmlChar_ptr(n_content, 3);
20987
William M. Brackf13f77f2004-11-12 16:03:48 +000020988 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020989 desret_xmlNodePtr(ret_val);
20990 call_tests++;
20991 des_xmlNodePtr(n_parent, parent, 0);
20992 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20994 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020995 xmlResetLastError();
20996 if (mem_base != xmlMemBlocks()) {
20997 printf("Leak of %d blocks found in xmlNewTextChild",
20998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020999 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000021000 printf(" %d", n_parent);
21001 printf(" %d", n_ns);
21002 printf(" %d", n_name);
21003 printf(" %d", n_content);
21004 printf("\n");
21005 }
21006 }
21007 }
21008 }
21009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021010 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021011#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021012#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000021013
Daniel Veillard42595322004-11-08 10:52:06 +000021014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021015}
21016
21017
21018static int
21019test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021021
21022 int mem_base;
21023 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021024 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021025 int n_content;
21026 int len; /* the text len. */
21027 int n_len;
21028
21029 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21030 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21031 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021032 content = gen_const_xmlChar_ptr(n_content, 0);
21033 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021034
William M. Brackf13f77f2004-11-12 16:03:48 +000021035 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021036 desret_xmlNodePtr(ret_val);
21037 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021038 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021039 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021040 xmlResetLastError();
21041 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021042 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021044 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021045 printf(" %d", n_content);
21046 printf(" %d", n_len);
21047 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021048 }
21049 }
21050 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021051 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021052
Daniel Veillard42595322004-11-08 10:52:06 +000021053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021054}
21055
21056
21057static int
21058test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021060
21061 int mem_base;
21062 xmlNodePtr cur; /* the node being modified */
21063 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021064 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021065 int n_content;
21066
21067 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21068 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21069 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021070 cur = gen_xmlNodePtr(n_cur, 0);
21071 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021072
William M. Brackf13f77f2004-11-12 16:03:48 +000021073 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021074 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021075 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021076 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021077 xmlResetLastError();
21078 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021079 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021081 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021082 printf(" %d", n_cur);
21083 printf(" %d", n_content);
21084 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021085 }
21086 }
21087 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021088 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021089
Daniel Veillard42595322004-11-08 10:52:06 +000021090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021091}
21092
21093
21094static int
21095test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021097
21098 int mem_base;
21099 xmlNodePtr cur; /* the node being modified */
21100 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021101 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021102 int n_content;
21103 int len; /* the size of @content */
21104 int n_len;
21105
21106 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21107 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21108 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21109 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021110 cur = gen_xmlNodePtr(n_cur, 0);
21111 content = gen_const_xmlChar_ptr(n_content, 1);
21112 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021113
William M. Brackf13f77f2004-11-12 16:03:48 +000021114 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021115 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021116 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021117 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021118 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021119 xmlResetLastError();
21120 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021121 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021123 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021124 printf(" %d", n_cur);
21125 printf(" %d", n_content);
21126 printf(" %d", n_len);
21127 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021128 }
21129 }
21130 }
21131 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021132 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021133
Daniel Veillard42595322004-11-08 10:52:06 +000021134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021135}
21136
21137
21138static int
21139test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021141
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021142 int mem_base;
21143 int ret_val;
21144 xmlBufferPtr buffer; /* a buffer */
21145 int n_buffer;
21146 xmlNodePtr cur; /* the node being read */
21147 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021148
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021149 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21150 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021152 buffer = gen_xmlBufferPtr(n_buffer, 0);
21153 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021154
21155 ret_val = xmlNodeBufGetContent(buffer, cur);
21156 desret_int(ret_val);
21157 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021158 des_xmlBufferPtr(n_buffer, buffer, 0);
21159 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021160 xmlResetLastError();
21161 if (mem_base != xmlMemBlocks()) {
21162 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021164 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021165 printf(" %d", n_buffer);
21166 printf(" %d", n_cur);
21167 printf("\n");
21168 }
21169 }
21170 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021171 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021172
Daniel Veillard42595322004-11-08 10:52:06 +000021173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021174}
21175
21176
21177static int
21178test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021180
William M. Brack21e4ef22005-01-02 09:53:13 +000021181#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021182 int mem_base;
21183 int ret_val;
21184 xmlBufferPtr buf; /* the XML buffer output */
21185 int n_buf;
21186 xmlDocPtr doc; /* the document */
21187 int n_doc;
21188 xmlNodePtr cur; /* the current node */
21189 int n_cur;
21190 int level; /* the imbrication level for indenting */
21191 int n_level;
21192 int format; /* is formatting allowed */
21193 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021194
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021195 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21196 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21197 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21198 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21199 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21200 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021201 buf = gen_xmlBufferPtr(n_buf, 0);
21202 doc = gen_xmlDocPtr(n_doc, 1);
21203 cur = gen_xmlNodePtr(n_cur, 2);
21204 level = gen_int(n_level, 3);
21205 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021206
21207 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21208 desret_int(ret_val);
21209 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021210 des_xmlBufferPtr(n_buf, buf, 0);
21211 des_xmlDocPtr(n_doc, doc, 1);
21212 des_xmlNodePtr(n_cur, cur, 2);
21213 des_int(n_level, level, 3);
21214 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021215 xmlResetLastError();
21216 if (mem_base != xmlMemBlocks()) {
21217 printf("Leak of %d blocks found in xmlNodeDump",
21218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021219 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021220 printf(" %d", n_buf);
21221 printf(" %d", n_doc);
21222 printf(" %d", n_cur);
21223 printf(" %d", n_level);
21224 printf(" %d", n_format);
21225 printf("\n");
21226 }
21227 }
21228 }
21229 }
21230 }
21231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021232 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021233#endif
21234
Daniel Veillard42595322004-11-08 10:52:06 +000021235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021236}
21237
21238
21239static int
21240test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021242
William M. Brack21e4ef22005-01-02 09:53:13 +000021243#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021244 int mem_base;
21245 xmlOutputBufferPtr buf; /* the XML buffer output */
21246 int n_buf;
21247 xmlDocPtr doc; /* the document */
21248 int n_doc;
21249 xmlNodePtr cur; /* the current node */
21250 int n_cur;
21251 int level; /* the imbrication level for indenting */
21252 int n_level;
21253 int format; /* is formatting allowed */
21254 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021255 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021256 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021257
Daniel Veillard3d97e662004-11-04 10:49:00 +000021258 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21259 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21260 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21261 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21262 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21263 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21264 mem_base = xmlMemBlocks();
21265 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21266 doc = gen_xmlDocPtr(n_doc, 1);
21267 cur = gen_xmlNodePtr(n_cur, 2);
21268 level = gen_int(n_level, 3);
21269 format = gen_int(n_format, 4);
21270 encoding = gen_const_char_ptr(n_encoding, 5);
21271
William M. Brackf13f77f2004-11-12 16:03:48 +000021272 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021273 call_tests++;
21274 des_xmlOutputBufferPtr(n_buf, buf, 0);
21275 des_xmlDocPtr(n_doc, doc, 1);
21276 des_xmlNodePtr(n_cur, cur, 2);
21277 des_int(n_level, level, 3);
21278 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021279 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021280 xmlResetLastError();
21281 if (mem_base != xmlMemBlocks()) {
21282 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021284 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021285 printf(" %d", n_buf);
21286 printf(" %d", n_doc);
21287 printf(" %d", n_cur);
21288 printf(" %d", n_level);
21289 printf(" %d", n_format);
21290 printf(" %d", n_encoding);
21291 printf("\n");
21292 }
21293 }
21294 }
21295 }
21296 }
21297 }
21298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021299 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021300#endif
21301
Daniel Veillard42595322004-11-08 10:52:06 +000021302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021303}
21304
21305
21306static int
21307test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021309
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021310 int mem_base;
21311 xmlChar * ret_val;
21312 xmlDocPtr doc; /* the document the node pertains to */
21313 int n_doc;
21314 xmlNodePtr cur; /* the node being checked */
21315 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021316
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021317 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21318 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021320 doc = gen_xmlDocPtr(n_doc, 0);
21321 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021322
21323 ret_val = xmlNodeGetBase(doc, cur);
21324 desret_xmlChar_ptr(ret_val);
21325 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021326 des_xmlDocPtr(n_doc, doc, 0);
21327 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021328 xmlResetLastError();
21329 if (mem_base != xmlMemBlocks()) {
21330 printf("Leak of %d blocks found in xmlNodeGetBase",
21331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021332 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021333 printf(" %d", n_doc);
21334 printf(" %d", n_cur);
21335 printf("\n");
21336 }
21337 }
21338 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021340
Daniel Veillard42595322004-11-08 10:52:06 +000021341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021342}
21343
21344
21345static int
21346test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021348
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021349 int mem_base;
21350 xmlChar * ret_val;
21351 xmlNodePtr cur; /* the node being read */
21352 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021353
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021354 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21355 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021356 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021357
21358 ret_val = xmlNodeGetContent(cur);
21359 desret_xmlChar_ptr(ret_val);
21360 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021361 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021362 xmlResetLastError();
21363 if (mem_base != xmlMemBlocks()) {
21364 printf("Leak of %d blocks found in xmlNodeGetContent",
21365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021366 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021367 printf(" %d", n_cur);
21368 printf("\n");
21369 }
21370 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021372
Daniel Veillard42595322004-11-08 10:52:06 +000021373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021374}
21375
21376
21377static int
21378test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021380
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021381 int mem_base;
21382 xmlChar * ret_val;
21383 xmlNodePtr cur; /* the node being checked */
21384 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021385
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021386 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021388 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021389
21390 ret_val = xmlNodeGetLang(cur);
21391 desret_xmlChar_ptr(ret_val);
21392 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021393 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021394 xmlResetLastError();
21395 if (mem_base != xmlMemBlocks()) {
21396 printf("Leak of %d blocks found in xmlNodeGetLang",
21397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021398 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021399 printf(" %d", n_cur);
21400 printf("\n");
21401 }
21402 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021403 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021404
Daniel Veillard42595322004-11-08 10:52:06 +000021405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406}
21407
21408
21409static int
21410test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021412
21413 int mem_base;
21414 int ret_val;
21415 xmlNodePtr cur; /* the node being checked */
21416 int n_cur;
21417
21418 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21419 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021420 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421
21422 ret_val = xmlNodeGetSpacePreserve(cur);
21423 desret_int(ret_val);
21424 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021425 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021426 xmlResetLastError();
21427 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021428 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021430 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021431 printf(" %d", n_cur);
21432 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021433 }
21434 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021435 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021436
Daniel Veillard42595322004-11-08 10:52:06 +000021437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438}
21439
21440
21441static int
21442test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021444
21445 int mem_base;
21446 int ret_val;
21447 xmlNodePtr node; /* the node */
21448 int n_node;
21449
21450 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21451 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021452 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021453
21454 ret_val = xmlNodeIsText(node);
21455 desret_int(ret_val);
21456 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021457 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021458 xmlResetLastError();
21459 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021460 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021462 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021463 printf(" %d", n_node);
21464 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021465 }
21466 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021467 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021468
Daniel Veillard42595322004-11-08 10:52:06 +000021469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021470}
21471
21472
21473static int
21474test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021476
William M. Brack21e4ef22005-01-02 09:53:13 +000021477#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021478 int mem_base;
21479 xmlChar * ret_val;
21480 xmlDocPtr doc; /* the document */
21481 int n_doc;
21482 xmlNodePtr list; /* a Node list */
21483 int n_list;
21484 int inLine; /* should we replace entity contents or show their external form */
21485 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021486
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021487 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21488 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21489 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021491 doc = gen_xmlDocPtr(n_doc, 0);
21492 list = gen_xmlNodePtr(n_list, 1);
21493 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021494
21495 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21496 desret_xmlChar_ptr(ret_val);
21497 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021498 des_xmlDocPtr(n_doc, doc, 0);
21499 des_xmlNodePtr(n_list, list, 1);
21500 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021501 xmlResetLastError();
21502 if (mem_base != xmlMemBlocks()) {
21503 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021505 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021506 printf(" %d", n_doc);
21507 printf(" %d", n_list);
21508 printf(" %d", n_inLine);
21509 printf("\n");
21510 }
21511 }
21512 }
21513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021514 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021515#endif
21516
Daniel Veillard42595322004-11-08 10:52:06 +000021517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021518}
21519
21520
21521static int
21522test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021525 int mem_base;
21526 xmlChar * ret_val;
21527 xmlDocPtr doc; /* the document */
21528 int n_doc;
21529 xmlNodePtr list; /* a Node list */
21530 int n_list;
21531 int inLine; /* should we replace entity contents or show their external form */
21532 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021533
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021534 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21535 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21536 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021538 doc = gen_xmlDocPtr(n_doc, 0);
21539 list = gen_xmlNodePtr(n_list, 1);
21540 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021541
21542 ret_val = xmlNodeListGetString(doc, list, inLine);
21543 desret_xmlChar_ptr(ret_val);
21544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021545 des_xmlDocPtr(n_doc, doc, 0);
21546 des_xmlNodePtr(n_list, list, 1);
21547 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021548 xmlResetLastError();
21549 if (mem_base != xmlMemBlocks()) {
21550 printf("Leak of %d blocks found in xmlNodeListGetString",
21551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021552 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021553 printf(" %d", n_doc);
21554 printf(" %d", n_list);
21555 printf(" %d", n_inLine);
21556 printf("\n");
21557 }
21558 }
21559 }
21560 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021562
Daniel Veillard42595322004-11-08 10:52:06 +000021563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021564}
21565
21566
21567static int
21568test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021570
William M. Brack21e4ef22005-01-02 09:53:13 +000021571#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021572 int mem_base;
21573 xmlNodePtr cur; /* the node being changed */
21574 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021575 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021576 int n_uri;
21577
21578 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21579 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21580 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021581 cur = gen_xmlNodePtr(n_cur, 0);
21582 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583
William M. Brackf13f77f2004-11-12 16:03:48 +000021584 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021585 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021586 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021587 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021588 xmlResetLastError();
21589 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021590 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021592 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021593 printf(" %d", n_cur);
21594 printf(" %d", n_uri);
21595 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021596 }
21597 }
21598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021599 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021600#endif
21601
Daniel Veillard42595322004-11-08 10:52:06 +000021602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021603}
21604
21605
21606static int
21607test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021609
21610 int mem_base;
21611 xmlNodePtr cur; /* the node being modified */
21612 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021613 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021614 int n_content;
21615
21616 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21617 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21618 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021619 cur = gen_xmlNodePtr(n_cur, 0);
21620 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021621
William M. Brackf13f77f2004-11-12 16:03:48 +000021622 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021623 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021624 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021625 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021626 xmlResetLastError();
21627 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021628 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021630 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021631 printf(" %d", n_cur);
21632 printf(" %d", n_content);
21633 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021634 }
21635 }
21636 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021637 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021638
Daniel Veillard42595322004-11-08 10:52:06 +000021639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021640}
21641
21642
21643static int
21644test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021646
William M. Brack21e4ef22005-01-02 09:53:13 +000021647#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021648 int mem_base;
21649 xmlNodePtr cur; /* the node being modified */
21650 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021651 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021652 int n_content;
21653 int len; /* the size of @content */
21654 int n_len;
21655
21656 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21657 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21658 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21659 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021660 cur = gen_xmlNodePtr(n_cur, 0);
21661 content = gen_const_xmlChar_ptr(n_content, 1);
21662 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021663
William M. Brackf13f77f2004-11-12 16:03:48 +000021664 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021665 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021666 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021667 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021668 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021669 xmlResetLastError();
21670 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021671 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021673 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021674 printf(" %d", n_cur);
21675 printf(" %d", n_content);
21676 printf(" %d", n_len);
21677 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021678 }
21679 }
21680 }
21681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021682 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021683#endif
21684
Daniel Veillard42595322004-11-08 10:52:06 +000021685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021686}
21687
21688
21689static int
21690test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021692
William M. Brack21e4ef22005-01-02 09:53:13 +000021693#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021694 int mem_base;
21695 xmlNodePtr cur; /* the node being changed */
21696 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021697 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021698 int n_lang;
21699
21700 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21701 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021703 cur = gen_xmlNodePtr(n_cur, 0);
21704 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021705
William M. Brackf13f77f2004-11-12 16:03:48 +000021706 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021707 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021708 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021709 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021710 xmlResetLastError();
21711 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021712 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021714 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021715 printf(" %d", n_cur);
21716 printf(" %d", n_lang);
21717 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021718 }
21719 }
21720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021721 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021722#endif
21723
Daniel Veillard42595322004-11-08 10:52:06 +000021724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021725}
21726
21727
21728static int
21729test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021731
William M. Brack21e4ef22005-01-02 09:53:13 +000021732#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021733 int mem_base;
21734 xmlNodePtr cur; /* the node being changed */
21735 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021736 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021737 int n_name;
21738
21739 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21740 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021742 cur = gen_xmlNodePtr(n_cur, 0);
21743 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021744
William M. Brackf13f77f2004-11-12 16:03:48 +000021745 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021747 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021748 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749 xmlResetLastError();
21750 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021751 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021753 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021754 printf(" %d", n_cur);
21755 printf(" %d", n_name);
21756 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021757 }
21758 }
21759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021760 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761#endif
21762
Daniel Veillard42595322004-11-08 10:52:06 +000021763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021764}
21765
21766
21767static int
21768test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021770
William M. Brack21e4ef22005-01-02 09:53:13 +000021771#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021772 int mem_base;
21773 xmlNodePtr cur; /* the node being changed */
21774 int n_cur;
21775 int val; /* the xml:space value ("0": default, 1: "preserve") */
21776 int n_val;
21777
21778 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21779 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021781 cur = gen_xmlNodePtr(n_cur, 0);
21782 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021783
21784 xmlNodeSetSpacePreserve(cur, val);
21785 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021786 des_xmlNodePtr(n_cur, cur, 0);
21787 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021788 xmlResetLastError();
21789 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021790 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021792 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021793 printf(" %d", n_cur);
21794 printf(" %d", n_val);
21795 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021796 }
21797 }
21798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021799 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021800#endif
21801
Daniel Veillard42595322004-11-08 10:52:06 +000021802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021803}
21804
21805
21806static int
21807test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021809
William M. Brack21e4ef22005-01-02 09:53:13 +000021810#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021811#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021812 int mem_base;
21813 int ret_val;
21814 xmlDocPtr doc; /* the document */
21815 int n_doc;
21816 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21817 int n_tree;
21818
21819 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21820 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021822 doc = gen_xmlDocPtr(n_doc, 0);
21823 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021824
21825 ret_val = xmlReconciliateNs(doc, tree);
21826 desret_int(ret_val);
21827 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021828 des_xmlDocPtr(n_doc, doc, 0);
21829 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021830 xmlResetLastError();
21831 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021832 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021834 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021835 printf(" %d", n_doc);
21836 printf(" %d", n_tree);
21837 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021838 }
21839 }
21840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021841 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021842#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021843#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021844
Daniel Veillard42595322004-11-08 10:52:06 +000021845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021846}
21847
21848
21849static int
21850test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021852
William M. Brack21e4ef22005-01-02 09:53:13 +000021853#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021854 int mem_base;
21855 int ret_val;
21856 xmlAttrPtr cur; /* an attribute */
21857 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021858
Daniel Veillardce244ad2004-11-05 10:03:46 +000021859 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21860 mem_base = xmlMemBlocks();
21861 cur = gen_xmlAttrPtr(n_cur, 0);
21862
21863 ret_val = xmlRemoveProp(cur);
21864 cur = NULL;
21865 desret_int(ret_val);
21866 call_tests++;
21867 des_xmlAttrPtr(n_cur, cur, 0);
21868 xmlResetLastError();
21869 if (mem_base != xmlMemBlocks()) {
21870 printf("Leak of %d blocks found in xmlRemoveProp",
21871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021872 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021873 printf(" %d", n_cur);
21874 printf("\n");
21875 }
21876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021877 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021878#endif
21879
Daniel Veillard42595322004-11-08 10:52:06 +000021880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021881}
21882
21883
21884static int
21885test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021887
William M. Brack21e4ef22005-01-02 09:53:13 +000021888#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021889 int mem_base;
21890 xmlNodePtr ret_val;
21891 xmlNodePtr old; /* the old node */
21892 int n_old;
21893 xmlNodePtr cur; /* the node */
21894 int n_cur;
21895
21896 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021897 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021899 old = gen_xmlNodePtr(n_old, 0);
21900 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901
21902 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021903 if (cur != NULL) {
21904 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021905 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021906 if (old != NULL) {
21907 xmlUnlinkNode(old);
21908 xmlFreeNode(old) ; old = NULL ; }
21909 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021910 desret_xmlNodePtr(ret_val);
21911 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021912 des_xmlNodePtr(n_old, old, 0);
21913 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914 xmlResetLastError();
21915 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021916 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021918 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021919 printf(" %d", n_old);
21920 printf(" %d", n_cur);
21921 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021922 }
21923 }
21924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021925 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021926#endif
21927
Daniel Veillard42595322004-11-08 10:52:06 +000021928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929}
21930
21931
21932static int
21933test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021935
William M. Brack21e4ef22005-01-02 09:53:13 +000021936#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021937 int mem_base;
21938 int ret_val;
21939 const char * filename; /* the filename (or URL) */
21940 int n_filename;
21941 xmlDocPtr cur; /* the document */
21942 int n_cur;
21943
21944 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21945 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021947 filename = gen_fileoutput(n_filename, 0);
21948 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021949
21950 ret_val = xmlSaveFile(filename, cur);
21951 desret_int(ret_val);
21952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021953 des_fileoutput(n_filename, filename, 0);
21954 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021955 xmlResetLastError();
21956 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021957 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021959 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021960 printf(" %d", n_filename);
21961 printf(" %d", n_cur);
21962 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021963 }
21964 }
21965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021966 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021967#endif
21968
Daniel Veillard42595322004-11-08 10:52:06 +000021969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021970}
21971
21972
21973static int
21974test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021976
William M. Brack21e4ef22005-01-02 09:53:13 +000021977#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021978 int mem_base;
21979 int ret_val;
21980 const char * filename; /* the filename (or URL) */
21981 int n_filename;
21982 xmlDocPtr cur; /* the document */
21983 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021984 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021985 int n_encoding;
21986
21987 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21988 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21989 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021991 filename = gen_fileoutput(n_filename, 0);
21992 cur = gen_xmlDocPtr(n_cur, 1);
21993 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021994
William M. Brackf13f77f2004-11-12 16:03:48 +000021995 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021996 desret_int(ret_val);
21997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021998 des_fileoutput(n_filename, filename, 0);
21999 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022000 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022001 xmlResetLastError();
22002 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022003 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022005 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022006 printf(" %d", n_filename);
22007 printf(" %d", n_cur);
22008 printf(" %d", n_encoding);
22009 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022010 }
22011 }
22012 }
22013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022014 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022015#endif
22016
Daniel Veillard42595322004-11-08 10:52:06 +000022017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022018}
22019
22020
22021static int
22022test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022024
William M. Brack21e4ef22005-01-02 09:53:13 +000022025#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022026 int mem_base;
22027 int ret_val;
22028 xmlOutputBufferPtr buf; /* an output I/O buffer */
22029 int n_buf;
22030 xmlDocPtr cur; /* the document */
22031 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022032 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022033 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022034
Daniel Veillard3d97e662004-11-04 10:49:00 +000022035 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22036 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22037 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22038 mem_base = xmlMemBlocks();
22039 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22040 cur = gen_xmlDocPtr(n_cur, 1);
22041 encoding = gen_const_char_ptr(n_encoding, 2);
22042
William M. Brackf13f77f2004-11-12 16:03:48 +000022043 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022044 buf = NULL;
22045 desret_int(ret_val);
22046 call_tests++;
22047 des_xmlOutputBufferPtr(n_buf, buf, 0);
22048 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022049 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022050 xmlResetLastError();
22051 if (mem_base != xmlMemBlocks()) {
22052 printf("Leak of %d blocks found in xmlSaveFileTo",
22053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022054 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022055 printf(" %d", n_buf);
22056 printf(" %d", n_cur);
22057 printf(" %d", n_encoding);
22058 printf("\n");
22059 }
22060 }
22061 }
22062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022063 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022064#endif
22065
Daniel Veillard42595322004-11-08 10:52:06 +000022066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022067}
22068
22069
22070static int
22071test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022073
William M. Brack21e4ef22005-01-02 09:53:13 +000022074#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022075 int mem_base;
22076 int ret_val;
22077 const char * filename; /* the filename (or URL) */
22078 int n_filename;
22079 xmlDocPtr cur; /* the document */
22080 int n_cur;
22081 int format; /* should formatting spaces been added */
22082 int n_format;
22083
22084 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22085 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22086 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22087 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022088 filename = gen_fileoutput(n_filename, 0);
22089 cur = gen_xmlDocPtr(n_cur, 1);
22090 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022091
22092 ret_val = xmlSaveFormatFile(filename, cur, format);
22093 desret_int(ret_val);
22094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022095 des_fileoutput(n_filename, filename, 0);
22096 des_xmlDocPtr(n_cur, cur, 1);
22097 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022098 xmlResetLastError();
22099 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022100 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022102 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022103 printf(" %d", n_filename);
22104 printf(" %d", n_cur);
22105 printf(" %d", n_format);
22106 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022107 }
22108 }
22109 }
22110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022111 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022112#endif
22113
Daniel Veillard42595322004-11-08 10:52:06 +000022114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022115}
22116
22117
22118static int
22119test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022121
William M. Brack21e4ef22005-01-02 09:53:13 +000022122#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022123 int mem_base;
22124 int ret_val;
22125 const char * filename; /* the filename or URL to output */
22126 int n_filename;
22127 xmlDocPtr cur; /* the document being saved */
22128 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022129 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022130 int n_encoding;
22131 int format; /* should formatting spaces be added. */
22132 int n_format;
22133
22134 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22135 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22136 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22137 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022139 filename = gen_fileoutput(n_filename, 0);
22140 cur = gen_xmlDocPtr(n_cur, 1);
22141 encoding = gen_const_char_ptr(n_encoding, 2);
22142 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022143
William M. Brackf13f77f2004-11-12 16:03:48 +000022144 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022145 desret_int(ret_val);
22146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022147 des_fileoutput(n_filename, filename, 0);
22148 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022149 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022150 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022151 xmlResetLastError();
22152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022153 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022156 printf(" %d", n_filename);
22157 printf(" %d", n_cur);
22158 printf(" %d", n_encoding);
22159 printf(" %d", n_format);
22160 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022161 }
22162 }
22163 }
22164 }
22165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022166 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022167#endif
22168
Daniel Veillard42595322004-11-08 10:52:06 +000022169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022170}
22171
22172
22173static int
22174test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022176
William M. Brack21e4ef22005-01-02 09:53:13 +000022177#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022178 int mem_base;
22179 int ret_val;
22180 xmlOutputBufferPtr buf; /* an output I/O buffer */
22181 int n_buf;
22182 xmlDocPtr cur; /* the document */
22183 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022184 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022185 int n_encoding;
22186 int format; /* should formatting spaces been added */
22187 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022188
Daniel Veillard3d97e662004-11-04 10:49:00 +000022189 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22190 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22191 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22192 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22193 mem_base = xmlMemBlocks();
22194 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22195 cur = gen_xmlDocPtr(n_cur, 1);
22196 encoding = gen_const_char_ptr(n_encoding, 2);
22197 format = gen_int(n_format, 3);
22198
William M. Brackf13f77f2004-11-12 16:03:48 +000022199 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022200 buf = NULL;
22201 desret_int(ret_val);
22202 call_tests++;
22203 des_xmlOutputBufferPtr(n_buf, buf, 0);
22204 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022205 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022206 des_int(n_format, format, 3);
22207 xmlResetLastError();
22208 if (mem_base != xmlMemBlocks()) {
22209 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022211 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022212 printf(" %d", n_buf);
22213 printf(" %d", n_cur);
22214 printf(" %d", n_encoding);
22215 printf(" %d", n_format);
22216 printf("\n");
22217 }
22218 }
22219 }
22220 }
22221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022222 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022223#endif
22224
Daniel Veillard42595322004-11-08 10:52:06 +000022225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022226}
22227
22228
22229static int
22230test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022232
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022233 int mem_base;
22234 xmlNsPtr ret_val;
22235 xmlDocPtr doc; /* the document */
22236 int n_doc;
22237 xmlNodePtr node; /* the current node */
22238 int n_node;
22239 xmlChar * nameSpace; /* the namespace prefix */
22240 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022241
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022242 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22243 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22244 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22245 mem_base = xmlMemBlocks();
22246 doc = gen_xmlDocPtr(n_doc, 0);
22247 node = gen_xmlNodePtr(n_node, 1);
22248 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22249
William M. Brackf13f77f2004-11-12 16:03:48 +000022250 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022251 desret_xmlNsPtr(ret_val);
22252 call_tests++;
22253 des_xmlDocPtr(n_doc, doc, 0);
22254 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022255 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022256 xmlResetLastError();
22257 if (mem_base != xmlMemBlocks()) {
22258 printf("Leak of %d blocks found in xmlSearchNs",
22259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022260 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022261 printf(" %d", n_doc);
22262 printf(" %d", n_node);
22263 printf(" %d", n_nameSpace);
22264 printf("\n");
22265 }
22266 }
22267 }
22268 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022269 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022270
Daniel Veillard42595322004-11-08 10:52:06 +000022271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022272}
22273
22274
22275static int
22276test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022278
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022279 int mem_base;
22280 xmlNsPtr ret_val;
22281 xmlDocPtr doc; /* the document */
22282 int n_doc;
22283 xmlNodePtr node; /* the current node */
22284 int n_node;
22285 xmlChar * href; /* the namespace value */
22286 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022287
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022288 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22289 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22290 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22291 mem_base = xmlMemBlocks();
22292 doc = gen_xmlDocPtr(n_doc, 0);
22293 node = gen_xmlNodePtr(n_node, 1);
22294 href = gen_const_xmlChar_ptr(n_href, 2);
22295
William M. Brackf13f77f2004-11-12 16:03:48 +000022296 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022297 desret_xmlNsPtr(ret_val);
22298 call_tests++;
22299 des_xmlDocPtr(n_doc, doc, 0);
22300 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022301 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022302 xmlResetLastError();
22303 if (mem_base != xmlMemBlocks()) {
22304 printf("Leak of %d blocks found in xmlSearchNsByHref",
22305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022306 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022307 printf(" %d", n_doc);
22308 printf(" %d", n_node);
22309 printf(" %d", n_href);
22310 printf("\n");
22311 }
22312 }
22313 }
22314 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022315 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022316
Daniel Veillard42595322004-11-08 10:52:06 +000022317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022318}
22319
22320
22321static int
22322test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022324
Daniel Veillard57b25162004-11-06 14:50:18 +000022325 int mem_base;
22326 xmlBufferAllocationScheme scheme; /* allocation method to use */
22327 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022328
Daniel Veillard57b25162004-11-06 14:50:18 +000022329 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22330 mem_base = xmlMemBlocks();
22331 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22332
22333 xmlSetBufferAllocationScheme(scheme);
22334 call_tests++;
22335 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22336 xmlResetLastError();
22337 if (mem_base != xmlMemBlocks()) {
22338 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022340 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022341 printf(" %d", n_scheme);
22342 printf("\n");
22343 }
22344 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022346
Daniel Veillard42595322004-11-08 10:52:06 +000022347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022348}
22349
22350
22351static int
22352test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022354
22355 int mem_base;
22356 int mode; /* the compression ratio */
22357 int n_mode;
22358
22359 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022361 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022362
22363 xmlSetCompressMode(mode);
22364 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022365 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022366 xmlResetLastError();
22367 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022368 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022369 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022370 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022371 printf(" %d", n_mode);
22372 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022373 }
22374 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022375 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022376
Daniel Veillard42595322004-11-08 10:52:06 +000022377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022378}
22379
22380
22381static int
22382test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022384
22385 int mem_base;
22386 xmlDocPtr doc; /* the document */
22387 int n_doc;
22388 int mode; /* the compression ratio */
22389 int n_mode;
22390
22391 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22392 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022394 doc = gen_xmlDocPtr(n_doc, 0);
22395 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022396
22397 xmlSetDocCompressMode(doc, mode);
22398 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022399 des_xmlDocPtr(n_doc, doc, 0);
22400 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022401 xmlResetLastError();
22402 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022403 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022405 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022406 printf(" %d", n_doc);
22407 printf(" %d", n_mode);
22408 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022409 }
22410 }
22411 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022413
Daniel Veillard42595322004-11-08 10:52:06 +000022414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022415}
22416
22417
22418static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022419test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022421
Daniel Veillard27f20102004-11-05 11:50:11 +000022422 int mem_base;
22423 xmlNodePtr node; /* a node in the document */
22424 int n_node;
22425 xmlNsPtr ns; /* a namespace pointer */
22426 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022427
Daniel Veillard27f20102004-11-05 11:50:11 +000022428 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22429 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22430 mem_base = xmlMemBlocks();
22431 node = gen_xmlNodePtr(n_node, 0);
22432 ns = gen_xmlNsPtr(n_ns, 1);
22433
22434 xmlSetNs(node, ns);
22435 call_tests++;
22436 des_xmlNodePtr(n_node, node, 0);
22437 des_xmlNsPtr(n_ns, ns, 1);
22438 xmlResetLastError();
22439 if (mem_base != xmlMemBlocks()) {
22440 printf("Leak of %d blocks found in xmlSetNs",
22441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022442 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022443 printf(" %d", n_node);
22444 printf(" %d", n_ns);
22445 printf("\n");
22446 }
22447 }
22448 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022449 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022450
Daniel Veillard42595322004-11-08 10:52:06 +000022451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022452}
22453
22454
22455static int
22456test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022458
William M. Brack21e4ef22005-01-02 09:53:13 +000022459#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022460 int mem_base;
22461 xmlAttrPtr ret_val;
22462 xmlNodePtr node; /* the node */
22463 int n_node;
22464 xmlNsPtr ns; /* the namespace definition */
22465 int n_ns;
22466 xmlChar * name; /* the attribute name */
22467 int n_name;
22468 xmlChar * value; /* the attribute value */
22469 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022470
Daniel Veillard57b25162004-11-06 14:50:18 +000022471 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22472 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22473 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22474 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22475 mem_base = xmlMemBlocks();
22476 node = gen_xmlNodePtr(n_node, 0);
22477 ns = gen_xmlNsPtr(n_ns, 1);
22478 name = gen_const_xmlChar_ptr(n_name, 2);
22479 value = gen_const_xmlChar_ptr(n_value, 3);
22480
William M. Brackf13f77f2004-11-12 16:03:48 +000022481 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022482 desret_xmlAttrPtr(ret_val);
22483 call_tests++;
22484 des_xmlNodePtr(n_node, node, 0);
22485 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022486 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22487 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022488 xmlResetLastError();
22489 if (mem_base != xmlMemBlocks()) {
22490 printf("Leak of %d blocks found in xmlSetNsProp",
22491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022492 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022493 printf(" %d", n_node);
22494 printf(" %d", n_ns);
22495 printf(" %d", n_name);
22496 printf(" %d", n_value);
22497 printf("\n");
22498 }
22499 }
22500 }
22501 }
22502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022503 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022504#endif
22505
Daniel Veillard42595322004-11-08 10:52:06 +000022506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022507}
22508
22509
22510static int
22511test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022513
William M. Brack21e4ef22005-01-02 09:53:13 +000022514#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022515 int mem_base;
22516 xmlAttrPtr ret_val;
22517 xmlNodePtr node; /* the node */
22518 int n_node;
22519 xmlChar * name; /* the attribute name */
22520 int n_name;
22521 xmlChar * value; /* the attribute value */
22522 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022523
Daniel Veillard57b25162004-11-06 14:50:18 +000022524 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22525 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22526 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22527 mem_base = xmlMemBlocks();
22528 node = gen_xmlNodePtr(n_node, 0);
22529 name = gen_const_xmlChar_ptr(n_name, 1);
22530 value = gen_const_xmlChar_ptr(n_value, 2);
22531
William M. Brackf13f77f2004-11-12 16:03:48 +000022532 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022533 desret_xmlAttrPtr(ret_val);
22534 call_tests++;
22535 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022536 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22537 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022538 xmlResetLastError();
22539 if (mem_base != xmlMemBlocks()) {
22540 printf("Leak of %d blocks found in xmlSetProp",
22541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022542 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022543 printf(" %d", n_node);
22544 printf(" %d", n_name);
22545 printf(" %d", n_value);
22546 printf("\n");
22547 }
22548 }
22549 }
22550 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022551 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022552#endif
22553
Daniel Veillard42595322004-11-08 10:52:06 +000022554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022555}
22556
22557
22558static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022559test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022560 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022561
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022562 int mem_base;
22563 xmlChar * ret_val;
22564 xmlChar * name; /* the full QName */
22565 int n_name;
22566 xmlChar ** prefix; /* a xmlChar ** */
22567 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022568
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022569 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22570 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22571 mem_base = xmlMemBlocks();
22572 name = gen_const_xmlChar_ptr(n_name, 0);
22573 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22574
William M. Brackf13f77f2004-11-12 16:03:48 +000022575 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022576 desret_xmlChar_ptr(ret_val);
22577 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022578 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022579 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22580 xmlResetLastError();
22581 if (mem_base != xmlMemBlocks()) {
22582 printf("Leak of %d blocks found in xmlSplitQName2",
22583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022584 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022585 printf(" %d", n_name);
22586 printf(" %d", n_prefix);
22587 printf("\n");
22588 }
22589 }
22590 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022591 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022592
Daniel Veillard42595322004-11-08 10:52:06 +000022593 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022594}
22595
22596
22597static int
22598test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022599 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022600
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022601 int mem_base;
22602 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022603 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022604 int n_name;
22605 int * len; /* an int * */
22606 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022607
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022608 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22609 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22610 mem_base = xmlMemBlocks();
22611 name = gen_const_xmlChar_ptr(n_name, 0);
22612 len = gen_int_ptr(n_len, 1);
22613
William M. Brackf13f77f2004-11-12 16:03:48 +000022614 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022615 desret_const_xmlChar_ptr(ret_val);
22616 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022617 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022618 des_int_ptr(n_len, len, 1);
22619 xmlResetLastError();
22620 if (mem_base != xmlMemBlocks()) {
22621 printf("Leak of %d blocks found in xmlSplitQName3",
22622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022623 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022624 printf(" %d", n_name);
22625 printf(" %d", n_len);
22626 printf("\n");
22627 }
22628 }
22629 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022630 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022631
Daniel Veillard42595322004-11-08 10:52:06 +000022632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022633}
22634
22635
22636static int
22637test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022639
22640 int mem_base;
22641 xmlNodePtr ret_val;
22642 xmlDocPtr doc; /* the document */
22643 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022644 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022645 int n_value;
22646
22647 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22648 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22649 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022650 doc = gen_xmlDocPtr(n_doc, 0);
22651 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022652
William M. Brackf13f77f2004-11-12 16:03:48 +000022653 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022654 desret_xmlNodePtr(ret_val);
22655 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022656 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022657 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022658 xmlResetLastError();
22659 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022660 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022663 printf(" %d", n_doc);
22664 printf(" %d", n_value);
22665 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022666 }
22667 }
22668 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022669 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022670
Daniel Veillard42595322004-11-08 10:52:06 +000022671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022672}
22673
22674
22675static int
22676test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022678
22679 int mem_base;
22680 xmlNodePtr ret_val;
22681 xmlDocPtr doc; /* the document */
22682 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022683 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022684 int n_value;
22685 int len; /* the length of the string value */
22686 int n_len;
22687
22688 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22689 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22690 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022692 doc = gen_xmlDocPtr(n_doc, 0);
22693 value = gen_const_xmlChar_ptr(n_value, 1);
22694 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022695
William M. Brackf13f77f2004-11-12 16:03:48 +000022696 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022697 desret_xmlNodePtr(ret_val);
22698 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022699 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022700 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022701 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022702 xmlResetLastError();
22703 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022704 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022707 printf(" %d", n_doc);
22708 printf(" %d", n_value);
22709 printf(" %d", n_len);
22710 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022711 }
22712 }
22713 }
22714 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022715 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022716
Daniel Veillard42595322004-11-08 10:52:06 +000022717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022718}
22719
22720
22721static int
22722test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022724
22725 int mem_base;
22726 int ret_val;
22727 xmlNodePtr node; /* the node */
22728 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022729 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022730 int n_content;
22731 int len; /* @content length */
22732 int n_len;
22733
22734 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22735 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22736 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022738 node = gen_xmlNodePtr(n_node, 0);
22739 content = gen_const_xmlChar_ptr(n_content, 1);
22740 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022741
William M. Brackf13f77f2004-11-12 16:03:48 +000022742 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022743 desret_int(ret_val);
22744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022745 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022746 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022747 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022748 xmlResetLastError();
22749 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022750 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022752 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022753 printf(" %d", n_node);
22754 printf(" %d", n_content);
22755 printf(" %d", n_len);
22756 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022757 }
22758 }
22759 }
22760 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022761 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022762
Daniel Veillard42595322004-11-08 10:52:06 +000022763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022764}
22765
22766
22767static int
22768test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022770
22771 int mem_base;
22772 xmlNodePtr ret_val;
22773 xmlNodePtr first; /* the first text node */
22774 int n_first;
22775 xmlNodePtr second; /* the second text node being merged */
22776 int n_second;
22777
Daniel Veillarda03e3652004-11-02 18:45:30 +000022778 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22779 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022781 first = gen_xmlNodePtr_in(n_first, 0);
22782 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022783
22784 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022785 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022786 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022787 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022788 desret_xmlNodePtr(ret_val);
22789 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022790 des_xmlNodePtr_in(n_first, first, 0);
22791 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022792 xmlResetLastError();
22793 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022794 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022796 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022797 printf(" %d", n_first);
22798 printf(" %d", n_second);
22799 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022800 }
22801 }
22802 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022803 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022804
Daniel Veillard42595322004-11-08 10:52:06 +000022805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022806}
22807
22808
22809static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022812
William M. Brack21e4ef22005-01-02 09:53:13 +000022813#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022814 int mem_base;
22815 int ret_val;
22816 xmlNodePtr node; /* the node */
22817 int n_node;
22818 xmlNsPtr ns; /* the namespace definition */
22819 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022820 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022821 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822
Daniel Veillard27f20102004-11-05 11:50:11 +000022823 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22824 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22825 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22826 mem_base = xmlMemBlocks();
22827 node = gen_xmlNodePtr(n_node, 0);
22828 ns = gen_xmlNsPtr(n_ns, 1);
22829 name = gen_const_xmlChar_ptr(n_name, 2);
22830
William M. Brackf13f77f2004-11-12 16:03:48 +000022831 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022832 desret_int(ret_val);
22833 call_tests++;
22834 des_xmlNodePtr(n_node, node, 0);
22835 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022836 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022837 xmlResetLastError();
22838 if (mem_base != xmlMemBlocks()) {
22839 printf("Leak of %d blocks found in xmlUnsetNsProp",
22840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022841 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022842 printf(" %d", n_node);
22843 printf(" %d", n_ns);
22844 printf(" %d", n_name);
22845 printf("\n");
22846 }
22847 }
22848 }
22849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022850 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022851#endif
22852
Daniel Veillard42595322004-11-08 10:52:06 +000022853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022854}
22855
22856
22857static int
22858test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022860
William M. Brack21e4ef22005-01-02 09:53:13 +000022861#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022862 int mem_base;
22863 int ret_val;
22864 xmlNodePtr node; /* the node */
22865 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022866 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022867 int n_name;
22868
22869 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22870 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022872 node = gen_xmlNodePtr(n_node, 0);
22873 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022874
William M. Brackf13f77f2004-11-12 16:03:48 +000022875 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022876 desret_int(ret_val);
22877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022878 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022879 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022880 xmlResetLastError();
22881 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022882 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022884 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022885 printf(" %d", n_node);
22886 printf(" %d", n_name);
22887 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022888 }
22889 }
22890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022891 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022892#endif
22893
Daniel Veillard42595322004-11-08 10:52:06 +000022894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022895}
22896
22897
22898static int
22899test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022901
William M. Brack21e4ef22005-01-02 09:53:13 +000022902#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022903#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022904 int mem_base;
22905 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022906 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022907 int n_value;
22908 int space; /* allow spaces in front and end of the string */
22909 int n_space;
22910
22911 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22912 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022914 value = gen_const_xmlChar_ptr(n_value, 0);
22915 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022916
William M. Brackf13f77f2004-11-12 16:03:48 +000022917 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022918 desret_int(ret_val);
22919 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022920 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022921 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022922 xmlResetLastError();
22923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022924 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022927 printf(" %d", n_value);
22928 printf(" %d", n_space);
22929 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022930 }
22931 }
22932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022933 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022934#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022935#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022936
Daniel Veillard42595322004-11-08 10:52:06 +000022937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022938}
22939
22940
22941static int
22942test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022944
William M. Brack21e4ef22005-01-02 09:53:13 +000022945#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022946#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022947 int mem_base;
22948 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022949 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022950 int n_value;
22951 int space; /* allow spaces in front and end of the string */
22952 int n_space;
22953
22954 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22955 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022957 value = gen_const_xmlChar_ptr(n_value, 0);
22958 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022959
William M. Brackf13f77f2004-11-12 16:03:48 +000022960 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022961 desret_int(ret_val);
22962 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022963 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022964 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022965 xmlResetLastError();
22966 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022967 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022969 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022970 printf(" %d", n_value);
22971 printf(" %d", n_space);
22972 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022973 }
22974 }
22975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022976 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022977#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022978#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022979
Daniel Veillard42595322004-11-08 10:52:06 +000022980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022981}
22982
22983
22984static int
22985test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022987
William M. Brack21e4ef22005-01-02 09:53:13 +000022988#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022989#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022990 int mem_base;
22991 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022992 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022993 int n_value;
22994 int space; /* allow spaces in front and end of the string */
22995 int n_space;
22996
22997 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22998 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22999 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023000 value = gen_const_xmlChar_ptr(n_value, 0);
23001 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023002
William M. Brackf13f77f2004-11-12 16:03:48 +000023003 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023004 desret_int(ret_val);
23005 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023006 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023007 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023008 xmlResetLastError();
23009 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023010 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023012 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023013 printf(" %d", n_value);
23014 printf(" %d", n_space);
23015 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023016 }
23017 }
23018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023019 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023020#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023021#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023022
Daniel Veillard42595322004-11-08 10:52:06 +000023023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023024}
23025
23026
23027static int
23028test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023030
William M. Brack21e4ef22005-01-02 09:53:13 +000023031#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023032#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023033 int mem_base;
23034 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023035 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023036 int n_value;
23037 int space; /* allow spaces in front and end of the string */
23038 int n_space;
23039
23040 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23041 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23042 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023043 value = gen_const_xmlChar_ptr(n_value, 0);
23044 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023045
William M. Brackf13f77f2004-11-12 16:03:48 +000023046 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023047 desret_int(ret_val);
23048 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023049 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023050 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023051 xmlResetLastError();
23052 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023053 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023055 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023056 printf(" %d", n_value);
23057 printf(" %d", n_space);
23058 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023059 }
23060 }
23061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023062 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023063#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023064#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023065
Daniel Veillard42595322004-11-08 10:52:06 +000023066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023067}
23068
23069static int
23070test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023072
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023073 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023074 test_ret += test_xmlAddChild();
23075 test_ret += test_xmlAddChildList();
23076 test_ret += test_xmlAddNextSibling();
23077 test_ret += test_xmlAddPrevSibling();
23078 test_ret += test_xmlAddSibling();
23079 test_ret += test_xmlAttrSerializeTxtContent();
23080 test_ret += test_xmlBufferAdd();
23081 test_ret += test_xmlBufferAddHead();
23082 test_ret += test_xmlBufferCCat();
23083 test_ret += test_xmlBufferCat();
23084 test_ret += test_xmlBufferContent();
23085 test_ret += test_xmlBufferCreate();
23086 test_ret += test_xmlBufferCreateSize();
23087 test_ret += test_xmlBufferCreateStatic();
23088 test_ret += test_xmlBufferEmpty();
23089 test_ret += test_xmlBufferGrow();
23090 test_ret += test_xmlBufferLength();
23091 test_ret += test_xmlBufferResize();
23092 test_ret += test_xmlBufferSetAllocationScheme();
23093 test_ret += test_xmlBufferShrink();
23094 test_ret += test_xmlBufferWriteCHAR();
23095 test_ret += test_xmlBufferWriteChar();
23096 test_ret += test_xmlBufferWriteQuotedString();
23097 test_ret += test_xmlBuildQName();
23098 test_ret += test_xmlCopyDoc();
23099 test_ret += test_xmlCopyDtd();
23100 test_ret += test_xmlCopyNamespace();
23101 test_ret += test_xmlCopyNamespaceList();
23102 test_ret += test_xmlCopyNode();
23103 test_ret += test_xmlCopyNodeList();
23104 test_ret += test_xmlCopyProp();
23105 test_ret += test_xmlCopyPropList();
23106 test_ret += test_xmlCreateIntSubset();
23107 test_ret += test_xmlDocCopyNode();
23108 test_ret += test_xmlDocCopyNodeList();
23109 test_ret += test_xmlDocDump();
23110 test_ret += test_xmlDocDumpFormatMemory();
23111 test_ret += test_xmlDocDumpFormatMemoryEnc();
23112 test_ret += test_xmlDocDumpMemory();
23113 test_ret += test_xmlDocDumpMemoryEnc();
23114 test_ret += test_xmlDocFormatDump();
23115 test_ret += test_xmlDocGetRootElement();
23116 test_ret += test_xmlDocSetRootElement();
23117 test_ret += test_xmlElemDump();
23118 test_ret += test_xmlGetBufferAllocationScheme();
23119 test_ret += test_xmlGetCompressMode();
23120 test_ret += test_xmlGetDocCompressMode();
23121 test_ret += test_xmlGetIntSubset();
23122 test_ret += test_xmlGetLastChild();
23123 test_ret += test_xmlGetLineNo();
23124 test_ret += test_xmlGetNoNsProp();
23125 test_ret += test_xmlGetNodePath();
23126 test_ret += test_xmlGetNsList();
23127 test_ret += test_xmlGetNsProp();
23128 test_ret += test_xmlGetProp();
23129 test_ret += test_xmlHasNsProp();
23130 test_ret += test_xmlHasProp();
23131 test_ret += test_xmlIsBlankNode();
23132 test_ret += test_xmlIsXHTML();
23133 test_ret += test_xmlNewCDataBlock();
23134 test_ret += test_xmlNewCharRef();
23135 test_ret += test_xmlNewChild();
23136 test_ret += test_xmlNewComment();
23137 test_ret += test_xmlNewDoc();
23138 test_ret += test_xmlNewDocComment();
23139 test_ret += test_xmlNewDocFragment();
23140 test_ret += test_xmlNewDocNode();
23141 test_ret += test_xmlNewDocNodeEatName();
23142 test_ret += test_xmlNewDocPI();
23143 test_ret += test_xmlNewDocProp();
23144 test_ret += test_xmlNewDocRawNode();
23145 test_ret += test_xmlNewDocText();
23146 test_ret += test_xmlNewDocTextLen();
23147 test_ret += test_xmlNewDtd();
23148 test_ret += test_xmlNewNode();
23149 test_ret += test_xmlNewNodeEatName();
23150 test_ret += test_xmlNewNs();
23151 test_ret += test_xmlNewNsProp();
23152 test_ret += test_xmlNewNsPropEatName();
23153 test_ret += test_xmlNewPI();
23154 test_ret += test_xmlNewProp();
23155 test_ret += test_xmlNewReference();
23156 test_ret += test_xmlNewText();
23157 test_ret += test_xmlNewTextChild();
23158 test_ret += test_xmlNewTextLen();
23159 test_ret += test_xmlNodeAddContent();
23160 test_ret += test_xmlNodeAddContentLen();
23161 test_ret += test_xmlNodeBufGetContent();
23162 test_ret += test_xmlNodeDump();
23163 test_ret += test_xmlNodeDumpOutput();
23164 test_ret += test_xmlNodeGetBase();
23165 test_ret += test_xmlNodeGetContent();
23166 test_ret += test_xmlNodeGetLang();
23167 test_ret += test_xmlNodeGetSpacePreserve();
23168 test_ret += test_xmlNodeIsText();
23169 test_ret += test_xmlNodeListGetRawString();
23170 test_ret += test_xmlNodeListGetString();
23171 test_ret += test_xmlNodeSetBase();
23172 test_ret += test_xmlNodeSetContent();
23173 test_ret += test_xmlNodeSetContentLen();
23174 test_ret += test_xmlNodeSetLang();
23175 test_ret += test_xmlNodeSetName();
23176 test_ret += test_xmlNodeSetSpacePreserve();
23177 test_ret += test_xmlReconciliateNs();
23178 test_ret += test_xmlRemoveProp();
23179 test_ret += test_xmlReplaceNode();
23180 test_ret += test_xmlSaveFile();
23181 test_ret += test_xmlSaveFileEnc();
23182 test_ret += test_xmlSaveFileTo();
23183 test_ret += test_xmlSaveFormatFile();
23184 test_ret += test_xmlSaveFormatFileEnc();
23185 test_ret += test_xmlSaveFormatFileTo();
23186 test_ret += test_xmlSearchNs();
23187 test_ret += test_xmlSearchNsByHref();
23188 test_ret += test_xmlSetBufferAllocationScheme();
23189 test_ret += test_xmlSetCompressMode();
23190 test_ret += test_xmlSetDocCompressMode();
23191 test_ret += test_xmlSetNs();
23192 test_ret += test_xmlSetNsProp();
23193 test_ret += test_xmlSetProp();
23194 test_ret += test_xmlSplitQName2();
23195 test_ret += test_xmlSplitQName3();
23196 test_ret += test_xmlStringGetNodeList();
23197 test_ret += test_xmlStringLenGetNodeList();
23198 test_ret += test_xmlTextConcat();
23199 test_ret += test_xmlTextMerge();
23200 test_ret += test_xmlUnsetNsProp();
23201 test_ret += test_xmlUnsetProp();
23202 test_ret += test_xmlValidateNCName();
23203 test_ret += test_xmlValidateNMToken();
23204 test_ret += test_xmlValidateName();
23205 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023206
Daniel Veillard42595322004-11-08 10:52:06 +000023207 if (test_ret != 0)
23208 printf("Module tree: %d errors\n", test_ret);
23209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023210}
23211
23212static int
23213test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023215
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023216 int mem_base;
23217 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023218 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023219 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023220 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023221 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023222
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023223 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23224 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023226 URI = gen_const_xmlChar_ptr(n_URI, 0);
23227 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023228
William M. Brackf13f77f2004-11-12 16:03:48 +000023229 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023230 desret_xmlChar_ptr(ret_val);
23231 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023232 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23233 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023234 xmlResetLastError();
23235 if (mem_base != xmlMemBlocks()) {
23236 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023238 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023239 printf(" %d", n_URI);
23240 printf(" %d", n_base);
23241 printf("\n");
23242 }
23243 }
23244 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023246
Daniel Veillard42595322004-11-08 10:52:06 +000023247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023248}
23249
23250
23251static int
23252test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023254
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023255 int mem_base;
23256 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023257 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023258 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023259 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023260 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023261
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023262 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23263 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023265 URI = gen_const_xmlChar_ptr(n_URI, 0);
23266 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023267
William M. Brackf13f77f2004-11-12 16:03:48 +000023268 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023269 desret_xmlChar_ptr(ret_val);
23270 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023271 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23272 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023273 xmlResetLastError();
23274 if (mem_base != xmlMemBlocks()) {
23275 printf("Leak of %d blocks found in xmlBuildURI",
23276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023277 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023278 printf(" %d", n_URI);
23279 printf(" %d", n_base);
23280 printf("\n");
23281 }
23282 }
23283 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023284 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023285
Daniel Veillard42595322004-11-08 10:52:06 +000023286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023287}
23288
23289
23290static int
23291test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023293
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023294 int mem_base;
23295 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023296 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023297 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023298
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023299 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023301 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023302
William M. Brackf13f77f2004-11-12 16:03:48 +000023303 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023304 desret_xmlChar_ptr(ret_val);
23305 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023306 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023307 xmlResetLastError();
23308 if (mem_base != xmlMemBlocks()) {
23309 printf("Leak of %d blocks found in xmlCanonicPath",
23310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023311 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023312 printf(" %d", n_path);
23313 printf("\n");
23314 }
23315 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023316 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023317
Daniel Veillard42595322004-11-08 10:52:06 +000023318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023319}
23320
23321
23322static int
23323test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023325
23326
23327 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023329}
23330
23331
23332static int
23333test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023335
Daniel Veillardce682bc2004-11-05 17:22:25 +000023336 int mem_base;
23337 int ret_val;
23338 char * path; /* pointer to the path string */
23339 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023340
Daniel Veillardce682bc2004-11-05 17:22:25 +000023341 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23342 mem_base = xmlMemBlocks();
23343 path = gen_char_ptr(n_path, 0);
23344
23345 ret_val = xmlNormalizeURIPath(path);
23346 desret_int(ret_val);
23347 call_tests++;
23348 des_char_ptr(n_path, path, 0);
23349 xmlResetLastError();
23350 if (mem_base != xmlMemBlocks()) {
23351 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023353 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023354 printf(" %d", n_path);
23355 printf("\n");
23356 }
23357 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023358 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023359
Daniel Veillard42595322004-11-08 10:52:06 +000023360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023361}
23362
23363
23364static int
23365test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023367
23368
23369 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023371}
23372
23373
Daniel Veillardce682bc2004-11-05 17:22:25 +000023374#define gen_nb_xmlURIPtr 1
23375static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23376 return(NULL);
23377}
23378static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23379}
23380
Daniel Veillardd93f6252004-11-02 15:53:51 +000023381static int
23382test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023384
Daniel Veillardce682bc2004-11-05 17:22:25 +000023385 int mem_base;
23386 int ret_val;
23387 xmlURIPtr uri; /* pointer to an URI structure */
23388 int n_uri;
23389 char * str; /* the string to analyze */
23390 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023391
Daniel Veillardce682bc2004-11-05 17:22:25 +000023392 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23393 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23394 mem_base = xmlMemBlocks();
23395 uri = gen_xmlURIPtr(n_uri, 0);
23396 str = gen_const_char_ptr(n_str, 1);
23397
William M. Brackf13f77f2004-11-12 16:03:48 +000023398 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023399 desret_int(ret_val);
23400 call_tests++;
23401 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023402 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023403 xmlResetLastError();
23404 if (mem_base != xmlMemBlocks()) {
23405 printf("Leak of %d blocks found in xmlParseURIReference",
23406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023407 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023408 printf(" %d", n_uri);
23409 printf(" %d", n_str);
23410 printf("\n");
23411 }
23412 }
23413 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023414 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023415
Daniel Veillard42595322004-11-08 10:52:06 +000023416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023417}
23418
23419
23420static int
23421test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023423
Daniel Veillardce682bc2004-11-05 17:22:25 +000023424 int mem_base;
23425 FILE * stream; /* a FILE* for the output */
23426 int n_stream;
23427 xmlURIPtr uri; /* pointer to an xmlURI */
23428 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023429
Daniel Veillardce682bc2004-11-05 17:22:25 +000023430 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23431 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23432 mem_base = xmlMemBlocks();
23433 stream = gen_FILE_ptr(n_stream, 0);
23434 uri = gen_xmlURIPtr(n_uri, 1);
23435
23436 xmlPrintURI(stream, uri);
23437 call_tests++;
23438 des_FILE_ptr(n_stream, stream, 0);
23439 des_xmlURIPtr(n_uri, uri, 1);
23440 xmlResetLastError();
23441 if (mem_base != xmlMemBlocks()) {
23442 printf("Leak of %d blocks found in xmlPrintURI",
23443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023444 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023445 printf(" %d", n_stream);
23446 printf(" %d", n_uri);
23447 printf("\n");
23448 }
23449 }
23450 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023451 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023452
Daniel Veillard42595322004-11-08 10:52:06 +000023453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023454}
23455
23456
23457static int
23458test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023460
Daniel Veillardce682bc2004-11-05 17:22:25 +000023461 int mem_base;
23462 xmlChar * ret_val;
23463 xmlURIPtr uri; /* pointer to an xmlURI */
23464 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023465
Daniel Veillardce682bc2004-11-05 17:22:25 +000023466 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23467 mem_base = xmlMemBlocks();
23468 uri = gen_xmlURIPtr(n_uri, 0);
23469
23470 ret_val = xmlSaveUri(uri);
23471 desret_xmlChar_ptr(ret_val);
23472 call_tests++;
23473 des_xmlURIPtr(n_uri, uri, 0);
23474 xmlResetLastError();
23475 if (mem_base != xmlMemBlocks()) {
23476 printf("Leak of %d blocks found in xmlSaveUri",
23477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023478 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023479 printf(" %d", n_uri);
23480 printf("\n");
23481 }
23482 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023484
Daniel Veillard42595322004-11-08 10:52:06 +000023485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023486}
23487
23488
23489static int
23490test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023492
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023493 int mem_base;
23494 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023495 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023496 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023497
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023498 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23499 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023500 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023501
William M. Brackf13f77f2004-11-12 16:03:48 +000023502 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023503 desret_xmlChar_ptr(ret_val);
23504 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023505 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023506 xmlResetLastError();
23507 if (mem_base != xmlMemBlocks()) {
23508 printf("Leak of %d blocks found in xmlURIEscape",
23509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023510 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023511 printf(" %d", n_str);
23512 printf("\n");
23513 }
23514 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023516
Daniel Veillard42595322004-11-08 10:52:06 +000023517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023518}
23519
23520
23521static int
23522test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023524
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023525 int mem_base;
23526 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023527 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023528 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023529 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023530 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023531
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023532 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23533 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023535 str = gen_const_xmlChar_ptr(n_str, 0);
23536 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023537
William M. Brackf13f77f2004-11-12 16:03:48 +000023538 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023539 desret_xmlChar_ptr(ret_val);
23540 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023541 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23542 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023543 xmlResetLastError();
23544 if (mem_base != xmlMemBlocks()) {
23545 printf("Leak of %d blocks found in xmlURIEscapeStr",
23546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023547 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023548 printf(" %d", n_str);
23549 printf(" %d", n_list);
23550 printf("\n");
23551 }
23552 }
23553 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023554 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023555
Daniel Veillard42595322004-11-08 10:52:06 +000023556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023557}
23558
23559
23560static int
23561test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023563
23564
23565 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023567}
23568
23569static int
23570test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023572
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023573 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023574 test_ret += test_xmlBuildRelativeURI();
23575 test_ret += test_xmlBuildURI();
23576 test_ret += test_xmlCanonicPath();
23577 test_ret += test_xmlCreateURI();
23578 test_ret += test_xmlNormalizeURIPath();
23579 test_ret += test_xmlParseURI();
23580 test_ret += test_xmlParseURIReference();
23581 test_ret += test_xmlPrintURI();
23582 test_ret += test_xmlSaveUri();
23583 test_ret += test_xmlURIEscape();
23584 test_ret += test_xmlURIEscapeStr();
23585 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023586
Daniel Veillard42595322004-11-08 10:52:06 +000023587 if (test_ret != 0)
23588 printf("Module uri: %d errors\n", test_ret);
23589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023590}
23591
23592static int
23593test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023595
Daniel Veillard42595322004-11-08 10:52:06 +000023596 int mem_base;
23597 xmlAttributePtr ret_val;
23598 xmlValidCtxtPtr ctxt; /* the validation context */
23599 int n_ctxt;
23600 xmlDtdPtr dtd; /* pointer to the DTD */
23601 int n_dtd;
23602 xmlChar * elem; /* the element name */
23603 int n_elem;
23604 xmlChar * name; /* the attribute name */
23605 int n_name;
23606 xmlChar * ns; /* the attribute namespace prefix */
23607 int n_ns;
23608 xmlAttributeType type; /* the attribute type */
23609 int n_type;
23610 xmlAttributeDefault def; /* the attribute default type */
23611 int n_def;
23612 xmlChar * defaultValue; /* the attribute default value */
23613 int n_defaultValue;
23614 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23615 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023616
Daniel Veillard42595322004-11-08 10:52:06 +000023617 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23618 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23619 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23620 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23621 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23622 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23623 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23624 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23625 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23626 mem_base = xmlMemBlocks();
23627 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23628 dtd = gen_xmlDtdPtr(n_dtd, 1);
23629 elem = gen_const_xmlChar_ptr(n_elem, 2);
23630 name = gen_const_xmlChar_ptr(n_name, 3);
23631 ns = gen_const_xmlChar_ptr(n_ns, 4);
23632 type = gen_xmlAttributeType(n_type, 5);
23633 def = gen_xmlAttributeDefault(n_def, 6);
23634 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23635 tree = gen_xmlEnumerationPtr(n_tree, 8);
23636
William M. Brackf13f77f2004-11-12 16:03:48 +000023637 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 +000023638 desret_xmlAttributePtr(ret_val);
23639 call_tests++;
23640 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23641 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023642 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23643 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23644 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023645 des_xmlAttributeType(n_type, type, 5);
23646 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023647 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023648 des_xmlEnumerationPtr(n_tree, tree, 8);
23649 xmlResetLastError();
23650 if (mem_base != xmlMemBlocks()) {
23651 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23652 xmlMemBlocks() - mem_base);
23653 test_ret++;
23654 printf(" %d", n_ctxt);
23655 printf(" %d", n_dtd);
23656 printf(" %d", n_elem);
23657 printf(" %d", n_name);
23658 printf(" %d", n_ns);
23659 printf(" %d", n_type);
23660 printf(" %d", n_def);
23661 printf(" %d", n_defaultValue);
23662 printf(" %d", n_tree);
23663 printf("\n");
23664 }
23665 }
23666 }
23667 }
23668 }
23669 }
23670 }
23671 }
23672 }
23673 }
Daniel Veillard42595322004-11-08 10:52:06 +000023674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023675
Daniel Veillard42595322004-11-08 10:52:06 +000023676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023677}
23678
23679
23680static int
23681test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023683
Daniel Veillard42595322004-11-08 10:52:06 +000023684 int mem_base;
23685 xmlElementPtr ret_val;
23686 xmlValidCtxtPtr ctxt; /* the validation context */
23687 int n_ctxt;
23688 xmlDtdPtr dtd; /* pointer to the DTD */
23689 int n_dtd;
23690 xmlChar * name; /* the entity name */
23691 int n_name;
23692 xmlElementTypeVal type; /* the element type */
23693 int n_type;
23694 xmlElementContentPtr content; /* the element content tree or NULL */
23695 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023696
Daniel Veillard42595322004-11-08 10:52:06 +000023697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23698 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23699 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23700 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23701 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23702 mem_base = xmlMemBlocks();
23703 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23704 dtd = gen_xmlDtdPtr(n_dtd, 1);
23705 name = gen_const_xmlChar_ptr(n_name, 2);
23706 type = gen_xmlElementTypeVal(n_type, 3);
23707 content = gen_xmlElementContentPtr(n_content, 4);
23708
William M. Brackf13f77f2004-11-12 16:03:48 +000023709 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023710 desret_xmlElementPtr(ret_val);
23711 call_tests++;
23712 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23713 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023714 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023715 des_xmlElementTypeVal(n_type, type, 3);
23716 des_xmlElementContentPtr(n_content, content, 4);
23717 xmlResetLastError();
23718 if (mem_base != xmlMemBlocks()) {
23719 printf("Leak of %d blocks found in xmlAddElementDecl",
23720 xmlMemBlocks() - mem_base);
23721 test_ret++;
23722 printf(" %d", n_ctxt);
23723 printf(" %d", n_dtd);
23724 printf(" %d", n_name);
23725 printf(" %d", n_type);
23726 printf(" %d", n_content);
23727 printf("\n");
23728 }
23729 }
23730 }
23731 }
23732 }
23733 }
Daniel Veillard42595322004-11-08 10:52:06 +000023734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023735
Daniel Veillard42595322004-11-08 10:52:06 +000023736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023737}
23738
23739
23740static int
23741test_xmlAddID(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
23750static int
23751test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023753
23754
23755 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023756 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023757}
23758
23759
23760static int
23761test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023762 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023763
23764
23765 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023767}
23768
23769
Daniel Veillardce682bc2004-11-05 17:22:25 +000023770#define gen_nb_xmlAttributeTablePtr 1
23771static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23772 return(NULL);
23773}
23774static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23775}
23776
Daniel Veillardd93f6252004-11-02 15:53:51 +000023777static int
23778test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023780
23781
23782 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023784}
23785
23786
23787static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023788test_xmlCopyDocElementContent(void) {
23789 int test_ret = 0;
23790
23791 int mem_base;
23792 xmlElementContentPtr ret_val;
23793 xmlDocPtr doc; /* the document owning the element declaration */
23794 int n_doc;
23795 xmlElementContentPtr cur; /* An element content pointer. */
23796 int n_cur;
23797
23798 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23799 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23800 mem_base = xmlMemBlocks();
23801 doc = gen_xmlDocPtr(n_doc, 0);
23802 cur = gen_xmlElementContentPtr(n_cur, 1);
23803
23804 ret_val = xmlCopyDocElementContent(doc, cur);
23805 desret_xmlElementContentPtr(ret_val);
23806 call_tests++;
23807 des_xmlDocPtr(n_doc, doc, 0);
23808 des_xmlElementContentPtr(n_cur, cur, 1);
23809 xmlResetLastError();
23810 if (mem_base != xmlMemBlocks()) {
23811 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23812 xmlMemBlocks() - mem_base);
23813 test_ret++;
23814 printf(" %d", n_doc);
23815 printf(" %d", n_cur);
23816 printf("\n");
23817 }
23818 }
23819 }
23820 function_tests++;
23821
23822 return(test_ret);
23823}
23824
23825
23826static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023827test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023829
William M. Brack094dd862004-11-14 14:28:34 +000023830 int mem_base;
23831 xmlElementContentPtr ret_val;
23832 xmlElementContentPtr cur; /* An element content pointer. */
23833 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023834
William M. Brack094dd862004-11-14 14:28:34 +000023835 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23836 mem_base = xmlMemBlocks();
23837 cur = gen_xmlElementContentPtr(n_cur, 0);
23838
23839 ret_val = xmlCopyElementContent(cur);
23840 desret_xmlElementContentPtr(ret_val);
23841 call_tests++;
23842 des_xmlElementContentPtr(n_cur, cur, 0);
23843 xmlResetLastError();
23844 if (mem_base != xmlMemBlocks()) {
23845 printf("Leak of %d blocks found in xmlCopyElementContent",
23846 xmlMemBlocks() - mem_base);
23847 test_ret++;
23848 printf(" %d", n_cur);
23849 printf("\n");
23850 }
23851 }
23852 function_tests++;
23853
Daniel Veillard42595322004-11-08 10:52:06 +000023854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023855}
23856
23857
Daniel Veillardce682bc2004-11-05 17:22:25 +000023858#define gen_nb_xmlElementTablePtr 1
23859static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23860 return(NULL);
23861}
23862static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23863}
23864
Daniel Veillardd93f6252004-11-02 15:53:51 +000023865static int
23866test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023868
23869
23870 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872}
23873
23874
23875static int
23876test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023878
23879
23880 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023882}
23883
23884
Daniel Veillardce682bc2004-11-05 17:22:25 +000023885#define gen_nb_xmlNotationTablePtr 1
23886static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23887 return(NULL);
23888}
23889static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23890}
23891
Daniel Veillardd93f6252004-11-02 15:53:51 +000023892static int
23893test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023895
23896
23897 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023899}
23900
23901
23902static int
23903test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023905
23906
23907 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023909}
23910
23911
Daniel Veillardce682bc2004-11-05 17:22:25 +000023912#define gen_nb_xmlAttributePtr 1
23913static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23914 return(NULL);
23915}
23916static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23917}
23918
Daniel Veillardd93f6252004-11-02 15:53:51 +000023919static int
23920test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023922
William M. Brack21e4ef22005-01-02 09:53:13 +000023923#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023924 int mem_base;
23925 xmlBufferPtr buf; /* the XML buffer output */
23926 int n_buf;
23927 xmlAttributePtr attr; /* An attribute declaration */
23928 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023929
Daniel Veillardce682bc2004-11-05 17:22:25 +000023930 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23931 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23932 mem_base = xmlMemBlocks();
23933 buf = gen_xmlBufferPtr(n_buf, 0);
23934 attr = gen_xmlAttributePtr(n_attr, 1);
23935
23936 xmlDumpAttributeDecl(buf, attr);
23937 call_tests++;
23938 des_xmlBufferPtr(n_buf, buf, 0);
23939 des_xmlAttributePtr(n_attr, attr, 1);
23940 xmlResetLastError();
23941 if (mem_base != xmlMemBlocks()) {
23942 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023944 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023945 printf(" %d", n_buf);
23946 printf(" %d", n_attr);
23947 printf("\n");
23948 }
23949 }
23950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023951 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023952#endif
23953
Daniel Veillard42595322004-11-08 10:52:06 +000023954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023955}
23956
23957
23958static int
23959test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023961
William M. Brack21e4ef22005-01-02 09:53:13 +000023962#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023963 int mem_base;
23964 xmlBufferPtr buf; /* the XML buffer output */
23965 int n_buf;
23966 xmlAttributeTablePtr table; /* An attribute table */
23967 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023968
Daniel Veillardce682bc2004-11-05 17:22:25 +000023969 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23970 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23971 mem_base = xmlMemBlocks();
23972 buf = gen_xmlBufferPtr(n_buf, 0);
23973 table = gen_xmlAttributeTablePtr(n_table, 1);
23974
23975 xmlDumpAttributeTable(buf, table);
23976 call_tests++;
23977 des_xmlBufferPtr(n_buf, buf, 0);
23978 des_xmlAttributeTablePtr(n_table, table, 1);
23979 xmlResetLastError();
23980 if (mem_base != xmlMemBlocks()) {
23981 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023983 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023984 printf(" %d", n_buf);
23985 printf(" %d", n_table);
23986 printf("\n");
23987 }
23988 }
23989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023990 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023991#endif
23992
Daniel Veillard42595322004-11-08 10:52:06 +000023993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023994}
23995
23996
Daniel Veillardce682bc2004-11-05 17:22:25 +000023997#define gen_nb_xmlElementPtr 1
23998static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23999 return(NULL);
24000}
24001static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24002}
24003
Daniel Veillardd93f6252004-11-02 15:53:51 +000024004static int
24005test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024007
William M. Brack21e4ef22005-01-02 09:53:13 +000024008#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024009 int mem_base;
24010 xmlBufferPtr buf; /* the XML buffer output */
24011 int n_buf;
24012 xmlElementPtr elem; /* An element table */
24013 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024014
Daniel Veillardce682bc2004-11-05 17:22:25 +000024015 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24016 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24017 mem_base = xmlMemBlocks();
24018 buf = gen_xmlBufferPtr(n_buf, 0);
24019 elem = gen_xmlElementPtr(n_elem, 1);
24020
24021 xmlDumpElementDecl(buf, elem);
24022 call_tests++;
24023 des_xmlBufferPtr(n_buf, buf, 0);
24024 des_xmlElementPtr(n_elem, elem, 1);
24025 xmlResetLastError();
24026 if (mem_base != xmlMemBlocks()) {
24027 printf("Leak of %d blocks found in xmlDumpElementDecl",
24028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024029 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024030 printf(" %d", n_buf);
24031 printf(" %d", n_elem);
24032 printf("\n");
24033 }
24034 }
24035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024036 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024037#endif
24038
Daniel Veillard42595322004-11-08 10:52:06 +000024039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024040}
24041
24042
24043static int
24044test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024046
William M. Brack21e4ef22005-01-02 09:53:13 +000024047#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024048 int mem_base;
24049 xmlBufferPtr buf; /* the XML buffer output */
24050 int n_buf;
24051 xmlElementTablePtr table; /* An element table */
24052 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024053
Daniel Veillardce682bc2004-11-05 17:22:25 +000024054 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24055 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24056 mem_base = xmlMemBlocks();
24057 buf = gen_xmlBufferPtr(n_buf, 0);
24058 table = gen_xmlElementTablePtr(n_table, 1);
24059
24060 xmlDumpElementTable(buf, table);
24061 call_tests++;
24062 des_xmlBufferPtr(n_buf, buf, 0);
24063 des_xmlElementTablePtr(n_table, table, 1);
24064 xmlResetLastError();
24065 if (mem_base != xmlMemBlocks()) {
24066 printf("Leak of %d blocks found in xmlDumpElementTable",
24067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024068 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024069 printf(" %d", n_buf);
24070 printf(" %d", n_table);
24071 printf("\n");
24072 }
24073 }
24074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024075 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024076#endif
24077
Daniel Veillard42595322004-11-08 10:52:06 +000024078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024079}
24080
24081
Daniel Veillardce682bc2004-11-05 17:22:25 +000024082#define gen_nb_xmlNotationPtr 1
24083static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24084 return(NULL);
24085}
24086static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24087}
24088
Daniel Veillardd93f6252004-11-02 15:53:51 +000024089static int
24090test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024092
William M. Brack21e4ef22005-01-02 09:53:13 +000024093#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024094 int mem_base;
24095 xmlBufferPtr buf; /* the XML buffer output */
24096 int n_buf;
24097 xmlNotationPtr nota; /* A notation declaration */
24098 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024099
Daniel Veillardce682bc2004-11-05 17:22:25 +000024100 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24101 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24102 mem_base = xmlMemBlocks();
24103 buf = gen_xmlBufferPtr(n_buf, 0);
24104 nota = gen_xmlNotationPtr(n_nota, 1);
24105
24106 xmlDumpNotationDecl(buf, nota);
24107 call_tests++;
24108 des_xmlBufferPtr(n_buf, buf, 0);
24109 des_xmlNotationPtr(n_nota, nota, 1);
24110 xmlResetLastError();
24111 if (mem_base != xmlMemBlocks()) {
24112 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024114 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024115 printf(" %d", n_buf);
24116 printf(" %d", n_nota);
24117 printf("\n");
24118 }
24119 }
24120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024121 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024122#endif
24123
Daniel Veillard42595322004-11-08 10:52:06 +000024124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024125}
24126
24127
24128static int
24129test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024131
William M. Brack21e4ef22005-01-02 09:53:13 +000024132#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024133 int mem_base;
24134 xmlBufferPtr buf; /* the XML buffer output */
24135 int n_buf;
24136 xmlNotationTablePtr table; /* A notation table */
24137 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024138
Daniel Veillardce682bc2004-11-05 17:22:25 +000024139 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24140 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24141 mem_base = xmlMemBlocks();
24142 buf = gen_xmlBufferPtr(n_buf, 0);
24143 table = gen_xmlNotationTablePtr(n_table, 1);
24144
24145 xmlDumpNotationTable(buf, table);
24146 call_tests++;
24147 des_xmlBufferPtr(n_buf, buf, 0);
24148 des_xmlNotationTablePtr(n_table, table, 1);
24149 xmlResetLastError();
24150 if (mem_base != xmlMemBlocks()) {
24151 printf("Leak of %d blocks found in xmlDumpNotationTable",
24152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024153 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024154 printf(" %d", n_buf);
24155 printf(" %d", n_table);
24156 printf("\n");
24157 }
24158 }
24159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024160 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024161#endif
24162
Daniel Veillard42595322004-11-08 10:52:06 +000024163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024164}
24165
24166
24167static int
24168test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024170
Daniel Veillard42595322004-11-08 10:52:06 +000024171 int mem_base;
24172 xmlAttributePtr ret_val;
24173 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24174 int n_dtd;
24175 xmlChar * elem; /* the element name */
24176 int n_elem;
24177 xmlChar * name; /* the attribute name */
24178 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024179
Daniel Veillard42595322004-11-08 10:52:06 +000024180 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24181 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24182 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24183 mem_base = xmlMemBlocks();
24184 dtd = gen_xmlDtdPtr(n_dtd, 0);
24185 elem = gen_const_xmlChar_ptr(n_elem, 1);
24186 name = gen_const_xmlChar_ptr(n_name, 2);
24187
William M. Brackf13f77f2004-11-12 16:03:48 +000024188 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024189 desret_xmlAttributePtr(ret_val);
24190 call_tests++;
24191 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024192 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24193 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024194 xmlResetLastError();
24195 if (mem_base != xmlMemBlocks()) {
24196 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24197 xmlMemBlocks() - mem_base);
24198 test_ret++;
24199 printf(" %d", n_dtd);
24200 printf(" %d", n_elem);
24201 printf(" %d", n_name);
24202 printf("\n");
24203 }
24204 }
24205 }
24206 }
Daniel Veillard42595322004-11-08 10:52:06 +000024207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024208
Daniel Veillard42595322004-11-08 10:52:06 +000024209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024210}
24211
24212
24213static int
24214test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024216
Daniel Veillard42595322004-11-08 10:52:06 +000024217 int mem_base;
24218 xmlElementPtr ret_val;
24219 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24220 int n_dtd;
24221 xmlChar * name; /* the element name */
24222 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024223
Daniel Veillard42595322004-11-08 10:52:06 +000024224 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24225 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24226 mem_base = xmlMemBlocks();
24227 dtd = gen_xmlDtdPtr(n_dtd, 0);
24228 name = gen_const_xmlChar_ptr(n_name, 1);
24229
William M. Brackf13f77f2004-11-12 16:03:48 +000024230 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024231 desret_xmlElementPtr(ret_val);
24232 call_tests++;
24233 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024234 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024235 xmlResetLastError();
24236 if (mem_base != xmlMemBlocks()) {
24237 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24238 xmlMemBlocks() - mem_base);
24239 test_ret++;
24240 printf(" %d", n_dtd);
24241 printf(" %d", n_name);
24242 printf("\n");
24243 }
24244 }
24245 }
Daniel Veillard42595322004-11-08 10:52:06 +000024246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024247
Daniel Veillard42595322004-11-08 10:52:06 +000024248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024249}
24250
24251
24252static int
24253test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024255
24256
24257 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024259}
24260
24261
24262static int
24263test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024265
Daniel Veillard42595322004-11-08 10:52:06 +000024266 int mem_base;
24267 xmlAttributePtr ret_val;
24268 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24269 int n_dtd;
24270 xmlChar * elem; /* the element name */
24271 int n_elem;
24272 xmlChar * name; /* the attribute name */
24273 int n_name;
24274 xmlChar * prefix; /* the attribute namespace prefix */
24275 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024276
Daniel Veillard42595322004-11-08 10:52:06 +000024277 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24278 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24279 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24280 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24281 mem_base = xmlMemBlocks();
24282 dtd = gen_xmlDtdPtr(n_dtd, 0);
24283 elem = gen_const_xmlChar_ptr(n_elem, 1);
24284 name = gen_const_xmlChar_ptr(n_name, 2);
24285 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24286
William M. Brackf13f77f2004-11-12 16:03:48 +000024287 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024288 desret_xmlAttributePtr(ret_val);
24289 call_tests++;
24290 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024291 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24292 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24293 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024294 xmlResetLastError();
24295 if (mem_base != xmlMemBlocks()) {
24296 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24297 xmlMemBlocks() - mem_base);
24298 test_ret++;
24299 printf(" %d", n_dtd);
24300 printf(" %d", n_elem);
24301 printf(" %d", n_name);
24302 printf(" %d", n_prefix);
24303 printf("\n");
24304 }
24305 }
24306 }
24307 }
24308 }
Daniel Veillard42595322004-11-08 10:52:06 +000024309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024310
Daniel Veillard42595322004-11-08 10:52:06 +000024311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024312}
24313
24314
24315static int
24316test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024318
Daniel Veillard42595322004-11-08 10:52:06 +000024319 int mem_base;
24320 xmlElementPtr ret_val;
24321 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24322 int n_dtd;
24323 xmlChar * name; /* the element name */
24324 int n_name;
24325 xmlChar * prefix; /* the element namespace prefix */
24326 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024327
Daniel Veillard42595322004-11-08 10:52:06 +000024328 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24329 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24330 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24331 mem_base = xmlMemBlocks();
24332 dtd = gen_xmlDtdPtr(n_dtd, 0);
24333 name = gen_const_xmlChar_ptr(n_name, 1);
24334 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24335
William M. Brackf13f77f2004-11-12 16:03:48 +000024336 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024337 desret_xmlElementPtr(ret_val);
24338 call_tests++;
24339 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024340 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24341 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024342 xmlResetLastError();
24343 if (mem_base != xmlMemBlocks()) {
24344 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24345 xmlMemBlocks() - mem_base);
24346 test_ret++;
24347 printf(" %d", n_dtd);
24348 printf(" %d", n_name);
24349 printf(" %d", n_prefix);
24350 printf("\n");
24351 }
24352 }
24353 }
24354 }
Daniel Veillard42595322004-11-08 10:52:06 +000024355 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024356
Daniel Veillard42595322004-11-08 10:52:06 +000024357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024358}
24359
24360
24361static int
24362test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024364
Daniel Veillard57b25162004-11-06 14:50:18 +000024365 int mem_base;
24366 xmlAttrPtr ret_val;
24367 xmlDocPtr doc; /* pointer to the document */
24368 int n_doc;
24369 xmlChar * ID; /* the ID value */
24370 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024371
Daniel Veillard57b25162004-11-06 14:50:18 +000024372 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24373 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24374 mem_base = xmlMemBlocks();
24375 doc = gen_xmlDocPtr(n_doc, 0);
24376 ID = gen_const_xmlChar_ptr(n_ID, 1);
24377
William M. Brackf13f77f2004-11-12 16:03:48 +000024378 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024379 desret_xmlAttrPtr(ret_val);
24380 call_tests++;
24381 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024382 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024383 xmlResetLastError();
24384 if (mem_base != xmlMemBlocks()) {
24385 printf("Leak of %d blocks found in xmlGetID",
24386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024387 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024388 printf(" %d", n_doc);
24389 printf(" %d", n_ID);
24390 printf("\n");
24391 }
24392 }
24393 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024395
Daniel Veillard42595322004-11-08 10:52:06 +000024396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024397}
24398
24399
24400static int
24401test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024403
24404
24405 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024407}
24408
24409
24410static int
24411test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024413
Daniel Veillardce244ad2004-11-05 10:03:46 +000024414 int mem_base;
24415 int ret_val;
24416 xmlDocPtr doc; /* the document */
24417 int n_doc;
24418 xmlNodePtr elem; /* the element carrying the attribute */
24419 int n_elem;
24420 xmlAttrPtr attr; /* the attribute */
24421 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024422
Daniel Veillardce244ad2004-11-05 10:03:46 +000024423 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24424 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24425 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24426 mem_base = xmlMemBlocks();
24427 doc = gen_xmlDocPtr(n_doc, 0);
24428 elem = gen_xmlNodePtr(n_elem, 1);
24429 attr = gen_xmlAttrPtr(n_attr, 2);
24430
24431 ret_val = xmlIsID(doc, elem, attr);
24432 desret_int(ret_val);
24433 call_tests++;
24434 des_xmlDocPtr(n_doc, doc, 0);
24435 des_xmlNodePtr(n_elem, elem, 1);
24436 des_xmlAttrPtr(n_attr, attr, 2);
24437 xmlResetLastError();
24438 if (mem_base != xmlMemBlocks()) {
24439 printf("Leak of %d blocks found in xmlIsID",
24440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024441 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024442 printf(" %d", n_doc);
24443 printf(" %d", n_elem);
24444 printf(" %d", n_attr);
24445 printf("\n");
24446 }
24447 }
24448 }
24449 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024451
Daniel Veillard42595322004-11-08 10:52:06 +000024452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024453}
24454
24455
24456static int
24457test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024459
24460 int mem_base;
24461 int ret_val;
24462 xmlDocPtr doc; /* the document */
24463 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024464 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024465 int n_name;
24466
24467 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24468 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24469 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024470 doc = gen_xmlDocPtr(n_doc, 0);
24471 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024472
William M. Brackf13f77f2004-11-12 16:03:48 +000024473 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024474 desret_int(ret_val);
24475 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024476 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024477 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024478 xmlResetLastError();
24479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024480 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024483 printf(" %d", n_doc);
24484 printf(" %d", n_name);
24485 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024486 }
24487 }
24488 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024490
Daniel Veillard42595322004-11-08 10:52:06 +000024491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024492}
24493
24494
24495static int
24496test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024498
Daniel Veillardce244ad2004-11-05 10:03:46 +000024499 int mem_base;
24500 int ret_val;
24501 xmlDocPtr doc; /* the document */
24502 int n_doc;
24503 xmlNodePtr elem; /* the element carrying the attribute */
24504 int n_elem;
24505 xmlAttrPtr attr; /* the attribute */
24506 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024507
Daniel Veillardce244ad2004-11-05 10:03:46 +000024508 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24509 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24510 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24511 mem_base = xmlMemBlocks();
24512 doc = gen_xmlDocPtr(n_doc, 0);
24513 elem = gen_xmlNodePtr(n_elem, 1);
24514 attr = gen_xmlAttrPtr(n_attr, 2);
24515
24516 ret_val = xmlIsRef(doc, elem, attr);
24517 desret_int(ret_val);
24518 call_tests++;
24519 des_xmlDocPtr(n_doc, doc, 0);
24520 des_xmlNodePtr(n_elem, elem, 1);
24521 des_xmlAttrPtr(n_attr, attr, 2);
24522 xmlResetLastError();
24523 if (mem_base != xmlMemBlocks()) {
24524 printf("Leak of %d blocks found in xmlIsRef",
24525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024526 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024527 printf(" %d", n_doc);
24528 printf(" %d", n_elem);
24529 printf(" %d", n_attr);
24530 printf("\n");
24531 }
24532 }
24533 }
24534 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024536
Daniel Veillard42595322004-11-08 10:52:06 +000024537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024538}
24539
24540
24541static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024542test_xmlNewDocElementContent(void) {
24543 int test_ret = 0;
24544
24545 int mem_base;
24546 xmlElementContentPtr ret_val;
24547 xmlDocPtr doc; /* the document */
24548 int n_doc;
24549 xmlChar * name; /* the subelement name or NULL */
24550 int n_name;
24551 xmlElementContentType type; /* the type of element content decl */
24552 int n_type;
24553
24554 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24555 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24556 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24557 mem_base = xmlMemBlocks();
24558 doc = gen_xmlDocPtr(n_doc, 0);
24559 name = gen_const_xmlChar_ptr(n_name, 1);
24560 type = gen_xmlElementContentType(n_type, 2);
24561
24562 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024563 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024564 desret_xmlElementContentPtr(ret_val);
24565 call_tests++;
24566 des_xmlDocPtr(n_doc, doc, 0);
24567 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24568 des_xmlElementContentType(n_type, type, 2);
24569 xmlResetLastError();
24570 if (mem_base != xmlMemBlocks()) {
24571 printf("Leak of %d blocks found in xmlNewDocElementContent",
24572 xmlMemBlocks() - mem_base);
24573 test_ret++;
24574 printf(" %d", n_doc);
24575 printf(" %d", n_name);
24576 printf(" %d", n_type);
24577 printf("\n");
24578 }
24579 }
24580 }
24581 }
24582 function_tests++;
24583
24584 return(test_ret);
24585}
24586
24587
24588static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024589test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024591
William M. Brack094dd862004-11-14 14:28:34 +000024592 int mem_base;
24593 xmlElementContentPtr ret_val;
24594 xmlChar * name; /* the subelement name or NULL */
24595 int n_name;
24596 xmlElementContentType type; /* the type of element content decl */
24597 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024598
William M. Brack094dd862004-11-14 14:28:34 +000024599 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24600 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24601 mem_base = xmlMemBlocks();
24602 name = gen_const_xmlChar_ptr(n_name, 0);
24603 type = gen_xmlElementContentType(n_type, 1);
24604
24605 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24606 desret_xmlElementContentPtr(ret_val);
24607 call_tests++;
24608 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24609 des_xmlElementContentType(n_type, type, 1);
24610 xmlResetLastError();
24611 if (mem_base != xmlMemBlocks()) {
24612 printf("Leak of %d blocks found in xmlNewElementContent",
24613 xmlMemBlocks() - mem_base);
24614 test_ret++;
24615 printf(" %d", n_name);
24616 printf(" %d", n_type);
24617 printf("\n");
24618 }
24619 }
24620 }
24621 function_tests++;
24622
Daniel Veillard42595322004-11-08 10:52:06 +000024623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024624}
24625
24626
24627static int
24628test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024629 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024630
24631
24632 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024634}
24635
24636
24637static int
24638test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024640
Daniel Veillardce244ad2004-11-05 10:03:46 +000024641 int mem_base;
24642 int ret_val;
24643 xmlDocPtr doc; /* the document */
24644 int n_doc;
24645 xmlAttrPtr attr; /* the attribute */
24646 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024647
Daniel Veillardce244ad2004-11-05 10:03:46 +000024648 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24649 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24650 mem_base = xmlMemBlocks();
24651 doc = gen_xmlDocPtr(n_doc, 0);
24652 attr = gen_xmlAttrPtr(n_attr, 1);
24653
24654 ret_val = xmlRemoveID(doc, attr);
24655 desret_int(ret_val);
24656 call_tests++;
24657 des_xmlDocPtr(n_doc, doc, 0);
24658 des_xmlAttrPtr(n_attr, attr, 1);
24659 xmlResetLastError();
24660 if (mem_base != xmlMemBlocks()) {
24661 printf("Leak of %d blocks found in xmlRemoveID",
24662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024663 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024664 printf(" %d", n_doc);
24665 printf(" %d", n_attr);
24666 printf("\n");
24667 }
24668 }
24669 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024670 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024671
Daniel Veillard42595322004-11-08 10:52:06 +000024672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024673}
24674
24675
24676static int
24677test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024679
Daniel Veillardce244ad2004-11-05 10:03:46 +000024680 int mem_base;
24681 int ret_val;
24682 xmlDocPtr doc; /* the document */
24683 int n_doc;
24684 xmlAttrPtr attr; /* the attribute */
24685 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024686
Daniel Veillardce244ad2004-11-05 10:03:46 +000024687 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24688 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24689 mem_base = xmlMemBlocks();
24690 doc = gen_xmlDocPtr(n_doc, 0);
24691 attr = gen_xmlAttrPtr(n_attr, 1);
24692
24693 ret_val = xmlRemoveRef(doc, attr);
24694 desret_int(ret_val);
24695 call_tests++;
24696 des_xmlDocPtr(n_doc, doc, 0);
24697 des_xmlAttrPtr(n_attr, attr, 1);
24698 xmlResetLastError();
24699 if (mem_base != xmlMemBlocks()) {
24700 printf("Leak of %d blocks found in xmlRemoveRef",
24701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024702 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024703 printf(" %d", n_doc);
24704 printf(" %d", n_attr);
24705 printf("\n");
24706 }
24707 }
24708 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024709 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024710
Daniel Veillard42595322004-11-08 10:52:06 +000024711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024712}
24713
24714
24715static int
24716test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024718
Daniel Veillardce682bc2004-11-05 17:22:25 +000024719 int mem_base;
24720 char * buf; /* an output buffer */
24721 int n_buf;
24722 int size; /* the buffer size */
24723 int n_size;
24724 xmlElementContentPtr content; /* An element table */
24725 int n_content;
24726 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24727 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024728
Daniel Veillardce682bc2004-11-05 17:22:25 +000024729 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24730 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24731 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24732 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24733 mem_base = xmlMemBlocks();
24734 buf = gen_char_ptr(n_buf, 0);
24735 size = gen_int(n_size, 1);
24736 content = gen_xmlElementContentPtr(n_content, 2);
24737 glob = gen_int(n_glob, 3);
24738
24739 xmlSnprintfElementContent(buf, size, content, glob);
24740 call_tests++;
24741 des_char_ptr(n_buf, buf, 0);
24742 des_int(n_size, size, 1);
24743 des_xmlElementContentPtr(n_content, content, 2);
24744 des_int(n_glob, glob, 3);
24745 xmlResetLastError();
24746 if (mem_base != xmlMemBlocks()) {
24747 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024749 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024750 printf(" %d", n_buf);
24751 printf(" %d", n_size);
24752 printf(" %d", n_content);
24753 printf(" %d", n_glob);
24754 printf("\n");
24755 }
24756 }
24757 }
24758 }
24759 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024760 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024761
Daniel Veillard42595322004-11-08 10:52:06 +000024762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024763}
24764
24765
24766static int
24767test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024769
William M. Brack21e4ef22005-01-02 09:53:13 +000024770#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024771#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024772 int mem_base;
24773 char * buf; /* an output buffer */
24774 int n_buf;
24775 xmlElementContentPtr content; /* An element table */
24776 int n_content;
24777 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24778 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024779
Daniel Veillardce682bc2004-11-05 17:22:25 +000024780 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24781 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24782 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24783 mem_base = xmlMemBlocks();
24784 buf = gen_char_ptr(n_buf, 0);
24785 content = gen_xmlElementContentPtr(n_content, 1);
24786 glob = gen_int(n_glob, 2);
24787
24788 xmlSprintfElementContent(buf, content, glob);
24789 call_tests++;
24790 des_char_ptr(n_buf, buf, 0);
24791 des_xmlElementContentPtr(n_content, content, 1);
24792 des_int(n_glob, glob, 2);
24793 xmlResetLastError();
24794 if (mem_base != xmlMemBlocks()) {
24795 printf("Leak of %d blocks found in xmlSprintfElementContent",
24796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024797 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024798 printf(" %d", n_buf);
24799 printf(" %d", n_content);
24800 printf(" %d", n_glob);
24801 printf("\n");
24802 }
24803 }
24804 }
24805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024806 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024807#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024808#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024809
Daniel Veillard42595322004-11-08 10:52:06 +000024810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024811}
24812
24813
24814static int
24815test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024817
William M. Brack21e4ef22005-01-02 09:53:13 +000024818#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024819 int mem_base;
24820 int ret_val;
24821 xmlValidCtxtPtr ctxt; /* a validation context */
24822 int n_ctxt;
24823 xmlElementPtr elem; /* an element declaration node */
24824 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024825
Daniel Veillardce682bc2004-11-05 17:22:25 +000024826 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24827 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24828 mem_base = xmlMemBlocks();
24829 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24830 elem = gen_xmlElementPtr(n_elem, 1);
24831
24832 ret_val = xmlValidBuildContentModel(ctxt, elem);
24833 desret_int(ret_val);
24834 call_tests++;
24835 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24836 des_xmlElementPtr(n_elem, elem, 1);
24837 xmlResetLastError();
24838 if (mem_base != xmlMemBlocks()) {
24839 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024841 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024842 printf(" %d", n_ctxt);
24843 printf(" %d", n_elem);
24844 printf("\n");
24845 }
24846 }
24847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024848 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024849#endif
24850
Daniel Veillard42595322004-11-08 10:52:06 +000024851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024852}
24853
24854
24855static int
24856test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024858
William M. Brack21e4ef22005-01-02 09:53:13 +000024859#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024860 int mem_base;
24861 xmlChar * ret_val;
24862 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24863 int n_ctxt;
24864 xmlDocPtr doc; /* the document */
24865 int n_doc;
24866 xmlNodePtr elem; /* the parent */
24867 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024868 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024869 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024870 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024871 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024872
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024873 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24874 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24875 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24876 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24877 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024879 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24880 doc = gen_xmlDocPtr(n_doc, 1);
24881 elem = gen_xmlNodePtr(n_elem, 2);
24882 name = gen_const_xmlChar_ptr(n_name, 3);
24883 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024884
William M. Brackf13f77f2004-11-12 16:03:48 +000024885 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024886 desret_xmlChar_ptr(ret_val);
24887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024888 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24889 des_xmlDocPtr(n_doc, doc, 1);
24890 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024891 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24892 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024893 xmlResetLastError();
24894 if (mem_base != xmlMemBlocks()) {
24895 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024897 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024898 printf(" %d", n_ctxt);
24899 printf(" %d", n_doc);
24900 printf(" %d", n_elem);
24901 printf(" %d", n_name);
24902 printf(" %d", n_value);
24903 printf("\n");
24904 }
24905 }
24906 }
24907 }
24908 }
24909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024910 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024911#endif
24912
Daniel Veillard42595322004-11-08 10:52:06 +000024913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024914}
24915
24916
Daniel Veillardce682bc2004-11-05 17:22:25 +000024917#define gen_nb_xmlElementContent_ptr 1
24918static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24919 return(NULL);
24920}
24921static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24922}
24923
Daniel Veillardd93f6252004-11-02 15:53:51 +000024924static int
24925test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024927
William M. Brack21e4ef22005-01-02 09:53:13 +000024928#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024929#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024930 int mem_base;
24931 int ret_val;
24932 xmlElementContent * ctree; /* an element content tree */
24933 int n_ctree;
24934 xmlChar ** list; /* an array to store the list of child names */
24935 int n_list;
24936 int * len; /* a pointer to the number of element in the list */
24937 int n_len;
24938 int max; /* the size of the array */
24939 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024940
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024941 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24942 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24943 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24944 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24945 mem_base = xmlMemBlocks();
24946 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24947 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24948 len = gen_int_ptr(n_len, 2);
24949 max = gen_int(n_max, 3);
24950
William M. Brackf13f77f2004-11-12 16:03:48 +000024951 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024952 desret_int(ret_val);
24953 call_tests++;
24954 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024955 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024956 des_int_ptr(n_len, len, 2);
24957 des_int(n_max, max, 3);
24958 xmlResetLastError();
24959 if (mem_base != xmlMemBlocks()) {
24960 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024962 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024963 printf(" %d", n_ctree);
24964 printf(" %d", n_list);
24965 printf(" %d", n_len);
24966 printf(" %d", n_max);
24967 printf("\n");
24968 }
24969 }
24970 }
24971 }
24972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024973 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024974#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024975#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024976
Daniel Veillard42595322004-11-08 10:52:06 +000024977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024978}
24979
24980
24981static int
24982test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024984
William M. Brack21e4ef22005-01-02 09:53:13 +000024985#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024986#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024987 int mem_base;
24988 int ret_val;
24989 xmlNode * prev; /* an element to insert after */
24990 int n_prev;
24991 xmlNode * next; /* an element to insert next */
24992 int n_next;
24993 xmlChar ** names; /* an array to store the list of child names */
24994 int n_names;
24995 int max; /* the size of the array */
24996 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024997
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024998 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24999 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
25000 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
25001 for (n_max = 0;n_max < gen_nb_int;n_max++) {
25002 mem_base = xmlMemBlocks();
25003 prev = gen_xmlNodePtr(n_prev, 0);
25004 next = gen_xmlNodePtr(n_next, 1);
25005 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
25006 max = gen_int(n_max, 3);
25007
William M. Brackf13f77f2004-11-12 16:03:48 +000025008 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025009 desret_int(ret_val);
25010 call_tests++;
25011 des_xmlNodePtr(n_prev, prev, 0);
25012 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025013 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025014 des_int(n_max, max, 3);
25015 xmlResetLastError();
25016 if (mem_base != xmlMemBlocks()) {
25017 printf("Leak of %d blocks found in xmlValidGetValidElements",
25018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025019 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025020 printf(" %d", n_prev);
25021 printf(" %d", n_next);
25022 printf(" %d", n_names);
25023 printf(" %d", n_max);
25024 printf("\n");
25025 }
25026 }
25027 }
25028 }
25029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025030 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000025031#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000025032#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025033
Daniel Veillard42595322004-11-08 10:52:06 +000025034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025035}
25036
25037
25038static int
25039test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025041
William M. Brack21e4ef22005-01-02 09:53:13 +000025042#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025043 int mem_base;
25044 xmlChar * ret_val;
25045 xmlDocPtr doc; /* the document */
25046 int n_doc;
25047 xmlNodePtr elem; /* the parent */
25048 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025049 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025050 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025051 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025052 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025053
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025054 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25055 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25056 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25057 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25058 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025059 doc = gen_xmlDocPtr(n_doc, 0);
25060 elem = gen_xmlNodePtr(n_elem, 1);
25061 name = gen_const_xmlChar_ptr(n_name, 2);
25062 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025063
William M. Brackf13f77f2004-11-12 16:03:48 +000025064 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025065 desret_xmlChar_ptr(ret_val);
25066 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025067 des_xmlDocPtr(n_doc, doc, 0);
25068 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025069 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
25070 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025071 xmlResetLastError();
25072 if (mem_base != xmlMemBlocks()) {
25073 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
25074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025075 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025076 printf(" %d", n_doc);
25077 printf(" %d", n_elem);
25078 printf(" %d", n_name);
25079 printf(" %d", n_value);
25080 printf("\n");
25081 }
25082 }
25083 }
25084 }
25085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025086 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025087#endif
25088
Daniel Veillard42595322004-11-08 10:52:06 +000025089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025090}
25091
25092
25093static int
25094test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025096
William M. Brack21e4ef22005-01-02 09:53:13 +000025097#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025098 int mem_base;
25099 int ret_val;
25100 xmlValidCtxtPtr ctxt; /* the validation context */
25101 int n_ctxt;
25102 xmlDocPtr doc; /* a document instance */
25103 int n_doc;
25104 xmlAttributePtr attr; /* an attribute definition */
25105 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025106
Daniel Veillardce682bc2004-11-05 17:22:25 +000025107 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25108 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25109 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25110 mem_base = xmlMemBlocks();
25111 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25112 doc = gen_xmlDocPtr(n_doc, 1);
25113 attr = gen_xmlAttributePtr(n_attr, 2);
25114
25115 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25116 desret_int(ret_val);
25117 call_tests++;
25118 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25119 des_xmlDocPtr(n_doc, doc, 1);
25120 des_xmlAttributePtr(n_attr, attr, 2);
25121 xmlResetLastError();
25122 if (mem_base != xmlMemBlocks()) {
25123 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025125 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025126 printf(" %d", n_ctxt);
25127 printf(" %d", n_doc);
25128 printf(" %d", n_attr);
25129 printf("\n");
25130 }
25131 }
25132 }
25133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025134 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025135#endif
25136
Daniel Veillard42595322004-11-08 10:52:06 +000025137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025138}
25139
25140
25141static int
25142test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025144
William M. Brack21e4ef22005-01-02 09:53:13 +000025145#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000025146 int mem_base;
25147 int ret_val;
25148 xmlAttributeType type; /* an attribute type */
25149 int n_type;
25150 xmlChar * value; /* an attribute value */
25151 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025152
Daniel Veillard57b25162004-11-06 14:50:18 +000025153 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25154 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25155 mem_base = xmlMemBlocks();
25156 type = gen_xmlAttributeType(n_type, 0);
25157 value = gen_const_xmlChar_ptr(n_value, 1);
25158
William M. Brackf13f77f2004-11-12 16:03:48 +000025159 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025160 desret_int(ret_val);
25161 call_tests++;
25162 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025163 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025164 xmlResetLastError();
25165 if (mem_base != xmlMemBlocks()) {
25166 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025168 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025169 printf(" %d", n_type);
25170 printf(" %d", n_value);
25171 printf("\n");
25172 }
25173 }
25174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025175 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025176#endif
25177
Daniel Veillard42595322004-11-08 10:52:06 +000025178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025179}
25180
25181
25182static int
25183test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025185
William M. Brack21e4ef22005-01-02 09:53:13 +000025186#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025187 int mem_base;
25188 int ret_val;
25189 xmlValidCtxtPtr ctxt; /* the validation context */
25190 int n_ctxt;
25191 xmlDocPtr doc; /* a document instance */
25192 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025193
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025194 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25195 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25196 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025197 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25198 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025199
25200 ret_val = xmlValidateDocument(ctxt, doc);
25201 desret_int(ret_val);
25202 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025203 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25204 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025205 xmlResetLastError();
25206 if (mem_base != xmlMemBlocks()) {
25207 printf("Leak of %d blocks found in xmlValidateDocument",
25208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025209 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025210 printf(" %d", n_ctxt);
25211 printf(" %d", n_doc);
25212 printf("\n");
25213 }
25214 }
25215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025216 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025217#endif
25218
Daniel Veillard42595322004-11-08 10:52:06 +000025219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025220}
25221
25222
25223static int
25224test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025226
William M. Brack21e4ef22005-01-02 09:53:13 +000025227#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025228 int mem_base;
25229 int ret_val;
25230 xmlValidCtxtPtr ctxt; /* the validation context */
25231 int n_ctxt;
25232 xmlDocPtr doc; /* a document instance */
25233 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025234
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025235 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25236 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025238 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25239 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025240
25241 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25242 desret_int(ret_val);
25243 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025244 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25245 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025246 xmlResetLastError();
25247 if (mem_base != xmlMemBlocks()) {
25248 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025250 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025251 printf(" %d", n_ctxt);
25252 printf(" %d", n_doc);
25253 printf("\n");
25254 }
25255 }
25256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025257 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025258#endif
25259
Daniel Veillard42595322004-11-08 10:52:06 +000025260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025261}
25262
25263
25264static int
25265test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025267
William M. Brack21e4ef22005-01-02 09:53:13 +000025268#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025269 int mem_base;
25270 int ret_val;
25271 xmlValidCtxtPtr ctxt; /* the validation context */
25272 int n_ctxt;
25273 xmlDocPtr doc; /* a document instance */
25274 int n_doc;
25275 xmlDtdPtr dtd; /* a dtd instance */
25276 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025277
Daniel Veillard27f20102004-11-05 11:50:11 +000025278 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25279 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25280 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25281 mem_base = xmlMemBlocks();
25282 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25283 doc = gen_xmlDocPtr(n_doc, 1);
25284 dtd = gen_xmlDtdPtr(n_dtd, 2);
25285
25286 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25287 desret_int(ret_val);
25288 call_tests++;
25289 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25290 des_xmlDocPtr(n_doc, doc, 1);
25291 des_xmlDtdPtr(n_dtd, dtd, 2);
25292 xmlResetLastError();
25293 if (mem_base != xmlMemBlocks()) {
25294 printf("Leak of %d blocks found in xmlValidateDtd",
25295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025296 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025297 printf(" %d", n_ctxt);
25298 printf(" %d", n_doc);
25299 printf(" %d", n_dtd);
25300 printf("\n");
25301 }
25302 }
25303 }
25304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025305 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025306#endif
25307
Daniel Veillard42595322004-11-08 10:52:06 +000025308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025309}
25310
25311
25312static int
25313test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025315
William M. Brack21e4ef22005-01-02 09:53:13 +000025316#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025317 int mem_base;
25318 int ret_val;
25319 xmlValidCtxtPtr ctxt; /* the validation context */
25320 int n_ctxt;
25321 xmlDocPtr doc; /* a document instance */
25322 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025323
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025324 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25325 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025327 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25328 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025329
25330 ret_val = xmlValidateDtdFinal(ctxt, doc);
25331 desret_int(ret_val);
25332 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025333 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25334 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025335 xmlResetLastError();
25336 if (mem_base != xmlMemBlocks()) {
25337 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025339 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025340 printf(" %d", n_ctxt);
25341 printf(" %d", n_doc);
25342 printf("\n");
25343 }
25344 }
25345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025346 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025347#endif
25348
Daniel Veillard42595322004-11-08 10:52:06 +000025349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025350}
25351
25352
25353static int
25354test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025356
William M. Brack21e4ef22005-01-02 09:53:13 +000025357#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025358 int mem_base;
25359 int ret_val;
25360 xmlValidCtxtPtr ctxt; /* the validation context */
25361 int n_ctxt;
25362 xmlDocPtr doc; /* a document instance */
25363 int n_doc;
25364 xmlNodePtr elem; /* an element instance */
25365 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025366
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025367 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25369 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025371 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25372 doc = gen_xmlDocPtr(n_doc, 1);
25373 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025374
25375 ret_val = xmlValidateElement(ctxt, doc, elem);
25376 desret_int(ret_val);
25377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025378 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25379 des_xmlDocPtr(n_doc, doc, 1);
25380 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025381 xmlResetLastError();
25382 if (mem_base != xmlMemBlocks()) {
25383 printf("Leak of %d blocks found in xmlValidateElement",
25384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025385 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025386 printf(" %d", n_ctxt);
25387 printf(" %d", n_doc);
25388 printf(" %d", n_elem);
25389 printf("\n");
25390 }
25391 }
25392 }
25393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025394 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025395#endif
25396
Daniel Veillard42595322004-11-08 10:52:06 +000025397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025398}
25399
25400
25401static int
25402test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025404
William M. Brack21e4ef22005-01-02 09:53:13 +000025405#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025406 int mem_base;
25407 int ret_val;
25408 xmlValidCtxtPtr ctxt; /* the validation context */
25409 int n_ctxt;
25410 xmlDocPtr doc; /* a document instance */
25411 int n_doc;
25412 xmlElementPtr elem; /* an element definition */
25413 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025414
Daniel Veillardce682bc2004-11-05 17:22:25 +000025415 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25416 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25417 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25418 mem_base = xmlMemBlocks();
25419 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25420 doc = gen_xmlDocPtr(n_doc, 1);
25421 elem = gen_xmlElementPtr(n_elem, 2);
25422
25423 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25424 desret_int(ret_val);
25425 call_tests++;
25426 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25427 des_xmlDocPtr(n_doc, doc, 1);
25428 des_xmlElementPtr(n_elem, elem, 2);
25429 xmlResetLastError();
25430 if (mem_base != xmlMemBlocks()) {
25431 printf("Leak of %d blocks found in xmlValidateElementDecl",
25432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025433 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025434 printf(" %d", n_ctxt);
25435 printf(" %d", n_doc);
25436 printf(" %d", n_elem);
25437 printf("\n");
25438 }
25439 }
25440 }
25441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025442 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025443#endif
25444
Daniel Veillard42595322004-11-08 10:52:06 +000025445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025446}
25447
25448
25449static int
25450test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025452
William M. Brack21e4ef22005-01-02 09:53:13 +000025453#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025454 int mem_base;
25455 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025456 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025457 int n_value;
25458
25459 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25460 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025461 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025462
William M. Brackf13f77f2004-11-12 16:03:48 +000025463 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025464 desret_int(ret_val);
25465 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025466 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025467 xmlResetLastError();
25468 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025469 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025471 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025472 printf(" %d", n_value);
25473 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025474 }
25475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025476 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025477#endif
25478
Daniel Veillard42595322004-11-08 10:52:06 +000025479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025480}
25481
25482
25483static int
25484test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025486
William M. Brack21e4ef22005-01-02 09:53:13 +000025487#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025488 int mem_base;
25489 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025490 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025491 int n_value;
25492
25493 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25494 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025495 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025496
William M. Brackf13f77f2004-11-12 16:03:48 +000025497 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025498 desret_int(ret_val);
25499 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025500 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025501 xmlResetLastError();
25502 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025503 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025505 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025506 printf(" %d", n_value);
25507 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025508 }
25509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025510 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025511#endif
25512
Daniel Veillard42595322004-11-08 10:52:06 +000025513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025514}
25515
25516
25517static int
25518test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025520
William M. Brack21e4ef22005-01-02 09:53:13 +000025521#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025522 int mem_base;
25523 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025524 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025525 int n_value;
25526
25527 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25528 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025529 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025530
William M. Brackf13f77f2004-11-12 16:03:48 +000025531 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025532 desret_int(ret_val);
25533 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025534 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025535 xmlResetLastError();
25536 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025537 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025539 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025540 printf(" %d", n_value);
25541 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025542 }
25543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025544 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025545#endif
25546
Daniel Veillard42595322004-11-08 10:52:06 +000025547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025548}
25549
25550
25551static int
25552test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025554
William M. Brack21e4ef22005-01-02 09:53:13 +000025555#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025556 int mem_base;
25557 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025558 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025559 int n_value;
25560
25561 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25562 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025563 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025564
William M. Brackf13f77f2004-11-12 16:03:48 +000025565 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025566 desret_int(ret_val);
25567 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025568 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025569 xmlResetLastError();
25570 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025571 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025574 printf(" %d", n_value);
25575 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025576 }
25577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025578 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025579#endif
25580
Daniel Veillard42595322004-11-08 10:52:06 +000025581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025582}
25583
25584
25585static int
25586test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025588
William M. Brack21e4ef22005-01-02 09:53:13 +000025589#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025590 int mem_base;
25591 int ret_val;
25592 xmlValidCtxtPtr ctxt; /* the validation context */
25593 int n_ctxt;
25594 xmlDocPtr doc; /* a document instance */
25595 int n_doc;
25596 xmlNotationPtr nota; /* a notation definition */
25597 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025598
Daniel Veillardce682bc2004-11-05 17:22:25 +000025599 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25600 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25601 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25602 mem_base = xmlMemBlocks();
25603 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25604 doc = gen_xmlDocPtr(n_doc, 1);
25605 nota = gen_xmlNotationPtr(n_nota, 2);
25606
25607 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25608 desret_int(ret_val);
25609 call_tests++;
25610 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25611 des_xmlDocPtr(n_doc, doc, 1);
25612 des_xmlNotationPtr(n_nota, nota, 2);
25613 xmlResetLastError();
25614 if (mem_base != xmlMemBlocks()) {
25615 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025617 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025618 printf(" %d", n_ctxt);
25619 printf(" %d", n_doc);
25620 printf(" %d", n_nota);
25621 printf("\n");
25622 }
25623 }
25624 }
25625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025626 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025627#endif
25628
Daniel Veillard42595322004-11-08 10:52:06 +000025629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025630}
25631
25632
25633static int
25634test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025636
William M. Brack21e4ef22005-01-02 09:53:13 +000025637#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025638 int mem_base;
25639 int ret_val;
25640 xmlValidCtxtPtr ctxt; /* the validation context */
25641 int n_ctxt;
25642 xmlDocPtr doc; /* the document */
25643 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025644 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025645 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025646
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025647 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25648 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25649 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025651 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25652 doc = gen_xmlDocPtr(n_doc, 1);
25653 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025654
William M. Brackf13f77f2004-11-12 16:03:48 +000025655 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025656 desret_int(ret_val);
25657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025658 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25659 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025660 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025661 xmlResetLastError();
25662 if (mem_base != xmlMemBlocks()) {
25663 printf("Leak of %d blocks found in xmlValidateNotationUse",
25664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025665 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025666 printf(" %d", n_ctxt);
25667 printf(" %d", n_doc);
25668 printf(" %d", n_notationName);
25669 printf("\n");
25670 }
25671 }
25672 }
25673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025674 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025675#endif
25676
Daniel Veillard42595322004-11-08 10:52:06 +000025677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025678}
25679
25680
25681static int
25682test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025684
William M. Brack21e4ef22005-01-02 09:53:13 +000025685#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025686 int mem_base;
25687 int ret_val;
25688 xmlValidCtxtPtr ctxt; /* the validation context */
25689 int n_ctxt;
25690 xmlDocPtr doc; /* a document instance */
25691 int n_doc;
25692 xmlNodePtr elem; /* an element instance */
25693 int n_elem;
25694 xmlAttrPtr attr; /* an attribute instance */
25695 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025696 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025697 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025698
Daniel Veillardce244ad2004-11-05 10:03:46 +000025699 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25700 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25701 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25702 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25703 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25704 mem_base = xmlMemBlocks();
25705 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25706 doc = gen_xmlDocPtr(n_doc, 1);
25707 elem = gen_xmlNodePtr(n_elem, 2);
25708 attr = gen_xmlAttrPtr(n_attr, 3);
25709 value = gen_const_xmlChar_ptr(n_value, 4);
25710
William M. Brackf13f77f2004-11-12 16:03:48 +000025711 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025712 desret_int(ret_val);
25713 call_tests++;
25714 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25715 des_xmlDocPtr(n_doc, doc, 1);
25716 des_xmlNodePtr(n_elem, elem, 2);
25717 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025718 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025719 xmlResetLastError();
25720 if (mem_base != xmlMemBlocks()) {
25721 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025723 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025724 printf(" %d", n_ctxt);
25725 printf(" %d", n_doc);
25726 printf(" %d", n_elem);
25727 printf(" %d", n_attr);
25728 printf(" %d", n_value);
25729 printf("\n");
25730 }
25731 }
25732 }
25733 }
25734 }
25735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025736 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025737#endif
25738
Daniel Veillard42595322004-11-08 10:52:06 +000025739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025740}
25741
25742
25743static int
25744test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025746
William M. Brack21e4ef22005-01-02 09:53:13 +000025747#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025748 int mem_base;
25749 int ret_val;
25750 xmlValidCtxtPtr ctxt; /* the validation context */
25751 int n_ctxt;
25752 xmlDocPtr doc; /* a document instance */
25753 int n_doc;
25754 xmlNodePtr elem; /* an element instance */
25755 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025756
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025757 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25758 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25759 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025761 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25762 doc = gen_xmlDocPtr(n_doc, 1);
25763 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025764
25765 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25766 desret_int(ret_val);
25767 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025768 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25769 des_xmlDocPtr(n_doc, doc, 1);
25770 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025771 xmlResetLastError();
25772 if (mem_base != xmlMemBlocks()) {
25773 printf("Leak of %d blocks found in xmlValidateOneElement",
25774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025775 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025776 printf(" %d", n_ctxt);
25777 printf(" %d", n_doc);
25778 printf(" %d", n_elem);
25779 printf("\n");
25780 }
25781 }
25782 }
25783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025784 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025785#endif
25786
Daniel Veillard42595322004-11-08 10:52:06 +000025787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025788}
25789
25790
25791static int
25792test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025794
William M. Brack21e4ef22005-01-02 09:53:13 +000025795#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025796 int mem_base;
25797 int ret_val;
25798 xmlValidCtxtPtr ctxt; /* the validation context */
25799 int n_ctxt;
25800 xmlDocPtr doc; /* a document instance */
25801 int n_doc;
25802 xmlNodePtr elem; /* an element instance */
25803 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025804 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025805 int n_prefix;
25806 xmlNsPtr ns; /* an namespace declaration instance */
25807 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025808 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025809 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025810
Daniel Veillard27f20102004-11-05 11:50:11 +000025811 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25812 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25813 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25814 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25815 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25816 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25817 mem_base = xmlMemBlocks();
25818 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25819 doc = gen_xmlDocPtr(n_doc, 1);
25820 elem = gen_xmlNodePtr(n_elem, 2);
25821 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25822 ns = gen_xmlNsPtr(n_ns, 4);
25823 value = gen_const_xmlChar_ptr(n_value, 5);
25824
William M. Brackf13f77f2004-11-12 16:03:48 +000025825 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025826 desret_int(ret_val);
25827 call_tests++;
25828 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25829 des_xmlDocPtr(n_doc, doc, 1);
25830 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025831 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025832 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025833 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025834 xmlResetLastError();
25835 if (mem_base != xmlMemBlocks()) {
25836 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025838 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025839 printf(" %d", n_ctxt);
25840 printf(" %d", n_doc);
25841 printf(" %d", n_elem);
25842 printf(" %d", n_prefix);
25843 printf(" %d", n_ns);
25844 printf(" %d", n_value);
25845 printf("\n");
25846 }
25847 }
25848 }
25849 }
25850 }
25851 }
25852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025853 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025854#endif
25855
Daniel Veillard42595322004-11-08 10:52:06 +000025856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025857}
25858
25859
25860static int
25861test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025863
William M. Brack21e4ef22005-01-02 09:53:13 +000025864#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025865 int mem_base;
25866 int ret_val;
25867 xmlValidCtxtPtr ctxt; /* the validation context */
25868 int n_ctxt;
25869 xmlDocPtr doc; /* a document instance */
25870 int n_doc;
25871 xmlNodePtr elem; /* an element instance */
25872 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025873 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025874 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025875
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025876 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25877 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25878 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25879 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025881 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25882 doc = gen_xmlDocPtr(n_doc, 1);
25883 elem = gen_xmlNodePtr(n_elem, 2);
25884 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025885
William M. Brackf13f77f2004-11-12 16:03:48 +000025886 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025887 desret_int(ret_val);
25888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025889 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25890 des_xmlDocPtr(n_doc, doc, 1);
25891 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025892 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025893 xmlResetLastError();
25894 if (mem_base != xmlMemBlocks()) {
25895 printf("Leak of %d blocks found in xmlValidatePopElement",
25896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025897 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025898 printf(" %d", n_ctxt);
25899 printf(" %d", n_doc);
25900 printf(" %d", n_elem);
25901 printf(" %d", n_qname);
25902 printf("\n");
25903 }
25904 }
25905 }
25906 }
25907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025908 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025909#endif
25910
Daniel Veillard42595322004-11-08 10:52:06 +000025911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025912}
25913
25914
25915static int
25916test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025918
William M. Brack21e4ef22005-01-02 09:53:13 +000025919#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025920 int mem_base;
25921 int ret_val;
25922 xmlValidCtxtPtr ctxt; /* the validation context */
25923 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025924 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025925 int n_data;
25926 int len; /* the lenght of the data */
25927 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025928
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025929 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25930 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25931 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025933 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25934 data = gen_const_xmlChar_ptr(n_data, 1);
25935 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025936
William M. Brackf13f77f2004-11-12 16:03:48 +000025937 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025938 desret_int(ret_val);
25939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025940 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025941 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025942 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025943 xmlResetLastError();
25944 if (mem_base != xmlMemBlocks()) {
25945 printf("Leak of %d blocks found in xmlValidatePushCData",
25946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025947 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025948 printf(" %d", n_ctxt);
25949 printf(" %d", n_data);
25950 printf(" %d", n_len);
25951 printf("\n");
25952 }
25953 }
25954 }
25955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025956 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025957#endif
25958
Daniel Veillard42595322004-11-08 10:52:06 +000025959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025960}
25961
25962
25963static int
25964test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025966
William M. Brack21e4ef22005-01-02 09:53:13 +000025967#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025968 int mem_base;
25969 int ret_val;
25970 xmlValidCtxtPtr ctxt; /* the validation context */
25971 int n_ctxt;
25972 xmlDocPtr doc; /* a document instance */
25973 int n_doc;
25974 xmlNodePtr elem; /* an element instance */
25975 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025976 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025977 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025978
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025979 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25980 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25981 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25982 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25983 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025984 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25985 doc = gen_xmlDocPtr(n_doc, 1);
25986 elem = gen_xmlNodePtr(n_elem, 2);
25987 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025988
William M. Brackf13f77f2004-11-12 16:03:48 +000025989 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025990 desret_int(ret_val);
25991 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025992 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25993 des_xmlDocPtr(n_doc, doc, 1);
25994 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025995 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025996 xmlResetLastError();
25997 if (mem_base != xmlMemBlocks()) {
25998 printf("Leak of %d blocks found in xmlValidatePushElement",
25999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026000 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026001 printf(" %d", n_ctxt);
26002 printf(" %d", n_doc);
26003 printf(" %d", n_elem);
26004 printf(" %d", n_qname);
26005 printf("\n");
26006 }
26007 }
26008 }
26009 }
26010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026011 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026012#endif
26013
Daniel Veillard42595322004-11-08 10:52:06 +000026014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026015}
26016
26017
26018static int
26019test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026021
William M. Brack21e4ef22005-01-02 09:53:13 +000026022#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026023 int mem_base;
26024 int ret_val;
26025 xmlValidCtxtPtr ctxt; /* the validation context */
26026 int n_ctxt;
26027 xmlDocPtr doc; /* a document instance */
26028 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026029
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026030 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26031 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026033 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26034 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026035
26036 ret_val = xmlValidateRoot(ctxt, doc);
26037 desret_int(ret_val);
26038 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026039 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26040 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026041 xmlResetLastError();
26042 if (mem_base != xmlMemBlocks()) {
26043 printf("Leak of %d blocks found in xmlValidateRoot",
26044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026045 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026046 printf(" %d", n_ctxt);
26047 printf(" %d", n_doc);
26048 printf("\n");
26049 }
26050 }
26051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026052 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026053#endif
26054
Daniel Veillard42595322004-11-08 10:52:06 +000026055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026056}
26057
26058static int
26059test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026061
Daniel Veillard2ae13382005-01-25 23:45:06 +000026062 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026063 test_ret += test_xmlAddAttributeDecl();
26064 test_ret += test_xmlAddElementDecl();
26065 test_ret += test_xmlAddID();
26066 test_ret += test_xmlAddNotationDecl();
26067 test_ret += test_xmlAddRef();
26068 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026069 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026070 test_ret += test_xmlCopyElementContent();
26071 test_ret += test_xmlCopyElementTable();
26072 test_ret += test_xmlCopyEnumeration();
26073 test_ret += test_xmlCopyNotationTable();
26074 test_ret += test_xmlCreateEnumeration();
26075 test_ret += test_xmlDumpAttributeDecl();
26076 test_ret += test_xmlDumpAttributeTable();
26077 test_ret += test_xmlDumpElementDecl();
26078 test_ret += test_xmlDumpElementTable();
26079 test_ret += test_xmlDumpNotationDecl();
26080 test_ret += test_xmlDumpNotationTable();
26081 test_ret += test_xmlGetDtdAttrDesc();
26082 test_ret += test_xmlGetDtdElementDesc();
26083 test_ret += test_xmlGetDtdNotationDesc();
26084 test_ret += test_xmlGetDtdQAttrDesc();
26085 test_ret += test_xmlGetDtdQElementDesc();
26086 test_ret += test_xmlGetID();
26087 test_ret += test_xmlGetRefs();
26088 test_ret += test_xmlIsID();
26089 test_ret += test_xmlIsMixedElement();
26090 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026091 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026092 test_ret += test_xmlNewElementContent();
26093 test_ret += test_xmlNewValidCtxt();
26094 test_ret += test_xmlRemoveID();
26095 test_ret += test_xmlRemoveRef();
26096 test_ret += test_xmlSnprintfElementContent();
26097 test_ret += test_xmlSprintfElementContent();
26098 test_ret += test_xmlValidBuildContentModel();
26099 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26100 test_ret += test_xmlValidGetPotentialChildren();
26101 test_ret += test_xmlValidGetValidElements();
26102 test_ret += test_xmlValidNormalizeAttributeValue();
26103 test_ret += test_xmlValidateAttributeDecl();
26104 test_ret += test_xmlValidateAttributeValue();
26105 test_ret += test_xmlValidateDocument();
26106 test_ret += test_xmlValidateDocumentFinal();
26107 test_ret += test_xmlValidateDtd();
26108 test_ret += test_xmlValidateDtdFinal();
26109 test_ret += test_xmlValidateElement();
26110 test_ret += test_xmlValidateElementDecl();
26111 test_ret += test_xmlValidateNameValue();
26112 test_ret += test_xmlValidateNamesValue();
26113 test_ret += test_xmlValidateNmtokenValue();
26114 test_ret += test_xmlValidateNmtokensValue();
26115 test_ret += test_xmlValidateNotationDecl();
26116 test_ret += test_xmlValidateNotationUse();
26117 test_ret += test_xmlValidateOneAttribute();
26118 test_ret += test_xmlValidateOneElement();
26119 test_ret += test_xmlValidateOneNamespace();
26120 test_ret += test_xmlValidatePopElement();
26121 test_ret += test_xmlValidatePushCData();
26122 test_ret += test_xmlValidatePushElement();
26123 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026124
Daniel Veillard42595322004-11-08 10:52:06 +000026125 if (test_ret != 0)
26126 printf("Module valid: %d errors\n", test_ret);
26127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026128}
26129
26130static int
26131test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026133
26134
26135 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026137}
26138
26139
26140static int
26141test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026143
William M. Brack21e4ef22005-01-02 09:53:13 +000026144#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026145 int mem_base;
26146 int ret_val;
26147 xmlDocPtr doc; /* an XML document */
26148 int n_doc;
26149
26150 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026152 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026153
26154 ret_val = xmlXIncludeProcess(doc);
26155 desret_int(ret_val);
26156 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026157 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026158 xmlResetLastError();
26159 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026160 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026162 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026163 printf(" %d", n_doc);
26164 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026165 }
26166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026167 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026168#endif
26169
Daniel Veillard42595322004-11-08 10:52:06 +000026170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026171}
26172
26173
26174static int
26175test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026177
William M. Brack21e4ef22005-01-02 09:53:13 +000026178#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026179 int mem_base;
26180 int ret_val;
26181 xmlDocPtr doc; /* an XML document */
26182 int n_doc;
26183 int flags; /* a set of xmlParserOption used for parsing XML includes */
26184 int n_flags;
26185
26186 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26187 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026189 doc = gen_xmlDocPtr(n_doc, 0);
26190 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026191
26192 ret_val = xmlXIncludeProcessFlags(doc, flags);
26193 desret_int(ret_val);
26194 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026195 des_xmlDocPtr(n_doc, doc, 0);
26196 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026197 xmlResetLastError();
26198 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026199 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026201 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026202 printf(" %d", n_doc);
26203 printf(" %d", n_flags);
26204 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205 }
26206 }
26207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026208 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026209#endif
26210
Daniel Veillard42595322004-11-08 10:52:06 +000026211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026212}
26213
Daniel Veillarda521d282004-11-09 14:59:59 +000026214#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026215
Daniel Veillardce682bc2004-11-05 17:22:25 +000026216#define gen_nb_xmlXIncludeCtxtPtr 1
26217static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26218 return(NULL);
26219}
26220static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26221}
Daniel Veillarda521d282004-11-09 14:59:59 +000026222#endif
26223
Daniel Veillardce682bc2004-11-05 17:22:25 +000026224
Daniel Veillardd93f6252004-11-02 15:53:51 +000026225static int
26226test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026228
William M. Brack21e4ef22005-01-02 09:53:13 +000026229#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026230 int mem_base;
26231 int ret_val;
26232 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26233 int n_ctxt;
26234 xmlNodePtr node; /* a node in an XML document */
26235 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026236
Daniel Veillardce682bc2004-11-05 17:22:25 +000026237 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26238 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26239 mem_base = xmlMemBlocks();
26240 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26241 node = gen_xmlNodePtr(n_node, 1);
26242
26243 ret_val = xmlXIncludeProcessNode(ctxt, node);
26244 desret_int(ret_val);
26245 call_tests++;
26246 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26247 des_xmlNodePtr(n_node, node, 1);
26248 xmlResetLastError();
26249 if (mem_base != xmlMemBlocks()) {
26250 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026252 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026253 printf(" %d", n_ctxt);
26254 printf(" %d", n_node);
26255 printf("\n");
26256 }
26257 }
26258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026259 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026260#endif
26261
Daniel Veillard42595322004-11-08 10:52:06 +000026262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026263}
26264
26265
26266static int
26267test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026269
William M. Brack21e4ef22005-01-02 09:53:13 +000026270#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026271 int mem_base;
26272 int ret_val;
26273 xmlNodePtr tree; /* a node in an XML document */
26274 int n_tree;
26275
26276 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026278 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026279
26280 ret_val = xmlXIncludeProcessTree(tree);
26281 desret_int(ret_val);
26282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026283 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026284 xmlResetLastError();
26285 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026286 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026288 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026289 printf(" %d", n_tree);
26290 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026291 }
26292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026293 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026294#endif
26295
Daniel Veillard42595322004-11-08 10:52:06 +000026296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026297}
26298
26299
26300static int
26301test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026303
William M. Brack21e4ef22005-01-02 09:53:13 +000026304#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026305 int mem_base;
26306 int ret_val;
26307 xmlNodePtr tree; /* a node in an XML document */
26308 int n_tree;
26309 int flags; /* a set of xmlParserOption used for parsing XML includes */
26310 int n_flags;
26311
26312 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26313 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26314 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026315 tree = gen_xmlNodePtr(n_tree, 0);
26316 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026317
26318 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26319 desret_int(ret_val);
26320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026321 des_xmlNodePtr(n_tree, tree, 0);
26322 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026323 xmlResetLastError();
26324 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026325 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026327 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026328 printf(" %d", n_tree);
26329 printf(" %d", n_flags);
26330 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026331 }
26332 }
26333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026334 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026335#endif
26336
Daniel Veillard42595322004-11-08 10:52:06 +000026337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026338}
26339
26340
26341static int
26342test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026344
William M. Brack21e4ef22005-01-02 09:53:13 +000026345#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026346 int mem_base;
26347 int ret_val;
26348 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26349 int n_ctxt;
26350 int flags; /* a set of xmlParserOption used for parsing XML includes */
26351 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026352
Daniel Veillardce682bc2004-11-05 17:22:25 +000026353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26354 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26355 mem_base = xmlMemBlocks();
26356 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26357 flags = gen_int(n_flags, 1);
26358
26359 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26360 desret_int(ret_val);
26361 call_tests++;
26362 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26363 des_int(n_flags, flags, 1);
26364 xmlResetLastError();
26365 if (mem_base != xmlMemBlocks()) {
26366 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026368 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026369 printf(" %d", n_ctxt);
26370 printf(" %d", n_flags);
26371 printf("\n");
26372 }
26373 }
26374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026375 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026376#endif
26377
Daniel Veillard42595322004-11-08 10:52:06 +000026378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379}
26380
26381static int
26382test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026384
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026385 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026386 test_ret += test_xmlXIncludeNewContext();
26387 test_ret += test_xmlXIncludeProcess();
26388 test_ret += test_xmlXIncludeProcessFlags();
26389 test_ret += test_xmlXIncludeProcessNode();
26390 test_ret += test_xmlXIncludeProcessTree();
26391 test_ret += test_xmlXIncludeProcessTreeFlags();
26392 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026393
Daniel Veillard42595322004-11-08 10:52:06 +000026394 if (test_ret != 0)
26395 printf("Module xinclude: %d errors\n", test_ret);
26396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026397}
26398
26399static int
26400test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026402
William M. Brack21e4ef22005-01-02 09:53:13 +000026403#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026404 int mem_base;
26405 xmlOutputBufferPtr ret_val;
26406 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26407 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026408
Daniel Veillard3d95c732004-11-06 22:25:14 +000026409 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26410 mem_base = xmlMemBlocks();
26411 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26412
26413 ret_val = xmlAllocOutputBuffer(encoder);
26414 desret_xmlOutputBufferPtr(ret_val);
26415 call_tests++;
26416 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26417 xmlResetLastError();
26418 if (mem_base != xmlMemBlocks()) {
26419 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026421 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026422 printf(" %d", n_encoder);
26423 printf("\n");
26424 }
26425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026426 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026427#endif
26428
Daniel Veillard42595322004-11-08 10:52:06 +000026429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026430}
26431
26432
26433static int
26434test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026436
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026437 int mem_base;
26438 xmlParserInputBufferPtr ret_val;
26439 xmlCharEncoding enc; /* the charset encoding if known */
26440 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026441
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026442 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26443 mem_base = xmlMemBlocks();
26444 enc = gen_xmlCharEncoding(n_enc, 0);
26445
26446 ret_val = xmlAllocParserInputBuffer(enc);
26447 desret_xmlParserInputBufferPtr(ret_val);
26448 call_tests++;
26449 des_xmlCharEncoding(n_enc, enc, 0);
26450 xmlResetLastError();
26451 if (mem_base != xmlMemBlocks()) {
26452 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026454 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026455 printf(" %d", n_enc);
26456 printf("\n");
26457 }
26458 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026460
Daniel Veillard42595322004-11-08 10:52:06 +000026461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026462}
26463
26464
26465static int
26466test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026468
26469 int mem_base;
26470 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026471 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026472 int n_path;
26473
26474 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26475 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026476 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026477
William M. Brackf13f77f2004-11-12 16:03:48 +000026478 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026479 desret_int(ret_val);
26480 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026481 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026482 xmlResetLastError();
26483 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026484 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026486 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026487 printf(" %d", n_path);
26488 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026489 }
26490 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026491 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026492
Daniel Veillard42595322004-11-08 10:52:06 +000026493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026494}
26495
26496
26497static int
26498test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026500
Daniel Veillard42595322004-11-08 10:52:06 +000026501 int mem_base;
26502 xmlParserInputPtr ret_val;
26503 xmlParserCtxtPtr ctxt; /* an XML parser context */
26504 int n_ctxt;
26505 xmlParserInputPtr ret; /* an XML parser input */
26506 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026507
Daniel Veillard42595322004-11-08 10:52:06 +000026508 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26509 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26510 mem_base = xmlMemBlocks();
26511 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26512 ret = gen_xmlParserInputPtr(n_ret, 1);
26513
26514 ret_val = xmlCheckHTTPInput(ctxt, ret);
26515 desret_xmlParserInputPtr(ret_val);
26516 call_tests++;
26517 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26518 des_xmlParserInputPtr(n_ret, ret, 1);
26519 xmlResetLastError();
26520 if (mem_base != xmlMemBlocks()) {
26521 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26522 xmlMemBlocks() - mem_base);
26523 test_ret++;
26524 printf(" %d", n_ctxt);
26525 printf(" %d", n_ret);
26526 printf("\n");
26527 }
26528 }
26529 }
Daniel Veillard42595322004-11-08 10:52:06 +000026530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026531
Daniel Veillard42595322004-11-08 10:52:06 +000026532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026533}
26534
26535
26536static int
26537test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026539
26540 int mem_base;
26541
26542 mem_base = xmlMemBlocks();
26543
26544 xmlCleanupInputCallbacks();
26545 call_tests++;
26546 xmlResetLastError();
26547 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026548 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026550 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026551 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026552 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026554
Daniel Veillard42595322004-11-08 10:52:06 +000026555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026556}
26557
26558
26559static int
26560test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026562
William M. Brack21e4ef22005-01-02 09:53:13 +000026563#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026564 int mem_base;
26565
26566 mem_base = xmlMemBlocks();
26567
26568 xmlCleanupOutputCallbacks();
26569 call_tests++;
26570 xmlResetLastError();
26571 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026572 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026574 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026575 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026577 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026578#endif
26579
Daniel Veillard42595322004-11-08 10:52:06 +000026580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026581}
26582
26583
26584static int
26585test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026587
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026588 int mem_base;
26589 int ret_val;
26590 void * context; /* the I/O context */
26591 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026592
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026593 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26594 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026595 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026596
26597 ret_val = xmlFileClose(context);
26598 desret_int(ret_val);
26599 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026600 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026601 xmlResetLastError();
26602 if (mem_base != xmlMemBlocks()) {
26603 printf("Leak of %d blocks found in xmlFileClose",
26604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026605 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026606 printf(" %d", n_context);
26607 printf("\n");
26608 }
26609 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026610 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026611
Daniel Veillard42595322004-11-08 10:52:06 +000026612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026613}
26614
26615
26616static int
26617test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026619
26620 int mem_base;
26621 int ret_val;
26622 const char * filename; /* the URI for matching */
26623 int n_filename;
26624
26625 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026627 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026628
26629 ret_val = xmlFileMatch(filename);
26630 desret_int(ret_val);
26631 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026632 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026633 xmlResetLastError();
26634 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026635 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026637 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026638 printf(" %d", n_filename);
26639 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026640 }
26641 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026643
Daniel Veillard42595322004-11-08 10:52:06 +000026644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026645}
26646
26647
26648static int
26649test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026651
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026652 int mem_base;
26653 void * ret_val;
26654 const char * filename; /* the URI for matching */
26655 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026656
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026657 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026659 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026660
26661 ret_val = xmlFileOpen(filename);
26662 desret_void_ptr(ret_val);
26663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026664 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026665 xmlResetLastError();
26666 if (mem_base != xmlMemBlocks()) {
26667 printf("Leak of %d blocks found in xmlFileOpen",
26668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026669 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026670 printf(" %d", n_filename);
26671 printf("\n");
26672 }
26673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026675
Daniel Veillard42595322004-11-08 10:52:06 +000026676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026677}
26678
26679
26680static int
26681test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026683
Daniel Veillardce682bc2004-11-05 17:22:25 +000026684 int mem_base;
26685 int ret_val;
26686 void * context; /* the I/O context */
26687 int n_context;
26688 char * buffer; /* where to drop data */
26689 int n_buffer;
26690 int len; /* number of bytes to write */
26691 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026692
Daniel Veillardce682bc2004-11-05 17:22:25 +000026693 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26694 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26695 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26696 mem_base = xmlMemBlocks();
26697 context = gen_void_ptr(n_context, 0);
26698 buffer = gen_char_ptr(n_buffer, 1);
26699 len = gen_int(n_len, 2);
26700
26701 ret_val = xmlFileRead(context, buffer, len);
26702 desret_int(ret_val);
26703 call_tests++;
26704 des_void_ptr(n_context, context, 0);
26705 des_char_ptr(n_buffer, buffer, 1);
26706 des_int(n_len, len, 2);
26707 xmlResetLastError();
26708 if (mem_base != xmlMemBlocks()) {
26709 printf("Leak of %d blocks found in xmlFileRead",
26710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026711 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026712 printf(" %d", n_context);
26713 printf(" %d", n_buffer);
26714 printf(" %d", n_len);
26715 printf("\n");
26716 }
26717 }
26718 }
26719 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026720 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026721
Daniel Veillard42595322004-11-08 10:52:06 +000026722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026723}
26724
26725
26726static int
26727test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026729
William M. Brack21e4ef22005-01-02 09:53:13 +000026730#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026731 int mem_base;
26732 int ret_val;
26733 void * context; /* the I/O context */
26734 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026735
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026736 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026738 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026739
26740 ret_val = xmlIOFTPClose(context);
26741 desret_int(ret_val);
26742 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026743 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026744 xmlResetLastError();
26745 if (mem_base != xmlMemBlocks()) {
26746 printf("Leak of %d blocks found in xmlIOFTPClose",
26747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026748 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026749 printf(" %d", n_context);
26750 printf("\n");
26751 }
26752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026753 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026754#endif
26755
Daniel Veillard42595322004-11-08 10:52:06 +000026756 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026757}
26758
26759
26760static int
26761test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026762 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026763
William M. Brack21e4ef22005-01-02 09:53:13 +000026764#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026765 int mem_base;
26766 int ret_val;
26767 const char * filename; /* the URI for matching */
26768 int n_filename;
26769
26770 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26771 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026772 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026773
26774 ret_val = xmlIOFTPMatch(filename);
26775 desret_int(ret_val);
26776 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026777 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026778 xmlResetLastError();
26779 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026780 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026782 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026783 printf(" %d", n_filename);
26784 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026785 }
26786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026787 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026788#endif
26789
Daniel Veillard42595322004-11-08 10:52:06 +000026790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026791}
26792
26793
26794static int
26795test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026797
William M. Brack21e4ef22005-01-02 09:53:13 +000026798#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026799 int mem_base;
26800 void * ret_val;
26801 const char * filename; /* the URI for matching */
26802 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026803
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026804 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026806 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026807
26808 ret_val = xmlIOFTPOpen(filename);
26809 desret_void_ptr(ret_val);
26810 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026811 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026812 xmlResetLastError();
26813 if (mem_base != xmlMemBlocks()) {
26814 printf("Leak of %d blocks found in xmlIOFTPOpen",
26815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026816 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026817 printf(" %d", n_filename);
26818 printf("\n");
26819 }
26820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026821 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026822#endif
26823
Daniel Veillard42595322004-11-08 10:52:06 +000026824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026825}
26826
26827
26828static int
26829test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026831
William M. Brack21e4ef22005-01-02 09:53:13 +000026832#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026833 int mem_base;
26834 int ret_val;
26835 void * context; /* the I/O context */
26836 int n_context;
26837 char * buffer; /* where to drop data */
26838 int n_buffer;
26839 int len; /* number of bytes to write */
26840 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026841
Daniel Veillardce682bc2004-11-05 17:22:25 +000026842 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26843 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26844 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26845 mem_base = xmlMemBlocks();
26846 context = gen_void_ptr(n_context, 0);
26847 buffer = gen_char_ptr(n_buffer, 1);
26848 len = gen_int(n_len, 2);
26849
26850 ret_val = xmlIOFTPRead(context, buffer, len);
26851 desret_int(ret_val);
26852 call_tests++;
26853 des_void_ptr(n_context, context, 0);
26854 des_char_ptr(n_buffer, buffer, 1);
26855 des_int(n_len, len, 2);
26856 xmlResetLastError();
26857 if (mem_base != xmlMemBlocks()) {
26858 printf("Leak of %d blocks found in xmlIOFTPRead",
26859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026860 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026861 printf(" %d", n_context);
26862 printf(" %d", n_buffer);
26863 printf(" %d", n_len);
26864 printf("\n");
26865 }
26866 }
26867 }
26868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026869 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026870#endif
26871
Daniel Veillard42595322004-11-08 10:52:06 +000026872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026873}
26874
26875
26876static int
26877test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026879
William M. Brack21e4ef22005-01-02 09:53:13 +000026880#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026881 int mem_base;
26882 int ret_val;
26883 void * context; /* the I/O context */
26884 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026885
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026886 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26887 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026888 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026889
26890 ret_val = xmlIOHTTPClose(context);
26891 desret_int(ret_val);
26892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026893 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026894 xmlResetLastError();
26895 if (mem_base != xmlMemBlocks()) {
26896 printf("Leak of %d blocks found in xmlIOHTTPClose",
26897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026898 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026899 printf(" %d", n_context);
26900 printf("\n");
26901 }
26902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026903 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026904#endif
26905
Daniel Veillard42595322004-11-08 10:52:06 +000026906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026907}
26908
26909
26910static int
26911test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026913
William M. Brack21e4ef22005-01-02 09:53:13 +000026914#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026915 int mem_base;
26916 int ret_val;
26917 const char * filename; /* the URI for matching */
26918 int n_filename;
26919
26920 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26921 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026922 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026923
26924 ret_val = xmlIOHTTPMatch(filename);
26925 desret_int(ret_val);
26926 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026927 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026928 xmlResetLastError();
26929 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026930 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026932 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026933 printf(" %d", n_filename);
26934 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026935 }
26936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026937 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026938#endif
26939
Daniel Veillard42595322004-11-08 10:52:06 +000026940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026941}
26942
26943
26944static int
26945test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026947
William M. Brack21e4ef22005-01-02 09:53:13 +000026948#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026949 int mem_base;
26950 void * ret_val;
26951 const char * filename; /* the URI for matching */
26952 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026953
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026954 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026956 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026957
26958 ret_val = xmlIOHTTPOpen(filename);
William M. Brack015ccb22005-02-13 08:18:52 +000026959 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026961 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026962 xmlResetLastError();
26963 if (mem_base != xmlMemBlocks()) {
26964 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026966 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026967 printf(" %d", n_filename);
26968 printf("\n");
26969 }
26970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026971 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026972#endif
26973
Daniel Veillard42595322004-11-08 10:52:06 +000026974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026975}
26976
26977
26978static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000026979test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026981
William M. Brack21e4ef22005-01-02 09:53:13 +000026982#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026983 int mem_base;
26984 int ret_val;
26985 void * context; /* the I/O context */
26986 int n_context;
26987 char * buffer; /* where to drop data */
26988 int n_buffer;
26989 int len; /* number of bytes to write */
26990 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026991
Daniel Veillardce682bc2004-11-05 17:22:25 +000026992 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26993 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26994 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26995 mem_base = xmlMemBlocks();
26996 context = gen_void_ptr(n_context, 0);
26997 buffer = gen_char_ptr(n_buffer, 1);
26998 len = gen_int(n_len, 2);
26999
27000 ret_val = xmlIOHTTPRead(context, buffer, len);
27001 desret_int(ret_val);
27002 call_tests++;
27003 des_void_ptr(n_context, context, 0);
27004 des_char_ptr(n_buffer, buffer, 1);
27005 des_int(n_len, len, 2);
27006 xmlResetLastError();
27007 if (mem_base != xmlMemBlocks()) {
27008 printf("Leak of %d blocks found in xmlIOHTTPRead",
27009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027010 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027011 printf(" %d", n_context);
27012 printf(" %d", n_buffer);
27013 printf(" %d", n_len);
27014 printf("\n");
27015 }
27016 }
27017 }
27018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027019 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027020#endif
27021
Daniel Veillard42595322004-11-08 10:52:06 +000027022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027023}
27024
27025
27026static int
27027test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027029
Daniel Veillard42595322004-11-08 10:52:06 +000027030 int mem_base;
27031 xmlParserInputPtr ret_val;
27032 const char * URL; /* the URL for the entity to load */
27033 int n_URL;
27034 char * ID; /* the System ID for the entity to load */
27035 int n_ID;
27036 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
27037 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027038
Daniel Veillard42595322004-11-08 10:52:06 +000027039 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
27040 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
27041 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
27042 mem_base = xmlMemBlocks();
27043 URL = gen_filepath(n_URL, 0);
27044 ID = gen_const_char_ptr(n_ID, 1);
27045 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
27046
William M. Brackf13f77f2004-11-12 16:03:48 +000027047 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000027048 desret_xmlParserInputPtr(ret_val);
27049 call_tests++;
27050 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027051 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000027052 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
27053 xmlResetLastError();
27054 if (mem_base != xmlMemBlocks()) {
27055 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
27056 xmlMemBlocks() - mem_base);
27057 test_ret++;
27058 printf(" %d", n_URL);
27059 printf(" %d", n_ID);
27060 printf(" %d", n_ctxt);
27061 printf("\n");
27062 }
27063 }
27064 }
27065 }
Daniel Veillard42595322004-11-08 10:52:06 +000027066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027067
Daniel Veillard42595322004-11-08 10:52:06 +000027068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027069}
27070
27071
27072static int
27073test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027075
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027076 int mem_base;
27077 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027078 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027079 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027080
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027081 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
27082 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027083 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027084
William M. Brackf13f77f2004-11-12 16:03:48 +000027085 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027086 desret_xmlChar_ptr(ret_val);
27087 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027088 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027089 xmlResetLastError();
27090 if (mem_base != xmlMemBlocks()) {
27091 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027093 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027094 printf(" %d", n_path);
27095 printf("\n");
27096 }
27097 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027098 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027099
Daniel Veillard42595322004-11-08 10:52:06 +000027100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027101}
27102
27103
27104static int
27105test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027107
William M. Brack21e4ef22005-01-02 09:53:13 +000027108#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027109 int mem_base;
27110 xmlOutputBufferPtr ret_val;
27111 int fd; /* a file descriptor number */
27112 int n_fd;
27113 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27114 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027115
Daniel Veillard3d95c732004-11-06 22:25:14 +000027116 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27117 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27118 mem_base = xmlMemBlocks();
27119 fd = gen_int(n_fd, 0);
27120 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27121
27122 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27123 desret_xmlOutputBufferPtr(ret_val);
27124 call_tests++;
27125 des_int(n_fd, fd, 0);
27126 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27127 xmlResetLastError();
27128 if (mem_base != xmlMemBlocks()) {
27129 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027131 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027132 printf(" %d", n_fd);
27133 printf(" %d", n_encoder);
27134 printf("\n");
27135 }
27136 }
27137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027138 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027139#endif
27140
Daniel Veillard42595322004-11-08 10:52:06 +000027141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027142}
27143
27144
27145static int
27146test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027148
William M. Brack21e4ef22005-01-02 09:53:13 +000027149#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027150 int mem_base;
27151 xmlOutputBufferPtr ret_val;
27152 FILE * file; /* a FILE* */
27153 int n_file;
27154 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27155 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027156
Daniel Veillard3d95c732004-11-06 22:25:14 +000027157 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27158 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27159 mem_base = xmlMemBlocks();
27160 file = gen_FILE_ptr(n_file, 0);
27161 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27162
27163 ret_val = xmlOutputBufferCreateFile(file, encoder);
27164 desret_xmlOutputBufferPtr(ret_val);
27165 call_tests++;
27166 des_FILE_ptr(n_file, file, 0);
27167 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27168 xmlResetLastError();
27169 if (mem_base != xmlMemBlocks()) {
27170 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027172 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027173 printf(" %d", n_file);
27174 printf(" %d", n_encoder);
27175 printf("\n");
27176 }
27177 }
27178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027179 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027180#endif
27181
Daniel Veillard42595322004-11-08 10:52:06 +000027182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027183}
27184
27185
27186static int
27187test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027189
William M. Brack21e4ef22005-01-02 09:53:13 +000027190#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027191 int mem_base;
27192 xmlOutputBufferPtr ret_val;
27193 const char * URI; /* a C string containing the URI or filename */
27194 int n_URI;
27195 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27196 int n_encoder;
27197 int compression; /* the compression ration (0 none, 9 max). */
27198 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027199
Daniel Veillard42595322004-11-08 10:52:06 +000027200 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027201 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27202 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27203 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027204 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027205 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27206 compression = gen_int(n_compression, 2);
27207
27208 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27209 desret_xmlOutputBufferPtr(ret_val);
27210 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027211 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027212 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27213 des_int(n_compression, compression, 2);
27214 xmlResetLastError();
27215 if (mem_base != xmlMemBlocks()) {
27216 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027218 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027219 printf(" %d", n_URI);
27220 printf(" %d", n_encoder);
27221 printf(" %d", n_compression);
27222 printf("\n");
27223 }
27224 }
27225 }
27226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027227 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027228#endif
27229
Daniel Veillard42595322004-11-08 10:52:06 +000027230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027231}
27232
27233
27234static int
27235test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027237
William M. Brack21e4ef22005-01-02 09:53:13 +000027238#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027239 int mem_base;
27240 int ret_val;
27241 xmlOutputBufferPtr out; /* a buffered output */
27242 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027243
Daniel Veillard3d97e662004-11-04 10:49:00 +000027244 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27245 mem_base = xmlMemBlocks();
27246 out = gen_xmlOutputBufferPtr(n_out, 0);
27247
27248 ret_val = xmlOutputBufferFlush(out);
27249 desret_int(ret_val);
27250 call_tests++;
27251 des_xmlOutputBufferPtr(n_out, out, 0);
27252 xmlResetLastError();
27253 if (mem_base != xmlMemBlocks()) {
27254 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027256 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027257 printf(" %d", n_out);
27258 printf("\n");
27259 }
27260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027261 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027262#endif
27263
Daniel Veillard42595322004-11-08 10:52:06 +000027264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027265}
27266
27267
27268static int
27269test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027271
William M. Brack21e4ef22005-01-02 09:53:13 +000027272#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027273 int mem_base;
27274 int ret_val;
27275 xmlOutputBufferPtr out; /* a buffered parser output */
27276 int n_out;
27277 int len; /* the size in bytes of the array. */
27278 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027279 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027280 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027281
Daniel Veillard3d97e662004-11-04 10:49:00 +000027282 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27283 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27284 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27285 mem_base = xmlMemBlocks();
27286 out = gen_xmlOutputBufferPtr(n_out, 0);
27287 len = gen_int(n_len, 1);
27288 buf = gen_const_char_ptr(n_buf, 2);
27289
William M. Brackf13f77f2004-11-12 16:03:48 +000027290 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027291 desret_int(ret_val);
27292 call_tests++;
27293 des_xmlOutputBufferPtr(n_out, out, 0);
27294 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027295 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027296 xmlResetLastError();
27297 if (mem_base != xmlMemBlocks()) {
27298 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027300 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027301 printf(" %d", n_out);
27302 printf(" %d", n_len);
27303 printf(" %d", n_buf);
27304 printf("\n");
27305 }
27306 }
27307 }
27308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027309 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027310#endif
27311
Daniel Veillard42595322004-11-08 10:52:06 +000027312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027313}
27314
27315
27316static int
27317test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027319
27320
27321 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027323}
27324
27325
27326static int
27327test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027329
William M. Brack21e4ef22005-01-02 09:53:13 +000027330#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027331 int mem_base;
27332 int ret_val;
27333 xmlOutputBufferPtr out; /* a buffered parser output */
27334 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027335 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027336 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027337
Daniel Veillard3d97e662004-11-04 10:49:00 +000027338 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27339 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27340 mem_base = xmlMemBlocks();
27341 out = gen_xmlOutputBufferPtr(n_out, 0);
27342 str = gen_const_char_ptr(n_str, 1);
27343
William M. Brackf13f77f2004-11-12 16:03:48 +000027344 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027345 desret_int(ret_val);
27346 call_tests++;
27347 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027348 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027349 xmlResetLastError();
27350 if (mem_base != xmlMemBlocks()) {
27351 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027353 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027354 printf(" %d", n_out);
27355 printf(" %d", n_str);
27356 printf("\n");
27357 }
27358 }
27359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027360 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027361#endif
27362
Daniel Veillard42595322004-11-08 10:52:06 +000027363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027364}
27365
27366
27367static int
27368test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027370
27371
27372 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027374}
27375
27376
27377static int
27378test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027380
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027381 int mem_base;
27382 xmlParserInputBufferPtr ret_val;
27383 int fd; /* a file descriptor number */
27384 int n_fd;
27385 xmlCharEncoding enc; /* the charset encoding if known */
27386 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027387
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027388 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27389 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27390 mem_base = xmlMemBlocks();
27391 fd = gen_int(n_fd, 0);
27392 enc = gen_xmlCharEncoding(n_enc, 1);
27393 if (fd >= 0) fd = -1;
27394
27395 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27396 desret_xmlParserInputBufferPtr(ret_val);
27397 call_tests++;
27398 des_int(n_fd, fd, 0);
27399 des_xmlCharEncoding(n_enc, enc, 1);
27400 xmlResetLastError();
27401 if (mem_base != xmlMemBlocks()) {
27402 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027404 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027405 printf(" %d", n_fd);
27406 printf(" %d", n_enc);
27407 printf("\n");
27408 }
27409 }
27410 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027412
Daniel Veillard42595322004-11-08 10:52:06 +000027413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027414}
27415
27416
27417static int
27418test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027420
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027421 int mem_base;
27422 xmlParserInputBufferPtr ret_val;
27423 FILE * file; /* a FILE* */
27424 int n_file;
27425 xmlCharEncoding enc; /* the charset encoding if known */
27426 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027427
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027428 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27429 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27430 mem_base = xmlMemBlocks();
27431 file = gen_FILE_ptr(n_file, 0);
27432 enc = gen_xmlCharEncoding(n_enc, 1);
27433
27434 ret_val = xmlParserInputBufferCreateFile(file, enc);
27435 desret_xmlParserInputBufferPtr(ret_val);
27436 call_tests++;
27437 des_FILE_ptr(n_file, file, 0);
27438 des_xmlCharEncoding(n_enc, enc, 1);
27439 xmlResetLastError();
27440 if (mem_base != xmlMemBlocks()) {
27441 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027443 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027444 printf(" %d", n_file);
27445 printf(" %d", n_enc);
27446 printf("\n");
27447 }
27448 }
27449 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027451
Daniel Veillard42595322004-11-08 10:52:06 +000027452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027453}
27454
27455
27456static int
27457test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027459
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027460 int mem_base;
27461 xmlParserInputBufferPtr ret_val;
27462 const char * URI; /* a C string containing the URI or filename */
27463 int n_URI;
27464 xmlCharEncoding enc; /* the charset encoding if known */
27465 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027466
Daniel Veillard42595322004-11-08 10:52:06 +000027467 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027468 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27469 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027470 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027471 enc = gen_xmlCharEncoding(n_enc, 1);
27472
27473 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27474 desret_xmlParserInputBufferPtr(ret_val);
27475 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027476 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027477 des_xmlCharEncoding(n_enc, enc, 1);
27478 xmlResetLastError();
27479 if (mem_base != xmlMemBlocks()) {
27480 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027482 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027483 printf(" %d", n_URI);
27484 printf(" %d", n_enc);
27485 printf("\n");
27486 }
27487 }
27488 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027490
Daniel Veillard42595322004-11-08 10:52:06 +000027491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027492}
27493
27494
27495static int
27496test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027498
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027499 int mem_base;
27500 xmlParserInputBufferPtr ret_val;
27501 char * mem; /* the memory input */
27502 int n_mem;
27503 int size; /* the length of the memory block */
27504 int n_size;
27505 xmlCharEncoding enc; /* the charset encoding if known */
27506 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027507
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027508 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27509 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27510 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27511 mem_base = xmlMemBlocks();
27512 mem = gen_const_char_ptr(n_mem, 0);
27513 size = gen_int(n_size, 1);
27514 enc = gen_xmlCharEncoding(n_enc, 2);
27515
William M. Brackf13f77f2004-11-12 16:03:48 +000027516 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027517 desret_xmlParserInputBufferPtr(ret_val);
27518 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027519 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027520 des_int(n_size, size, 1);
27521 des_xmlCharEncoding(n_enc, enc, 2);
27522 xmlResetLastError();
27523 if (mem_base != xmlMemBlocks()) {
27524 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027526 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027527 printf(" %d", n_mem);
27528 printf(" %d", n_size);
27529 printf(" %d", n_enc);
27530 printf("\n");
27531 }
27532 }
27533 }
27534 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027536
Daniel Veillard42595322004-11-08 10:52:06 +000027537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027538}
27539
27540
27541static int
27542test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027544
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027545 int mem_base;
27546 xmlParserInputBufferPtr ret_val;
27547 char * mem; /* the memory input */
27548 int n_mem;
27549 int size; /* the length of the memory block */
27550 int n_size;
27551 xmlCharEncoding enc; /* the charset encoding if known */
27552 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027553
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027554 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27555 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27556 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27557 mem_base = xmlMemBlocks();
27558 mem = gen_const_char_ptr(n_mem, 0);
27559 size = gen_int(n_size, 1);
27560 enc = gen_xmlCharEncoding(n_enc, 2);
27561
William M. Brackf13f77f2004-11-12 16:03:48 +000027562 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027563 desret_xmlParserInputBufferPtr(ret_val);
27564 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027565 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027566 des_int(n_size, size, 1);
27567 des_xmlCharEncoding(n_enc, enc, 2);
27568 xmlResetLastError();
27569 if (mem_base != xmlMemBlocks()) {
27570 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027572 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027573 printf(" %d", n_mem);
27574 printf(" %d", n_size);
27575 printf(" %d", n_enc);
27576 printf("\n");
27577 }
27578 }
27579 }
27580 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027582
Daniel Veillard42595322004-11-08 10:52:06 +000027583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027584}
27585
27586
27587static int
27588test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027590
Daniel Veillard34099b42004-11-04 17:34:35 +000027591 int mem_base;
27592 int ret_val;
27593 xmlParserInputBufferPtr in; /* a buffered parser input */
27594 int n_in;
27595 int len; /* indicative value of the amount of chars to read */
27596 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027597
Daniel Veillard34099b42004-11-04 17:34:35 +000027598 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27599 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27600 mem_base = xmlMemBlocks();
27601 in = gen_xmlParserInputBufferPtr(n_in, 0);
27602 len = gen_int(n_len, 1);
27603
27604 ret_val = xmlParserInputBufferGrow(in, len);
27605 desret_int(ret_val);
27606 call_tests++;
27607 des_xmlParserInputBufferPtr(n_in, in, 0);
27608 des_int(n_len, len, 1);
27609 xmlResetLastError();
27610 if (mem_base != xmlMemBlocks()) {
27611 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027613 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027614 printf(" %d", n_in);
27615 printf(" %d", n_len);
27616 printf("\n");
27617 }
27618 }
27619 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027620 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027621
Daniel Veillard42595322004-11-08 10:52:06 +000027622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027623}
27624
27625
27626static int
27627test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027629
Daniel Veillard34099b42004-11-04 17:34:35 +000027630 int mem_base;
27631 int ret_val;
27632 xmlParserInputBufferPtr in; /* a buffered parser input */
27633 int n_in;
27634 int len; /* the size in bytes of the array. */
27635 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027636 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027637 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027638
Daniel Veillard34099b42004-11-04 17:34:35 +000027639 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27640 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27641 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27642 mem_base = xmlMemBlocks();
27643 in = gen_xmlParserInputBufferPtr(n_in, 0);
27644 len = gen_int(n_len, 1);
27645 buf = gen_const_char_ptr(n_buf, 2);
27646
William M. Brackf13f77f2004-11-12 16:03:48 +000027647 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027648 desret_int(ret_val);
27649 call_tests++;
27650 des_xmlParserInputBufferPtr(n_in, in, 0);
27651 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027652 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027653 xmlResetLastError();
27654 if (mem_base != xmlMemBlocks()) {
27655 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027657 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027658 printf(" %d", n_in);
27659 printf(" %d", n_len);
27660 printf(" %d", n_buf);
27661 printf("\n");
27662 }
27663 }
27664 }
27665 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027666 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027667
Daniel Veillard42595322004-11-08 10:52:06 +000027668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027669}
27670
27671
27672static int
27673test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027675
Daniel Veillard34099b42004-11-04 17:34:35 +000027676 int mem_base;
27677 int ret_val;
27678 xmlParserInputBufferPtr in; /* a buffered parser input */
27679 int n_in;
27680 int len; /* indicative value of the amount of chars to read */
27681 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027682
Daniel Veillard34099b42004-11-04 17:34:35 +000027683 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27684 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27685 mem_base = xmlMemBlocks();
27686 in = gen_xmlParserInputBufferPtr(n_in, 0);
27687 len = gen_int(n_len, 1);
27688
27689 ret_val = xmlParserInputBufferRead(in, len);
27690 desret_int(ret_val);
27691 call_tests++;
27692 des_xmlParserInputBufferPtr(n_in, in, 0);
27693 des_int(n_len, len, 1);
27694 xmlResetLastError();
27695 if (mem_base != xmlMemBlocks()) {
27696 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027698 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027699 printf(" %d", n_in);
27700 printf(" %d", n_len);
27701 printf("\n");
27702 }
27703 }
27704 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027705 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027706
Daniel Veillard42595322004-11-08 10:52:06 +000027707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027708}
27709
27710
27711static int
27712test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027714
27715 int mem_base;
27716 int ret_val;
27717
27718 mem_base = xmlMemBlocks();
27719
27720 ret_val = xmlPopInputCallbacks();
27721 desret_int(ret_val);
27722 call_tests++;
27723 xmlResetLastError();
27724 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027725 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027727 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027728 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027729 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027731
Daniel Veillard42595322004-11-08 10:52:06 +000027732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027733}
27734
27735
27736static int
27737test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027739
27740 int mem_base;
27741
27742 mem_base = xmlMemBlocks();
27743
27744 xmlRegisterDefaultInputCallbacks();
27745 call_tests++;
27746 xmlResetLastError();
27747 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027748 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027750 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027751 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027752 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027753 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027754
Daniel Veillard42595322004-11-08 10:52:06 +000027755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027756}
27757
27758
27759static int
27760test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027762
William M. Brack21e4ef22005-01-02 09:53:13 +000027763#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027764 int mem_base;
27765
27766 mem_base = xmlMemBlocks();
27767
27768 xmlRegisterDefaultOutputCallbacks();
27769 call_tests++;
27770 xmlResetLastError();
27771 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027772 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027774 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027775 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027777 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027778#endif
27779
Daniel Veillard42595322004-11-08 10:52:06 +000027780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027781}
27782
27783
27784static int
27785test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027787
William M. Brack21e4ef22005-01-02 09:53:13 +000027788#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027789 int mem_base;
27790
27791 mem_base = xmlMemBlocks();
27792
27793 xmlRegisterHTTPPostCallbacks();
27794 call_tests++;
27795 xmlResetLastError();
27796 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027797 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027799 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027800 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027802 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027803#endif
27804
Daniel Veillard42595322004-11-08 10:52:06 +000027805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027806}
27807
27808static int
27809test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027811
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027812 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027813 test_ret += test_xmlAllocOutputBuffer();
27814 test_ret += test_xmlAllocParserInputBuffer();
27815 test_ret += test_xmlCheckFilename();
27816 test_ret += test_xmlCheckHTTPInput();
27817 test_ret += test_xmlCleanupInputCallbacks();
27818 test_ret += test_xmlCleanupOutputCallbacks();
27819 test_ret += test_xmlFileClose();
27820 test_ret += test_xmlFileMatch();
27821 test_ret += test_xmlFileOpen();
27822 test_ret += test_xmlFileRead();
27823 test_ret += test_xmlIOFTPClose();
27824 test_ret += test_xmlIOFTPMatch();
27825 test_ret += test_xmlIOFTPOpen();
27826 test_ret += test_xmlIOFTPRead();
27827 test_ret += test_xmlIOHTTPClose();
27828 test_ret += test_xmlIOHTTPMatch();
27829 test_ret += test_xmlIOHTTPOpen();
Daniel Veillard42595322004-11-08 10:52:06 +000027830 test_ret += test_xmlIOHTTPRead();
27831 test_ret += test_xmlNoNetExternalEntityLoader();
27832 test_ret += test_xmlNormalizeWindowsPath();
27833 test_ret += test_xmlOutputBufferCreateFd();
27834 test_ret += test_xmlOutputBufferCreateFile();
27835 test_ret += test_xmlOutputBufferCreateFilename();
27836 test_ret += test_xmlOutputBufferFlush();
27837 test_ret += test_xmlOutputBufferWrite();
27838 test_ret += test_xmlOutputBufferWriteEscape();
27839 test_ret += test_xmlOutputBufferWriteString();
27840 test_ret += test_xmlParserGetDirectory();
27841 test_ret += test_xmlParserInputBufferCreateFd();
27842 test_ret += test_xmlParserInputBufferCreateFile();
27843 test_ret += test_xmlParserInputBufferCreateFilename();
27844 test_ret += test_xmlParserInputBufferCreateMem();
27845 test_ret += test_xmlParserInputBufferCreateStatic();
27846 test_ret += test_xmlParserInputBufferGrow();
27847 test_ret += test_xmlParserInputBufferPush();
27848 test_ret += test_xmlParserInputBufferRead();
27849 test_ret += test_xmlPopInputCallbacks();
27850 test_ret += test_xmlRegisterDefaultInputCallbacks();
27851 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27852 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027853
Daniel Veillard42595322004-11-08 10:52:06 +000027854 if (test_ret != 0)
27855 printf("Module xmlIO: %d errors\n", test_ret);
27856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027857}
Daniel Veillarda521d282004-11-09 14:59:59 +000027858#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027859
Daniel Veillarda82b1822004-11-08 16:24:57 +000027860#define gen_nb_xmlAutomataPtr 1
27861static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27862 return(NULL);
27863}
27864static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27865}
Daniel Veillarda521d282004-11-09 14:59:59 +000027866#endif
27867
Daniel Veillarda82b1822004-11-08 16:24:57 +000027868
27869static int
27870test_xmlAutomataCompile(void) {
27871 int test_ret = 0;
27872
27873
27874 /* missing type support */
27875 return(test_ret);
27876}
27877
27878
27879static int
27880test_xmlAutomataGetInitState(void) {
27881 int test_ret = 0;
27882
27883
27884 /* missing type support */
27885 return(test_ret);
27886}
27887
27888
27889static int
27890test_xmlAutomataIsDeterminist(void) {
27891 int test_ret = 0;
27892
William M. Brack21e4ef22005-01-02 09:53:13 +000027893#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027894 int mem_base;
27895 int ret_val;
27896 xmlAutomataPtr am; /* an automata */
27897 int n_am;
27898
27899 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27900 mem_base = xmlMemBlocks();
27901 am = gen_xmlAutomataPtr(n_am, 0);
27902
27903 ret_val = xmlAutomataIsDeterminist(am);
27904 desret_int(ret_val);
27905 call_tests++;
27906 des_xmlAutomataPtr(n_am, am, 0);
27907 xmlResetLastError();
27908 if (mem_base != xmlMemBlocks()) {
27909 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27910 xmlMemBlocks() - mem_base);
27911 test_ret++;
27912 printf(" %d", n_am);
27913 printf("\n");
27914 }
27915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027916 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027917#endif
27918
Daniel Veillarda82b1822004-11-08 16:24:57 +000027919 return(test_ret);
27920}
27921
Daniel Veillarda521d282004-11-09 14:59:59 +000027922#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027923
27924#define gen_nb_xmlAutomataStatePtr 1
27925static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27926 return(NULL);
27927}
27928static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27929}
Daniel Veillarda521d282004-11-09 14:59:59 +000027930#endif
27931
Daniel Veillarda82b1822004-11-08 16:24:57 +000027932
27933static int
27934test_xmlAutomataNewAllTrans(void) {
27935 int test_ret = 0;
27936
27937
27938 /* missing type support */
27939 return(test_ret);
27940}
27941
27942
27943static int
27944test_xmlAutomataNewCountTrans(void) {
27945 int test_ret = 0;
27946
27947
27948 /* missing type support */
27949 return(test_ret);
27950}
27951
27952
27953static int
27954test_xmlAutomataNewCountTrans2(void) {
27955 int test_ret = 0;
27956
27957
27958 /* missing type support */
27959 return(test_ret);
27960}
27961
27962
27963static int
27964test_xmlAutomataNewCountedTrans(void) {
27965 int test_ret = 0;
27966
27967
27968 /* missing type support */
27969 return(test_ret);
27970}
27971
27972
27973static int
27974test_xmlAutomataNewCounter(void) {
27975 int test_ret = 0;
27976
William M. Brack21e4ef22005-01-02 09:53:13 +000027977#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027978 int mem_base;
27979 int ret_val;
27980 xmlAutomataPtr am; /* an automata */
27981 int n_am;
27982 int min; /* the minimal value on the counter */
27983 int n_min;
27984 int max; /* the maximal value on the counter */
27985 int n_max;
27986
27987 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27988 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27989 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27990 mem_base = xmlMemBlocks();
27991 am = gen_xmlAutomataPtr(n_am, 0);
27992 min = gen_int(n_min, 1);
27993 max = gen_int(n_max, 2);
27994
27995 ret_val = xmlAutomataNewCounter(am, min, max);
27996 desret_int(ret_val);
27997 call_tests++;
27998 des_xmlAutomataPtr(n_am, am, 0);
27999 des_int(n_min, min, 1);
28000 des_int(n_max, max, 2);
28001 xmlResetLastError();
28002 if (mem_base != xmlMemBlocks()) {
28003 printf("Leak of %d blocks found in xmlAutomataNewCounter",
28004 xmlMemBlocks() - mem_base);
28005 test_ret++;
28006 printf(" %d", n_am);
28007 printf(" %d", n_min);
28008 printf(" %d", n_max);
28009 printf("\n");
28010 }
28011 }
28012 }
28013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028014 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028015#endif
28016
Daniel Veillarda82b1822004-11-08 16:24:57 +000028017 return(test_ret);
28018}
28019
28020
28021static int
28022test_xmlAutomataNewCounterTrans(void) {
28023 int test_ret = 0;
28024
28025
28026 /* missing type support */
28027 return(test_ret);
28028}
28029
28030
28031static int
28032test_xmlAutomataNewEpsilon(void) {
28033 int test_ret = 0;
28034
28035
28036 /* missing type support */
28037 return(test_ret);
28038}
28039
28040
28041static int
28042test_xmlAutomataNewOnceTrans(void) {
28043 int test_ret = 0;
28044
28045
28046 /* missing type support */
28047 return(test_ret);
28048}
28049
28050
28051static int
28052test_xmlAutomataNewOnceTrans2(void) {
28053 int test_ret = 0;
28054
28055
28056 /* missing type support */
28057 return(test_ret);
28058}
28059
28060
28061static int
28062test_xmlAutomataNewState(void) {
28063 int test_ret = 0;
28064
28065
28066 /* missing type support */
28067 return(test_ret);
28068}
28069
28070
28071static int
28072test_xmlAutomataNewTransition(void) {
28073 int test_ret = 0;
28074
28075
28076 /* missing type support */
28077 return(test_ret);
28078}
28079
28080
28081static int
28082test_xmlAutomataNewTransition2(void) {
28083 int test_ret = 0;
28084
28085
28086 /* missing type support */
28087 return(test_ret);
28088}
28089
28090
28091static int
28092test_xmlAutomataSetFinalState(void) {
28093 int test_ret = 0;
28094
William M. Brack21e4ef22005-01-02 09:53:13 +000028095#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028096 int mem_base;
28097 int ret_val;
28098 xmlAutomataPtr am; /* an automata */
28099 int n_am;
28100 xmlAutomataStatePtr state; /* a state in this automata */
28101 int n_state;
28102
28103 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28104 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28105 mem_base = xmlMemBlocks();
28106 am = gen_xmlAutomataPtr(n_am, 0);
28107 state = gen_xmlAutomataStatePtr(n_state, 1);
28108
28109 ret_val = xmlAutomataSetFinalState(am, state);
28110 desret_int(ret_val);
28111 call_tests++;
28112 des_xmlAutomataPtr(n_am, am, 0);
28113 des_xmlAutomataStatePtr(n_state, state, 1);
28114 xmlResetLastError();
28115 if (mem_base != xmlMemBlocks()) {
28116 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28117 xmlMemBlocks() - mem_base);
28118 test_ret++;
28119 printf(" %d", n_am);
28120 printf(" %d", n_state);
28121 printf("\n");
28122 }
28123 }
28124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028125 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028126#endif
28127
Daniel Veillarda82b1822004-11-08 16:24:57 +000028128 return(test_ret);
28129}
28130
28131
28132static int
28133test_xmlNewAutomata(void) {
28134 int test_ret = 0;
28135
28136
28137 /* missing type support */
28138 return(test_ret);
28139}
28140
28141static int
28142test_xmlautomata(void) {
28143 int test_ret = 0;
28144
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028145 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028146 test_ret += test_xmlAutomataCompile();
28147 test_ret += test_xmlAutomataGetInitState();
28148 test_ret += test_xmlAutomataIsDeterminist();
28149 test_ret += test_xmlAutomataNewAllTrans();
28150 test_ret += test_xmlAutomataNewCountTrans();
28151 test_ret += test_xmlAutomataNewCountTrans2();
28152 test_ret += test_xmlAutomataNewCountedTrans();
28153 test_ret += test_xmlAutomataNewCounter();
28154 test_ret += test_xmlAutomataNewCounterTrans();
28155 test_ret += test_xmlAutomataNewEpsilon();
28156 test_ret += test_xmlAutomataNewOnceTrans();
28157 test_ret += test_xmlAutomataNewOnceTrans2();
28158 test_ret += test_xmlAutomataNewState();
28159 test_ret += test_xmlAutomataNewTransition();
28160 test_ret += test_xmlAutomataNewTransition2();
28161 test_ret += test_xmlAutomataSetFinalState();
28162 test_ret += test_xmlNewAutomata();
28163
28164 if (test_ret != 0)
28165 printf("Module xmlautomata: %d errors\n", test_ret);
28166 return(test_ret);
28167}
28168
Daniel Veillardce682bc2004-11-05 17:22:25 +000028169#define gen_nb_xmlGenericErrorFunc_ptr 1
28170static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28171 return(NULL);
28172}
28173static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28174}
28175
Daniel Veillardd93f6252004-11-02 15:53:51 +000028176static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028177test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028179
Daniel Veillardce682bc2004-11-05 17:22:25 +000028180 int mem_base;
28181 xmlGenericErrorFunc * handler; /* the handler */
28182 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028183
Daniel Veillardce682bc2004-11-05 17:22:25 +000028184 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28185 mem_base = xmlMemBlocks();
28186 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28187
28188 initGenericErrorDefaultFunc(handler);
28189 call_tests++;
28190 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28191 xmlResetLastError();
28192 if (mem_base != xmlMemBlocks()) {
28193 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028195 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028196 printf(" %d", n_handler);
28197 printf("\n");
28198 }
28199 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028200 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028201
Daniel Veillard42595322004-11-08 10:52:06 +000028202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028203}
28204
28205
Daniel Veillardce682bc2004-11-05 17:22:25 +000028206#define gen_nb_xmlErrorPtr 1
28207static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28208 return(NULL);
28209}
28210static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28211}
28212
Daniel Veillardd93f6252004-11-02 15:53:51 +000028213static int
28214test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028216
Daniel Veillardce682bc2004-11-05 17:22:25 +000028217 int mem_base;
28218 int ret_val;
28219 xmlErrorPtr from; /* a source error */
28220 int n_from;
28221 xmlErrorPtr to; /* a target error */
28222 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028223
Daniel Veillardce682bc2004-11-05 17:22:25 +000028224 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28225 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28226 mem_base = xmlMemBlocks();
28227 from = gen_xmlErrorPtr(n_from, 0);
28228 to = gen_xmlErrorPtr(n_to, 1);
28229
28230 ret_val = xmlCopyError(from, to);
28231 desret_int(ret_val);
28232 call_tests++;
28233 des_xmlErrorPtr(n_from, from, 0);
28234 des_xmlErrorPtr(n_to, to, 1);
28235 xmlResetLastError();
28236 if (mem_base != xmlMemBlocks()) {
28237 printf("Leak of %d blocks found in xmlCopyError",
28238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028239 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028240 printf(" %d", n_from);
28241 printf(" %d", n_to);
28242 printf("\n");
28243 }
28244 }
28245 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028247
Daniel Veillard42595322004-11-08 10:52:06 +000028248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028249}
28250
28251
28252static int
28253test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028255
28256
28257 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028259}
28260
28261
28262static int
28263test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028265
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028266 int mem_base;
28267 void * ctx; /* an XML parser context */
28268 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028269
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028270 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028272 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028273
28274 xmlCtxtResetLastError(ctx);
28275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028276 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028277 xmlResetLastError();
28278 if (mem_base != xmlMemBlocks()) {
28279 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028281 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028282 printf(" %d", n_ctx);
28283 printf("\n");
28284 }
28285 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028287
Daniel Veillard42595322004-11-08 10:52:06 +000028288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028289}
28290
28291
28292static int
28293test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028295
28296
28297 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028299}
28300
28301
28302static int
28303test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028305
28306
28307 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028309}
28310
28311
28312static int
28313test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028315
Daniel Veillardce682bc2004-11-05 17:22:25 +000028316 int mem_base;
28317 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28318 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028319
Daniel Veillardce682bc2004-11-05 17:22:25 +000028320 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28321 mem_base = xmlMemBlocks();
28322 input = gen_xmlParserInputPtr(n_input, 0);
28323
28324 xmlParserPrintFileContext(input);
28325 call_tests++;
28326 des_xmlParserInputPtr(n_input, input, 0);
28327 xmlResetLastError();
28328 if (mem_base != xmlMemBlocks()) {
28329 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028331 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028332 printf(" %d", n_input);
28333 printf("\n");
28334 }
28335 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028336 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028337
Daniel Veillard42595322004-11-08 10:52:06 +000028338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028339}
28340
28341
28342static int
28343test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028345
Daniel Veillardce682bc2004-11-05 17:22:25 +000028346 int mem_base;
28347 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28348 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028349
Daniel Veillardce682bc2004-11-05 17:22:25 +000028350 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28351 mem_base = xmlMemBlocks();
28352 input = gen_xmlParserInputPtr(n_input, 0);
28353
28354 xmlParserPrintFileInfo(input);
28355 call_tests++;
28356 des_xmlParserInputPtr(n_input, input, 0);
28357 xmlResetLastError();
28358 if (mem_base != xmlMemBlocks()) {
28359 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028361 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028362 printf(" %d", n_input);
28363 printf("\n");
28364 }
28365 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028366 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028367
Daniel Veillard42595322004-11-08 10:52:06 +000028368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028369}
28370
28371
28372static int
28373test_xmlParserValidityError(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_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028385
28386
28387 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028389}
28390
28391
28392static int
28393test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028395
28396
28397 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028399}
28400
28401
28402static int
28403test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028405
Daniel Veillardce682bc2004-11-05 17:22:25 +000028406 int mem_base;
28407 xmlErrorPtr err; /* pointer to the error. */
28408 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028409
Daniel Veillardce682bc2004-11-05 17:22:25 +000028410 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28411 mem_base = xmlMemBlocks();
28412 err = gen_xmlErrorPtr(n_err, 0);
28413
28414 xmlResetError(err);
28415 call_tests++;
28416 des_xmlErrorPtr(n_err, err, 0);
28417 xmlResetLastError();
28418 if (mem_base != xmlMemBlocks()) {
28419 printf("Leak of %d blocks found in xmlResetError",
28420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028421 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028422 printf(" %d", n_err);
28423 printf("\n");
28424 }
28425 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028427
Daniel Veillard42595322004-11-08 10:52:06 +000028428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028429}
28430
28431
28432static int
28433test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028435
28436
28437
28438 xmlResetLastError();
28439 call_tests++;
28440 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028442
Daniel Veillard42595322004-11-08 10:52:06 +000028443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028444}
28445
28446
28447static int
28448test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028450
28451
28452 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028454}
28455
28456
28457static int
28458test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028460
28461
28462 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028464}
28465
28466static int
28467test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028469
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028470 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028471 test_ret += test_initGenericErrorDefaultFunc();
28472 test_ret += test_xmlCopyError();
28473 test_ret += test_xmlCtxtGetLastError();
28474 test_ret += test_xmlCtxtResetLastError();
28475 test_ret += test_xmlGetLastError();
28476 test_ret += test_xmlParserError();
28477 test_ret += test_xmlParserPrintFileContext();
28478 test_ret += test_xmlParserPrintFileInfo();
28479 test_ret += test_xmlParserValidityError();
28480 test_ret += test_xmlParserValidityWarning();
28481 test_ret += test_xmlParserWarning();
28482 test_ret += test_xmlResetError();
28483 test_ret += test_xmlResetLastError();
28484 test_ret += test_xmlSetGenericErrorFunc();
28485 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028486
Daniel Veillard42595322004-11-08 10:52:06 +000028487 if (test_ret != 0)
28488 printf("Module xmlerror: %d errors\n", test_ret);
28489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028490}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028491#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028492
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028493#define gen_nb_xmlModulePtr 1
28494static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28495 return(NULL);
28496}
28497static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28498}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028499#endif
28500
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028501
28502static int
28503test_xmlModuleClose(void) {
28504 int test_ret = 0;
28505
28506#if defined(LIBXML_MODULES_ENABLED)
28507 int mem_base;
28508 int ret_val;
28509 xmlModulePtr module; /* the module handle */
28510 int n_module;
28511
28512 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28513 mem_base = xmlMemBlocks();
28514 module = gen_xmlModulePtr(n_module, 0);
28515
28516 ret_val = xmlModuleClose(module);
28517 desret_int(ret_val);
28518 call_tests++;
28519 des_xmlModulePtr(n_module, module, 0);
28520 xmlResetLastError();
28521 if (mem_base != xmlMemBlocks()) {
28522 printf("Leak of %d blocks found in xmlModuleClose",
28523 xmlMemBlocks() - mem_base);
28524 test_ret++;
28525 printf(" %d", n_module);
28526 printf("\n");
28527 }
28528 }
28529 function_tests++;
28530#endif
28531
28532 return(test_ret);
28533}
28534
28535
28536static int
28537test_xmlModuleOpen(void) {
28538 int test_ret = 0;
28539
28540
28541 /* missing type support */
28542 return(test_ret);
28543}
28544
28545
28546static int
28547test_xmlModuleSymbol(void) {
28548 int test_ret = 0;
28549
28550#if defined(LIBXML_MODULES_ENABLED)
28551 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028552 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028553 xmlModulePtr module; /* the module */
28554 int n_module;
28555 char * name; /* the name of the symbol */
28556 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028557 void ** symbol; /* the resulting symbol address */
28558 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028559
28560 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28561 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028562 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028563 mem_base = xmlMemBlocks();
28564 module = gen_xmlModulePtr(n_module, 0);
28565 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028566 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028567
Daniel Veillardbe076e92005-01-04 20:18:14 +000028568 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28569 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028570 call_tests++;
28571 des_xmlModulePtr(n_module, module, 0);
28572 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028573 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028574 xmlResetLastError();
28575 if (mem_base != xmlMemBlocks()) {
28576 printf("Leak of %d blocks found in xmlModuleSymbol",
28577 xmlMemBlocks() - mem_base);
28578 test_ret++;
28579 printf(" %d", n_module);
28580 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028581 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028582 printf("\n");
28583 }
28584 }
28585 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028586 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028587 function_tests++;
28588#endif
28589
28590 return(test_ret);
28591}
28592
28593static int
28594test_xmlmodule(void) {
28595 int test_ret = 0;
28596
28597 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28598 test_ret += test_xmlModuleClose();
28599 test_ret += test_xmlModuleOpen();
28600 test_ret += test_xmlModuleSymbol();
28601
28602 if (test_ret != 0)
28603 printf("Module xmlmodule: %d errors\n", test_ret);
28604 return(test_ret);
28605}
28606
Daniel Veillardd93f6252004-11-02 15:53:51 +000028607static int
28608test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028610
William M. Brack21e4ef22005-01-02 09:53:13 +000028611#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028612 int mem_base;
28613 xmlTextReaderPtr ret_val;
28614 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28615 int n_input;
28616 const char * URI; /* the URI information for the source if available */
28617 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028618
Daniel Veillard34099b42004-11-04 17:34:35 +000028619 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28620 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28621 mem_base = xmlMemBlocks();
28622 input = gen_xmlParserInputBufferPtr(n_input, 0);
28623 URI = gen_filepath(n_URI, 1);
28624
28625 ret_val = xmlNewTextReader(input, URI);
28626 desret_xmlTextReaderPtr(ret_val);
28627 call_tests++;
28628 des_xmlParserInputBufferPtr(n_input, input, 0);
28629 des_filepath(n_URI, URI, 1);
28630 xmlResetLastError();
28631 if (mem_base != xmlMemBlocks()) {
28632 printf("Leak of %d blocks found in xmlNewTextReader",
28633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028634 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028635 printf(" %d", n_input);
28636 printf(" %d", n_URI);
28637 printf("\n");
28638 }
28639 }
28640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028641 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028642#endif
28643
Daniel Veillard42595322004-11-08 10:52:06 +000028644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028645}
28646
28647
28648static int
28649test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028651
William M. Brack21e4ef22005-01-02 09:53:13 +000028652#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028653 int mem_base;
28654 xmlTextReaderPtr ret_val;
28655 const char * URI; /* the URI of the resource to process */
28656 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028657
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028658 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28659 mem_base = xmlMemBlocks();
28660 URI = gen_filepath(n_URI, 0);
28661
28662 ret_val = xmlNewTextReaderFilename(URI);
28663 desret_xmlTextReaderPtr(ret_val);
28664 call_tests++;
28665 des_filepath(n_URI, URI, 0);
28666 xmlResetLastError();
28667 if (mem_base != xmlMemBlocks()) {
28668 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028670 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028671 printf(" %d", n_URI);
28672 printf("\n");
28673 }
28674 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028675 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028676#endif
28677
Daniel Veillard42595322004-11-08 10:52:06 +000028678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028679}
28680
28681
28682static int
28683test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028685
William M. Brack21e4ef22005-01-02 09:53:13 +000028686#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028687 int mem_base;
28688 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028689 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028690 int n_cur;
28691 const char * URL; /* the base URL to use for the document */
28692 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028693 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028694 int n_encoding;
28695 int options; /* a combination of xmlParserOption */
28696 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028697
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028698 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28699 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28700 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028701 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028702 mem_base = xmlMemBlocks();
28703 cur = gen_const_xmlChar_ptr(n_cur, 0);
28704 URL = gen_filepath(n_URL, 1);
28705 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028706 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028707
William M. Brackf13f77f2004-11-12 16:03:48 +000028708 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028709 desret_xmlTextReaderPtr(ret_val);
28710 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028711 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028712 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028713 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028714 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028715 xmlResetLastError();
28716 if (mem_base != xmlMemBlocks()) {
28717 printf("Leak of %d blocks found in xmlReaderForDoc",
28718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028719 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028720 printf(" %d", n_cur);
28721 printf(" %d", n_URL);
28722 printf(" %d", n_encoding);
28723 printf(" %d", n_options);
28724 printf("\n");
28725 }
28726 }
28727 }
28728 }
28729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028730 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028731#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028732
Daniel Veillard42595322004-11-08 10:52:06 +000028733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028734}
28735
28736
28737static int
28738test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028740
William M. Brack21e4ef22005-01-02 09:53:13 +000028741#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028742 int mem_base;
28743 xmlTextReaderPtr ret_val;
28744 const char * filename; /* a file or URL */
28745 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028746 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028747 int n_encoding;
28748 int options; /* a combination of xmlParserOption */
28749 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028750
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028751 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28752 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028753 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028754 mem_base = xmlMemBlocks();
28755 filename = gen_filepath(n_filename, 0);
28756 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028757 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028758
William M. Brackf13f77f2004-11-12 16:03:48 +000028759 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028760 desret_xmlTextReaderPtr(ret_val);
28761 call_tests++;
28762 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028763 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028764 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028765 xmlResetLastError();
28766 if (mem_base != xmlMemBlocks()) {
28767 printf("Leak of %d blocks found in xmlReaderForFile",
28768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028769 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028770 printf(" %d", n_filename);
28771 printf(" %d", n_encoding);
28772 printf(" %d", n_options);
28773 printf("\n");
28774 }
28775 }
28776 }
28777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028778 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028779#endif
28780
Daniel Veillard42595322004-11-08 10:52:06 +000028781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028782}
28783
28784
28785static int
28786test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028788
William M. Brack21e4ef22005-01-02 09:53:13 +000028789#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028790 int mem_base;
28791 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028792 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028793 int n_buffer;
28794 int size; /* the size of the array */
28795 int n_size;
28796 const char * URL; /* the base URL to use for the document */
28797 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028798 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028799 int n_encoding;
28800 int options; /* a combination of xmlParserOption */
28801 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028802
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028803 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28804 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28805 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28806 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028807 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028808 mem_base = xmlMemBlocks();
28809 buffer = gen_const_char_ptr(n_buffer, 0);
28810 size = gen_int(n_size, 1);
28811 URL = gen_filepath(n_URL, 2);
28812 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028813 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028814
William M. Brackf13f77f2004-11-12 16:03:48 +000028815 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028816 desret_xmlTextReaderPtr(ret_val);
28817 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028818 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028819 des_int(n_size, size, 1);
28820 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028821 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028822 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028823 xmlResetLastError();
28824 if (mem_base != xmlMemBlocks()) {
28825 printf("Leak of %d blocks found in xmlReaderForMemory",
28826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028827 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028828 printf(" %d", n_buffer);
28829 printf(" %d", n_size);
28830 printf(" %d", n_URL);
28831 printf(" %d", n_encoding);
28832 printf(" %d", n_options);
28833 printf("\n");
28834 }
28835 }
28836 }
28837 }
28838 }
28839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028840 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028841#endif
28842
Daniel Veillard42595322004-11-08 10:52:06 +000028843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028844}
28845
28846
28847static int
28848test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028850
William M. Brack21e4ef22005-01-02 09:53:13 +000028851#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028852 int mem_base;
28853 int ret_val;
28854 xmlTextReaderPtr reader; /* an XML reader */
28855 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028856 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028857 int n_cur;
28858 const char * URL; /* the base URL to use for the document */
28859 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028860 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028861 int n_encoding;
28862 int options; /* a combination of xmlParserOption */
28863 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028864
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028865 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28866 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28867 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28868 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028869 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028870 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028871 reader = gen_xmlTextReaderPtr(n_reader, 0);
28872 cur = gen_const_xmlChar_ptr(n_cur, 1);
28873 URL = gen_filepath(n_URL, 2);
28874 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028875 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028876
William M. Brackf13f77f2004-11-12 16:03:48 +000028877 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028878 desret_int(ret_val);
28879 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028880 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028881 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028882 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028883 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028884 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028885 xmlResetLastError();
28886 if (mem_base != xmlMemBlocks()) {
28887 printf("Leak of %d blocks found in xmlReaderNewDoc",
28888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028889 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028890 printf(" %d", n_reader);
28891 printf(" %d", n_cur);
28892 printf(" %d", n_URL);
28893 printf(" %d", n_encoding);
28894 printf(" %d", n_options);
28895 printf("\n");
28896 }
28897 }
28898 }
28899 }
28900 }
28901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028902 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028903#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028904
Daniel Veillard42595322004-11-08 10:52:06 +000028905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028906}
28907
28908
28909static int
28910test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028912
William M. Brack21e4ef22005-01-02 09:53:13 +000028913#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028914 int mem_base;
28915 int ret_val;
28916 xmlTextReaderPtr reader; /* an XML reader */
28917 int n_reader;
28918 const char * filename; /* a file or URL */
28919 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028920 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028921 int n_encoding;
28922 int options; /* a combination of xmlParserOption */
28923 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028924
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028925 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28926 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28927 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028928 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028930 reader = gen_xmlTextReaderPtr(n_reader, 0);
28931 filename = gen_filepath(n_filename, 1);
28932 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028933 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028934
William M. Brackf13f77f2004-11-12 16:03:48 +000028935 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028936 desret_int(ret_val);
28937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028938 des_xmlTextReaderPtr(n_reader, reader, 0);
28939 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028940 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028941 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028942 xmlResetLastError();
28943 if (mem_base != xmlMemBlocks()) {
28944 printf("Leak of %d blocks found in xmlReaderNewFile",
28945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028946 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028947 printf(" %d", n_reader);
28948 printf(" %d", n_filename);
28949 printf(" %d", n_encoding);
28950 printf(" %d", n_options);
28951 printf("\n");
28952 }
28953 }
28954 }
28955 }
28956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028957 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028958#endif
28959
Daniel Veillard42595322004-11-08 10:52:06 +000028960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028961}
28962
28963
28964static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028965test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028967
William M. Brack21e4ef22005-01-02 09:53:13 +000028968#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028969 int mem_base;
28970 int ret_val;
28971 xmlTextReaderPtr reader; /* an XML reader */
28972 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028973 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028974 int n_buffer;
28975 int size; /* the size of the array */
28976 int n_size;
28977 const char * URL; /* the base URL to use for the document */
28978 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028979 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028980 int n_encoding;
28981 int options; /* a combination of xmlParserOption */
28982 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028983
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028984 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28985 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28986 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28987 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28988 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028989 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028991 reader = gen_xmlTextReaderPtr(n_reader, 0);
28992 buffer = gen_const_char_ptr(n_buffer, 1);
28993 size = gen_int(n_size, 2);
28994 URL = gen_filepath(n_URL, 3);
28995 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028996 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028997
William M. Brackf13f77f2004-11-12 16:03:48 +000028998 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028999 desret_int(ret_val);
29000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029001 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029002 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000029003 des_int(n_size, size, 2);
29004 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000029005 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000029006 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029007 xmlResetLastError();
29008 if (mem_base != xmlMemBlocks()) {
29009 printf("Leak of %d blocks found in xmlReaderNewMemory",
29010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029011 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029012 printf(" %d", n_reader);
29013 printf(" %d", n_buffer);
29014 printf(" %d", n_size);
29015 printf(" %d", n_URL);
29016 printf(" %d", n_encoding);
29017 printf(" %d", n_options);
29018 printf("\n");
29019 }
29020 }
29021 }
29022 }
29023 }
29024 }
29025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029026 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029027#endif
29028
Daniel Veillard42595322004-11-08 10:52:06 +000029029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029030}
29031
29032
29033static int
29034test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029036
William M. Brack21e4ef22005-01-02 09:53:13 +000029037#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029038 int mem_base;
29039 int ret_val;
29040 xmlTextReaderPtr reader; /* an XML reader */
29041 int n_reader;
29042 xmlDocPtr doc; /* a preparsed document */
29043 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029044
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029045 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29046 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029048 reader = gen_xmlTextReaderPtr(n_reader, 0);
29049 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029050
29051 ret_val = xmlReaderNewWalker(reader, doc);
29052 desret_int(ret_val);
29053 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029054 des_xmlTextReaderPtr(n_reader, reader, 0);
29055 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029056 xmlResetLastError();
29057 if (mem_base != xmlMemBlocks()) {
29058 printf("Leak of %d blocks found in xmlReaderNewWalker",
29059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029060 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029061 printf(" %d", n_reader);
29062 printf(" %d", n_doc);
29063 printf("\n");
29064 }
29065 }
29066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029067 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029068#endif
29069
Daniel Veillard42595322004-11-08 10:52:06 +000029070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029071}
29072
29073
29074static int
29075test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029077
William M. Brack21e4ef22005-01-02 09:53:13 +000029078#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029079 int mem_base;
29080 xmlTextReaderPtr ret_val;
29081 xmlDocPtr doc; /* a preparsed document */
29082 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029083
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029084 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29085 mem_base = xmlMemBlocks();
29086 doc = gen_xmlDocPtr(n_doc, 0);
29087
29088 ret_val = xmlReaderWalker(doc);
29089 desret_xmlTextReaderPtr(ret_val);
29090 call_tests++;
29091 des_xmlDocPtr(n_doc, doc, 0);
29092 xmlResetLastError();
29093 if (mem_base != xmlMemBlocks()) {
29094 printf("Leak of %d blocks found in xmlReaderWalker",
29095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029096 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029097 printf(" %d", n_doc);
29098 printf("\n");
29099 }
29100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029101 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029102#endif
29103
Daniel Veillard42595322004-11-08 10:52:06 +000029104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029105}
29106
29107
29108static int
29109test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029111
William M. Brack21e4ef22005-01-02 09:53:13 +000029112#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029113 int mem_base;
29114 int ret_val;
29115 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29116 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029117
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029118 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29119 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029120 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029121
29122 ret_val = xmlTextReaderAttributeCount(reader);
29123 desret_int(ret_val);
29124 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029125 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029126 xmlResetLastError();
29127 if (mem_base != xmlMemBlocks()) {
29128 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
29129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029130 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029131 printf(" %d", n_reader);
29132 printf("\n");
29133 }
29134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029135 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029136#endif
29137
Daniel Veillard42595322004-11-08 10:52:06 +000029138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029139}
29140
29141
29142static int
29143test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029145
William M. Brack21e4ef22005-01-02 09:53:13 +000029146#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029147 int mem_base;
29148 xmlChar * ret_val;
29149 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29150 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029151
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029152 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029154 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029155
29156 ret_val = xmlTextReaderBaseUri(reader);
29157 desret_xmlChar_ptr(ret_val);
29158 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029159 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029160 xmlResetLastError();
29161 if (mem_base != xmlMemBlocks()) {
29162 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029164 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029165 printf(" %d", n_reader);
29166 printf("\n");
29167 }
29168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029169 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029170#endif
29171
Daniel Veillard42595322004-11-08 10:52:06 +000029172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029173}
29174
29175
29176static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000029177test_xmlTextReaderByteConsumed(void) {
29178 int test_ret = 0;
29179
29180#if defined(LIBXML_READER_ENABLED)
29181 int mem_base;
29182 long ret_val;
29183 xmlTextReaderPtr reader; /* an XML reader */
29184 int n_reader;
29185
29186 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29187 mem_base = xmlMemBlocks();
29188 reader = gen_xmlTextReaderPtr(n_reader, 0);
29189
29190 ret_val = xmlTextReaderByteConsumed(reader);
29191 desret_long(ret_val);
29192 call_tests++;
29193 des_xmlTextReaderPtr(n_reader, reader, 0);
29194 xmlResetLastError();
29195 if (mem_base != xmlMemBlocks()) {
29196 printf("Leak of %d blocks found in xmlTextReaderByteConsumed",
29197 xmlMemBlocks() - mem_base);
29198 test_ret++;
29199 printf(" %d", n_reader);
29200 printf("\n");
29201 }
29202 }
29203 function_tests++;
29204#endif
29205
29206 return(test_ret);
29207}
29208
29209
29210static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029211test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029213
William M. Brack21e4ef22005-01-02 09:53:13 +000029214#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029215 int mem_base;
29216 int ret_val;
29217 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29218 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029219
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029220 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029222 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029223
29224 ret_val = xmlTextReaderClose(reader);
29225 desret_int(ret_val);
29226 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029227 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029228 xmlResetLastError();
29229 if (mem_base != xmlMemBlocks()) {
29230 printf("Leak of %d blocks found in xmlTextReaderClose",
29231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029232 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029233 printf(" %d", n_reader);
29234 printf("\n");
29235 }
29236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029237 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029238#endif
29239
Daniel Veillard42595322004-11-08 10:52:06 +000029240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029241}
29242
29243
29244static int
29245test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029247
William M. Brack21e4ef22005-01-02 09:53:13 +000029248#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029249 int mem_base;
29250 const xmlChar * ret_val;
29251 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29252 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029253
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029254 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029256 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029257
29258 ret_val = xmlTextReaderConstBaseUri(reader);
29259 desret_const_xmlChar_ptr(ret_val);
29260 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029261 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029262 xmlResetLastError();
29263 if (mem_base != xmlMemBlocks()) {
29264 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029266 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029267 printf(" %d", n_reader);
29268 printf("\n");
29269 }
29270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029271 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029272#endif
29273
Daniel Veillard42595322004-11-08 10:52:06 +000029274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029275}
29276
29277
29278static int
29279test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029281
William M. Brack21e4ef22005-01-02 09:53:13 +000029282#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029283 int mem_base;
29284 const xmlChar * ret_val;
29285 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29286 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029287
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029288 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29289 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029290 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029291
29292 ret_val = xmlTextReaderConstEncoding(reader);
29293 desret_const_xmlChar_ptr(ret_val);
29294 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029295 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029296 xmlResetLastError();
29297 if (mem_base != xmlMemBlocks()) {
29298 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029300 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029301 printf(" %d", n_reader);
29302 printf("\n");
29303 }
29304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029305 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029306#endif
29307
Daniel Veillard42595322004-11-08 10:52:06 +000029308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029309}
29310
29311
29312static int
29313test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029315
William M. Brack21e4ef22005-01-02 09:53:13 +000029316#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029317 int mem_base;
29318 const xmlChar * ret_val;
29319 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29320 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029321
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029322 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029324 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029325
29326 ret_val = xmlTextReaderConstLocalName(reader);
29327 desret_const_xmlChar_ptr(ret_val);
29328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029329 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029330 xmlResetLastError();
29331 if (mem_base != xmlMemBlocks()) {
29332 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029334 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029335 printf(" %d", n_reader);
29336 printf("\n");
29337 }
29338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029339 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029340#endif
29341
Daniel Veillard42595322004-11-08 10:52:06 +000029342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029343}
29344
29345
29346static int
29347test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029349
William M. Brack21e4ef22005-01-02 09:53:13 +000029350#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029351 int mem_base;
29352 const xmlChar * ret_val;
29353 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29354 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029355
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029356 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29357 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029358 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029359
29360 ret_val = xmlTextReaderConstName(reader);
29361 desret_const_xmlChar_ptr(ret_val);
29362 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029363 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029364 xmlResetLastError();
29365 if (mem_base != xmlMemBlocks()) {
29366 printf("Leak of %d blocks found in xmlTextReaderConstName",
29367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029368 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029369 printf(" %d", n_reader);
29370 printf("\n");
29371 }
29372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029373 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029374#endif
29375
Daniel Veillard42595322004-11-08 10:52:06 +000029376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029377}
29378
29379
29380static int
29381test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029383
William M. Brack21e4ef22005-01-02 09:53:13 +000029384#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029385 int mem_base;
29386 const xmlChar * ret_val;
29387 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29388 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029389
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029390 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29391 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029392 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029393
29394 ret_val = xmlTextReaderConstNamespaceUri(reader);
29395 desret_const_xmlChar_ptr(ret_val);
29396 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029397 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029398 xmlResetLastError();
29399 if (mem_base != xmlMemBlocks()) {
29400 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029402 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029403 printf(" %d", n_reader);
29404 printf("\n");
29405 }
29406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029407 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029408#endif
29409
Daniel Veillard42595322004-11-08 10:52:06 +000029410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029411}
29412
29413
29414static int
29415test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029417
William M. Brack21e4ef22005-01-02 09:53:13 +000029418#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029419 int mem_base;
29420 const xmlChar * ret_val;
29421 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29422 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029423
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029424 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029426 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029427
29428 ret_val = xmlTextReaderConstPrefix(reader);
29429 desret_const_xmlChar_ptr(ret_val);
29430 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029431 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029432 xmlResetLastError();
29433 if (mem_base != xmlMemBlocks()) {
29434 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029436 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029437 printf(" %d", n_reader);
29438 printf("\n");
29439 }
29440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029441 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029442#endif
29443
Daniel Veillard42595322004-11-08 10:52:06 +000029444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029445}
29446
29447
29448static int
29449test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029451
William M. Brack21e4ef22005-01-02 09:53:13 +000029452#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029453 int mem_base;
29454 const xmlChar * ret_val;
29455 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29456 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029457 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029458 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029459
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029460 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29461 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029463 reader = gen_xmlTextReaderPtr(n_reader, 0);
29464 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029465
William M. Brackf13f77f2004-11-12 16:03:48 +000029466 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029467 desret_const_xmlChar_ptr(ret_val);
29468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029469 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029470 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029471 xmlResetLastError();
29472 if (mem_base != xmlMemBlocks()) {
29473 printf("Leak of %d blocks found in xmlTextReaderConstString",
29474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029475 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029476 printf(" %d", n_reader);
29477 printf(" %d", n_str);
29478 printf("\n");
29479 }
29480 }
29481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029482 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029483#endif
29484
Daniel Veillard42595322004-11-08 10:52:06 +000029485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029486}
29487
29488
29489static int
29490test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029492
William M. Brack21e4ef22005-01-02 09:53:13 +000029493#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029494 int mem_base;
29495 const xmlChar * ret_val;
29496 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29497 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029498
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029499 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029501 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029502
29503 ret_val = xmlTextReaderConstValue(reader);
29504 desret_const_xmlChar_ptr(ret_val);
29505 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029506 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029507 xmlResetLastError();
29508 if (mem_base != xmlMemBlocks()) {
29509 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029511 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029512 printf(" %d", n_reader);
29513 printf("\n");
29514 }
29515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029516 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029517#endif
29518
Daniel Veillard42595322004-11-08 10:52:06 +000029519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029520}
29521
29522
29523static int
29524test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029526
William M. Brack21e4ef22005-01-02 09:53:13 +000029527#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029528 int mem_base;
29529 const xmlChar * ret_val;
29530 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29531 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029532
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029533 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029535 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029536
29537 ret_val = xmlTextReaderConstXmlLang(reader);
29538 desret_const_xmlChar_ptr(ret_val);
29539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029540 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029541 xmlResetLastError();
29542 if (mem_base != xmlMemBlocks()) {
29543 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029545 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029546 printf(" %d", n_reader);
29547 printf("\n");
29548 }
29549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029550 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029551#endif
29552
Daniel Veillard42595322004-11-08 10:52:06 +000029553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029554}
29555
29556
29557static int
29558test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029560
William M. Brack21e4ef22005-01-02 09:53:13 +000029561#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029562 int mem_base;
29563 const xmlChar * ret_val;
29564 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29565 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029566
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029567 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029569 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029570
29571 ret_val = xmlTextReaderConstXmlVersion(reader);
29572 desret_const_xmlChar_ptr(ret_val);
29573 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029574 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029575 xmlResetLastError();
29576 if (mem_base != xmlMemBlocks()) {
29577 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029579 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029580 printf(" %d", n_reader);
29581 printf("\n");
29582 }
29583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029584 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029585#endif
29586
Daniel Veillard42595322004-11-08 10:52:06 +000029587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029588}
29589
29590
29591static int
29592test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029594
William M. Brack21e4ef22005-01-02 09:53:13 +000029595#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029596 int mem_base;
29597 xmlDocPtr ret_val;
29598 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29599 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029600
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029601 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029603 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029604
29605 ret_val = xmlTextReaderCurrentDoc(reader);
29606 desret_xmlDocPtr(ret_val);
29607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029608 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029609 xmlResetLastError();
29610 if (mem_base != xmlMemBlocks()) {
29611 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029613 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029614 printf(" %d", n_reader);
29615 printf("\n");
29616 }
29617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029618 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029619#endif
29620
Daniel Veillard42595322004-11-08 10:52:06 +000029621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029622}
29623
29624
29625static int
29626test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029628
William M. Brack21e4ef22005-01-02 09:53:13 +000029629#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029630 int mem_base;
29631 xmlNodePtr ret_val;
29632 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29633 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029634
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029635 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029637 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029638
29639 ret_val = xmlTextReaderCurrentNode(reader);
29640 desret_xmlNodePtr(ret_val);
29641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029642 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029643 xmlResetLastError();
29644 if (mem_base != xmlMemBlocks()) {
29645 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029647 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029648 printf(" %d", n_reader);
29649 printf("\n");
29650 }
29651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029652 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029653#endif
29654
Daniel Veillard42595322004-11-08 10:52:06 +000029655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029656}
29657
29658
29659static int
29660test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029662
William M. Brack21e4ef22005-01-02 09:53:13 +000029663#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029664 int mem_base;
29665 int ret_val;
29666 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29667 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029668
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029669 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029671 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029672
29673 ret_val = xmlTextReaderDepth(reader);
29674 desret_int(ret_val);
29675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029676 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029677 xmlResetLastError();
29678 if (mem_base != xmlMemBlocks()) {
29679 printf("Leak of %d blocks found in xmlTextReaderDepth",
29680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029681 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029682 printf(" %d", n_reader);
29683 printf("\n");
29684 }
29685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029686 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029687#endif
29688
Daniel Veillard42595322004-11-08 10:52:06 +000029689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029690}
29691
29692
29693static int
29694test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029696
William M. Brack21e4ef22005-01-02 09:53:13 +000029697#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029698 int mem_base;
29699 xmlNodePtr ret_val;
29700 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29701 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029702
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029703 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029705 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029706
29707 ret_val = xmlTextReaderExpand(reader);
29708 desret_xmlNodePtr(ret_val);
29709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029710 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029711 xmlResetLastError();
29712 if (mem_base != xmlMemBlocks()) {
29713 printf("Leak of %d blocks found in xmlTextReaderExpand",
29714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029715 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029716 printf(" %d", n_reader);
29717 printf("\n");
29718 }
29719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029720 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029721#endif
29722
Daniel Veillard42595322004-11-08 10:52:06 +000029723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029724}
29725
29726
29727static int
29728test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029730
William M. Brack21e4ef22005-01-02 09:53:13 +000029731#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029732 int mem_base;
29733 xmlChar * ret_val;
29734 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29735 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029736 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029737 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029738
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029739 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29740 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029742 reader = gen_xmlTextReaderPtr(n_reader, 0);
29743 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029744
William M. Brackf13f77f2004-11-12 16:03:48 +000029745 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029746 desret_xmlChar_ptr(ret_val);
29747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029748 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029749 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029750 xmlResetLastError();
29751 if (mem_base != xmlMemBlocks()) {
29752 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029754 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029755 printf(" %d", n_reader);
29756 printf(" %d", n_name);
29757 printf("\n");
29758 }
29759 }
29760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029761 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029762#endif
29763
Daniel Veillard42595322004-11-08 10:52:06 +000029764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029765}
29766
29767
29768static int
29769test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029771
William M. Brack21e4ef22005-01-02 09:53:13 +000029772#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029773 int mem_base;
29774 xmlChar * ret_val;
29775 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29776 int n_reader;
29777 int no; /* the zero-based index of the attribute relative to the containing element */
29778 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029779
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029780 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29781 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029783 reader = gen_xmlTextReaderPtr(n_reader, 0);
29784 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029785
29786 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29787 desret_xmlChar_ptr(ret_val);
29788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029789 des_xmlTextReaderPtr(n_reader, reader, 0);
29790 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029791 xmlResetLastError();
29792 if (mem_base != xmlMemBlocks()) {
29793 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029795 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029796 printf(" %d", n_reader);
29797 printf(" %d", n_no);
29798 printf("\n");
29799 }
29800 }
29801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029802 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803#endif
29804
Daniel Veillard42595322004-11-08 10:52:06 +000029805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029806}
29807
29808
29809static int
29810test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029812
William M. Brack21e4ef22005-01-02 09:53:13 +000029813#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029814 int mem_base;
29815 xmlChar * ret_val;
29816 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29817 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029818 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029819 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029820 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029821 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029822
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029823 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29824 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29825 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029827 reader = gen_xmlTextReaderPtr(n_reader, 0);
29828 localName = gen_const_xmlChar_ptr(n_localName, 1);
29829 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029830
William M. Brackf13f77f2004-11-12 16:03:48 +000029831 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029832 desret_xmlChar_ptr(ret_val);
29833 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029834 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029835 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29836 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029837 xmlResetLastError();
29838 if (mem_base != xmlMemBlocks()) {
29839 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029841 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029842 printf(" %d", n_reader);
29843 printf(" %d", n_localName);
29844 printf(" %d", n_namespaceURI);
29845 printf("\n");
29846 }
29847 }
29848 }
29849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029850 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029851#endif
29852
Daniel Veillard42595322004-11-08 10:52:06 +000029853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029854}
29855
Daniel Veillarda521d282004-11-09 14:59:59 +000029856#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029857
Daniel Veillardce682bc2004-11-05 17:22:25 +000029858#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29859static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29860 return(NULL);
29861}
29862static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29863}
Daniel Veillarda521d282004-11-09 14:59:59 +000029864#endif
29865
Daniel Veillardce682bc2004-11-05 17:22:25 +000029866
Daniel Veillardd93f6252004-11-02 15:53:51 +000029867static int
29868test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029870
William M. Brack21e4ef22005-01-02 09:53:13 +000029871#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029872 int mem_base;
29873 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29874 int n_reader;
29875 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29876 int n_f;
29877 void ** arg; /* a user argument */
29878 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029879
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029880 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29881 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29882 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29883 mem_base = xmlMemBlocks();
29884 reader = gen_xmlTextReaderPtr(n_reader, 0);
29885 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29886 arg = gen_void_ptr_ptr(n_arg, 2);
29887
29888 xmlTextReaderGetErrorHandler(reader, f, arg);
29889 call_tests++;
29890 des_xmlTextReaderPtr(n_reader, reader, 0);
29891 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29892 des_void_ptr_ptr(n_arg, arg, 2);
29893 xmlResetLastError();
29894 if (mem_base != xmlMemBlocks()) {
29895 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029897 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029898 printf(" %d", n_reader);
29899 printf(" %d", n_f);
29900 printf(" %d", n_arg);
29901 printf("\n");
29902 }
29903 }
29904 }
29905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029906 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029907#endif
29908
Daniel Veillard42595322004-11-08 10:52:06 +000029909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029910}
29911
29912
29913static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029914test_xmlTextReaderGetParserColumnNumber(void) {
29915 int test_ret = 0;
29916
29917#if defined(LIBXML_READER_ENABLED)
29918 int mem_base;
29919 int ret_val;
29920 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29921 int n_reader;
29922
29923 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29924 mem_base = xmlMemBlocks();
29925 reader = gen_xmlTextReaderPtr(n_reader, 0);
29926
29927 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29928 desret_int(ret_val);
29929 call_tests++;
29930 des_xmlTextReaderPtr(n_reader, reader, 0);
29931 xmlResetLastError();
29932 if (mem_base != xmlMemBlocks()) {
29933 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29934 xmlMemBlocks() - mem_base);
29935 test_ret++;
29936 printf(" %d", n_reader);
29937 printf("\n");
29938 }
29939 }
29940 function_tests++;
29941#endif
29942
29943 return(test_ret);
29944}
29945
29946
29947static int
29948test_xmlTextReaderGetParserLineNumber(void) {
29949 int test_ret = 0;
29950
29951#if defined(LIBXML_READER_ENABLED)
29952 int mem_base;
29953 int ret_val;
29954 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29955 int n_reader;
29956
29957 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29958 mem_base = xmlMemBlocks();
29959 reader = gen_xmlTextReaderPtr(n_reader, 0);
29960
29961 ret_val = xmlTextReaderGetParserLineNumber(reader);
29962 desret_int(ret_val);
29963 call_tests++;
29964 des_xmlTextReaderPtr(n_reader, reader, 0);
29965 xmlResetLastError();
29966 if (mem_base != xmlMemBlocks()) {
29967 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29968 xmlMemBlocks() - mem_base);
29969 test_ret++;
29970 printf(" %d", n_reader);
29971 printf("\n");
29972 }
29973 }
29974 function_tests++;
29975#endif
29976
29977 return(test_ret);
29978}
29979
29980
29981static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029982test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029984
William M. Brack21e4ef22005-01-02 09:53:13 +000029985#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029986 int mem_base;
29987 int ret_val;
29988 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29989 int n_reader;
29990 int prop; /* the xmlParserProperties to get */
29991 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029992
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029993 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29994 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029996 reader = gen_xmlTextReaderPtr(n_reader, 0);
29997 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029998
29999 ret_val = xmlTextReaderGetParserProp(reader, prop);
30000 desret_int(ret_val);
30001 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030002 des_xmlTextReaderPtr(n_reader, reader, 0);
30003 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030004 xmlResetLastError();
30005 if (mem_base != xmlMemBlocks()) {
30006 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
30007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030008 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030009 printf(" %d", n_reader);
30010 printf(" %d", n_prop);
30011 printf("\n");
30012 }
30013 }
30014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030015 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030016#endif
30017
Daniel Veillard42595322004-11-08 10:52:06 +000030018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030019}
30020
30021
30022static int
30023test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030025
William M. Brack21e4ef22005-01-02 09:53:13 +000030026#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030027 int mem_base;
30028 xmlParserInputBufferPtr ret_val;
30029 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30030 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030032 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30033 mem_base = xmlMemBlocks();
30034 reader = gen_xmlTextReaderPtr(n_reader, 0);
30035
30036 ret_val = xmlTextReaderGetRemainder(reader);
30037 desret_xmlParserInputBufferPtr(ret_val);
30038 call_tests++;
30039 des_xmlTextReaderPtr(n_reader, reader, 0);
30040 xmlResetLastError();
30041 if (mem_base != xmlMemBlocks()) {
30042 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
30043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030044 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030045 printf(" %d", n_reader);
30046 printf("\n");
30047 }
30048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030049 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030050#endif
30051
Daniel Veillard42595322004-11-08 10:52:06 +000030052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030053}
30054
30055
30056static int
30057test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030059
William M. Brack21e4ef22005-01-02 09:53:13 +000030060#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030061 int mem_base;
30062 int ret_val;
30063 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30064 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030065
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030066 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30067 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030068 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030069
30070 ret_val = xmlTextReaderHasAttributes(reader);
30071 desret_int(ret_val);
30072 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030073 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030074 xmlResetLastError();
30075 if (mem_base != xmlMemBlocks()) {
30076 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
30077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030078 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030079 printf(" %d", n_reader);
30080 printf("\n");
30081 }
30082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030083 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030084#endif
30085
Daniel Veillard42595322004-11-08 10:52:06 +000030086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030087}
30088
30089
30090static int
30091test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030093
William M. Brack21e4ef22005-01-02 09:53:13 +000030094#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030095 int mem_base;
30096 int ret_val;
30097 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30098 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030099
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030100 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30101 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030102 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030103
30104 ret_val = xmlTextReaderHasValue(reader);
30105 desret_int(ret_val);
30106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030107 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030108 xmlResetLastError();
30109 if (mem_base != xmlMemBlocks()) {
30110 printf("Leak of %d blocks found in xmlTextReaderHasValue",
30111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030112 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030113 printf(" %d", n_reader);
30114 printf("\n");
30115 }
30116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030117 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030118#endif
30119
Daniel Veillard42595322004-11-08 10:52:06 +000030120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030121}
30122
30123
30124static int
30125test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030127
William M. Brack21e4ef22005-01-02 09:53:13 +000030128#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030129 int mem_base;
30130 int ret_val;
30131 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30132 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030133
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030134 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030136 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030137
30138 ret_val = xmlTextReaderIsDefault(reader);
30139 desret_int(ret_val);
30140 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030141 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030142 xmlResetLastError();
30143 if (mem_base != xmlMemBlocks()) {
30144 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
30145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030146 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030147 printf(" %d", n_reader);
30148 printf("\n");
30149 }
30150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030151 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030152#endif
30153
Daniel Veillard42595322004-11-08 10:52:06 +000030154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030155}
30156
30157
30158static int
30159test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030161
William M. Brack21e4ef22005-01-02 09:53:13 +000030162#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030163 int mem_base;
30164 int ret_val;
30165 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30166 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030167
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030168 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30169 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030170 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030171
30172 ret_val = xmlTextReaderIsEmptyElement(reader);
30173 desret_int(ret_val);
30174 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030175 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030176 xmlResetLastError();
30177 if (mem_base != xmlMemBlocks()) {
30178 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
30179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030180 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030181 printf(" %d", n_reader);
30182 printf("\n");
30183 }
30184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030185 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030186#endif
30187
Daniel Veillard42595322004-11-08 10:52:06 +000030188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030189}
30190
30191
30192static int
30193test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030195
William M. Brack21e4ef22005-01-02 09:53:13 +000030196#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030197 int mem_base;
30198 int ret_val;
30199 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30200 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030201
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030202 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30203 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030204 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030205
30206 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30207 desret_int(ret_val);
30208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030209 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030210 xmlResetLastError();
30211 if (mem_base != xmlMemBlocks()) {
30212 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030214 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030215 printf(" %d", n_reader);
30216 printf("\n");
30217 }
30218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030219 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030220#endif
30221
Daniel Veillard42595322004-11-08 10:52:06 +000030222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030223}
30224
30225
30226static int
30227test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030229
William M. Brack21e4ef22005-01-02 09:53:13 +000030230#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030231 int mem_base;
30232 int ret_val;
30233 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30234 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030235
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030236 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030238 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030239
30240 ret_val = xmlTextReaderIsValid(reader);
30241 desret_int(ret_val);
30242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030243 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030244 xmlResetLastError();
30245 if (mem_base != xmlMemBlocks()) {
30246 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030248 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030249 printf(" %d", n_reader);
30250 printf("\n");
30251 }
30252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030253 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030254#endif
30255
Daniel Veillard42595322004-11-08 10:52:06 +000030256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030257}
30258
30259
30260static int
30261test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030263
William M. Brack21e4ef22005-01-02 09:53:13 +000030264#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030265 int mem_base;
30266 xmlChar * ret_val;
30267 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30268 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030269
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030270 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030272 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030273
30274 ret_val = xmlTextReaderLocalName(reader);
30275 desret_xmlChar_ptr(ret_val);
30276 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030277 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030278 xmlResetLastError();
30279 if (mem_base != xmlMemBlocks()) {
30280 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030282 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030283 printf(" %d", n_reader);
30284 printf("\n");
30285 }
30286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030287 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030288#endif
30289
Daniel Veillard42595322004-11-08 10:52:06 +000030290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030291}
30292
Daniel Veillarda521d282004-11-09 14:59:59 +000030293#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030294
Daniel Veillardce682bc2004-11-05 17:22:25 +000030295#define gen_nb_xmlTextReaderLocatorPtr 1
30296static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30297 return(NULL);
30298}
30299static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30300}
Daniel Veillarda521d282004-11-09 14:59:59 +000030301#endif
30302
Daniel Veillardce682bc2004-11-05 17:22:25 +000030303
Daniel Veillardd93f6252004-11-02 15:53:51 +000030304static int
30305test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030307
William M. Brack21e4ef22005-01-02 09:53:13 +000030308#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030309 int mem_base;
30310 xmlChar * ret_val;
30311 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30312 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030313
Daniel Veillardce682bc2004-11-05 17:22:25 +000030314 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30315 mem_base = xmlMemBlocks();
30316 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30317
30318 ret_val = xmlTextReaderLocatorBaseURI(locator);
30319 desret_xmlChar_ptr(ret_val);
30320 call_tests++;
30321 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30322 xmlResetLastError();
30323 if (mem_base != xmlMemBlocks()) {
30324 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030326 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030327 printf(" %d", n_locator);
30328 printf("\n");
30329 }
30330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030331 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030332#endif
30333
Daniel Veillard42595322004-11-08 10:52:06 +000030334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030335}
30336
30337
30338static int
30339test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030341
William M. Brack21e4ef22005-01-02 09:53:13 +000030342#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030343 int mem_base;
30344 int ret_val;
30345 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30346 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030347
Daniel Veillardce682bc2004-11-05 17:22:25 +000030348 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30349 mem_base = xmlMemBlocks();
30350 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30351
30352 ret_val = xmlTextReaderLocatorLineNumber(locator);
30353 desret_int(ret_val);
30354 call_tests++;
30355 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30356 xmlResetLastError();
30357 if (mem_base != xmlMemBlocks()) {
30358 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030360 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030361 printf(" %d", n_locator);
30362 printf("\n");
30363 }
30364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030365 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030366#endif
30367
Daniel Veillard42595322004-11-08 10:52:06 +000030368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030369}
30370
30371
30372static int
30373test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030375
William M. Brack21e4ef22005-01-02 09:53:13 +000030376#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030377 int mem_base;
30378 xmlChar * ret_val;
30379 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30380 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030381 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 +000030382 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030383
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030384 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30385 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030387 reader = gen_xmlTextReaderPtr(n_reader, 0);
30388 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030389
William M. Brackf13f77f2004-11-12 16:03:48 +000030390 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030391 desret_xmlChar_ptr(ret_val);
30392 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030393 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030394 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030395 xmlResetLastError();
30396 if (mem_base != xmlMemBlocks()) {
30397 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030399 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030400 printf(" %d", n_reader);
30401 printf(" %d", n_prefix);
30402 printf("\n");
30403 }
30404 }
30405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030406 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030407#endif
30408
Daniel Veillard42595322004-11-08 10:52:06 +000030409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030410}
30411
30412
30413static int
30414test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030416
William M. Brack21e4ef22005-01-02 09:53:13 +000030417#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030418 int mem_base;
30419 int ret_val;
30420 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30421 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030422 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030423 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030424
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030425 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30426 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30427 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030428 reader = gen_xmlTextReaderPtr(n_reader, 0);
30429 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030430
William M. Brackf13f77f2004-11-12 16:03:48 +000030431 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030432 desret_int(ret_val);
30433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030434 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030435 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030436 xmlResetLastError();
30437 if (mem_base != xmlMemBlocks()) {
30438 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030440 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030441 printf(" %d", n_reader);
30442 printf(" %d", n_name);
30443 printf("\n");
30444 }
30445 }
30446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030447 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030448#endif
30449
Daniel Veillard42595322004-11-08 10:52:06 +000030450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030451}
30452
30453
30454static int
30455test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030457
William M. Brack21e4ef22005-01-02 09:53:13 +000030458#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030459 int mem_base;
30460 int ret_val;
30461 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30462 int n_reader;
30463 int no; /* the zero-based index of the attribute relative to the containing element. */
30464 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030465
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030466 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30467 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30468 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030469 reader = gen_xmlTextReaderPtr(n_reader, 0);
30470 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030471
30472 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30473 desret_int(ret_val);
30474 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030475 des_xmlTextReaderPtr(n_reader, reader, 0);
30476 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030477 xmlResetLastError();
30478 if (mem_base != xmlMemBlocks()) {
30479 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030481 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030482 printf(" %d", n_reader);
30483 printf(" %d", n_no);
30484 printf("\n");
30485 }
30486 }
30487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030488 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489#endif
30490
Daniel Veillard42595322004-11-08 10:52:06 +000030491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030492}
30493
30494
30495static int
30496test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030498
William M. Brack21e4ef22005-01-02 09:53:13 +000030499#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030500 int mem_base;
30501 int ret_val;
30502 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30503 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030504 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030505 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030506 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030507 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030508
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030509 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30510 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30511 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30512 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030513 reader = gen_xmlTextReaderPtr(n_reader, 0);
30514 localName = gen_const_xmlChar_ptr(n_localName, 1);
30515 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030516
William M. Brackf13f77f2004-11-12 16:03:48 +000030517 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030518 desret_int(ret_val);
30519 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030520 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030521 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30522 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030523 xmlResetLastError();
30524 if (mem_base != xmlMemBlocks()) {
30525 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030527 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030528 printf(" %d", n_reader);
30529 printf(" %d", n_localName);
30530 printf(" %d", n_namespaceURI);
30531 printf("\n");
30532 }
30533 }
30534 }
30535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030536 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030537#endif
30538
Daniel Veillard42595322004-11-08 10:52:06 +000030539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030540}
30541
30542
30543static int
30544test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030546
William M. Brack21e4ef22005-01-02 09:53:13 +000030547#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030548 int mem_base;
30549 int ret_val;
30550 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30551 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030552
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030553 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30554 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030555 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030556
30557 ret_val = xmlTextReaderMoveToElement(reader);
30558 desret_int(ret_val);
30559 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030560 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030561 xmlResetLastError();
30562 if (mem_base != xmlMemBlocks()) {
30563 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030565 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030566 printf(" %d", n_reader);
30567 printf("\n");
30568 }
30569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030570 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030571#endif
30572
Daniel Veillard42595322004-11-08 10:52:06 +000030573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030574}
30575
30576
30577static int
30578test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030580
William M. Brack21e4ef22005-01-02 09:53:13 +000030581#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030582 int mem_base;
30583 int ret_val;
30584 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30585 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030586
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030587 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30588 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030589 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030590
30591 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30592 desret_int(ret_val);
30593 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030594 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030595 xmlResetLastError();
30596 if (mem_base != xmlMemBlocks()) {
30597 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030599 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030600 printf(" %d", n_reader);
30601 printf("\n");
30602 }
30603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030604 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030605#endif
30606
Daniel Veillard42595322004-11-08 10:52:06 +000030607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030608}
30609
30610
30611static int
30612test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030614
William M. Brack21e4ef22005-01-02 09:53:13 +000030615#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030616 int mem_base;
30617 int ret_val;
30618 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30619 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030620
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030621 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30622 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030623 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030624
30625 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30626 desret_int(ret_val);
30627 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030628 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030629 xmlResetLastError();
30630 if (mem_base != xmlMemBlocks()) {
30631 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030633 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030634 printf(" %d", n_reader);
30635 printf("\n");
30636 }
30637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030638 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030639#endif
30640
Daniel Veillard42595322004-11-08 10:52:06 +000030641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030642}
30643
30644
30645static int
30646test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030648
William M. Brack21e4ef22005-01-02 09:53:13 +000030649#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030650 int mem_base;
30651 xmlChar * ret_val;
30652 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30653 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030654
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030655 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30656 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030657 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030658
30659 ret_val = xmlTextReaderName(reader);
30660 desret_xmlChar_ptr(ret_val);
30661 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030662 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030663 xmlResetLastError();
30664 if (mem_base != xmlMemBlocks()) {
30665 printf("Leak of %d blocks found in xmlTextReaderName",
30666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030667 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030668 printf(" %d", n_reader);
30669 printf("\n");
30670 }
30671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030672 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030673#endif
30674
Daniel Veillard42595322004-11-08 10:52:06 +000030675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030676}
30677
30678
30679static int
30680test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030682
William M. Brack21e4ef22005-01-02 09:53:13 +000030683#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030684 int mem_base;
30685 xmlChar * ret_val;
30686 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30687 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030688
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030689 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030691 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030692
30693 ret_val = xmlTextReaderNamespaceUri(reader);
30694 desret_xmlChar_ptr(ret_val);
30695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030696 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030697 xmlResetLastError();
30698 if (mem_base != xmlMemBlocks()) {
30699 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030701 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030702 printf(" %d", n_reader);
30703 printf("\n");
30704 }
30705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030706 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030707#endif
30708
Daniel Veillard42595322004-11-08 10:52:06 +000030709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030710}
30711
30712
30713static int
30714test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030716
William M. Brack21e4ef22005-01-02 09:53:13 +000030717#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030718 int mem_base;
30719 int ret_val;
30720 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30721 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030722
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030723 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30724 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030725 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030726
30727 ret_val = xmlTextReaderNext(reader);
30728 desret_int(ret_val);
30729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030730 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030731 xmlResetLastError();
30732 if (mem_base != xmlMemBlocks()) {
30733 printf("Leak of %d blocks found in xmlTextReaderNext",
30734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030735 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030736 printf(" %d", n_reader);
30737 printf("\n");
30738 }
30739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030740 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030741#endif
30742
Daniel Veillard42595322004-11-08 10:52:06 +000030743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030744}
30745
30746
30747static int
30748test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030750
William M. Brack21e4ef22005-01-02 09:53:13 +000030751#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030752 int mem_base;
30753 int ret_val;
30754 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30755 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030756
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030757 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30758 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030759 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030760
30761 ret_val = xmlTextReaderNextSibling(reader);
30762 desret_int(ret_val);
30763 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030764 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030765 xmlResetLastError();
30766 if (mem_base != xmlMemBlocks()) {
30767 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030769 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030770 printf(" %d", n_reader);
30771 printf("\n");
30772 }
30773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030774 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030775#endif
30776
Daniel Veillard42595322004-11-08 10:52:06 +000030777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030778}
30779
30780
30781static int
30782test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030784
William M. Brack21e4ef22005-01-02 09:53:13 +000030785#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030786 int mem_base;
30787 int ret_val;
30788 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30789 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030790
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030791 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030793 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030794
30795 ret_val = xmlTextReaderNodeType(reader);
30796 desret_int(ret_val);
30797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030798 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030799 xmlResetLastError();
30800 if (mem_base != xmlMemBlocks()) {
30801 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030803 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030804 printf(" %d", n_reader);
30805 printf("\n");
30806 }
30807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030808 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030809#endif
30810
Daniel Veillard42595322004-11-08 10:52:06 +000030811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030812}
30813
30814
30815static int
30816test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030818
William M. Brack21e4ef22005-01-02 09:53:13 +000030819#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030820 int mem_base;
30821 int ret_val;
30822 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30823 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030824
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030825 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030827 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030828
30829 ret_val = xmlTextReaderNormalization(reader);
30830 desret_int(ret_val);
30831 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030832 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030833 xmlResetLastError();
30834 if (mem_base != xmlMemBlocks()) {
30835 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030837 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030838 printf(" %d", n_reader);
30839 printf("\n");
30840 }
30841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030842 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030843#endif
30844
Daniel Veillard42595322004-11-08 10:52:06 +000030845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030846}
30847
30848
30849static int
30850test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030852
William M. Brack21e4ef22005-01-02 09:53:13 +000030853#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030854 int mem_base;
30855 xmlChar * ret_val;
30856 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30857 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030858
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030859 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030861 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030862
30863 ret_val = xmlTextReaderPrefix(reader);
30864 desret_xmlChar_ptr(ret_val);
30865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030866 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030867 xmlResetLastError();
30868 if (mem_base != xmlMemBlocks()) {
30869 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030871 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030872 printf(" %d", n_reader);
30873 printf("\n");
30874 }
30875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030876 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030877#endif
30878
Daniel Veillard42595322004-11-08 10:52:06 +000030879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030880}
30881
30882
30883static int
30884test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030886
William M. Brack21e4ef22005-01-02 09:53:13 +000030887#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030888 int mem_base;
30889 xmlNodePtr ret_val;
30890 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30891 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030892
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030893 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030895 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030896
30897 ret_val = xmlTextReaderPreserve(reader);
30898 desret_xmlNodePtr(ret_val);
30899 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030900 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030901 xmlResetLastError();
30902 if (mem_base != xmlMemBlocks()) {
30903 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030905 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030906 printf(" %d", n_reader);
30907 printf("\n");
30908 }
30909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030910 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030911#endif
30912
Daniel Veillard42595322004-11-08 10:52:06 +000030913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030914}
30915
30916
30917static int
30918test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030920
William M. Brack21e4ef22005-01-02 09:53:13 +000030921#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030922#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030923 int mem_base;
30924 int ret_val;
30925 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30926 int n_reader;
30927 xmlChar * pattern; /* an XPath subset pattern */
30928 int n_pattern;
30929 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30930 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030931
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030932 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30933 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30934 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30935 mem_base = xmlMemBlocks();
30936 reader = gen_xmlTextReaderPtr(n_reader, 0);
30937 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30938 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30939
William M. Brackf13f77f2004-11-12 16:03:48 +000030940 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030941 desret_int(ret_val);
30942 call_tests++;
30943 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030944 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30945 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030946 xmlResetLastError();
30947 if (mem_base != xmlMemBlocks()) {
30948 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030950 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030951 printf(" %d", n_reader);
30952 printf(" %d", n_pattern);
30953 printf(" %d", n_namespaces);
30954 printf("\n");
30955 }
30956 }
30957 }
30958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030959 function_tests++;
30960#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030961#endif
30962
Daniel Veillard42595322004-11-08 10:52:06 +000030963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030964}
30965
30966
30967static int
30968test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030970
William M. Brack21e4ef22005-01-02 09:53:13 +000030971#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030972 int mem_base;
30973 int ret_val;
30974 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30975 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030976
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030977 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030979 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030980
30981 ret_val = xmlTextReaderQuoteChar(reader);
30982 desret_int(ret_val);
30983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030984 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030985 xmlResetLastError();
30986 if (mem_base != xmlMemBlocks()) {
30987 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030989 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030990 printf(" %d", n_reader);
30991 printf("\n");
30992 }
30993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030994 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030995#endif
30996
Daniel Veillard42595322004-11-08 10:52:06 +000030997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030998}
30999
31000
31001static int
31002test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031004
William M. Brack21e4ef22005-01-02 09:53:13 +000031005#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031006 int mem_base;
31007 int ret_val;
31008 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31009 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031010
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031011 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31012 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031013 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031014
31015 ret_val = xmlTextReaderRead(reader);
31016 desret_int(ret_val);
31017 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031018 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031019 xmlResetLastError();
31020 if (mem_base != xmlMemBlocks()) {
31021 printf("Leak of %d blocks found in xmlTextReaderRead",
31022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031023 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031024 printf(" %d", n_reader);
31025 printf("\n");
31026 }
31027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031028 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031029#endif
31030
Daniel Veillard42595322004-11-08 10:52:06 +000031031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031032}
31033
31034
31035static int
31036test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031038
William M. Brack21e4ef22005-01-02 09:53:13 +000031039#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031040 int mem_base;
31041 int ret_val;
31042 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31043 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031044
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031045 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031047 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031048
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031049 ret_val = xmlTextReaderReadAttributeValue(reader);
31050 desret_int(ret_val);
31051 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031052 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031053 xmlResetLastError();
31054 if (mem_base != xmlMemBlocks()) {
31055 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
31056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031057 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031058 printf(" %d", n_reader);
31059 printf("\n");
31060 }
31061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031062 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031063#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031064
Daniel Veillard42595322004-11-08 10:52:06 +000031065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031066}
31067
31068
31069static int
31070test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031072
William M. Brack21e4ef22005-01-02 09:53:13 +000031073#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031074 int mem_base;
31075 int ret_val;
31076 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31077 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031078
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031079 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031081 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031082
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031083 ret_val = xmlTextReaderReadState(reader);
31084 desret_int(ret_val);
31085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031086 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031087 xmlResetLastError();
31088 if (mem_base != xmlMemBlocks()) {
31089 printf("Leak of %d blocks found in xmlTextReaderReadState",
31090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031091 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031092 printf(" %d", n_reader);
31093 printf("\n");
31094 }
31095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031096 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031097#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031098
Daniel Veillard42595322004-11-08 10:52:06 +000031099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031100}
31101
31102
31103static int
31104test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031106
William M. Brack21e4ef22005-01-02 09:53:13 +000031107#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031108 int mem_base;
31109 int ret_val;
31110 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31111 int n_reader;
31112 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
31113 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031114
Daniel Veillardce682bc2004-11-05 17:22:25 +000031115 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31116 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
31117 mem_base = xmlMemBlocks();
31118 reader = gen_xmlTextReaderPtr(n_reader, 0);
31119 schema = gen_xmlRelaxNGPtr(n_schema, 1);
31120
31121 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
31122 desret_int(ret_val);
31123 call_tests++;
31124 des_xmlTextReaderPtr(n_reader, reader, 0);
31125 des_xmlRelaxNGPtr(n_schema, schema, 1);
31126 xmlResetLastError();
31127 if (mem_base != xmlMemBlocks()) {
31128 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
31129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031130 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031131 printf(" %d", n_reader);
31132 printf(" %d", n_schema);
31133 printf("\n");
31134 }
31135 }
31136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031137 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031138#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031139
Daniel Veillard42595322004-11-08 10:52:06 +000031140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031141}
31142
31143
31144static int
31145test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031147
William M. Brack21e4ef22005-01-02 09:53:13 +000031148#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031149 int mem_base;
31150 int ret_val;
31151 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31152 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031153 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031154 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031155
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031156 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31157 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
31158 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031159 reader = gen_xmlTextReaderPtr(n_reader, 0);
31160 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031161
William M. Brackf13f77f2004-11-12 16:03:48 +000031162 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031163 desret_int(ret_val);
31164 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031165 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031166 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031167 xmlResetLastError();
31168 if (mem_base != xmlMemBlocks()) {
31169 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
31170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031171 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031172 printf(" %d", n_reader);
31173 printf(" %d", n_rng);
31174 printf("\n");
31175 }
31176 }
31177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031178 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031179#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031180
Daniel Veillard42595322004-11-08 10:52:06 +000031181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031182}
31183
31184
31185static int
31186test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031188
31189
31190 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031192}
31193
31194
31195static int
31196test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031198
William M. Brack21e4ef22005-01-02 09:53:13 +000031199#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031200 int mem_base;
31201 int ret_val;
31202 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31203 int n_reader;
31204 int prop; /* the xmlParserProperties to set */
31205 int n_prop;
31206 int value; /* usually 0 or 1 to (de)activate it */
31207 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031208
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031209 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31210 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31211 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31212 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031213 reader = gen_xmlTextReaderPtr(n_reader, 0);
31214 prop = gen_int(n_prop, 1);
31215 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031216
31217 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31218 desret_int(ret_val);
31219 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031220 des_xmlTextReaderPtr(n_reader, reader, 0);
31221 des_int(n_prop, prop, 1);
31222 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031223 xmlResetLastError();
31224 if (mem_base != xmlMemBlocks()) {
31225 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031227 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031228 printf(" %d", n_reader);
31229 printf(" %d", n_prop);
31230 printf(" %d", n_value);
31231 printf("\n");
31232 }
31233 }
31234 }
31235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031236 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031237#endif
31238
Daniel Veillard42595322004-11-08 10:52:06 +000031239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031240}
31241
31242
31243static int
31244test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031246
31247
31248 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031250}
31251
31252
31253static int
31254test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031256
William M. Brack21e4ef22005-01-02 09:53:13 +000031257#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031258 int mem_base;
31259 int ret_val;
31260 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31261 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031262
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031263 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031265 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031266
31267 ret_val = xmlTextReaderStandalone(reader);
31268 desret_int(ret_val);
31269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031270 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031271 xmlResetLastError();
31272 if (mem_base != xmlMemBlocks()) {
31273 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031275 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031276 printf(" %d", n_reader);
31277 printf("\n");
31278 }
31279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031280 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031281#endif
31282
Daniel Veillard42595322004-11-08 10:52:06 +000031283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031284}
31285
31286
31287static int
31288test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031290
William M. Brack21e4ef22005-01-02 09:53:13 +000031291#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031292 int mem_base;
31293 xmlChar * ret_val;
31294 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31295 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031296
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031297 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031299 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031300
31301 ret_val = xmlTextReaderValue(reader);
31302 desret_xmlChar_ptr(ret_val);
31303 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031304 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031305 xmlResetLastError();
31306 if (mem_base != xmlMemBlocks()) {
31307 printf("Leak of %d blocks found in xmlTextReaderValue",
31308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031309 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031310 printf(" %d", n_reader);
31311 printf("\n");
31312 }
31313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031314 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031315#endif
31316
Daniel Veillard42595322004-11-08 10:52:06 +000031317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031318}
31319
31320
31321static int
31322test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031324
William M. Brack21e4ef22005-01-02 09:53:13 +000031325#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031326 int mem_base;
31327 xmlChar * ret_val;
31328 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31329 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031330
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031331 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031333 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031334
31335 ret_val = xmlTextReaderXmlLang(reader);
31336 desret_xmlChar_ptr(ret_val);
31337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031338 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031339 xmlResetLastError();
31340 if (mem_base != xmlMemBlocks()) {
31341 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031343 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031344 printf(" %d", n_reader);
31345 printf("\n");
31346 }
31347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031348 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031349#endif
31350
Daniel Veillard42595322004-11-08 10:52:06 +000031351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031352}
31353
31354static int
31355test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031357
Daniel Veillardb5839c32005-02-19 18:27:14 +000031358 if (quiet == 0) printf("Testing xmlreader : 71 of 81 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031359 test_ret += test_xmlNewTextReader();
31360 test_ret += test_xmlNewTextReaderFilename();
31361 test_ret += test_xmlReaderForDoc();
31362 test_ret += test_xmlReaderForFile();
31363 test_ret += test_xmlReaderForMemory();
31364 test_ret += test_xmlReaderNewDoc();
31365 test_ret += test_xmlReaderNewFile();
31366 test_ret += test_xmlReaderNewMemory();
31367 test_ret += test_xmlReaderNewWalker();
31368 test_ret += test_xmlReaderWalker();
31369 test_ret += test_xmlTextReaderAttributeCount();
31370 test_ret += test_xmlTextReaderBaseUri();
Daniel Veillardb5839c32005-02-19 18:27:14 +000031371 test_ret += test_xmlTextReaderByteConsumed();
Daniel Veillard42595322004-11-08 10:52:06 +000031372 test_ret += test_xmlTextReaderClose();
31373 test_ret += test_xmlTextReaderConstBaseUri();
31374 test_ret += test_xmlTextReaderConstEncoding();
31375 test_ret += test_xmlTextReaderConstLocalName();
31376 test_ret += test_xmlTextReaderConstName();
31377 test_ret += test_xmlTextReaderConstNamespaceUri();
31378 test_ret += test_xmlTextReaderConstPrefix();
31379 test_ret += test_xmlTextReaderConstString();
31380 test_ret += test_xmlTextReaderConstValue();
31381 test_ret += test_xmlTextReaderConstXmlLang();
31382 test_ret += test_xmlTextReaderConstXmlVersion();
31383 test_ret += test_xmlTextReaderCurrentDoc();
31384 test_ret += test_xmlTextReaderCurrentNode();
31385 test_ret += test_xmlTextReaderDepth();
31386 test_ret += test_xmlTextReaderExpand();
31387 test_ret += test_xmlTextReaderGetAttribute();
31388 test_ret += test_xmlTextReaderGetAttributeNo();
31389 test_ret += test_xmlTextReaderGetAttributeNs();
31390 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031391 test_ret += test_xmlTextReaderGetParserColumnNumber();
31392 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031393 test_ret += test_xmlTextReaderGetParserProp();
31394 test_ret += test_xmlTextReaderGetRemainder();
31395 test_ret += test_xmlTextReaderHasAttributes();
31396 test_ret += test_xmlTextReaderHasValue();
31397 test_ret += test_xmlTextReaderIsDefault();
31398 test_ret += test_xmlTextReaderIsEmptyElement();
31399 test_ret += test_xmlTextReaderIsNamespaceDecl();
31400 test_ret += test_xmlTextReaderIsValid();
31401 test_ret += test_xmlTextReaderLocalName();
31402 test_ret += test_xmlTextReaderLocatorBaseURI();
31403 test_ret += test_xmlTextReaderLocatorLineNumber();
31404 test_ret += test_xmlTextReaderLookupNamespace();
31405 test_ret += test_xmlTextReaderMoveToAttribute();
31406 test_ret += test_xmlTextReaderMoveToAttributeNo();
31407 test_ret += test_xmlTextReaderMoveToAttributeNs();
31408 test_ret += test_xmlTextReaderMoveToElement();
31409 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31410 test_ret += test_xmlTextReaderMoveToNextAttribute();
31411 test_ret += test_xmlTextReaderName();
31412 test_ret += test_xmlTextReaderNamespaceUri();
31413 test_ret += test_xmlTextReaderNext();
31414 test_ret += test_xmlTextReaderNextSibling();
31415 test_ret += test_xmlTextReaderNodeType();
31416 test_ret += test_xmlTextReaderNormalization();
31417 test_ret += test_xmlTextReaderPrefix();
31418 test_ret += test_xmlTextReaderPreserve();
31419 test_ret += test_xmlTextReaderPreservePattern();
31420 test_ret += test_xmlTextReaderQuoteChar();
31421 test_ret += test_xmlTextReaderRead();
31422 test_ret += test_xmlTextReaderReadAttributeValue();
31423 test_ret += test_xmlTextReaderReadState();
31424 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31425 test_ret += test_xmlTextReaderRelaxNGValidate();
31426 test_ret += test_xmlTextReaderSetErrorHandler();
31427 test_ret += test_xmlTextReaderSetParserProp();
31428 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31429 test_ret += test_xmlTextReaderStandalone();
31430 test_ret += test_xmlTextReaderValue();
31431 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031432
Daniel Veillard42595322004-11-08 10:52:06 +000031433 if (test_ret != 0)
31434 printf("Module xmlreader: %d errors\n", test_ret);
31435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031436}
Daniel Veillarda521d282004-11-09 14:59:59 +000031437#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031438
Daniel Veillarda82b1822004-11-08 16:24:57 +000031439#define gen_nb_xmlRegExecCtxtPtr 1
31440static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31441 return(NULL);
31442}
31443static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31444}
Daniel Veillarda521d282004-11-09 14:59:59 +000031445#endif
31446
Daniel Veillarda82b1822004-11-08 16:24:57 +000031447
31448static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031449test_xmlRegExecErrInfo(void) {
31450 int test_ret = 0;
31451
31452#if defined(LIBXML_REGEXP_ENABLED)
31453 int mem_base;
31454 int ret_val;
31455 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31456 int n_exec;
31457 xmlChar ** string; /* return value for the error string */
31458 int n_string;
31459 int * nbval; /* pointer to the number of accepted values IN/OUT */
31460 int n_nbval;
31461 int * nbneg; /* return number of negative transitions */
31462 int n_nbneg;
31463 xmlChar ** values; /* pointer to the array of acceptable values */
31464 int n_values;
31465 int * terminal; /* return value if this was a terminal state */
31466 int n_terminal;
31467
31468 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31469 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31470 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31471 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31472 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31473 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31474 mem_base = xmlMemBlocks();
31475 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31476 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31477 nbval = gen_int_ptr(n_nbval, 2);
31478 nbneg = gen_int_ptr(n_nbneg, 3);
31479 values = gen_xmlChar_ptr_ptr(n_values, 4);
31480 terminal = gen_int_ptr(n_terminal, 5);
31481
31482 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31483 desret_int(ret_val);
31484 call_tests++;
31485 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31486 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31487 des_int_ptr(n_nbval, nbval, 2);
31488 des_int_ptr(n_nbneg, nbneg, 3);
31489 des_xmlChar_ptr_ptr(n_values, values, 4);
31490 des_int_ptr(n_terminal, terminal, 5);
31491 xmlResetLastError();
31492 if (mem_base != xmlMemBlocks()) {
31493 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31494 xmlMemBlocks() - mem_base);
31495 test_ret++;
31496 printf(" %d", n_exec);
31497 printf(" %d", n_string);
31498 printf(" %d", n_nbval);
31499 printf(" %d", n_nbneg);
31500 printf(" %d", n_values);
31501 printf(" %d", n_terminal);
31502 printf("\n");
31503 }
31504 }
31505 }
31506 }
31507 }
31508 }
31509 }
31510 function_tests++;
31511#endif
31512
31513 return(test_ret);
31514}
31515
31516
31517static int
31518test_xmlRegExecNextValues(void) {
31519 int test_ret = 0;
31520
31521#if defined(LIBXML_REGEXP_ENABLED)
31522 int mem_base;
31523 int ret_val;
31524 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31525 int n_exec;
31526 int * nbval; /* pointer to the number of accepted values IN/OUT */
31527 int n_nbval;
31528 int * nbneg; /* return number of negative transitions */
31529 int n_nbneg;
31530 xmlChar ** values; /* pointer to the array of acceptable values */
31531 int n_values;
31532 int * terminal; /* return value if this was a terminal state */
31533 int n_terminal;
31534
31535 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31536 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31537 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31538 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31539 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31540 mem_base = xmlMemBlocks();
31541 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31542 nbval = gen_int_ptr(n_nbval, 1);
31543 nbneg = gen_int_ptr(n_nbneg, 2);
31544 values = gen_xmlChar_ptr_ptr(n_values, 3);
31545 terminal = gen_int_ptr(n_terminal, 4);
31546
31547 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31548 desret_int(ret_val);
31549 call_tests++;
31550 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31551 des_int_ptr(n_nbval, nbval, 1);
31552 des_int_ptr(n_nbneg, nbneg, 2);
31553 des_xmlChar_ptr_ptr(n_values, values, 3);
31554 des_int_ptr(n_terminal, terminal, 4);
31555 xmlResetLastError();
31556 if (mem_base != xmlMemBlocks()) {
31557 printf("Leak of %d blocks found in xmlRegExecNextValues",
31558 xmlMemBlocks() - mem_base);
31559 test_ret++;
31560 printf(" %d", n_exec);
31561 printf(" %d", n_nbval);
31562 printf(" %d", n_nbneg);
31563 printf(" %d", n_values);
31564 printf(" %d", n_terminal);
31565 printf("\n");
31566 }
31567 }
31568 }
31569 }
31570 }
31571 }
31572 function_tests++;
31573#endif
31574
31575 return(test_ret);
31576}
31577
31578
31579static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031580test_xmlRegExecPushString(void) {
31581 int test_ret = 0;
31582
William M. Brack21e4ef22005-01-02 09:53:13 +000031583#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031584 int mem_base;
31585 int ret_val;
31586 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31587 int n_exec;
31588 xmlChar * value; /* a string token input */
31589 int n_value;
31590 void * data; /* data associated to the token to reuse in callbacks */
31591 int n_data;
31592
31593 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31594 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31595 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31596 mem_base = xmlMemBlocks();
31597 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31598 value = gen_const_xmlChar_ptr(n_value, 1);
31599 data = gen_userdata(n_data, 2);
31600
William M. Brackf13f77f2004-11-12 16:03:48 +000031601 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031602 desret_int(ret_val);
31603 call_tests++;
31604 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031605 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031606 des_userdata(n_data, data, 2);
31607 xmlResetLastError();
31608 if (mem_base != xmlMemBlocks()) {
31609 printf("Leak of %d blocks found in xmlRegExecPushString",
31610 xmlMemBlocks() - mem_base);
31611 test_ret++;
31612 printf(" %d", n_exec);
31613 printf(" %d", n_value);
31614 printf(" %d", n_data);
31615 printf("\n");
31616 }
31617 }
31618 }
31619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031620 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031621#endif
31622
Daniel Veillarda82b1822004-11-08 16:24:57 +000031623 return(test_ret);
31624}
31625
31626
31627static int
31628test_xmlRegExecPushString2(void) {
31629 int test_ret = 0;
31630
William M. Brack21e4ef22005-01-02 09:53:13 +000031631#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031632 int mem_base;
31633 int ret_val;
31634 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31635 int n_exec;
31636 xmlChar * value; /* the first string token input */
31637 int n_value;
31638 xmlChar * value2; /* the second string token input */
31639 int n_value2;
31640 void * data; /* data associated to the token to reuse in callbacks */
31641 int n_data;
31642
31643 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31644 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31645 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31646 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31647 mem_base = xmlMemBlocks();
31648 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31649 value = gen_const_xmlChar_ptr(n_value, 1);
31650 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31651 data = gen_userdata(n_data, 3);
31652
William M. Brackf13f77f2004-11-12 16:03:48 +000031653 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031654 desret_int(ret_val);
31655 call_tests++;
31656 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031657 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31658 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031659 des_userdata(n_data, data, 3);
31660 xmlResetLastError();
31661 if (mem_base != xmlMemBlocks()) {
31662 printf("Leak of %d blocks found in xmlRegExecPushString2",
31663 xmlMemBlocks() - mem_base);
31664 test_ret++;
31665 printf(" %d", n_exec);
31666 printf(" %d", n_value);
31667 printf(" %d", n_value2);
31668 printf(" %d", n_data);
31669 printf("\n");
31670 }
31671 }
31672 }
31673 }
31674 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031675 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031676#endif
31677
Daniel Veillarda82b1822004-11-08 16:24:57 +000031678 return(test_ret);
31679}
31680
Daniel Veillarda521d282004-11-09 14:59:59 +000031681#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031682
31683#define gen_nb_xmlRegexpPtr 1
31684static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31685 return(NULL);
31686}
31687static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31688}
Daniel Veillarda521d282004-11-09 14:59:59 +000031689#endif
31690
Daniel Veillarda82b1822004-11-08 16:24:57 +000031691
31692static int
31693test_xmlRegNewExecCtxt(void) {
31694 int test_ret = 0;
31695
31696
31697 /* missing type support */
31698 return(test_ret);
31699}
31700
31701
31702static int
31703test_xmlRegexpCompile(void) {
31704 int test_ret = 0;
31705
31706
31707 /* missing type support */
31708 return(test_ret);
31709}
31710
31711
31712static int
31713test_xmlRegexpExec(void) {
31714 int test_ret = 0;
31715
William M. Brack21e4ef22005-01-02 09:53:13 +000031716#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031717 int mem_base;
31718 int ret_val;
31719 xmlRegexpPtr comp; /* the compiled regular expression */
31720 int n_comp;
31721 xmlChar * content; /* the value to check against the regular expression */
31722 int n_content;
31723
31724 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31725 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31726 mem_base = xmlMemBlocks();
31727 comp = gen_xmlRegexpPtr(n_comp, 0);
31728 content = gen_const_xmlChar_ptr(n_content, 1);
31729
William M. Brackf13f77f2004-11-12 16:03:48 +000031730 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031731 desret_int(ret_val);
31732 call_tests++;
31733 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031734 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031735 xmlResetLastError();
31736 if (mem_base != xmlMemBlocks()) {
31737 printf("Leak of %d blocks found in xmlRegexpExec",
31738 xmlMemBlocks() - mem_base);
31739 test_ret++;
31740 printf(" %d", n_comp);
31741 printf(" %d", n_content);
31742 printf("\n");
31743 }
31744 }
31745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031746 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031747#endif
31748
Daniel Veillarda82b1822004-11-08 16:24:57 +000031749 return(test_ret);
31750}
31751
31752
31753static int
31754test_xmlRegexpIsDeterminist(void) {
31755 int test_ret = 0;
31756
William M. Brack21e4ef22005-01-02 09:53:13 +000031757#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031758 int mem_base;
31759 int ret_val;
31760 xmlRegexpPtr comp; /* the compiled regular expression */
31761 int n_comp;
31762
31763 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31764 mem_base = xmlMemBlocks();
31765 comp = gen_xmlRegexpPtr(n_comp, 0);
31766
31767 ret_val = xmlRegexpIsDeterminist(comp);
31768 desret_int(ret_val);
31769 call_tests++;
31770 des_xmlRegexpPtr(n_comp, comp, 0);
31771 xmlResetLastError();
31772 if (mem_base != xmlMemBlocks()) {
31773 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31774 xmlMemBlocks() - mem_base);
31775 test_ret++;
31776 printf(" %d", n_comp);
31777 printf("\n");
31778 }
31779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031780 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031781#endif
31782
Daniel Veillarda82b1822004-11-08 16:24:57 +000031783 return(test_ret);
31784}
31785
31786
31787static int
31788test_xmlRegexpPrint(void) {
31789 int test_ret = 0;
31790
William M. Brack21e4ef22005-01-02 09:53:13 +000031791#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031792 int mem_base;
31793 FILE * output; /* the file for the output debug */
31794 int n_output;
31795 xmlRegexpPtr regexp; /* the compiled regexp */
31796 int n_regexp;
31797
31798 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31799 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31800 mem_base = xmlMemBlocks();
31801 output = gen_FILE_ptr(n_output, 0);
31802 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31803
31804 xmlRegexpPrint(output, regexp);
31805 call_tests++;
31806 des_FILE_ptr(n_output, output, 0);
31807 des_xmlRegexpPtr(n_regexp, regexp, 1);
31808 xmlResetLastError();
31809 if (mem_base != xmlMemBlocks()) {
31810 printf("Leak of %d blocks found in xmlRegexpPrint",
31811 xmlMemBlocks() - mem_base);
31812 test_ret++;
31813 printf(" %d", n_output);
31814 printf(" %d", n_regexp);
31815 printf("\n");
31816 }
31817 }
31818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031819 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031820#endif
31821
Daniel Veillarda82b1822004-11-08 16:24:57 +000031822 return(test_ret);
31823}
31824
31825static int
31826test_xmlregexp(void) {
31827 int test_ret = 0;
31828
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031829 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31830 test_ret += test_xmlRegExecErrInfo();
31831 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031832 test_ret += test_xmlRegExecPushString();
31833 test_ret += test_xmlRegExecPushString2();
31834 test_ret += test_xmlRegNewExecCtxt();
31835 test_ret += test_xmlRegexpCompile();
31836 test_ret += test_xmlRegexpExec();
31837 test_ret += test_xmlRegexpIsDeterminist();
31838 test_ret += test_xmlRegexpPrint();
31839
31840 if (test_ret != 0)
31841 printf("Module xmlregexp: %d errors\n", test_ret);
31842 return(test_ret);
31843}
Daniel Veillarda521d282004-11-09 14:59:59 +000031844#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031845
Daniel Veillardce682bc2004-11-05 17:22:25 +000031846#define gen_nb_xmlSaveCtxtPtr 1
31847static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31848 return(NULL);
31849}
31850static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31851}
Daniel Veillarda521d282004-11-09 14:59:59 +000031852#endif
31853
Daniel Veillardce682bc2004-11-05 17:22:25 +000031854
Daniel Veillardd93f6252004-11-02 15:53:51 +000031855static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031856test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031858
William M. Brack21e4ef22005-01-02 09:53:13 +000031859#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031860 int mem_base;
31861 int ret_val;
31862 xmlSaveCtxtPtr ctxt; /* a document saving context */
31863 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031864
Daniel Veillardce682bc2004-11-05 17:22:25 +000031865 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31866 mem_base = xmlMemBlocks();
31867 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31868
31869 ret_val = xmlSaveClose(ctxt);
31870 desret_int(ret_val);
31871 call_tests++;
31872 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31873 xmlResetLastError();
31874 if (mem_base != xmlMemBlocks()) {
31875 printf("Leak of %d blocks found in xmlSaveClose",
31876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031877 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031878 printf(" %d", n_ctxt);
31879 printf("\n");
31880 }
31881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031882 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031883#endif
31884
Daniel Veillard42595322004-11-08 10:52:06 +000031885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031886}
31887
31888
31889static int
31890test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031892
William M. Brack21e4ef22005-01-02 09:53:13 +000031893#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031894 int mem_base;
31895 long ret_val;
31896 xmlSaveCtxtPtr ctxt; /* a document saving context */
31897 int n_ctxt;
31898 xmlDocPtr doc; /* a document */
31899 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031900
Daniel Veillardce682bc2004-11-05 17:22:25 +000031901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31902 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31903 mem_base = xmlMemBlocks();
31904 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31905 doc = gen_xmlDocPtr(n_doc, 1);
31906
31907 ret_val = xmlSaveDoc(ctxt, doc);
31908 desret_long(ret_val);
31909 call_tests++;
31910 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31911 des_xmlDocPtr(n_doc, doc, 1);
31912 xmlResetLastError();
31913 if (mem_base != xmlMemBlocks()) {
31914 printf("Leak of %d blocks found in xmlSaveDoc",
31915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031916 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031917 printf(" %d", n_ctxt);
31918 printf(" %d", n_doc);
31919 printf("\n");
31920 }
31921 }
31922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031923 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031924#endif
31925
Daniel Veillard42595322004-11-08 10:52:06 +000031926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031927}
31928
31929
31930static int
31931test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031933
William M. Brack21e4ef22005-01-02 09:53:13 +000031934#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031935 int mem_base;
31936 int ret_val;
31937 xmlSaveCtxtPtr ctxt; /* a document saving context */
31938 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031939
Daniel Veillardce682bc2004-11-05 17:22:25 +000031940 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31941 mem_base = xmlMemBlocks();
31942 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31943
31944 ret_val = xmlSaveFlush(ctxt);
31945 desret_int(ret_val);
31946 call_tests++;
31947 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31948 xmlResetLastError();
31949 if (mem_base != xmlMemBlocks()) {
31950 printf("Leak of %d blocks found in xmlSaveFlush",
31951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031952 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031953 printf(" %d", n_ctxt);
31954 printf("\n");
31955 }
31956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031957 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031958#endif
31959
Daniel Veillard42595322004-11-08 10:52:06 +000031960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031961}
31962
31963
31964static int
31965test_xmlSaveSetAttrEscape(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_xmlSaveSetEscape(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_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031987
31988
31989 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031991}
31992
31993
31994static int
31995test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031997
31998
31999 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032001}
32002
32003
32004static int
32005test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032007
William M. Brack21e4ef22005-01-02 09:53:13 +000032008#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032009 int mem_base;
32010 long ret_val;
32011 xmlSaveCtxtPtr ctxt; /* a document saving context */
32012 int n_ctxt;
32013 xmlNodePtr node; /* a document */
32014 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032015
Daniel Veillardce682bc2004-11-05 17:22:25 +000032016 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
32017 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32018 mem_base = xmlMemBlocks();
32019 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
32020 node = gen_xmlNodePtr(n_node, 1);
32021
32022 ret_val = xmlSaveTree(ctxt, node);
32023 desret_long(ret_val);
32024 call_tests++;
32025 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32026 des_xmlNodePtr(n_node, node, 1);
32027 xmlResetLastError();
32028 if (mem_base != xmlMemBlocks()) {
32029 printf("Leak of %d blocks found in xmlSaveTree",
32030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032031 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032032 printf(" %d", n_ctxt);
32033 printf(" %d", n_node);
32034 printf("\n");
32035 }
32036 }
32037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032038 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032039#endif
32040
Daniel Veillard42595322004-11-08 10:52:06 +000032041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032042}
32043
32044static int
32045test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032047
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032048 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032049 test_ret += test_xmlSaveClose();
32050 test_ret += test_xmlSaveDoc();
32051 test_ret += test_xmlSaveFlush();
32052 test_ret += test_xmlSaveSetAttrEscape();
32053 test_ret += test_xmlSaveSetEscape();
32054 test_ret += test_xmlSaveToFd();
32055 test_ret += test_xmlSaveToFilename();
32056 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032057
Daniel Veillard42595322004-11-08 10:52:06 +000032058 if (test_ret != 0)
32059 printf("Module xmlsave: %d errors\n", test_ret);
32060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032061}
Daniel Veillarda521d282004-11-09 14:59:59 +000032062#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032063
Daniel Veillardce682bc2004-11-05 17:22:25 +000032064#define gen_nb_xmlSchemaPtr 1
32065static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32066 return(NULL);
32067}
32068static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32069}
Daniel Veillarda521d282004-11-09 14:59:59 +000032070#endif
32071
Daniel Veillardce682bc2004-11-05 17:22:25 +000032072
Daniel Veillardd93f6252004-11-02 15:53:51 +000032073static int
32074test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032076
William M. Brack21e4ef22005-01-02 09:53:13 +000032077#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032078 int mem_base;
32079 FILE * output; /* the file output */
32080 int n_output;
32081 xmlSchemaPtr schema; /* a schema structure */
32082 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032083
Daniel Veillardce682bc2004-11-05 17:22:25 +000032084 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
32085 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
32086 mem_base = xmlMemBlocks();
32087 output = gen_FILE_ptr(n_output, 0);
32088 schema = gen_xmlSchemaPtr(n_schema, 1);
32089
32090 xmlSchemaDump(output, schema);
32091 call_tests++;
32092 des_FILE_ptr(n_output, output, 0);
32093 des_xmlSchemaPtr(n_schema, schema, 1);
32094 xmlResetLastError();
32095 if (mem_base != xmlMemBlocks()) {
32096 printf("Leak of %d blocks found in xmlSchemaDump",
32097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032098 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032099 printf(" %d", n_output);
32100 printf(" %d", n_schema);
32101 printf("\n");
32102 }
32103 }
32104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032105 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032106#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000032107
Daniel Veillard42595322004-11-08 10:52:06 +000032108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032109}
32110
Daniel Veillarda521d282004-11-09 14:59:59 +000032111#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032112
Daniel Veillardce682bc2004-11-05 17:22:25 +000032113#define gen_nb_xmlSchemaParserCtxtPtr 1
32114static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32115 return(NULL);
32116}
32117static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32118}
Daniel Veillarda521d282004-11-09 14:59:59 +000032119#endif
32120
32121#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032122
32123#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
32124static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32125 return(NULL);
32126}
32127static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32128}
Daniel Veillarda521d282004-11-09 14:59:59 +000032129#endif
32130
32131#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032132
32133#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
32134static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32135 return(NULL);
32136}
32137static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32138}
Daniel Veillarda521d282004-11-09 14:59:59 +000032139#endif
32140
Daniel Veillardce682bc2004-11-05 17:22:25 +000032141
Daniel Veillardd93f6252004-11-02 15:53:51 +000032142static int
32143test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032145
William M. Brack21e4ef22005-01-02 09:53:13 +000032146#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032147 int mem_base;
32148 int ret_val;
32149 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
32150 int n_ctxt;
32151 xmlSchemaValidityErrorFunc * err; /* the error callback result */
32152 int n_err;
32153 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
32154 int n_warn;
32155 void ** ctx; /* contextual data for the callbacks result */
32156 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032157
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32159 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32160 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32161 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32162 mem_base = xmlMemBlocks();
32163 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
32164 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32165 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32166 ctx = gen_void_ptr_ptr(n_ctx, 3);
32167
32168 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
32169 desret_int(ret_val);
32170 call_tests++;
32171 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
32172 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32173 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32174 des_void_ptr_ptr(n_ctx, ctx, 3);
32175 xmlResetLastError();
32176 if (mem_base != xmlMemBlocks()) {
32177 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
32178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032179 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032180 printf(" %d", n_ctxt);
32181 printf(" %d", n_err);
32182 printf(" %d", n_warn);
32183 printf(" %d", n_ctx);
32184 printf("\n");
32185 }
32186 }
32187 }
32188 }
32189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032190 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032191#endif
32192
Daniel Veillard42595322004-11-08 10:52:06 +000032193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032194}
32195
Daniel Veillarda521d282004-11-09 14:59:59 +000032196#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032197
Daniel Veillardce682bc2004-11-05 17:22:25 +000032198#define gen_nb_xmlSchemaValidCtxtPtr 1
32199static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32200 return(NULL);
32201}
32202static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32203}
Daniel Veillarda521d282004-11-09 14:59:59 +000032204#endif
32205
Daniel Veillardce682bc2004-11-05 17:22:25 +000032206
Daniel Veillardd93f6252004-11-02 15:53:51 +000032207static int
32208test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032210
William M. Brack21e4ef22005-01-02 09:53:13 +000032211#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032212 int mem_base;
32213 int ret_val;
32214 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32215 int n_ctxt;
32216 xmlSchemaValidityErrorFunc * err; /* the error function result */
32217 int n_err;
32218 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32219 int n_warn;
32220 void ** ctx; /* the functions context result */
32221 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032222
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032223 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32224 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32225 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32226 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32227 mem_base = xmlMemBlocks();
32228 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32229 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32230 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32231 ctx = gen_void_ptr_ptr(n_ctx, 3);
32232
32233 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32234 desret_int(ret_val);
32235 call_tests++;
32236 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32237 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32238 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32239 des_void_ptr_ptr(n_ctx, ctx, 3);
32240 xmlResetLastError();
32241 if (mem_base != xmlMemBlocks()) {
32242 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032244 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032245 printf(" %d", n_ctxt);
32246 printf(" %d", n_err);
32247 printf(" %d", n_warn);
32248 printf(" %d", n_ctx);
32249 printf("\n");
32250 }
32251 }
32252 }
32253 }
32254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032255 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032256#endif
32257
Daniel Veillard42595322004-11-08 10:52:06 +000032258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032259}
32260
32261
32262static int
32263test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032265
William M. Brack21e4ef22005-01-02 09:53:13 +000032266#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032267 int mem_base;
32268 xmlSchemaParserCtxtPtr ret_val;
32269 xmlDocPtr doc; /* a preparsed document tree */
32270 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032271
Daniel Veillard42595322004-11-08 10:52:06 +000032272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32273 mem_base = xmlMemBlocks();
32274 doc = gen_xmlDocPtr(n_doc, 0);
32275
32276 ret_val = xmlSchemaNewDocParserCtxt(doc);
32277 desret_xmlSchemaParserCtxtPtr(ret_val);
32278 call_tests++;
32279 des_xmlDocPtr(n_doc, doc, 0);
32280 xmlResetLastError();
32281 if (mem_base != xmlMemBlocks()) {
32282 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32283 xmlMemBlocks() - mem_base);
32284 test_ret++;
32285 printf(" %d", n_doc);
32286 printf("\n");
32287 }
32288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032289 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032290#endif
32291
Daniel Veillard42595322004-11-08 10:52:06 +000032292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032293}
32294
32295
32296static int
32297test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032299
William M. Brack21e4ef22005-01-02 09:53:13 +000032300#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032301 int mem_base;
32302 xmlSchemaParserCtxtPtr ret_val;
32303 char * buffer; /* a pointer to a char array containing the schemas */
32304 int n_buffer;
32305 int size; /* the size of the array */
32306 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032307
Daniel Veillard42595322004-11-08 10:52:06 +000032308 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32309 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32310 mem_base = xmlMemBlocks();
32311 buffer = gen_const_char_ptr(n_buffer, 0);
32312 size = gen_int(n_size, 1);
32313
William M. Brackf13f77f2004-11-12 16:03:48 +000032314 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032315 desret_xmlSchemaParserCtxtPtr(ret_val);
32316 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032317 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032318 des_int(n_size, size, 1);
32319 xmlResetLastError();
32320 if (mem_base != xmlMemBlocks()) {
32321 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32322 xmlMemBlocks() - mem_base);
32323 test_ret++;
32324 printf(" %d", n_buffer);
32325 printf(" %d", n_size);
32326 printf("\n");
32327 }
32328 }
32329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032330 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032331#endif
32332
Daniel Veillard42595322004-11-08 10:52:06 +000032333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032334}
32335
32336
32337static int
32338test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032340
William M. Brack21e4ef22005-01-02 09:53:13 +000032341#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032342 int mem_base;
32343 xmlSchemaParserCtxtPtr ret_val;
32344 char * URL; /* the location of the schema */
32345 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032346
Daniel Veillard42595322004-11-08 10:52:06 +000032347 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32348 mem_base = xmlMemBlocks();
32349 URL = gen_const_char_ptr(n_URL, 0);
32350
William M. Brackf13f77f2004-11-12 16:03:48 +000032351 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032352 desret_xmlSchemaParserCtxtPtr(ret_val);
32353 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032354 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032355 xmlResetLastError();
32356 if (mem_base != xmlMemBlocks()) {
32357 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32358 xmlMemBlocks() - mem_base);
32359 test_ret++;
32360 printf(" %d", n_URL);
32361 printf("\n");
32362 }
32363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032364 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032365#endif
32366
Daniel Veillard42595322004-11-08 10:52:06 +000032367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032368}
32369
32370
32371static int
32372test_xmlSchemaNewValidCtxt(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_xmlSchemaParse(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_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032394
32395
32396 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032398}
32399
32400
32401static int
32402test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032404
32405
32406 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032408}
32409
32410
32411static int
32412test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032414
William M. Brack21e4ef22005-01-02 09:53:13 +000032415#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032416 int mem_base;
32417 int ret_val;
32418 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32419 int n_ctxt;
32420 int options; /* a combination of xmlSchemaValidOption */
32421 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032422
Daniel Veillardce682bc2004-11-05 17:22:25 +000032423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32424 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32425 mem_base = xmlMemBlocks();
32426 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32427 options = gen_int(n_options, 1);
32428
32429 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32430 desret_int(ret_val);
32431 call_tests++;
32432 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32433 des_int(n_options, options, 1);
32434 xmlResetLastError();
32435 if (mem_base != xmlMemBlocks()) {
32436 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032439 printf(" %d", n_ctxt);
32440 printf(" %d", n_options);
32441 printf("\n");
32442 }
32443 }
32444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032445 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032446#endif
32447
Daniel Veillard42595322004-11-08 10:52:06 +000032448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032449}
32450
32451
32452static int
32453test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032455
William M. Brack21e4ef22005-01-02 09:53:13 +000032456#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032457 int mem_base;
32458 int ret_val;
32459 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32460 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032461
Daniel Veillardce682bc2004-11-05 17:22:25 +000032462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32463 mem_base = xmlMemBlocks();
32464 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32465
32466 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32467 desret_int(ret_val);
32468 call_tests++;
32469 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32470 xmlResetLastError();
32471 if (mem_base != xmlMemBlocks()) {
32472 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032475 printf(" %d", n_ctxt);
32476 printf("\n");
32477 }
32478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032479 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032480#endif
32481
Daniel Veillard42595322004-11-08 10:52:06 +000032482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032483}
32484
32485
32486static int
32487test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032489
William M. Brack21e4ef22005-01-02 09:53:13 +000032490#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032491 int mem_base;
32492 int ret_val;
32493 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32494 int n_ctxt;
32495 xmlDocPtr doc; /* a parsed document tree */
32496 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032497
Daniel Veillardce682bc2004-11-05 17:22:25 +000032498 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32499 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32500 mem_base = xmlMemBlocks();
32501 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32502 doc = gen_xmlDocPtr(n_doc, 1);
32503
32504 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32505 desret_int(ret_val);
32506 call_tests++;
32507 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32508 des_xmlDocPtr(n_doc, doc, 1);
32509 xmlResetLastError();
32510 if (mem_base != xmlMemBlocks()) {
32511 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032513 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032514 printf(" %d", n_ctxt);
32515 printf(" %d", n_doc);
32516 printf("\n");
32517 }
32518 }
32519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032520 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032521#endif
32522
Daniel Veillard42595322004-11-08 10:52:06 +000032523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032524}
32525
32526
32527static int
Daniel Veillard81562d22005-06-15 13:27:56 +000032528test_xmlSchemaValidateFile(void) {
32529 int test_ret = 0;
32530
32531#if defined(LIBXML_SCHEMAS_ENABLED)
32532 int mem_base;
32533 int ret_val;
32534 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32535 int n_ctxt;
32536 const char * filename; /* the URI of the instance */
32537 int n_filename;
32538 int options; /* a future set of options, currently unused */
32539 int n_options;
32540
32541 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32542 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
32543 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32544 mem_base = xmlMemBlocks();
32545 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32546 filename = gen_filepath(n_filename, 1);
32547 options = gen_int(n_options, 2);
32548
32549 ret_val = xmlSchemaValidateFile(ctxt, filename, options);
32550 desret_int(ret_val);
32551 call_tests++;
32552 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32553 des_filepath(n_filename, filename, 1);
32554 des_int(n_options, options, 2);
32555 xmlResetLastError();
32556 if (mem_base != xmlMemBlocks()) {
32557 printf("Leak of %d blocks found in xmlSchemaValidateFile",
32558 xmlMemBlocks() - mem_base);
32559 test_ret++;
32560 printf(" %d", n_ctxt);
32561 printf(" %d", n_filename);
32562 printf(" %d", n_options);
32563 printf("\n");
32564 }
32565 }
32566 }
32567 }
32568 function_tests++;
32569#endif
32570
32571 return(test_ret);
32572}
32573
32574
32575static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032576test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032578
William M. Brack21e4ef22005-01-02 09:53:13 +000032579#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032580 int mem_base;
32581 int ret_val;
32582 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32583 int n_ctxt;
32584 xmlNodePtr elem; /* an element node */
32585 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032586
Daniel Veillardce682bc2004-11-05 17:22:25 +000032587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32588 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32589 mem_base = xmlMemBlocks();
32590 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32591 elem = gen_xmlNodePtr(n_elem, 1);
32592
32593 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32594 desret_int(ret_val);
32595 call_tests++;
32596 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32597 des_xmlNodePtr(n_elem, elem, 1);
32598 xmlResetLastError();
32599 if (mem_base != xmlMemBlocks()) {
32600 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032602 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032603 printf(" %d", n_ctxt);
32604 printf(" %d", n_elem);
32605 printf("\n");
32606 }
32607 }
32608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032609 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032610#endif
32611
Daniel Veillard42595322004-11-08 10:52:06 +000032612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032613}
32614
32615
32616static int
32617test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032619
William M. Brack21e4ef22005-01-02 09:53:13 +000032620#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032621 int mem_base;
32622 int ret_val;
32623 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32624 int n_ctxt;
32625 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32626 int n_input;
32627 xmlCharEncoding enc; /* an optional encoding information */
32628 int n_enc;
32629 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32630 int n_sax;
32631 void * user_data; /* the context to provide to the SAX handler. */
32632 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032633
Daniel Veillardce682bc2004-11-05 17:22:25 +000032634 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32635 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32636 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32637 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32638 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32639 mem_base = xmlMemBlocks();
32640 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32641 input = gen_xmlParserInputBufferPtr(n_input, 1);
32642 enc = gen_xmlCharEncoding(n_enc, 2);
32643 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32644 user_data = gen_userdata(n_user_data, 4);
32645
32646 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32647 desret_int(ret_val);
32648 call_tests++;
32649 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32650 des_xmlParserInputBufferPtr(n_input, input, 1);
32651 des_xmlCharEncoding(n_enc, enc, 2);
32652 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32653 des_userdata(n_user_data, user_data, 4);
32654 xmlResetLastError();
32655 if (mem_base != xmlMemBlocks()) {
32656 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032658 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032659 printf(" %d", n_ctxt);
32660 printf(" %d", n_input);
32661 printf(" %d", n_enc);
32662 printf(" %d", n_sax);
32663 printf(" %d", n_user_data);
32664 printf("\n");
32665 }
32666 }
32667 }
32668 }
32669 }
32670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032671 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032672#endif
32673
Daniel Veillard42595322004-11-08 10:52:06 +000032674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032675}
32676
32677static int
32678test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032680
Daniel Veillard81562d22005-06-15 13:27:56 +000032681 if (quiet == 0) printf("Testing xmlschemas : 12 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032682 test_ret += test_xmlSchemaDump();
32683 test_ret += test_xmlSchemaGetParserErrors();
32684 test_ret += test_xmlSchemaGetValidErrors();
32685 test_ret += test_xmlSchemaNewDocParserCtxt();
32686 test_ret += test_xmlSchemaNewMemParserCtxt();
32687 test_ret += test_xmlSchemaNewParserCtxt();
32688 test_ret += test_xmlSchemaNewValidCtxt();
32689 test_ret += test_xmlSchemaParse();
32690 test_ret += test_xmlSchemaSetParserErrors();
32691 test_ret += test_xmlSchemaSetValidErrors();
32692 test_ret += test_xmlSchemaSetValidOptions();
32693 test_ret += test_xmlSchemaValidCtxtGetOptions();
32694 test_ret += test_xmlSchemaValidateDoc();
Daniel Veillard81562d22005-06-15 13:27:56 +000032695 test_ret += test_xmlSchemaValidateFile();
Daniel Veillard42595322004-11-08 10:52:06 +000032696 test_ret += test_xmlSchemaValidateOneElement();
32697 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032698
Daniel Veillard42595322004-11-08 10:52:06 +000032699 if (test_ret != 0)
32700 printf("Module xmlschemas: %d errors\n", test_ret);
32701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032702}
Daniel Veillarda521d282004-11-09 14:59:59 +000032703#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032704
Daniel Veillardce682bc2004-11-05 17:22:25 +000032705#define gen_nb_xmlSchemaFacetPtr 1
32706static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32707 return(NULL);
32708}
32709static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32710}
Daniel Veillarda521d282004-11-09 14:59:59 +000032711#endif
32712
32713#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032714
32715#define gen_nb_xmlSchemaTypePtr 1
32716static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32717 return(NULL);
32718}
32719static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32720}
Daniel Veillarda521d282004-11-09 14:59:59 +000032721#endif
32722
Daniel Veillardce682bc2004-11-05 17:22:25 +000032723
Daniel Veillardd93f6252004-11-02 15:53:51 +000032724static int
32725test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032727
William M. Brack21e4ef22005-01-02 09:53:13 +000032728#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032729 int mem_base;
32730 int ret_val;
32731 xmlSchemaFacetPtr facet; /* the facet */
32732 int n_facet;
32733 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32734 int n_typeDecl;
Daniel Veillard81562d22005-06-15 13:27:56 +000032735 xmlSchemaParserCtxtPtr pctxt; /* the schema parser context or NULL */
32736 int n_pctxt;
32737 xmlChar * name; /* the optional name of the type */
Daniel Veillardce682bc2004-11-05 17:22:25 +000032738 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032739
Daniel Veillardce682bc2004-11-05 17:22:25 +000032740 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32741 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
Daniel Veillard81562d22005-06-15 13:27:56 +000032742 for (n_pctxt = 0;n_pctxt < gen_nb_xmlSchemaParserCtxtPtr;n_pctxt++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +000032743 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32744 mem_base = xmlMemBlocks();
32745 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32746 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
Daniel Veillard81562d22005-06-15 13:27:56 +000032747 pctxt = gen_xmlSchemaParserCtxtPtr(n_pctxt, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032748 name = gen_const_xmlChar_ptr(n_name, 3);
32749
Daniel Veillard81562d22005-06-15 13:27:56 +000032750 ret_val = xmlSchemaCheckFacet(facet, typeDecl, pctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032751 desret_int(ret_val);
32752 call_tests++;
32753 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32754 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
Daniel Veillard81562d22005-06-15 13:27:56 +000032755 des_xmlSchemaParserCtxtPtr(n_pctxt, pctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032756 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032757 xmlResetLastError();
32758 if (mem_base != xmlMemBlocks()) {
32759 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032761 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032762 printf(" %d", n_facet);
32763 printf(" %d", n_typeDecl);
Daniel Veillard81562d22005-06-15 13:27:56 +000032764 printf(" %d", n_pctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032765 printf(" %d", n_name);
32766 printf("\n");
32767 }
32768 }
32769 }
32770 }
32771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032772 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032773#endif
32774
Daniel Veillard42595322004-11-08 10:52:06 +000032775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032776}
32777
32778
32779static int
32780test_xmlSchemaCleanupTypes(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 Veillardd93f6252004-11-02 15:53:51 +000032784 int mem_base;
32785
32786 mem_base = xmlMemBlocks();
32787
32788 xmlSchemaCleanupTypes();
32789 call_tests++;
32790 xmlResetLastError();
32791 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032792 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032794 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032795 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032797 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032798#endif
32799
Daniel Veillard42595322004-11-08 10:52:06 +000032800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032801}
32802
32803
32804static int
32805test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032807
William M. Brack21e4ef22005-01-02 09:53:13 +000032808#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032809 int mem_base;
32810 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032811 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032812 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032813
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032814 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032816 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032817
William M. Brackf13f77f2004-11-12 16:03:48 +000032818 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032819 desret_xmlChar_ptr(ret_val);
32820 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032821 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032822 xmlResetLastError();
32823 if (mem_base != xmlMemBlocks()) {
32824 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032826 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032827 printf(" %d", n_value);
32828 printf("\n");
32829 }
32830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032831 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032832#endif
32833
Daniel Veillard42595322004-11-08 10:52:06 +000032834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032835}
32836
Daniel Veillarda521d282004-11-09 14:59:59 +000032837#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032838
Daniel Veillardce682bc2004-11-05 17:22:25 +000032839#define gen_nb_xmlSchemaValPtr 1
32840static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32841 return(NULL);
32842}
32843static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32844}
Daniel Veillarda521d282004-11-09 14:59:59 +000032845#endif
32846
Daniel Veillardce682bc2004-11-05 17:22:25 +000032847
Daniel Veillardd93f6252004-11-02 15:53:51 +000032848static int
32849test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032851
William M. Brack21e4ef22005-01-02 09:53:13 +000032852#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032853 int mem_base;
32854 int ret_val;
32855 xmlSchemaValPtr x; /* a first value */
32856 int n_x;
32857 xmlSchemaValPtr y; /* a second value */
32858 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032859
Daniel Veillardce682bc2004-11-05 17:22:25 +000032860 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32861 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32862 mem_base = xmlMemBlocks();
32863 x = gen_xmlSchemaValPtr(n_x, 0);
32864 y = gen_xmlSchemaValPtr(n_y, 1);
32865
32866 ret_val = xmlSchemaCompareValues(x, y);
32867 desret_int(ret_val);
32868 call_tests++;
32869 des_xmlSchemaValPtr(n_x, x, 0);
32870 des_xmlSchemaValPtr(n_y, y, 1);
32871 xmlResetLastError();
32872 if (mem_base != xmlMemBlocks()) {
32873 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032875 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032876 printf(" %d", n_x);
32877 printf(" %d", n_y);
32878 printf("\n");
32879 }
32880 }
32881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032882 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032883#endif
32884
Daniel Veillard42595322004-11-08 10:52:06 +000032885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032886}
32887
32888
32889static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032890test_xmlSchemaCompareValuesWhtsp(void) {
32891 int test_ret = 0;
32892
32893#if defined(LIBXML_SCHEMAS_ENABLED)
32894 int mem_base;
32895 int ret_val;
32896 xmlSchemaValPtr x; /* a first value */
32897 int n_x;
32898 xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */
32899 int n_xws;
32900 xmlSchemaValPtr y; /* a second value */
32901 int n_y;
32902 xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */
32903 int n_yws;
32904
32905 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32906 for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) {
32907 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32908 for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) {
32909 mem_base = xmlMemBlocks();
32910 x = gen_xmlSchemaValPtr(n_x, 0);
32911 xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1);
32912 y = gen_xmlSchemaValPtr(n_y, 2);
32913 yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3);
32914
32915 ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws);
32916 desret_int(ret_val);
32917 call_tests++;
32918 des_xmlSchemaValPtr(n_x, x, 0);
32919 des_xmlSchemaWhitespaceValueType(n_xws, xws, 1);
32920 des_xmlSchemaValPtr(n_y, y, 2);
32921 des_xmlSchemaWhitespaceValueType(n_yws, yws, 3);
32922 xmlResetLastError();
32923 if (mem_base != xmlMemBlocks()) {
32924 printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp",
32925 xmlMemBlocks() - mem_base);
32926 test_ret++;
32927 printf(" %d", n_x);
32928 printf(" %d", n_xws);
32929 printf(" %d", n_y);
32930 printf(" %d", n_yws);
32931 printf("\n");
32932 }
32933 }
32934 }
32935 }
32936 }
32937 function_tests++;
32938#endif
32939
32940 return(test_ret);
32941}
32942
32943
32944static int
Daniel Veillard57c000e2005-03-13 18:34:29 +000032945test_xmlSchemaCopyValue(void) {
32946 int test_ret = 0;
32947
32948
32949 /* missing type support */
32950 return(test_ret);
32951}
32952
32953
32954static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032955test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032957
William M. Brack21e4ef22005-01-02 09:53:13 +000032958#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032959 int mem_base;
32960 xmlSchemaTypePtr ret_val;
32961 xmlSchemaTypePtr type; /* the built-in simple type. */
32962 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032963
Daniel Veillard42595322004-11-08 10:52:06 +000032964 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32965 mem_base = xmlMemBlocks();
32966 type = gen_xmlSchemaTypePtr(n_type, 0);
32967
32968 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32969 desret_xmlSchemaTypePtr(ret_val);
32970 call_tests++;
32971 des_xmlSchemaTypePtr(n_type, type, 0);
32972 xmlResetLastError();
32973 if (mem_base != xmlMemBlocks()) {
32974 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32975 xmlMemBlocks() - mem_base);
32976 test_ret++;
32977 printf(" %d", n_type);
32978 printf("\n");
32979 }
32980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032981 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032982#endif
32983
Daniel Veillard42595322004-11-08 10:52:06 +000032984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032985}
32986
32987
32988static int
32989test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032991
William M. Brack21e4ef22005-01-02 09:53:13 +000032992#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032993 xmlSchemaTypePtr ret_val;
32994 xmlSchemaValType type; /* the type of the built in type */
32995 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032996
Daniel Veillard42595322004-11-08 10:52:06 +000032997 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32998 type = gen_xmlSchemaValType(n_type, 0);
32999
33000 ret_val = xmlSchemaGetBuiltInType(type);
33001 desret_xmlSchemaTypePtr(ret_val);
33002 call_tests++;
33003 des_xmlSchemaValType(n_type, type, 0);
33004 xmlResetLastError();
33005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033006 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033007#endif
33008
Daniel Veillard42595322004-11-08 10:52:06 +000033009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033010}
33011
33012
33013static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000033014test_xmlSchemaGetCanonValue(void) {
33015 int test_ret = 0;
33016
33017#if defined(LIBXML_SCHEMAS_ENABLED)
33018 int mem_base;
33019 int ret_val;
33020 xmlSchemaValPtr val; /* the precomputed value */
33021 int n_val;
33022 xmlChar ** retValue; /* the returned value */
33023 int n_retValue;
33024
33025 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33026 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
33027 mem_base = xmlMemBlocks();
33028 val = gen_xmlSchemaValPtr(n_val, 0);
33029 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
33030
33031 ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue);
33032 desret_int(ret_val);
33033 call_tests++;
33034 des_xmlSchemaValPtr(n_val, val, 0);
33035 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
33036 xmlResetLastError();
33037 if (mem_base != xmlMemBlocks()) {
33038 printf("Leak of %d blocks found in xmlSchemaGetCanonValue",
33039 xmlMemBlocks() - mem_base);
33040 test_ret++;
33041 printf(" %d", n_val);
33042 printf(" %d", n_retValue);
33043 printf("\n");
33044 }
33045 }
33046 }
33047 function_tests++;
33048#endif
33049
33050 return(test_ret);
33051}
33052
33053
33054static int
Daniel Veillard99dd7632005-05-06 11:40:56 +000033055test_xmlSchemaGetCanonValueWhtsp(void) {
33056 int test_ret = 0;
33057
33058#if defined(LIBXML_SCHEMAS_ENABLED)
33059 int mem_base;
33060 int ret_val;
33061 xmlSchemaValPtr val; /* the precomputed value */
33062 int n_val;
33063 xmlChar ** retValue; /* the returned value */
33064 int n_retValue;
33065 xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
33066 int n_ws;
33067
33068 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33069 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
33070 for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
33071 mem_base = xmlMemBlocks();
33072 val = gen_xmlSchemaValPtr(n_val, 0);
33073 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
33074 ws = gen_xmlSchemaWhitespaceValueType(n_ws, 2);
33075
33076 ret_val = xmlSchemaGetCanonValueWhtsp(val, (const xmlChar **)retValue, ws);
33077 desret_int(ret_val);
33078 call_tests++;
33079 des_xmlSchemaValPtr(n_val, val, 0);
33080 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
33081 des_xmlSchemaWhitespaceValueType(n_ws, ws, 2);
33082 xmlResetLastError();
33083 if (mem_base != xmlMemBlocks()) {
33084 printf("Leak of %d blocks found in xmlSchemaGetCanonValueWhtsp",
33085 xmlMemBlocks() - mem_base);
33086 test_ret++;
33087 printf(" %d", n_val);
33088 printf(" %d", n_retValue);
33089 printf(" %d", n_ws);
33090 printf("\n");
33091 }
33092 }
33093 }
33094 }
33095 function_tests++;
33096#endif
33097
33098 return(test_ret);
33099}
33100
33101
33102static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033103test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033105
William M. Brack21e4ef22005-01-02 09:53:13 +000033106#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000033107 int mem_base;
33108 unsigned long ret_val;
33109 xmlSchemaFacetPtr facet; /* an schemas type facet */
33110 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033111
William M. Brack094dd862004-11-14 14:28:34 +000033112 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33113 mem_base = xmlMemBlocks();
33114 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33115
33116 ret_val = xmlSchemaGetFacetValueAsULong(facet);
33117 desret_unsigned_long(ret_val);
33118 call_tests++;
33119 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33120 xmlResetLastError();
33121 if (mem_base != xmlMemBlocks()) {
33122 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
33123 xmlMemBlocks() - mem_base);
33124 test_ret++;
33125 printf(" %d", n_facet);
33126 printf("\n");
33127 }
33128 }
33129 function_tests++;
33130#endif
33131
Daniel Veillard42595322004-11-08 10:52:06 +000033132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033133}
33134
33135
33136static int
33137test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033139
William M. Brack21e4ef22005-01-02 09:53:13 +000033140#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033141 int mem_base;
33142 xmlSchemaTypePtr ret_val;
33143 xmlChar * name; /* the type name */
33144 int n_name;
33145 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
33146 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033147
Daniel Veillard42595322004-11-08 10:52:06 +000033148 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33149 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
33150 mem_base = xmlMemBlocks();
33151 name = gen_const_xmlChar_ptr(n_name, 0);
33152 ns = gen_const_xmlChar_ptr(n_ns, 1);
33153
William M. Brackf13f77f2004-11-12 16:03:48 +000033154 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000033155 desret_xmlSchemaTypePtr(ret_val);
33156 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033157 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
33158 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000033159 xmlResetLastError();
33160 if (mem_base != xmlMemBlocks()) {
33161 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
33162 xmlMemBlocks() - mem_base);
33163 test_ret++;
33164 printf(" %d", n_name);
33165 printf(" %d", n_ns);
33166 printf("\n");
33167 }
33168 }
33169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033170 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033171#endif
33172
Daniel Veillard42595322004-11-08 10:52:06 +000033173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033174}
33175
33176
33177static int
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033178test_xmlSchemaGetValType(void) {
33179 int test_ret = 0;
33180
33181#if defined(LIBXML_SCHEMAS_ENABLED)
33182 int mem_base;
33183 xmlSchemaValType ret_val;
Daniel Veillard771971f2005-04-02 10:49:51 +000033184 xmlSchemaValPtr val; /* a schemas value */
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033185 int n_val;
33186
33187 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33188 mem_base = xmlMemBlocks();
33189 val = gen_xmlSchemaValPtr(n_val, 0);
33190
33191 ret_val = xmlSchemaGetValType(val);
33192 desret_xmlSchemaValType(ret_val);
33193 call_tests++;
33194 des_xmlSchemaValPtr(n_val, val, 0);
33195 xmlResetLastError();
33196 if (mem_base != xmlMemBlocks()) {
33197 printf("Leak of %d blocks found in xmlSchemaGetValType",
33198 xmlMemBlocks() - mem_base);
33199 test_ret++;
33200 printf(" %d", n_val);
33201 printf("\n");
33202 }
33203 }
33204 function_tests++;
33205#endif
33206
33207 return(test_ret);
33208}
33209
33210
33211static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033212test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033214
William M. Brack21e4ef22005-01-02 09:53:13 +000033215#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000033216
33217
33218 xmlSchemaInitTypes();
33219 call_tests++;
33220 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033221 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033222#endif
33223
Daniel Veillard42595322004-11-08 10:52:06 +000033224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033225}
33226
33227
33228static int
33229test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033231
William M. Brack21e4ef22005-01-02 09:53:13 +000033232#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033233 int mem_base;
33234 int ret_val;
33235 xmlSchemaTypePtr type; /* the built-in type */
33236 int n_type;
33237 int facetType; /* the facet type */
33238 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033239
Daniel Veillardce682bc2004-11-05 17:22:25 +000033240 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33241 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
33242 mem_base = xmlMemBlocks();
33243 type = gen_xmlSchemaTypePtr(n_type, 0);
33244 facetType = gen_int(n_facetType, 1);
33245
33246 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
33247 desret_int(ret_val);
33248 call_tests++;
33249 des_xmlSchemaTypePtr(n_type, type, 0);
33250 des_int(n_facetType, facetType, 1);
33251 xmlResetLastError();
33252 if (mem_base != xmlMemBlocks()) {
33253 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
33254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033255 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033256 printf(" %d", n_type);
33257 printf(" %d", n_facetType);
33258 printf("\n");
33259 }
33260 }
33261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033262 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033263#endif
33264
Daniel Veillard42595322004-11-08 10:52:06 +000033265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033266}
33267
33268
33269static int
33270test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033272
33273
33274 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033276}
33277
Daniel Veillardb5839c32005-02-19 18:27:14 +000033278
33279static int
33280test_xmlSchemaNewNOTATIONValue(void) {
33281 int test_ret = 0;
33282
33283
33284 /* missing type support */
33285 return(test_ret);
33286}
33287
33288
33289static int
Daniel Veillard81562d22005-06-15 13:27:56 +000033290test_xmlSchemaNewQNameValue(void) {
33291 int test_ret = 0;
33292
33293
33294 /* missing type support */
33295 return(test_ret);
33296}
33297
33298
33299static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000033300test_xmlSchemaNewStringValue(void) {
33301 int test_ret = 0;
33302
33303
33304 /* missing type support */
33305 return(test_ret);
33306}
33307
Daniel Veillarda521d282004-11-09 14:59:59 +000033308#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000033309
Daniel Veillardce682bc2004-11-05 17:22:25 +000033310#define gen_nb_xmlSchemaValPtr_ptr 1
33311static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33312 return(NULL);
33313}
33314static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33315}
Daniel Veillarda521d282004-11-09 14:59:59 +000033316#endif
33317
Daniel Veillardce682bc2004-11-05 17:22:25 +000033318
Daniel Veillardd93f6252004-11-02 15:53:51 +000033319static int
33320test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033322
William M. Brack21e4ef22005-01-02 09:53:13 +000033323#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033324 int mem_base;
33325 int ret_val;
33326 xmlSchemaTypePtr type; /* the predefined type */
33327 int n_type;
33328 xmlChar * value; /* the value to check */
33329 int n_value;
33330 xmlSchemaValPtr * val; /* the return computed value */
33331 int n_val;
33332 xmlNodePtr node; /* the node containing the value */
33333 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033334
Daniel Veillardce682bc2004-11-05 17:22:25 +000033335 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33336 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33337 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33338 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33339 mem_base = xmlMemBlocks();
33340 type = gen_xmlSchemaTypePtr(n_type, 0);
33341 value = gen_const_xmlChar_ptr(n_value, 1);
33342 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33343 node = gen_xmlNodePtr(n_node, 3);
33344
William M. Brackf13f77f2004-11-12 16:03:48 +000033345 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033346 desret_int(ret_val);
33347 call_tests++;
33348 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033349 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033350 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33351 des_xmlNodePtr(n_node, node, 3);
33352 xmlResetLastError();
33353 if (mem_base != xmlMemBlocks()) {
33354 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
33355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033356 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033357 printf(" %d", n_type);
33358 printf(" %d", n_value);
33359 printf(" %d", n_val);
33360 printf(" %d", n_node);
33361 printf("\n");
33362 }
33363 }
33364 }
33365 }
33366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033367 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033368#endif
33369
Daniel Veillard42595322004-11-08 10:52:06 +000033370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033371}
33372
33373
33374static int
33375test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033377
William M. Brack21e4ef22005-01-02 09:53:13 +000033378#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033379 int mem_base;
33380 int ret_val;
33381 xmlSchemaTypePtr type; /* the predefined type */
33382 int n_type;
33383 xmlChar * value; /* the value to check */
33384 int n_value;
33385 xmlSchemaValPtr * val; /* the return computed value */
33386 int n_val;
33387 xmlNodePtr node; /* the node containing the value */
33388 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033389
Daniel Veillardce682bc2004-11-05 17:22:25 +000033390 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33391 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33392 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33393 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33394 mem_base = xmlMemBlocks();
33395 type = gen_xmlSchemaTypePtr(n_type, 0);
33396 value = gen_const_xmlChar_ptr(n_value, 1);
33397 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33398 node = gen_xmlNodePtr(n_node, 3);
33399
William M. Brackf13f77f2004-11-12 16:03:48 +000033400 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033401 desret_int(ret_val);
33402 call_tests++;
33403 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033404 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033405 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33406 des_xmlNodePtr(n_node, node, 3);
33407 xmlResetLastError();
33408 if (mem_base != xmlMemBlocks()) {
33409 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
33410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033411 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033412 printf(" %d", n_type);
33413 printf(" %d", n_value);
33414 printf(" %d", n_val);
33415 printf(" %d", n_node);
33416 printf("\n");
33417 }
33418 }
33419 }
33420 }
33421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033422 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033423#endif
33424
Daniel Veillard42595322004-11-08 10:52:06 +000033425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033426}
33427
33428
33429static int
33430test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033432
William M. Brack21e4ef22005-01-02 09:53:13 +000033433#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033434 int mem_base;
33435 int ret_val;
33436 xmlSchemaTypePtr base; /* the base type */
33437 int n_base;
33438 xmlSchemaFacetPtr facet; /* the facet to check */
33439 int n_facet;
33440 xmlChar * value; /* the lexical repr of the value to validate */
33441 int n_value;
33442 xmlSchemaValPtr val; /* the precomputed value */
33443 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033444
Daniel Veillardce682bc2004-11-05 17:22:25 +000033445 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
33446 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33447 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33448 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33449 mem_base = xmlMemBlocks();
33450 base = gen_xmlSchemaTypePtr(n_base, 0);
33451 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33452 value = gen_const_xmlChar_ptr(n_value, 2);
33453 val = gen_xmlSchemaValPtr(n_val, 3);
33454
William M. Brackf13f77f2004-11-12 16:03:48 +000033455 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033456 desret_int(ret_val);
33457 call_tests++;
33458 des_xmlSchemaTypePtr(n_base, base, 0);
33459 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033460 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033461 des_xmlSchemaValPtr(n_val, val, 3);
33462 xmlResetLastError();
33463 if (mem_base != xmlMemBlocks()) {
33464 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033466 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033467 printf(" %d", n_base);
33468 printf(" %d", n_facet);
33469 printf(" %d", n_value);
33470 printf(" %d", n_val);
33471 printf("\n");
33472 }
33473 }
33474 }
33475 }
33476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033477 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033478#endif
33479
Daniel Veillard42595322004-11-08 10:52:06 +000033480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033481}
33482
33483
33484static int
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033485test_xmlSchemaValidateFacetWhtsp(void) {
33486 int test_ret = 0;
33487
33488#if defined(LIBXML_SCHEMAS_ENABLED)
33489 int mem_base;
33490 int ret_val;
33491 xmlSchemaFacetPtr facet; /* the facet to check */
33492 int n_facet;
33493 xmlSchemaWhitespaceValueType fws; /* the whitespace type of the facet's value */
33494 int n_fws;
33495 xmlSchemaValType valType; /* the built-in type of the value */
33496 int n_valType;
33497 xmlChar * value; /* the lexical (or normalized for pattern) repr of the value to validate */
33498 int n_value;
33499 xmlSchemaValPtr val; /* the precomputed value */
33500 int n_val;
33501 xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
33502 int n_ws;
33503
33504 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33505 for (n_fws = 0;n_fws < gen_nb_xmlSchemaWhitespaceValueType;n_fws++) {
33506 for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) {
33507 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33508 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33509 for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
33510 mem_base = xmlMemBlocks();
33511 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33512 fws = gen_xmlSchemaWhitespaceValueType(n_fws, 1);
33513 valType = gen_xmlSchemaValType(n_valType, 2);
33514 value = gen_const_xmlChar_ptr(n_value, 3);
33515 val = gen_xmlSchemaValPtr(n_val, 4);
33516 ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5);
33517
33518 ret_val = xmlSchemaValidateFacetWhtsp(facet, fws, valType, (const xmlChar *)value, val, ws);
33519 desret_int(ret_val);
33520 call_tests++;
33521 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33522 des_xmlSchemaWhitespaceValueType(n_fws, fws, 1);
33523 des_xmlSchemaValType(n_valType, valType, 2);
33524 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
33525 des_xmlSchemaValPtr(n_val, val, 4);
33526 des_xmlSchemaWhitespaceValueType(n_ws, ws, 5);
33527 xmlResetLastError();
33528 if (mem_base != xmlMemBlocks()) {
33529 printf("Leak of %d blocks found in xmlSchemaValidateFacetWhtsp",
33530 xmlMemBlocks() - mem_base);
33531 test_ret++;
33532 printf(" %d", n_facet);
33533 printf(" %d", n_fws);
33534 printf(" %d", n_valType);
33535 printf(" %d", n_value);
33536 printf(" %d", n_val);
33537 printf(" %d", n_ws);
33538 printf("\n");
33539 }
33540 }
33541 }
33542 }
33543 }
33544 }
33545 }
33546 function_tests++;
33547#endif
33548
33549 return(test_ret);
33550}
33551
33552
33553static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033554test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033556
William M. Brack21e4ef22005-01-02 09:53:13 +000033557#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033558 int mem_base;
33559 int ret_val;
33560 xmlSchemaTypePtr type; /* the built-in type */
33561 int n_type;
33562 xmlSchemaFacetPtr facet; /* the facet to check */
33563 int n_facet;
33564 xmlChar * value; /* the lexical repr. of the value to be validated */
33565 int n_value;
33566 xmlSchemaValPtr val; /* the precomputed value */
33567 int n_val;
33568 unsigned long * length; /* the actual length of the value */
33569 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033570
Daniel Veillardce682bc2004-11-05 17:22:25 +000033571 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33572 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33573 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33574 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33575 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33576 mem_base = xmlMemBlocks();
33577 type = gen_xmlSchemaTypePtr(n_type, 0);
33578 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33579 value = gen_const_xmlChar_ptr(n_value, 2);
33580 val = gen_xmlSchemaValPtr(n_val, 3);
33581 length = gen_unsigned_long_ptr(n_length, 4);
33582
William M. Brackf13f77f2004-11-12 16:03:48 +000033583 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033584 desret_int(ret_val);
33585 call_tests++;
33586 des_xmlSchemaTypePtr(n_type, type, 0);
33587 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033588 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033589 des_xmlSchemaValPtr(n_val, val, 3);
33590 des_unsigned_long_ptr(n_length, length, 4);
33591 xmlResetLastError();
33592 if (mem_base != xmlMemBlocks()) {
33593 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033595 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033596 printf(" %d", n_type);
33597 printf(" %d", n_facet);
33598 printf(" %d", n_value);
33599 printf(" %d", n_val);
33600 printf(" %d", n_length);
33601 printf("\n");
33602 }
33603 }
33604 }
33605 }
33606 }
33607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033608 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033609#endif
33610
Daniel Veillard42595322004-11-08 10:52:06 +000033611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033612}
33613
33614
33615static int
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033616test_xmlSchemaValidateLengthFacetWhtsp(void) {
33617 int test_ret = 0;
33618
33619#if defined(LIBXML_SCHEMAS_ENABLED)
33620 int mem_base;
33621 int ret_val;
33622 xmlSchemaFacetPtr facet; /* the facet to check */
33623 int n_facet;
33624 xmlSchemaValType valType; /* the built-in type */
33625 int n_valType;
33626 xmlChar * value; /* the lexical repr. of the value to be validated */
33627 int n_value;
33628 xmlSchemaValPtr val; /* the precomputed value */
33629 int n_val;
33630 unsigned long * length; /* the actual length of the value */
33631 int n_length;
33632 xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
33633 int n_ws;
33634
33635 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33636 for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) {
33637 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33638 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33639 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33640 for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
33641 mem_base = xmlMemBlocks();
33642 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33643 valType = gen_xmlSchemaValType(n_valType, 1);
33644 value = gen_const_xmlChar_ptr(n_value, 2);
33645 val = gen_xmlSchemaValPtr(n_val, 3);
33646 length = gen_unsigned_long_ptr(n_length, 4);
33647 ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5);
33648
33649 ret_val = xmlSchemaValidateLengthFacetWhtsp(facet, valType, (const xmlChar *)value, val, length, ws);
33650 desret_int(ret_val);
33651 call_tests++;
33652 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33653 des_xmlSchemaValType(n_valType, valType, 1);
33654 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
33655 des_xmlSchemaValPtr(n_val, val, 3);
33656 des_unsigned_long_ptr(n_length, length, 4);
33657 des_xmlSchemaWhitespaceValueType(n_ws, ws, 5);
33658 xmlResetLastError();
33659 if (mem_base != xmlMemBlocks()) {
33660 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacetWhtsp",
33661 xmlMemBlocks() - mem_base);
33662 test_ret++;
33663 printf(" %d", n_facet);
33664 printf(" %d", n_valType);
33665 printf(" %d", n_value);
33666 printf(" %d", n_val);
33667 printf(" %d", n_length);
33668 printf(" %d", n_ws);
33669 printf("\n");
33670 }
33671 }
33672 }
33673 }
33674 }
33675 }
33676 }
33677 function_tests++;
33678#endif
33679
33680 return(test_ret);
33681}
33682
33683
33684static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033685test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033687
William M. Brack21e4ef22005-01-02 09:53:13 +000033688#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033689 int mem_base;
33690 int ret_val;
33691 xmlSchemaFacetPtr facet; /* the facet to check */
33692 int n_facet;
33693 xmlChar * value; /* the lexical repr of the value to validate */
33694 int n_value;
33695 unsigned long actualLen; /* the number of list items */
33696 int n_actualLen;
33697 unsigned long * expectedLen; /* the resulting expected number of list items */
33698 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033699
Daniel Veillardce682bc2004-11-05 17:22:25 +000033700 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33701 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33702 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33703 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33704 mem_base = xmlMemBlocks();
33705 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33706 value = gen_const_xmlChar_ptr(n_value, 1);
33707 actualLen = gen_unsigned_long(n_actualLen, 2);
33708 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33709
William M. Brackf13f77f2004-11-12 16:03:48 +000033710 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033711 desret_int(ret_val);
33712 call_tests++;
33713 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033714 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033715 des_unsigned_long(n_actualLen, actualLen, 2);
33716 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33717 xmlResetLastError();
33718 if (mem_base != xmlMemBlocks()) {
33719 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033721 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033722 printf(" %d", n_facet);
33723 printf(" %d", n_value);
33724 printf(" %d", n_actualLen);
33725 printf(" %d", n_expectedLen);
33726 printf("\n");
33727 }
33728 }
33729 }
33730 }
33731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033732 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033733#endif
33734
Daniel Veillard42595322004-11-08 10:52:06 +000033735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033736}
33737
33738
33739static int
33740test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033742
William M. Brack21e4ef22005-01-02 09:53:13 +000033743#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033744 int mem_base;
33745 int ret_val;
33746 xmlSchemaTypePtr type; /* the predefined type */
33747 int n_type;
33748 xmlChar * value; /* the value to check */
33749 int n_value;
33750 xmlSchemaValPtr * val; /* the return computed value */
33751 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033752
Daniel Veillardce682bc2004-11-05 17:22:25 +000033753 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33754 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33755 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33756 mem_base = xmlMemBlocks();
33757 type = gen_xmlSchemaTypePtr(n_type, 0);
33758 value = gen_const_xmlChar_ptr(n_value, 1);
33759 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33760
William M. Brackf13f77f2004-11-12 16:03:48 +000033761 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033762 desret_int(ret_val);
33763 call_tests++;
33764 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033765 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033766 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33767 xmlResetLastError();
33768 if (mem_base != xmlMemBlocks()) {
33769 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033771 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033772 printf(" %d", n_type);
33773 printf(" %d", n_value);
33774 printf(" %d", n_val);
33775 printf("\n");
33776 }
33777 }
33778 }
33779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033780 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033781#endif
33782
Daniel Veillard42595322004-11-08 10:52:06 +000033783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033784}
33785
Daniel Veillard91b955c2004-12-10 10:26:42 +000033786
33787static int
Daniel Veillard81562d22005-06-15 13:27:56 +000033788test_xmlSchemaValueAppend(void) {
33789 int test_ret = 0;
33790
33791#if defined(LIBXML_SCHEMAS_ENABLED)
33792 int mem_base;
33793 int ret_val;
33794 xmlSchemaValPtr prev; /* */
33795 int n_prev;
33796 xmlSchemaValPtr cur; /* */
33797 int n_cur;
33798
33799 for (n_prev = 0;n_prev < gen_nb_xmlSchemaValPtr;n_prev++) {
33800 for (n_cur = 0;n_cur < gen_nb_xmlSchemaValPtr;n_cur++) {
33801 mem_base = xmlMemBlocks();
33802 prev = gen_xmlSchemaValPtr(n_prev, 0);
33803 cur = gen_xmlSchemaValPtr(n_cur, 1);
33804
33805 ret_val = xmlSchemaValueAppend(prev, cur);
33806 desret_int(ret_val);
33807 call_tests++;
33808 des_xmlSchemaValPtr(n_prev, prev, 0);
33809 des_xmlSchemaValPtr(n_cur, cur, 1);
33810 xmlResetLastError();
33811 if (mem_base != xmlMemBlocks()) {
33812 printf("Leak of %d blocks found in xmlSchemaValueAppend",
33813 xmlMemBlocks() - mem_base);
33814 test_ret++;
33815 printf(" %d", n_prev);
33816 printf(" %d", n_cur);
33817 printf("\n");
33818 }
33819 }
33820 }
33821 function_tests++;
33822#endif
33823
33824 return(test_ret);
33825}
33826
33827
33828static int
33829test_xmlSchemaValueGetAsBoolean(void) {
33830 int test_ret = 0;
33831
33832#if defined(LIBXML_SCHEMAS_ENABLED)
33833 int mem_base;
33834 int ret_val;
33835 xmlSchemaValPtr val; /* */
33836 int n_val;
33837
33838 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33839 mem_base = xmlMemBlocks();
33840 val = gen_xmlSchemaValPtr(n_val, 0);
33841
33842 ret_val = xmlSchemaValueGetAsBoolean(val);
33843 desret_int(ret_val);
33844 call_tests++;
33845 des_xmlSchemaValPtr(n_val, val, 0);
33846 xmlResetLastError();
33847 if (mem_base != xmlMemBlocks()) {
33848 printf("Leak of %d blocks found in xmlSchemaValueGetAsBoolean",
33849 xmlMemBlocks() - mem_base);
33850 test_ret++;
33851 printf(" %d", n_val);
33852 printf("\n");
33853 }
33854 }
33855 function_tests++;
33856#endif
33857
33858 return(test_ret);
33859}
33860
33861
33862static int
33863test_xmlSchemaValueGetAsString(void) {
33864 int test_ret = 0;
33865
33866#if defined(LIBXML_SCHEMAS_ENABLED)
33867 int mem_base;
33868 const xmlChar * ret_val;
33869 xmlSchemaValPtr val; /* */
33870 int n_val;
33871
33872 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33873 mem_base = xmlMemBlocks();
33874 val = gen_xmlSchemaValPtr(n_val, 0);
33875
33876 ret_val = xmlSchemaValueGetAsString(val);
33877 desret_const_xmlChar_ptr(ret_val);
33878 call_tests++;
33879 des_xmlSchemaValPtr(n_val, val, 0);
33880 xmlResetLastError();
33881 if (mem_base != xmlMemBlocks()) {
33882 printf("Leak of %d blocks found in xmlSchemaValueGetAsString",
33883 xmlMemBlocks() - mem_base);
33884 test_ret++;
33885 printf(" %d", n_val);
33886 printf("\n");
33887 }
33888 }
33889 function_tests++;
33890#endif
33891
33892 return(test_ret);
33893}
33894
33895
33896static int
33897test_xmlSchemaValueGetNext(void) {
33898 int test_ret = 0;
33899
33900
33901 /* missing type support */
33902 return(test_ret);
33903}
33904
33905
33906static int
Daniel Veillard91b955c2004-12-10 10:26:42 +000033907test_xmlSchemaWhiteSpaceReplace(void) {
33908 int test_ret = 0;
33909
William M. Brack21e4ef22005-01-02 09:53:13 +000033910#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033911 int mem_base;
33912 xmlChar * ret_val;
33913 xmlChar * value; /* a value */
33914 int n_value;
33915
33916 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33917 mem_base = xmlMemBlocks();
33918 value = gen_const_xmlChar_ptr(n_value, 0);
33919
33920 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33921 desret_xmlChar_ptr(ret_val);
33922 call_tests++;
33923 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33924 xmlResetLastError();
33925 if (mem_base != xmlMemBlocks()) {
33926 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33927 xmlMemBlocks() - mem_base);
33928 test_ret++;
33929 printf(" %d", n_value);
33930 printf("\n");
33931 }
33932 }
33933 function_tests++;
33934#endif
33935
33936 return(test_ret);
33937}
33938
Daniel Veillardd93f6252004-11-02 15:53:51 +000033939static int
33940test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033942
Daniel Veillard81562d22005-06-15 13:27:56 +000033943 if (quiet == 0) printf("Testing xmlschemastypes : 26 of 34 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033944 test_ret += test_xmlSchemaCheckFacet();
33945 test_ret += test_xmlSchemaCleanupTypes();
33946 test_ret += test_xmlSchemaCollapseString();
33947 test_ret += test_xmlSchemaCompareValues();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033948 test_ret += test_xmlSchemaCompareValuesWhtsp();
Daniel Veillard57c000e2005-03-13 18:34:29 +000033949 test_ret += test_xmlSchemaCopyValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033950 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33951 test_ret += test_xmlSchemaGetBuiltInType();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033952 test_ret += test_xmlSchemaGetCanonValue();
Daniel Veillard99dd7632005-05-06 11:40:56 +000033953 test_ret += test_xmlSchemaGetCanonValueWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000033954 test_ret += test_xmlSchemaGetFacetValueAsULong();
33955 test_ret += test_xmlSchemaGetPredefinedType();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033956 test_ret += test_xmlSchemaGetValType();
Daniel Veillard42595322004-11-08 10:52:06 +000033957 test_ret += test_xmlSchemaInitTypes();
33958 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33959 test_ret += test_xmlSchemaNewFacet();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033960 test_ret += test_xmlSchemaNewNOTATIONValue();
Daniel Veillard81562d22005-06-15 13:27:56 +000033961 test_ret += test_xmlSchemaNewQNameValue();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033962 test_ret += test_xmlSchemaNewStringValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033963 test_ret += test_xmlSchemaValPredefTypeNode();
33964 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33965 test_ret += test_xmlSchemaValidateFacet();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033966 test_ret += test_xmlSchemaValidateFacetWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000033967 test_ret += test_xmlSchemaValidateLengthFacet();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033968 test_ret += test_xmlSchemaValidateLengthFacetWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000033969 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33970 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard81562d22005-06-15 13:27:56 +000033971 test_ret += test_xmlSchemaValueAppend();
33972 test_ret += test_xmlSchemaValueGetAsBoolean();
33973 test_ret += test_xmlSchemaValueGetAsString();
33974 test_ret += test_xmlSchemaValueGetNext();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033975 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033976
Daniel Veillard42595322004-11-08 10:52:06 +000033977 if (test_ret != 0)
33978 printf("Module xmlschemastypes: %d errors\n", test_ret);
33979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033980}
33981
33982static int
33983test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033985
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033986 int mem_base;
33987 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033988 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033989 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033990
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033991 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033993 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033994
William M. Brackf13f77f2004-11-12 16:03:48 +000033995 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033996 desret_xmlChar_ptr(ret_val);
33997 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033998 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033999 xmlResetLastError();
34000 if (mem_base != xmlMemBlocks()) {
34001 printf("Leak of %d blocks found in xmlCharStrdup",
34002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034003 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034004 printf(" %d", n_cur);
34005 printf("\n");
34006 }
34007 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034008 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034009
Daniel Veillard42595322004-11-08 10:52:06 +000034010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034011}
34012
34013
34014static int
34015test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034017
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034018 int mem_base;
34019 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034020 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034021 int n_cur;
34022 int len; /* the len of @cur */
34023 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034024
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034025 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
34026 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034028 cur = gen_const_char_ptr(n_cur, 0);
34029 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034030
William M. Brackf13f77f2004-11-12 16:03:48 +000034031 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034032 desret_xmlChar_ptr(ret_val);
34033 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034034 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034035 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034036 xmlResetLastError();
34037 if (mem_base != xmlMemBlocks()) {
34038 printf("Leak of %d blocks found in xmlCharStrndup",
34039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034040 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034041 printf(" %d", n_cur);
34042 printf(" %d", n_len);
34043 printf("\n");
34044 }
34045 }
34046 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034047 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034048
Daniel Veillard42595322004-11-08 10:52:06 +000034049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034050}
34051
34052
34053static int
34054test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034056
Daniel Veillardce682bc2004-11-05 17:22:25 +000034057 int mem_base;
34058 int ret_val;
34059 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
34060 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034061
Daniel Veillardce682bc2004-11-05 17:22:25 +000034062 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
34063 mem_base = xmlMemBlocks();
34064 utf = gen_const_unsigned_char_ptr(n_utf, 0);
34065
William M. Brackf13f77f2004-11-12 16:03:48 +000034066 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034067 desret_int(ret_val);
34068 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034069 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034070 xmlResetLastError();
34071 if (mem_base != xmlMemBlocks()) {
34072 printf("Leak of %d blocks found in xmlCheckUTF8",
34073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034074 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034075 printf(" %d", n_utf);
34076 printf("\n");
34077 }
34078 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000034079 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034080
Daniel Veillard42595322004-11-08 10:52:06 +000034081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034082}
34083
34084
34085static int
34086test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034088
Daniel Veillardce682bc2004-11-05 17:22:25 +000034089 int mem_base;
34090 int ret_val;
34091 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
34092 int n_utf;
34093 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. */
34094 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034095
Daniel Veillardce682bc2004-11-05 17:22:25 +000034096 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
34097 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
34098 mem_base = xmlMemBlocks();
34099 utf = gen_const_unsigned_char_ptr(n_utf, 0);
34100 len = gen_int_ptr(n_len, 1);
34101
William M. Brackf13f77f2004-11-12 16:03:48 +000034102 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034103 desret_int(ret_val);
34104 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034105 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034106 des_int_ptr(n_len, len, 1);
34107 xmlResetLastError();
34108 if (mem_base != xmlMemBlocks()) {
34109 printf("Leak of %d blocks found in xmlGetUTF8Char",
34110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034111 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034112 printf(" %d", n_utf);
34113 printf(" %d", n_len);
34114 printf("\n");
34115 }
34116 }
34117 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000034118 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034119
Daniel Veillard42595322004-11-08 10:52:06 +000034120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034121}
34122
34123
34124static int
34125test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034127
34128 int mem_base;
34129 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034130 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034131 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034132 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034133 int n_str2;
34134
34135 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34136 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34137 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034138 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34139 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034140
William M. Brackf13f77f2004-11-12 16:03:48 +000034141 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034142 desret_int(ret_val);
34143 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034144 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34145 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034146 xmlResetLastError();
34147 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034148 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034150 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034151 printf(" %d", n_str1);
34152 printf(" %d", n_str2);
34153 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034154 }
34155 }
34156 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034158
Daniel Veillard42595322004-11-08 10:52:06 +000034159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034160}
34161
34162
34163static int
34164test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034166
34167
34168 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000034169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034170}
34171
34172
34173static int
34174test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034176
34177 int mem_base;
34178 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034179 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034180 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034181 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034182 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034183 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034184 int n_str;
34185
34186 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
34187 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
34188 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34189 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034190 pref = gen_const_xmlChar_ptr(n_pref, 0);
34191 name = gen_const_xmlChar_ptr(n_name, 1);
34192 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034193
William M. Brackf13f77f2004-11-12 16:03:48 +000034194 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034195 desret_int(ret_val);
34196 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034197 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
34198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
34199 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034200 xmlResetLastError();
34201 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034202 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034204 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034205 printf(" %d", n_pref);
34206 printf(" %d", n_name);
34207 printf(" %d", n_str);
34208 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034209 }
34210 }
34211 }
34212 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034214
Daniel Veillard42595322004-11-08 10:52:06 +000034215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034216}
34217
34218
34219static int
34220test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034222
34223
34224 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000034225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034226}
34227
34228
34229static int
34230test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034232
34233 int mem_base;
34234 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034235 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034236 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034237 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034238 int n_str2;
34239
34240 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34241 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034243 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34244 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034245
William M. Brackf13f77f2004-11-12 16:03:48 +000034246 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034247 desret_int(ret_val);
34248 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034249 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34250 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034251 xmlResetLastError();
34252 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034253 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034255 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034256 printf(" %d", n_str1);
34257 printf(" %d", n_str2);
34258 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034259 }
34260 }
34261 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034262 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034263
Daniel Veillard42595322004-11-08 10:52:06 +000034264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034265}
34266
34267
34268static int
34269test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034271
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034272 int mem_base;
34273 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034274 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034275 int n_str;
34276 xmlChar * val; /* the xmlChar to search (needle) */
34277 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034278
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034279 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34280 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
34281 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034282 str = gen_const_xmlChar_ptr(n_str, 0);
34283 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034284
William M. Brackf13f77f2004-11-12 16:03:48 +000034285 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034286 desret_const_xmlChar_ptr(ret_val);
34287 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034288 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034289 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034290 xmlResetLastError();
34291 if (mem_base != xmlMemBlocks()) {
34292 printf("Leak of %d blocks found in xmlStrcasestr",
34293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034294 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034295 printf(" %d", n_str);
34296 printf(" %d", n_val);
34297 printf("\n");
34298 }
34299 }
34300 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034301 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034302
Daniel Veillard42595322004-11-08 10:52:06 +000034303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034304}
34305
34306
34307static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034308test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034310
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034311 int mem_base;
34312 const xmlChar * ret_val;
34313 xmlChar * str; /* the xmlChar * array */
34314 int n_str;
34315 xmlChar val; /* the xmlChar to search */
34316 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034317
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034318 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34319 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
34320 mem_base = xmlMemBlocks();
34321 str = gen_const_xmlChar_ptr(n_str, 0);
34322 val = gen_xmlChar(n_val, 1);
34323
William M. Brackf13f77f2004-11-12 16:03:48 +000034324 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034325 desret_const_xmlChar_ptr(ret_val);
34326 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034327 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034328 des_xmlChar(n_val, val, 1);
34329 xmlResetLastError();
34330 if (mem_base != xmlMemBlocks()) {
34331 printf("Leak of %d blocks found in xmlStrchr",
34332 xmlMemBlocks() - mem_base);
34333 test_ret++;
34334 printf(" %d", n_str);
34335 printf(" %d", n_val);
34336 printf("\n");
34337 }
34338 }
34339 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034340 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034341
Daniel Veillard42595322004-11-08 10:52:06 +000034342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034343}
34344
34345
34346static int
34347test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034349
34350 int mem_base;
34351 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034352 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034353 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034354 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034355 int n_str2;
34356
34357 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34358 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34359 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034360 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34361 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034362
William M. Brackf13f77f2004-11-12 16:03:48 +000034363 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034364 desret_int(ret_val);
34365 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034366 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34367 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034368 xmlResetLastError();
34369 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034370 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034372 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034373 printf(" %d", n_str1);
34374 printf(" %d", n_str2);
34375 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034376 }
34377 }
34378 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034379 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034380
Daniel Veillard42595322004-11-08 10:52:06 +000034381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034382}
34383
34384
34385static int
34386test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034388
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034389 int mem_base;
34390 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034391 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034392 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034393
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034394 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34395 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034396 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034397
William M. Brackf13f77f2004-11-12 16:03:48 +000034398 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034399 desret_xmlChar_ptr(ret_val);
34400 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034401 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034402 xmlResetLastError();
34403 if (mem_base != xmlMemBlocks()) {
34404 printf("Leak of %d blocks found in xmlStrdup",
34405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034406 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034407 printf(" %d", n_cur);
34408 printf("\n");
34409 }
34410 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034412
Daniel Veillard42595322004-11-08 10:52:06 +000034413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034414}
34415
34416
34417static int
34418test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034420
34421 int mem_base;
34422 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034423 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034424 int n_str;
34425
34426 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34427 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034428 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034429
William M. Brackf13f77f2004-11-12 16:03:48 +000034430 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034431 desret_int(ret_val);
34432 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034433 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034434 xmlResetLastError();
34435 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034436 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034438 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034439 printf(" %d", n_str);
34440 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034441 }
34442 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034444
Daniel Veillard42595322004-11-08 10:52:06 +000034445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034446}
34447
34448
34449static int
34450test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034452
34453 int mem_base;
34454 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034455 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034456 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034457 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034458 int n_str2;
34459 int len; /* the max comparison length */
34460 int n_len;
34461
34462 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34463 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34464 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034466 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34467 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34468 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034469
William M. Brackf13f77f2004-11-12 16:03:48 +000034470 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034471 desret_int(ret_val);
34472 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034473 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34474 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034475 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034476 xmlResetLastError();
34477 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034478 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034480 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034481 printf(" %d", n_str1);
34482 printf(" %d", n_str2);
34483 printf(" %d", n_len);
34484 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034485 }
34486 }
34487 }
34488 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034490
Daniel Veillard42595322004-11-08 10:52:06 +000034491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034492}
34493
34494
34495static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034496test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034498
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034499 int mem_base;
34500 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034501 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034502 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034503 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034504 int n_str2;
34505 int len; /* the len of @str2 */
34506 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034507
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034508 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34509 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34510 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034512 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34513 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34514 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034515
William M. Brackf13f77f2004-11-12 16:03:48 +000034516 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034517 desret_xmlChar_ptr(ret_val);
34518 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034519 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34520 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034521 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034522 xmlResetLastError();
34523 if (mem_base != xmlMemBlocks()) {
34524 printf("Leak of %d blocks found in xmlStrncatNew",
34525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034526 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034527 printf(" %d", n_str1);
34528 printf(" %d", n_str2);
34529 printf(" %d", n_len);
34530 printf("\n");
34531 }
34532 }
34533 }
34534 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034536
Daniel Veillard42595322004-11-08 10:52:06 +000034537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034538}
34539
34540
34541static int
34542test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034544
34545 int mem_base;
34546 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034547 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034548 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034549 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034550 int n_str2;
34551 int len; /* the max comparison length */
34552 int n_len;
34553
34554 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34555 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34556 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034558 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34559 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34560 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034561
William M. Brackf13f77f2004-11-12 16:03:48 +000034562 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034563 desret_int(ret_val);
34564 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034565 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34566 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034567 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034568 xmlResetLastError();
34569 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034570 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034572 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034573 printf(" %d", n_str1);
34574 printf(" %d", n_str2);
34575 printf(" %d", n_len);
34576 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034577 }
34578 }
34579 }
34580 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034582
Daniel Veillard42595322004-11-08 10:52:06 +000034583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034584}
34585
34586
34587static int
34588test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034590
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034591 int mem_base;
34592 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034593 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034594 int n_cur;
34595 int len; /* the len of @cur */
34596 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034597
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034598 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34599 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034601 cur = gen_const_xmlChar_ptr(n_cur, 0);
34602 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034603
William M. Brackf13f77f2004-11-12 16:03:48 +000034604 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034605 desret_xmlChar_ptr(ret_val);
34606 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034607 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034608 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034609 xmlResetLastError();
34610 if (mem_base != xmlMemBlocks()) {
34611 printf("Leak of %d blocks found in xmlStrndup",
34612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034613 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034614 printf(" %d", n_cur);
34615 printf(" %d", n_len);
34616 printf("\n");
34617 }
34618 }
34619 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034620 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034621
Daniel Veillard42595322004-11-08 10:52:06 +000034622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034623}
34624
34625
34626static int
34627test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034629
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034630 int mem_base;
34631 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034632 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034633 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034634 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034635 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034636
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034637 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34638 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
34639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034640 str = gen_const_xmlChar_ptr(n_str, 0);
34641 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034642
William M. Brackf13f77f2004-11-12 16:03:48 +000034643 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034644 desret_const_xmlChar_ptr(ret_val);
34645 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034646 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
34647 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034648 xmlResetLastError();
34649 if (mem_base != xmlMemBlocks()) {
34650 printf("Leak of %d blocks found in xmlStrstr",
34651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034652 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034653 printf(" %d", n_str);
34654 printf(" %d", n_val);
34655 printf("\n");
34656 }
34657 }
34658 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034660
Daniel Veillard42595322004-11-08 10:52:06 +000034661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034662}
34663
34664
34665static int
34666test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034668
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034669 int mem_base;
34670 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034671 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034672 int n_str;
34673 int start; /* the index of the first char (zero based) */
34674 int n_start;
34675 int len; /* the length of the substring */
34676 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034677
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034678 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34679 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34680 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034682 str = gen_const_xmlChar_ptr(n_str, 0);
34683 start = gen_int(n_start, 1);
34684 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034685
William M. Brackf13f77f2004-11-12 16:03:48 +000034686 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034687 desret_xmlChar_ptr(ret_val);
34688 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034689 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034690 des_int(n_start, start, 1);
34691 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034692 xmlResetLastError();
34693 if (mem_base != xmlMemBlocks()) {
34694 printf("Leak of %d blocks found in xmlStrsub",
34695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034696 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034697 printf(" %d", n_str);
34698 printf(" %d", n_start);
34699 printf(" %d", n_len);
34700 printf("\n");
34701 }
34702 }
34703 }
34704 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034705 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034706
Daniel Veillard42595322004-11-08 10:52:06 +000034707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034708}
34709
34710
34711static int
34712test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034714
34715 int mem_base;
34716 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034717 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034718 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034719 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034720 int n_utf2;
34721
34722 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34723 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34724 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034725 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34726 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034727
William M. Brackf13f77f2004-11-12 16:03:48 +000034728 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034729 desret_int(ret_val);
34730 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034731 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34732 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034733 xmlResetLastError();
34734 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034735 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034737 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034738 printf(" %d", n_utf1);
34739 printf(" %d", n_utf2);
34740 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034741 }
34742 }
34743 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034744 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034745
Daniel Veillard42595322004-11-08 10:52:06 +000034746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034747}
34748
34749
34750static int
34751test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034753
34754 int mem_base;
34755 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034756 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034757 int n_utf;
34758
34759 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034761 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034762
William M. Brackf13f77f2004-11-12 16:03:48 +000034763 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034764 desret_int(ret_val);
34765 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034766 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034767 xmlResetLastError();
34768 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034769 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034771 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034772 printf(" %d", n_utf);
34773 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034774 }
34775 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034776 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034777
Daniel Veillard42595322004-11-08 10:52:06 +000034778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034779}
34780
34781
34782static int
34783test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034785
34786 int mem_base;
34787 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034788 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034789 int n_utf;
34790
34791 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034793 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034794
William M. Brackf13f77f2004-11-12 16:03:48 +000034795 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034796 desret_int(ret_val);
34797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034798 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034799 xmlResetLastError();
34800 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034801 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034803 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034804 printf(" %d", n_utf);
34805 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034806 }
34807 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034808 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034809
Daniel Veillard42595322004-11-08 10:52:06 +000034810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034811}
34812
34813
34814static int
34815test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034817
34818 int mem_base;
34819 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034820 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034821 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034822 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034823 int n_utfchar;
34824
34825 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34826 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034828 utf = gen_const_xmlChar_ptr(n_utf, 0);
34829 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034830
William M. Brackf13f77f2004-11-12 16:03:48 +000034831 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034832 desret_int(ret_val);
34833 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034834 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34835 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034836 xmlResetLastError();
34837 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034838 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034840 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034841 printf(" %d", n_utf);
34842 printf(" %d", n_utfchar);
34843 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034844 }
34845 }
34846 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034847 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034848
Daniel Veillard42595322004-11-08 10:52:06 +000034849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034850}
34851
34852
34853static int
34854test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034856
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034857 int mem_base;
34858 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034859 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034860 int n_utf;
34861 int len; /* the len of @utf (in chars) */
34862 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034863
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034864 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34865 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034867 utf = gen_const_xmlChar_ptr(n_utf, 0);
34868 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034869
William M. Brackf13f77f2004-11-12 16:03:48 +000034870 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034871 desret_xmlChar_ptr(ret_val);
34872 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034873 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034874 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034875 xmlResetLastError();
34876 if (mem_base != xmlMemBlocks()) {
34877 printf("Leak of %d blocks found in xmlUTF8Strndup",
34878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034879 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034880 printf(" %d", n_utf);
34881 printf(" %d", n_len);
34882 printf("\n");
34883 }
34884 }
34885 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034886 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034887
Daniel Veillard42595322004-11-08 10:52:06 +000034888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034889}
34890
34891
34892static int
34893test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034895
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034896 int mem_base;
34897 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034898 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034899 int n_utf;
34900 int pos; /* the position of the desired UTF8 char (in chars) */
34901 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034902
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034903 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34904 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34905 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034906 utf = gen_const_xmlChar_ptr(n_utf, 0);
34907 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034908
William M. Brackf13f77f2004-11-12 16:03:48 +000034909 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034910 desret_const_xmlChar_ptr(ret_val);
34911 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034912 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034913 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034914 xmlResetLastError();
34915 if (mem_base != xmlMemBlocks()) {
34916 printf("Leak of %d blocks found in xmlUTF8Strpos",
34917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034918 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034919 printf(" %d", n_utf);
34920 printf(" %d", n_pos);
34921 printf("\n");
34922 }
34923 }
34924 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034925 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034926
Daniel Veillard42595322004-11-08 10:52:06 +000034927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034928}
34929
34930
34931static int
34932test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034934
34935 int mem_base;
34936 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034937 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034938 int n_utf;
34939 int len; /* the number of characters in the array */
34940 int n_len;
34941
34942 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34943 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034945 utf = gen_const_xmlChar_ptr(n_utf, 0);
34946 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034947
William M. Brackf13f77f2004-11-12 16:03:48 +000034948 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034949 desret_int(ret_val);
34950 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034951 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034952 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034953 xmlResetLastError();
34954 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034955 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034957 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034958 printf(" %d", n_utf);
34959 printf(" %d", n_len);
34960 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034961 }
34962 }
34963 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034964 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034965
Daniel Veillard42595322004-11-08 10:52:06 +000034966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034967}
34968
34969
34970static int
34971test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034973
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034974 int mem_base;
34975 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034976 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034977 int n_utf;
34978 int start; /* relative pos of first char */
34979 int n_start;
34980 int len; /* total number to copy */
34981 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034982
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034983 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34984 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34985 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34986 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034987 utf = gen_const_xmlChar_ptr(n_utf, 0);
34988 start = gen_int(n_start, 1);
34989 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034990
William M. Brackf13f77f2004-11-12 16:03:48 +000034991 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034992 desret_xmlChar_ptr(ret_val);
34993 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034994 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034995 des_int(n_start, start, 1);
34996 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034997 xmlResetLastError();
34998 if (mem_base != xmlMemBlocks()) {
34999 printf("Leak of %d blocks found in xmlUTF8Strsub",
35000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035001 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035002 printf(" %d", n_utf);
35003 printf(" %d", n_start);
35004 printf(" %d", n_len);
35005 printf("\n");
35006 }
35007 }
35008 }
35009 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000035010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035011
Daniel Veillard42595322004-11-08 10:52:06 +000035012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035013}
35014
35015static int
35016test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035018
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035019 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000035020 test_ret += test_xmlCharStrdup();
35021 test_ret += test_xmlCharStrndup();
35022 test_ret += test_xmlCheckUTF8();
35023 test_ret += test_xmlGetUTF8Char();
35024 test_ret += test_xmlStrEqual();
35025 test_ret += test_xmlStrPrintf();
35026 test_ret += test_xmlStrQEqual();
35027 test_ret += test_xmlStrVPrintf();
35028 test_ret += test_xmlStrcasecmp();
35029 test_ret += test_xmlStrcasestr();
35030 test_ret += test_xmlStrchr();
35031 test_ret += test_xmlStrcmp();
35032 test_ret += test_xmlStrdup();
35033 test_ret += test_xmlStrlen();
35034 test_ret += test_xmlStrncasecmp();
35035 test_ret += test_xmlStrncatNew();
35036 test_ret += test_xmlStrncmp();
35037 test_ret += test_xmlStrndup();
35038 test_ret += test_xmlStrstr();
35039 test_ret += test_xmlStrsub();
35040 test_ret += test_xmlUTF8Charcmp();
35041 test_ret += test_xmlUTF8Size();
35042 test_ret += test_xmlUTF8Strlen();
35043 test_ret += test_xmlUTF8Strloc();
35044 test_ret += test_xmlUTF8Strndup();
35045 test_ret += test_xmlUTF8Strpos();
35046 test_ret += test_xmlUTF8Strsize();
35047 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000035048
Daniel Veillard42595322004-11-08 10:52:06 +000035049 if (test_ret != 0)
35050 printf("Module xmlstring: %d errors\n", test_ret);
35051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035052}
35053
35054static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035055test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035056 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035057
William M. Brack21e4ef22005-01-02 09:53:13 +000035058#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035059 int mem_base;
35060 int ret_val;
35061 int code; /* UCS code point */
35062 int n_code;
35063
35064 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35065 mem_base = xmlMemBlocks();
35066 code = gen_int(n_code, 0);
35067
35068 ret_val = xmlUCSIsAegeanNumbers(code);
35069 desret_int(ret_val);
35070 call_tests++;
35071 des_int(n_code, code, 0);
35072 xmlResetLastError();
35073 if (mem_base != xmlMemBlocks()) {
35074 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
35075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035076 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035077 printf(" %d", n_code);
35078 printf("\n");
35079 }
35080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035081 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035082#endif
35083
Daniel Veillard42595322004-11-08 10:52:06 +000035084 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035085}
35086
35087
35088static int
35089test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035090 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035091
William M. Brack21e4ef22005-01-02 09:53:13 +000035092#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035093 int mem_base;
35094 int ret_val;
35095 int code; /* UCS code point */
35096 int n_code;
35097
35098 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35099 mem_base = xmlMemBlocks();
35100 code = gen_int(n_code, 0);
35101
35102 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
35103 desret_int(ret_val);
35104 call_tests++;
35105 des_int(n_code, code, 0);
35106 xmlResetLastError();
35107 if (mem_base != xmlMemBlocks()) {
35108 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
35109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035110 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035111 printf(" %d", n_code);
35112 printf("\n");
35113 }
35114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035115 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035116#endif
35117
Daniel Veillard42595322004-11-08 10:52:06 +000035118 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035119}
35120
35121
35122static int
35123test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035124 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035125
William M. Brack21e4ef22005-01-02 09:53:13 +000035126#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035127 int mem_base;
35128 int ret_val;
35129 int code; /* UCS code point */
35130 int n_code;
35131
35132 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35133 mem_base = xmlMemBlocks();
35134 code = gen_int(n_code, 0);
35135
35136 ret_val = xmlUCSIsArabic(code);
35137 desret_int(ret_val);
35138 call_tests++;
35139 des_int(n_code, code, 0);
35140 xmlResetLastError();
35141 if (mem_base != xmlMemBlocks()) {
35142 printf("Leak of %d blocks found in xmlUCSIsArabic",
35143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035144 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035145 printf(" %d", n_code);
35146 printf("\n");
35147 }
35148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035149 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035150#endif
35151
Daniel Veillard42595322004-11-08 10:52:06 +000035152 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035153}
35154
35155
35156static int
35157test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035158 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035159
William M. Brack21e4ef22005-01-02 09:53:13 +000035160#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035161 int mem_base;
35162 int ret_val;
35163 int code; /* UCS code point */
35164 int n_code;
35165
35166 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35167 mem_base = xmlMemBlocks();
35168 code = gen_int(n_code, 0);
35169
35170 ret_val = xmlUCSIsArabicPresentationFormsA(code);
35171 desret_int(ret_val);
35172 call_tests++;
35173 des_int(n_code, code, 0);
35174 xmlResetLastError();
35175 if (mem_base != xmlMemBlocks()) {
35176 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
35177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035178 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035179 printf(" %d", n_code);
35180 printf("\n");
35181 }
35182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035183 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035184#endif
35185
Daniel Veillard42595322004-11-08 10:52:06 +000035186 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035187}
35188
35189
35190static int
35191test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035192 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035193
William M. Brack21e4ef22005-01-02 09:53:13 +000035194#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035195 int mem_base;
35196 int ret_val;
35197 int code; /* UCS code point */
35198 int n_code;
35199
35200 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35201 mem_base = xmlMemBlocks();
35202 code = gen_int(n_code, 0);
35203
35204 ret_val = xmlUCSIsArabicPresentationFormsB(code);
35205 desret_int(ret_val);
35206 call_tests++;
35207 des_int(n_code, code, 0);
35208 xmlResetLastError();
35209 if (mem_base != xmlMemBlocks()) {
35210 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
35211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035212 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035213 printf(" %d", n_code);
35214 printf("\n");
35215 }
35216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035217 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218#endif
35219
Daniel Veillard42595322004-11-08 10:52:06 +000035220 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035221}
35222
35223
35224static int
35225test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035226 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035227
William M. Brack21e4ef22005-01-02 09:53:13 +000035228#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035229 int mem_base;
35230 int ret_val;
35231 int code; /* UCS code point */
35232 int n_code;
35233
35234 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35235 mem_base = xmlMemBlocks();
35236 code = gen_int(n_code, 0);
35237
35238 ret_val = xmlUCSIsArmenian(code);
35239 desret_int(ret_val);
35240 call_tests++;
35241 des_int(n_code, code, 0);
35242 xmlResetLastError();
35243 if (mem_base != xmlMemBlocks()) {
35244 printf("Leak of %d blocks found in xmlUCSIsArmenian",
35245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035246 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035247 printf(" %d", n_code);
35248 printf("\n");
35249 }
35250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035251 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252#endif
35253
Daniel Veillard42595322004-11-08 10:52:06 +000035254 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035255}
35256
35257
35258static int
35259test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035260 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035261
William M. Brack21e4ef22005-01-02 09:53:13 +000035262#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035263 int mem_base;
35264 int ret_val;
35265 int code; /* UCS code point */
35266 int n_code;
35267
35268 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35269 mem_base = xmlMemBlocks();
35270 code = gen_int(n_code, 0);
35271
35272 ret_val = xmlUCSIsArrows(code);
35273 desret_int(ret_val);
35274 call_tests++;
35275 des_int(n_code, code, 0);
35276 xmlResetLastError();
35277 if (mem_base != xmlMemBlocks()) {
35278 printf("Leak of %d blocks found in xmlUCSIsArrows",
35279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035280 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035281 printf(" %d", n_code);
35282 printf("\n");
35283 }
35284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035285 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035286#endif
35287
Daniel Veillard42595322004-11-08 10:52:06 +000035288 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035289}
35290
35291
35292static int
35293test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035294 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035295
William M. Brack21e4ef22005-01-02 09:53:13 +000035296#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035297 int mem_base;
35298 int ret_val;
35299 int code; /* UCS code point */
35300 int n_code;
35301
35302 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35303 mem_base = xmlMemBlocks();
35304 code = gen_int(n_code, 0);
35305
35306 ret_val = xmlUCSIsBasicLatin(code);
35307 desret_int(ret_val);
35308 call_tests++;
35309 des_int(n_code, code, 0);
35310 xmlResetLastError();
35311 if (mem_base != xmlMemBlocks()) {
35312 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
35313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035314 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035315 printf(" %d", n_code);
35316 printf("\n");
35317 }
35318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035319 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035320#endif
35321
Daniel Veillard42595322004-11-08 10:52:06 +000035322 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035323}
35324
35325
35326static int
35327test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035328 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035329
William M. Brack21e4ef22005-01-02 09:53:13 +000035330#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035331 int mem_base;
35332 int ret_val;
35333 int code; /* UCS code point */
35334 int n_code;
35335
35336 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35337 mem_base = xmlMemBlocks();
35338 code = gen_int(n_code, 0);
35339
35340 ret_val = xmlUCSIsBengali(code);
35341 desret_int(ret_val);
35342 call_tests++;
35343 des_int(n_code, code, 0);
35344 xmlResetLastError();
35345 if (mem_base != xmlMemBlocks()) {
35346 printf("Leak of %d blocks found in xmlUCSIsBengali",
35347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035348 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035349 printf(" %d", n_code);
35350 printf("\n");
35351 }
35352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035353 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035354#endif
35355
Daniel Veillard42595322004-11-08 10:52:06 +000035356 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035357}
35358
35359
35360static int
35361test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035362 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035363
William M. Brack21e4ef22005-01-02 09:53:13 +000035364#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035365 int mem_base;
35366 int ret_val;
35367 int code; /* UCS code point */
35368 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035369 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035370 int n_block;
35371
35372 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35373 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
35374 mem_base = xmlMemBlocks();
35375 code = gen_int(n_code, 0);
35376 block = gen_const_char_ptr(n_block, 1);
35377
William M. Brackf13f77f2004-11-12 16:03:48 +000035378 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035379 desret_int(ret_val);
35380 call_tests++;
35381 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035382 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035383 xmlResetLastError();
35384 if (mem_base != xmlMemBlocks()) {
35385 printf("Leak of %d blocks found in xmlUCSIsBlock",
35386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035387 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035388 printf(" %d", n_code);
35389 printf(" %d", n_block);
35390 printf("\n");
35391 }
35392 }
35393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035395#endif
35396
Daniel Veillard42595322004-11-08 10:52:06 +000035397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035398}
35399
35400
35401static int
35402test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035404
William M. Brack21e4ef22005-01-02 09:53:13 +000035405#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035406 int mem_base;
35407 int ret_val;
35408 int code; /* UCS code point */
35409 int n_code;
35410
35411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35412 mem_base = xmlMemBlocks();
35413 code = gen_int(n_code, 0);
35414
35415 ret_val = xmlUCSIsBlockElements(code);
35416 desret_int(ret_val);
35417 call_tests++;
35418 des_int(n_code, code, 0);
35419 xmlResetLastError();
35420 if (mem_base != xmlMemBlocks()) {
35421 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
35422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035424 printf(" %d", n_code);
35425 printf("\n");
35426 }
35427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035429#endif
35430
Daniel Veillard42595322004-11-08 10:52:06 +000035431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035432}
35433
35434
35435static int
35436test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035438
William M. Brack21e4ef22005-01-02 09:53:13 +000035439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035440 int mem_base;
35441 int ret_val;
35442 int code; /* UCS code point */
35443 int n_code;
35444
35445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35446 mem_base = xmlMemBlocks();
35447 code = gen_int(n_code, 0);
35448
35449 ret_val = xmlUCSIsBopomofo(code);
35450 desret_int(ret_val);
35451 call_tests++;
35452 des_int(n_code, code, 0);
35453 xmlResetLastError();
35454 if (mem_base != xmlMemBlocks()) {
35455 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
35456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035458 printf(" %d", n_code);
35459 printf("\n");
35460 }
35461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035463#endif
35464
Daniel Veillard42595322004-11-08 10:52:06 +000035465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035466}
35467
35468
35469static int
35470test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035472
William M. Brack21e4ef22005-01-02 09:53:13 +000035473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035474 int mem_base;
35475 int ret_val;
35476 int code; /* UCS code point */
35477 int n_code;
35478
35479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35480 mem_base = xmlMemBlocks();
35481 code = gen_int(n_code, 0);
35482
35483 ret_val = xmlUCSIsBopomofoExtended(code);
35484 desret_int(ret_val);
35485 call_tests++;
35486 des_int(n_code, code, 0);
35487 xmlResetLastError();
35488 if (mem_base != xmlMemBlocks()) {
35489 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
35490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035492 printf(" %d", n_code);
35493 printf("\n");
35494 }
35495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035497#endif
35498
Daniel Veillard42595322004-11-08 10:52:06 +000035499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035500}
35501
35502
35503static int
35504test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035506
William M. Brack21e4ef22005-01-02 09:53:13 +000035507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035508 int mem_base;
35509 int ret_val;
35510 int code; /* UCS code point */
35511 int n_code;
35512
35513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35514 mem_base = xmlMemBlocks();
35515 code = gen_int(n_code, 0);
35516
35517 ret_val = xmlUCSIsBoxDrawing(code);
35518 desret_int(ret_val);
35519 call_tests++;
35520 des_int(n_code, code, 0);
35521 xmlResetLastError();
35522 if (mem_base != xmlMemBlocks()) {
35523 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
35524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035526 printf(" %d", n_code);
35527 printf("\n");
35528 }
35529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035531#endif
35532
Daniel Veillard42595322004-11-08 10:52:06 +000035533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035534}
35535
35536
35537static int
35538test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035540
William M. Brack21e4ef22005-01-02 09:53:13 +000035541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035542 int mem_base;
35543 int ret_val;
35544 int code; /* UCS code point */
35545 int n_code;
35546
35547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35548 mem_base = xmlMemBlocks();
35549 code = gen_int(n_code, 0);
35550
35551 ret_val = xmlUCSIsBraillePatterns(code);
35552 desret_int(ret_val);
35553 call_tests++;
35554 des_int(n_code, code, 0);
35555 xmlResetLastError();
35556 if (mem_base != xmlMemBlocks()) {
35557 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
35558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035560 printf(" %d", n_code);
35561 printf("\n");
35562 }
35563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035565#endif
35566
Daniel Veillard42595322004-11-08 10:52:06 +000035567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035568}
35569
35570
35571static int
35572test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035574
William M. Brack21e4ef22005-01-02 09:53:13 +000035575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035576 int mem_base;
35577 int ret_val;
35578 int code; /* UCS code point */
35579 int n_code;
35580
35581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35582 mem_base = xmlMemBlocks();
35583 code = gen_int(n_code, 0);
35584
35585 ret_val = xmlUCSIsBuhid(code);
35586 desret_int(ret_val);
35587 call_tests++;
35588 des_int(n_code, code, 0);
35589 xmlResetLastError();
35590 if (mem_base != xmlMemBlocks()) {
35591 printf("Leak of %d blocks found in xmlUCSIsBuhid",
35592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035594 printf(" %d", n_code);
35595 printf("\n");
35596 }
35597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035599#endif
35600
Daniel Veillard42595322004-11-08 10:52:06 +000035601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035602}
35603
35604
35605static int
35606test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035608
William M. Brack21e4ef22005-01-02 09:53:13 +000035609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035610 int mem_base;
35611 int ret_val;
35612 int code; /* UCS code point */
35613 int n_code;
35614
35615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35616 mem_base = xmlMemBlocks();
35617 code = gen_int(n_code, 0);
35618
35619 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
35620 desret_int(ret_val);
35621 call_tests++;
35622 des_int(n_code, code, 0);
35623 xmlResetLastError();
35624 if (mem_base != xmlMemBlocks()) {
35625 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
35626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035628 printf(" %d", n_code);
35629 printf("\n");
35630 }
35631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035633#endif
35634
Daniel Veillard42595322004-11-08 10:52:06 +000035635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035636}
35637
35638
35639static int
35640test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035642
William M. Brack21e4ef22005-01-02 09:53:13 +000035643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035644 int mem_base;
35645 int ret_val;
35646 int code; /* UCS code point */
35647 int n_code;
35648
35649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35650 mem_base = xmlMemBlocks();
35651 code = gen_int(n_code, 0);
35652
35653 ret_val = xmlUCSIsCJKCompatibility(code);
35654 desret_int(ret_val);
35655 call_tests++;
35656 des_int(n_code, code, 0);
35657 xmlResetLastError();
35658 if (mem_base != xmlMemBlocks()) {
35659 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
35660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035662 printf(" %d", n_code);
35663 printf("\n");
35664 }
35665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035667#endif
35668
Daniel Veillard42595322004-11-08 10:52:06 +000035669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035670}
35671
35672
35673static int
35674test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035676
William M. Brack21e4ef22005-01-02 09:53:13 +000035677#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035678 int mem_base;
35679 int ret_val;
35680 int code; /* UCS code point */
35681 int n_code;
35682
35683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35684 mem_base = xmlMemBlocks();
35685 code = gen_int(n_code, 0);
35686
35687 ret_val = xmlUCSIsCJKCompatibilityForms(code);
35688 desret_int(ret_val);
35689 call_tests++;
35690 des_int(n_code, code, 0);
35691 xmlResetLastError();
35692 if (mem_base != xmlMemBlocks()) {
35693 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
35694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035696 printf(" %d", n_code);
35697 printf("\n");
35698 }
35699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035701#endif
35702
Daniel Veillard42595322004-11-08 10:52:06 +000035703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035704}
35705
35706
35707static int
35708test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035710
William M. Brack21e4ef22005-01-02 09:53:13 +000035711#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035712 int mem_base;
35713 int ret_val;
35714 int code; /* UCS code point */
35715 int n_code;
35716
35717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35718 mem_base = xmlMemBlocks();
35719 code = gen_int(n_code, 0);
35720
35721 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
35722 desret_int(ret_val);
35723 call_tests++;
35724 des_int(n_code, code, 0);
35725 xmlResetLastError();
35726 if (mem_base != xmlMemBlocks()) {
35727 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
35728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035730 printf(" %d", n_code);
35731 printf("\n");
35732 }
35733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035735#endif
35736
Daniel Veillard42595322004-11-08 10:52:06 +000035737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035738}
35739
35740
35741static int
35742test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035744
William M. Brack21e4ef22005-01-02 09:53:13 +000035745#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035746 int mem_base;
35747 int ret_val;
35748 int code; /* UCS code point */
35749 int n_code;
35750
35751 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35752 mem_base = xmlMemBlocks();
35753 code = gen_int(n_code, 0);
35754
35755 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
35756 desret_int(ret_val);
35757 call_tests++;
35758 des_int(n_code, code, 0);
35759 xmlResetLastError();
35760 if (mem_base != xmlMemBlocks()) {
35761 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
35762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035763 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035764 printf(" %d", n_code);
35765 printf("\n");
35766 }
35767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035768 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035769#endif
35770
Daniel Veillard42595322004-11-08 10:52:06 +000035771 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035772}
35773
35774
35775static int
35776test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035777 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035778
William M. Brack21e4ef22005-01-02 09:53:13 +000035779#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035780 int mem_base;
35781 int ret_val;
35782 int code; /* UCS code point */
35783 int n_code;
35784
35785 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35786 mem_base = xmlMemBlocks();
35787 code = gen_int(n_code, 0);
35788
35789 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35790 desret_int(ret_val);
35791 call_tests++;
35792 des_int(n_code, code, 0);
35793 xmlResetLastError();
35794 if (mem_base != xmlMemBlocks()) {
35795 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035797 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035798 printf(" %d", n_code);
35799 printf("\n");
35800 }
35801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035802 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035803#endif
35804
Daniel Veillard42595322004-11-08 10:52:06 +000035805 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035806}
35807
35808
35809static int
35810test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035811 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035812
William M. Brack21e4ef22005-01-02 09:53:13 +000035813#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035814 int mem_base;
35815 int ret_val;
35816 int code; /* UCS code point */
35817 int n_code;
35818
35819 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35820 mem_base = xmlMemBlocks();
35821 code = gen_int(n_code, 0);
35822
35823 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35824 desret_int(ret_val);
35825 call_tests++;
35826 des_int(n_code, code, 0);
35827 xmlResetLastError();
35828 if (mem_base != xmlMemBlocks()) {
35829 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035831 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035832 printf(" %d", n_code);
35833 printf("\n");
35834 }
35835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035836 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035837#endif
35838
Daniel Veillard42595322004-11-08 10:52:06 +000035839 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035840}
35841
35842
35843static int
35844test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035845 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035846
William M. Brack21e4ef22005-01-02 09:53:13 +000035847#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035848 int mem_base;
35849 int ret_val;
35850 int code; /* UCS code point */
35851 int n_code;
35852
35853 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35854 mem_base = xmlMemBlocks();
35855 code = gen_int(n_code, 0);
35856
35857 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35858 desret_int(ret_val);
35859 call_tests++;
35860 des_int(n_code, code, 0);
35861 xmlResetLastError();
35862 if (mem_base != xmlMemBlocks()) {
35863 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035865 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035866 printf(" %d", n_code);
35867 printf("\n");
35868 }
35869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035870 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035871#endif
35872
Daniel Veillard42595322004-11-08 10:52:06 +000035873 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035874}
35875
35876
35877static int
35878test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035879 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035880
William M. Brack21e4ef22005-01-02 09:53:13 +000035881#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035882 int mem_base;
35883 int ret_val;
35884 int code; /* UCS code point */
35885 int n_code;
35886
35887 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35888 mem_base = xmlMemBlocks();
35889 code = gen_int(n_code, 0);
35890
35891 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35892 desret_int(ret_val);
35893 call_tests++;
35894 des_int(n_code, code, 0);
35895 xmlResetLastError();
35896 if (mem_base != xmlMemBlocks()) {
35897 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035900 printf(" %d", n_code);
35901 printf("\n");
35902 }
35903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035904 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035905#endif
35906
Daniel Veillard42595322004-11-08 10:52:06 +000035907 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035908}
35909
35910
35911static int
35912test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035913 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035914
William M. Brack21e4ef22005-01-02 09:53:13 +000035915#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035916 int mem_base;
35917 int ret_val;
35918 int code; /* UCS code point */
35919 int n_code;
35920
35921 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35922 mem_base = xmlMemBlocks();
35923 code = gen_int(n_code, 0);
35924
35925 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35926 desret_int(ret_val);
35927 call_tests++;
35928 des_int(n_code, code, 0);
35929 xmlResetLastError();
35930 if (mem_base != xmlMemBlocks()) {
35931 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035933 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035934 printf(" %d", n_code);
35935 printf("\n");
35936 }
35937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035938 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035939#endif
35940
Daniel Veillard42595322004-11-08 10:52:06 +000035941 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035942}
35943
35944
35945static int
35946test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035947 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035948
William M. Brack21e4ef22005-01-02 09:53:13 +000035949#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035950 int mem_base;
35951 int ret_val;
35952 int code; /* UCS code point */
35953 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035954 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035955 int n_cat;
35956
35957 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35958 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35959 mem_base = xmlMemBlocks();
35960 code = gen_int(n_code, 0);
35961 cat = gen_const_char_ptr(n_cat, 1);
35962
William M. Brackf13f77f2004-11-12 16:03:48 +000035963 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035964 desret_int(ret_val);
35965 call_tests++;
35966 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035967 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035968 xmlResetLastError();
35969 if (mem_base != xmlMemBlocks()) {
35970 printf("Leak of %d blocks found in xmlUCSIsCat",
35971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035972 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035973 printf(" %d", n_code);
35974 printf(" %d", n_cat);
35975 printf("\n");
35976 }
35977 }
35978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035979 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035980#endif
35981
Daniel Veillard42595322004-11-08 10:52:06 +000035982 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035983}
35984
35985
35986static int
35987test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035988 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035989
William M. Brack21e4ef22005-01-02 09:53:13 +000035990#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035991 int mem_base;
35992 int ret_val;
35993 int code; /* UCS code point */
35994 int n_code;
35995
35996 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35997 mem_base = xmlMemBlocks();
35998 code = gen_int(n_code, 0);
35999
36000 ret_val = xmlUCSIsCatC(code);
36001 desret_int(ret_val);
36002 call_tests++;
36003 des_int(n_code, code, 0);
36004 xmlResetLastError();
36005 if (mem_base != xmlMemBlocks()) {
36006 printf("Leak of %d blocks found in xmlUCSIsCatC",
36007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036008 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036009 printf(" %d", n_code);
36010 printf("\n");
36011 }
36012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036013 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036014#endif
36015
Daniel Veillard42595322004-11-08 10:52:06 +000036016 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036017}
36018
36019
36020static int
36021test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036022 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036023
William M. Brack21e4ef22005-01-02 09:53:13 +000036024#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036025 int mem_base;
36026 int ret_val;
36027 int code; /* UCS code point */
36028 int n_code;
36029
36030 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36031 mem_base = xmlMemBlocks();
36032 code = gen_int(n_code, 0);
36033
36034 ret_val = xmlUCSIsCatCc(code);
36035 desret_int(ret_val);
36036 call_tests++;
36037 des_int(n_code, code, 0);
36038 xmlResetLastError();
36039 if (mem_base != xmlMemBlocks()) {
36040 printf("Leak of %d blocks found in xmlUCSIsCatCc",
36041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036042 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036043 printf(" %d", n_code);
36044 printf("\n");
36045 }
36046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036047 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036048#endif
36049
Daniel Veillard42595322004-11-08 10:52:06 +000036050 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036051}
36052
36053
36054static int
36055test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036056 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036057
William M. Brack21e4ef22005-01-02 09:53:13 +000036058#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036059 int mem_base;
36060 int ret_val;
36061 int code; /* UCS code point */
36062 int n_code;
36063
36064 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36065 mem_base = xmlMemBlocks();
36066 code = gen_int(n_code, 0);
36067
36068 ret_val = xmlUCSIsCatCf(code);
36069 desret_int(ret_val);
36070 call_tests++;
36071 des_int(n_code, code, 0);
36072 xmlResetLastError();
36073 if (mem_base != xmlMemBlocks()) {
36074 printf("Leak of %d blocks found in xmlUCSIsCatCf",
36075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036076 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036077 printf(" %d", n_code);
36078 printf("\n");
36079 }
36080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036081 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036082#endif
36083
Daniel Veillard42595322004-11-08 10:52:06 +000036084 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036085}
36086
36087
36088static int
36089test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036090 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036091
William M. Brack21e4ef22005-01-02 09:53:13 +000036092#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036093 int mem_base;
36094 int ret_val;
36095 int code; /* UCS code point */
36096 int n_code;
36097
36098 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36099 mem_base = xmlMemBlocks();
36100 code = gen_int(n_code, 0);
36101
36102 ret_val = xmlUCSIsCatCo(code);
36103 desret_int(ret_val);
36104 call_tests++;
36105 des_int(n_code, code, 0);
36106 xmlResetLastError();
36107 if (mem_base != xmlMemBlocks()) {
36108 printf("Leak of %d blocks found in xmlUCSIsCatCo",
36109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036110 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036111 printf(" %d", n_code);
36112 printf("\n");
36113 }
36114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036115 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036116#endif
36117
Daniel Veillard42595322004-11-08 10:52:06 +000036118 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036119}
36120
36121
36122static int
36123test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036124 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036125
William M. Brack21e4ef22005-01-02 09:53:13 +000036126#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036127 int mem_base;
36128 int ret_val;
36129 int code; /* UCS code point */
36130 int n_code;
36131
36132 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36133 mem_base = xmlMemBlocks();
36134 code = gen_int(n_code, 0);
36135
36136 ret_val = xmlUCSIsCatCs(code);
36137 desret_int(ret_val);
36138 call_tests++;
36139 des_int(n_code, code, 0);
36140 xmlResetLastError();
36141 if (mem_base != xmlMemBlocks()) {
36142 printf("Leak of %d blocks found in xmlUCSIsCatCs",
36143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036144 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036145 printf(" %d", n_code);
36146 printf("\n");
36147 }
36148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036149 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036150#endif
36151
Daniel Veillard42595322004-11-08 10:52:06 +000036152 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036153}
36154
36155
36156static int
36157test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036158 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036159
William M. Brack21e4ef22005-01-02 09:53:13 +000036160#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036161 int mem_base;
36162 int ret_val;
36163 int code; /* UCS code point */
36164 int n_code;
36165
36166 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36167 mem_base = xmlMemBlocks();
36168 code = gen_int(n_code, 0);
36169
36170 ret_val = xmlUCSIsCatL(code);
36171 desret_int(ret_val);
36172 call_tests++;
36173 des_int(n_code, code, 0);
36174 xmlResetLastError();
36175 if (mem_base != xmlMemBlocks()) {
36176 printf("Leak of %d blocks found in xmlUCSIsCatL",
36177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036178 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036179 printf(" %d", n_code);
36180 printf("\n");
36181 }
36182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036183 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036184#endif
36185
Daniel Veillard42595322004-11-08 10:52:06 +000036186 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036187}
36188
36189
36190static int
36191test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036192 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036193
William M. Brack21e4ef22005-01-02 09:53:13 +000036194#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036195 int mem_base;
36196 int ret_val;
36197 int code; /* UCS code point */
36198 int n_code;
36199
36200 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36201 mem_base = xmlMemBlocks();
36202 code = gen_int(n_code, 0);
36203
36204 ret_val = xmlUCSIsCatLl(code);
36205 desret_int(ret_val);
36206 call_tests++;
36207 des_int(n_code, code, 0);
36208 xmlResetLastError();
36209 if (mem_base != xmlMemBlocks()) {
36210 printf("Leak of %d blocks found in xmlUCSIsCatLl",
36211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036212 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036213 printf(" %d", n_code);
36214 printf("\n");
36215 }
36216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036217 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036218#endif
36219
Daniel Veillard42595322004-11-08 10:52:06 +000036220 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036221}
36222
36223
36224static int
36225test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036226 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036227
William M. Brack21e4ef22005-01-02 09:53:13 +000036228#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036229 int mem_base;
36230 int ret_val;
36231 int code; /* UCS code point */
36232 int n_code;
36233
36234 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36235 mem_base = xmlMemBlocks();
36236 code = gen_int(n_code, 0);
36237
36238 ret_val = xmlUCSIsCatLm(code);
36239 desret_int(ret_val);
36240 call_tests++;
36241 des_int(n_code, code, 0);
36242 xmlResetLastError();
36243 if (mem_base != xmlMemBlocks()) {
36244 printf("Leak of %d blocks found in xmlUCSIsCatLm",
36245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036246 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036247 printf(" %d", n_code);
36248 printf("\n");
36249 }
36250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036251 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036252#endif
36253
Daniel Veillard42595322004-11-08 10:52:06 +000036254 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036255}
36256
36257
36258static int
36259test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036260 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036261
William M. Brack21e4ef22005-01-02 09:53:13 +000036262#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036263 int mem_base;
36264 int ret_val;
36265 int code; /* UCS code point */
36266 int n_code;
36267
36268 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36269 mem_base = xmlMemBlocks();
36270 code = gen_int(n_code, 0);
36271
36272 ret_val = xmlUCSIsCatLo(code);
36273 desret_int(ret_val);
36274 call_tests++;
36275 des_int(n_code, code, 0);
36276 xmlResetLastError();
36277 if (mem_base != xmlMemBlocks()) {
36278 printf("Leak of %d blocks found in xmlUCSIsCatLo",
36279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036280 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036281 printf(" %d", n_code);
36282 printf("\n");
36283 }
36284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036285 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036286#endif
36287
Daniel Veillard42595322004-11-08 10:52:06 +000036288 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036289}
36290
36291
36292static int
36293test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036294 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036295
William M. Brack21e4ef22005-01-02 09:53:13 +000036296#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036297 int mem_base;
36298 int ret_val;
36299 int code; /* UCS code point */
36300 int n_code;
36301
36302 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36303 mem_base = xmlMemBlocks();
36304 code = gen_int(n_code, 0);
36305
36306 ret_val = xmlUCSIsCatLt(code);
36307 desret_int(ret_val);
36308 call_tests++;
36309 des_int(n_code, code, 0);
36310 xmlResetLastError();
36311 if (mem_base != xmlMemBlocks()) {
36312 printf("Leak of %d blocks found in xmlUCSIsCatLt",
36313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036314 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036315 printf(" %d", n_code);
36316 printf("\n");
36317 }
36318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036319 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036320#endif
36321
Daniel Veillard42595322004-11-08 10:52:06 +000036322 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036323}
36324
36325
36326static int
36327test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036328 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036329
William M. Brack21e4ef22005-01-02 09:53:13 +000036330#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036331 int mem_base;
36332 int ret_val;
36333 int code; /* UCS code point */
36334 int n_code;
36335
36336 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36337 mem_base = xmlMemBlocks();
36338 code = gen_int(n_code, 0);
36339
36340 ret_val = xmlUCSIsCatLu(code);
36341 desret_int(ret_val);
36342 call_tests++;
36343 des_int(n_code, code, 0);
36344 xmlResetLastError();
36345 if (mem_base != xmlMemBlocks()) {
36346 printf("Leak of %d blocks found in xmlUCSIsCatLu",
36347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036348 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036349 printf(" %d", n_code);
36350 printf("\n");
36351 }
36352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036353 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036354#endif
36355
Daniel Veillard42595322004-11-08 10:52:06 +000036356 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036357}
36358
36359
36360static int
36361test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036362 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036363
William M. Brack21e4ef22005-01-02 09:53:13 +000036364#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036365 int mem_base;
36366 int ret_val;
36367 int code; /* UCS code point */
36368 int n_code;
36369
36370 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36371 mem_base = xmlMemBlocks();
36372 code = gen_int(n_code, 0);
36373
36374 ret_val = xmlUCSIsCatM(code);
36375 desret_int(ret_val);
36376 call_tests++;
36377 des_int(n_code, code, 0);
36378 xmlResetLastError();
36379 if (mem_base != xmlMemBlocks()) {
36380 printf("Leak of %d blocks found in xmlUCSIsCatM",
36381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036382 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036383 printf(" %d", n_code);
36384 printf("\n");
36385 }
36386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036387 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036388#endif
36389
Daniel Veillard42595322004-11-08 10:52:06 +000036390 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036391}
36392
36393
36394static int
36395test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036396 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036397
William M. Brack21e4ef22005-01-02 09:53:13 +000036398#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036399 int mem_base;
36400 int ret_val;
36401 int code; /* UCS code point */
36402 int n_code;
36403
36404 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36405 mem_base = xmlMemBlocks();
36406 code = gen_int(n_code, 0);
36407
36408 ret_val = xmlUCSIsCatMc(code);
36409 desret_int(ret_val);
36410 call_tests++;
36411 des_int(n_code, code, 0);
36412 xmlResetLastError();
36413 if (mem_base != xmlMemBlocks()) {
36414 printf("Leak of %d blocks found in xmlUCSIsCatMc",
36415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036416 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036417 printf(" %d", n_code);
36418 printf("\n");
36419 }
36420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036421 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036422#endif
36423
Daniel Veillard42595322004-11-08 10:52:06 +000036424 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036425}
36426
36427
36428static int
36429test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036430 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036431
William M. Brack21e4ef22005-01-02 09:53:13 +000036432#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036433 int mem_base;
36434 int ret_val;
36435 int code; /* UCS code point */
36436 int n_code;
36437
36438 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36439 mem_base = xmlMemBlocks();
36440 code = gen_int(n_code, 0);
36441
36442 ret_val = xmlUCSIsCatMe(code);
36443 desret_int(ret_val);
36444 call_tests++;
36445 des_int(n_code, code, 0);
36446 xmlResetLastError();
36447 if (mem_base != xmlMemBlocks()) {
36448 printf("Leak of %d blocks found in xmlUCSIsCatMe",
36449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036450 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036451 printf(" %d", n_code);
36452 printf("\n");
36453 }
36454 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036455 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036456#endif
36457
Daniel Veillard42595322004-11-08 10:52:06 +000036458 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036459}
36460
36461
36462static int
36463test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036464 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036465
William M. Brack21e4ef22005-01-02 09:53:13 +000036466#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036467 int mem_base;
36468 int ret_val;
36469 int code; /* UCS code point */
36470 int n_code;
36471
36472 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36473 mem_base = xmlMemBlocks();
36474 code = gen_int(n_code, 0);
36475
36476 ret_val = xmlUCSIsCatMn(code);
36477 desret_int(ret_val);
36478 call_tests++;
36479 des_int(n_code, code, 0);
36480 xmlResetLastError();
36481 if (mem_base != xmlMemBlocks()) {
36482 printf("Leak of %d blocks found in xmlUCSIsCatMn",
36483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036484 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036485 printf(" %d", n_code);
36486 printf("\n");
36487 }
36488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036489 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036490#endif
36491
Daniel Veillard42595322004-11-08 10:52:06 +000036492 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036493}
36494
36495
36496static int
36497test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036498 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036499
William M. Brack21e4ef22005-01-02 09:53:13 +000036500#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036501 int mem_base;
36502 int ret_val;
36503 int code; /* UCS code point */
36504 int n_code;
36505
36506 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36507 mem_base = xmlMemBlocks();
36508 code = gen_int(n_code, 0);
36509
36510 ret_val = xmlUCSIsCatN(code);
36511 desret_int(ret_val);
36512 call_tests++;
36513 des_int(n_code, code, 0);
36514 xmlResetLastError();
36515 if (mem_base != xmlMemBlocks()) {
36516 printf("Leak of %d blocks found in xmlUCSIsCatN",
36517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036518 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036519 printf(" %d", n_code);
36520 printf("\n");
36521 }
36522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036523 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036524#endif
36525
Daniel Veillard42595322004-11-08 10:52:06 +000036526 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036527}
36528
36529
36530static int
36531test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036532 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036533
William M. Brack21e4ef22005-01-02 09:53:13 +000036534#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036535 int mem_base;
36536 int ret_val;
36537 int code; /* UCS code point */
36538 int n_code;
36539
36540 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36541 mem_base = xmlMemBlocks();
36542 code = gen_int(n_code, 0);
36543
36544 ret_val = xmlUCSIsCatNd(code);
36545 desret_int(ret_val);
36546 call_tests++;
36547 des_int(n_code, code, 0);
36548 xmlResetLastError();
36549 if (mem_base != xmlMemBlocks()) {
36550 printf("Leak of %d blocks found in xmlUCSIsCatNd",
36551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036552 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036553 printf(" %d", n_code);
36554 printf("\n");
36555 }
36556 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036557 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036558#endif
36559
Daniel Veillard42595322004-11-08 10:52:06 +000036560 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036561}
36562
36563
36564static int
36565test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036566 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036567
William M. Brack21e4ef22005-01-02 09:53:13 +000036568#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036569 int mem_base;
36570 int ret_val;
36571 int code; /* UCS code point */
36572 int n_code;
36573
36574 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36575 mem_base = xmlMemBlocks();
36576 code = gen_int(n_code, 0);
36577
36578 ret_val = xmlUCSIsCatNl(code);
36579 desret_int(ret_val);
36580 call_tests++;
36581 des_int(n_code, code, 0);
36582 xmlResetLastError();
36583 if (mem_base != xmlMemBlocks()) {
36584 printf("Leak of %d blocks found in xmlUCSIsCatNl",
36585 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036586 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036587 printf(" %d", n_code);
36588 printf("\n");
36589 }
36590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036591 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036592#endif
36593
Daniel Veillard42595322004-11-08 10:52:06 +000036594 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036595}
36596
36597
36598static int
36599test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036600 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036601
William M. Brack21e4ef22005-01-02 09:53:13 +000036602#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036603 int mem_base;
36604 int ret_val;
36605 int code; /* UCS code point */
36606 int n_code;
36607
36608 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36609 mem_base = xmlMemBlocks();
36610 code = gen_int(n_code, 0);
36611
36612 ret_val = xmlUCSIsCatNo(code);
36613 desret_int(ret_val);
36614 call_tests++;
36615 des_int(n_code, code, 0);
36616 xmlResetLastError();
36617 if (mem_base != xmlMemBlocks()) {
36618 printf("Leak of %d blocks found in xmlUCSIsCatNo",
36619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036620 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036621 printf(" %d", n_code);
36622 printf("\n");
36623 }
36624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036625 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036626#endif
36627
Daniel Veillard42595322004-11-08 10:52:06 +000036628 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036629}
36630
36631
36632static int
36633test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036634 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036635
William M. Brack21e4ef22005-01-02 09:53:13 +000036636#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036637 int mem_base;
36638 int ret_val;
36639 int code; /* UCS code point */
36640 int n_code;
36641
36642 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36643 mem_base = xmlMemBlocks();
36644 code = gen_int(n_code, 0);
36645
36646 ret_val = xmlUCSIsCatP(code);
36647 desret_int(ret_val);
36648 call_tests++;
36649 des_int(n_code, code, 0);
36650 xmlResetLastError();
36651 if (mem_base != xmlMemBlocks()) {
36652 printf("Leak of %d blocks found in xmlUCSIsCatP",
36653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036654 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036655 printf(" %d", n_code);
36656 printf("\n");
36657 }
36658 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036659 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036660#endif
36661
Daniel Veillard42595322004-11-08 10:52:06 +000036662 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036663}
36664
36665
36666static int
36667test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036668 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036669
William M. Brack21e4ef22005-01-02 09:53:13 +000036670#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036671 int mem_base;
36672 int ret_val;
36673 int code; /* UCS code point */
36674 int n_code;
36675
36676 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36677 mem_base = xmlMemBlocks();
36678 code = gen_int(n_code, 0);
36679
36680 ret_val = xmlUCSIsCatPc(code);
36681 desret_int(ret_val);
36682 call_tests++;
36683 des_int(n_code, code, 0);
36684 xmlResetLastError();
36685 if (mem_base != xmlMemBlocks()) {
36686 printf("Leak of %d blocks found in xmlUCSIsCatPc",
36687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036688 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036689 printf(" %d", n_code);
36690 printf("\n");
36691 }
36692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036693 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036694#endif
36695
Daniel Veillard42595322004-11-08 10:52:06 +000036696 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036697}
36698
36699
36700static int
36701test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036702 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036703
William M. Brack21e4ef22005-01-02 09:53:13 +000036704#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036705 int mem_base;
36706 int ret_val;
36707 int code; /* UCS code point */
36708 int n_code;
36709
36710 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36711 mem_base = xmlMemBlocks();
36712 code = gen_int(n_code, 0);
36713
36714 ret_val = xmlUCSIsCatPd(code);
36715 desret_int(ret_val);
36716 call_tests++;
36717 des_int(n_code, code, 0);
36718 xmlResetLastError();
36719 if (mem_base != xmlMemBlocks()) {
36720 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036722 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036723 printf(" %d", n_code);
36724 printf("\n");
36725 }
36726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036727 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036728#endif
36729
Daniel Veillard42595322004-11-08 10:52:06 +000036730 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036731}
36732
36733
36734static int
36735test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036736 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036737
William M. Brack21e4ef22005-01-02 09:53:13 +000036738#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036739 int mem_base;
36740 int ret_val;
36741 int code; /* UCS code point */
36742 int n_code;
36743
36744 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36745 mem_base = xmlMemBlocks();
36746 code = gen_int(n_code, 0);
36747
36748 ret_val = xmlUCSIsCatPe(code);
36749 desret_int(ret_val);
36750 call_tests++;
36751 des_int(n_code, code, 0);
36752 xmlResetLastError();
36753 if (mem_base != xmlMemBlocks()) {
36754 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36755 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036756 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036757 printf(" %d", n_code);
36758 printf("\n");
36759 }
36760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036761 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036762#endif
36763
Daniel Veillard42595322004-11-08 10:52:06 +000036764 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036765}
36766
36767
36768static int
36769test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036770 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036771
William M. Brack21e4ef22005-01-02 09:53:13 +000036772#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036773 int mem_base;
36774 int ret_val;
36775 int code; /* UCS code point */
36776 int n_code;
36777
36778 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36779 mem_base = xmlMemBlocks();
36780 code = gen_int(n_code, 0);
36781
36782 ret_val = xmlUCSIsCatPf(code);
36783 desret_int(ret_val);
36784 call_tests++;
36785 des_int(n_code, code, 0);
36786 xmlResetLastError();
36787 if (mem_base != xmlMemBlocks()) {
36788 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36789 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036790 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036791 printf(" %d", n_code);
36792 printf("\n");
36793 }
36794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036795 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036796#endif
36797
Daniel Veillard42595322004-11-08 10:52:06 +000036798 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036799}
36800
36801
36802static int
36803test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036804 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036805
William M. Brack21e4ef22005-01-02 09:53:13 +000036806#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036807 int mem_base;
36808 int ret_val;
36809 int code; /* UCS code point */
36810 int n_code;
36811
36812 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36813 mem_base = xmlMemBlocks();
36814 code = gen_int(n_code, 0);
36815
36816 ret_val = xmlUCSIsCatPi(code);
36817 desret_int(ret_val);
36818 call_tests++;
36819 des_int(n_code, code, 0);
36820 xmlResetLastError();
36821 if (mem_base != xmlMemBlocks()) {
36822 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036824 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036825 printf(" %d", n_code);
36826 printf("\n");
36827 }
36828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036829 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036830#endif
36831
Daniel Veillard42595322004-11-08 10:52:06 +000036832 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036833}
36834
36835
36836static int
36837test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036838 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036839
William M. Brack21e4ef22005-01-02 09:53:13 +000036840#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036841 int mem_base;
36842 int ret_val;
36843 int code; /* UCS code point */
36844 int n_code;
36845
36846 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36847 mem_base = xmlMemBlocks();
36848 code = gen_int(n_code, 0);
36849
36850 ret_val = xmlUCSIsCatPo(code);
36851 desret_int(ret_val);
36852 call_tests++;
36853 des_int(n_code, code, 0);
36854 xmlResetLastError();
36855 if (mem_base != xmlMemBlocks()) {
36856 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036858 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036859 printf(" %d", n_code);
36860 printf("\n");
36861 }
36862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036863 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036864#endif
36865
Daniel Veillard42595322004-11-08 10:52:06 +000036866 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036867}
36868
36869
36870static int
36871test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036872 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036873
William M. Brack21e4ef22005-01-02 09:53:13 +000036874#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036875 int mem_base;
36876 int ret_val;
36877 int code; /* UCS code point */
36878 int n_code;
36879
36880 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36881 mem_base = xmlMemBlocks();
36882 code = gen_int(n_code, 0);
36883
36884 ret_val = xmlUCSIsCatPs(code);
36885 desret_int(ret_val);
36886 call_tests++;
36887 des_int(n_code, code, 0);
36888 xmlResetLastError();
36889 if (mem_base != xmlMemBlocks()) {
36890 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036892 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036893 printf(" %d", n_code);
36894 printf("\n");
36895 }
36896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036897 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036898#endif
36899
Daniel Veillard42595322004-11-08 10:52:06 +000036900 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036901}
36902
36903
36904static int
36905test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036906 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036907
William M. Brack21e4ef22005-01-02 09:53:13 +000036908#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036909 int mem_base;
36910 int ret_val;
36911 int code; /* UCS code point */
36912 int n_code;
36913
36914 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36915 mem_base = xmlMemBlocks();
36916 code = gen_int(n_code, 0);
36917
36918 ret_val = xmlUCSIsCatS(code);
36919 desret_int(ret_val);
36920 call_tests++;
36921 des_int(n_code, code, 0);
36922 xmlResetLastError();
36923 if (mem_base != xmlMemBlocks()) {
36924 printf("Leak of %d blocks found in xmlUCSIsCatS",
36925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036926 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036927 printf(" %d", n_code);
36928 printf("\n");
36929 }
36930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036931 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036932#endif
36933
Daniel Veillard42595322004-11-08 10:52:06 +000036934 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036935}
36936
36937
36938static int
36939test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036940 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036941
William M. Brack21e4ef22005-01-02 09:53:13 +000036942#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036943 int mem_base;
36944 int ret_val;
36945 int code; /* UCS code point */
36946 int n_code;
36947
36948 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36949 mem_base = xmlMemBlocks();
36950 code = gen_int(n_code, 0);
36951
36952 ret_val = xmlUCSIsCatSc(code);
36953 desret_int(ret_val);
36954 call_tests++;
36955 des_int(n_code, code, 0);
36956 xmlResetLastError();
36957 if (mem_base != xmlMemBlocks()) {
36958 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036960 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036961 printf(" %d", n_code);
36962 printf("\n");
36963 }
36964 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036965 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036966#endif
36967
Daniel Veillard42595322004-11-08 10:52:06 +000036968 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036969}
36970
36971
36972static int
36973test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036974 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036975
William M. Brack21e4ef22005-01-02 09:53:13 +000036976#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036977 int mem_base;
36978 int ret_val;
36979 int code; /* UCS code point */
36980 int n_code;
36981
36982 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36983 mem_base = xmlMemBlocks();
36984 code = gen_int(n_code, 0);
36985
36986 ret_val = xmlUCSIsCatSk(code);
36987 desret_int(ret_val);
36988 call_tests++;
36989 des_int(n_code, code, 0);
36990 xmlResetLastError();
36991 if (mem_base != xmlMemBlocks()) {
36992 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036994 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036995 printf(" %d", n_code);
36996 printf("\n");
36997 }
36998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036999 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037000#endif
37001
Daniel Veillard42595322004-11-08 10:52:06 +000037002 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037003}
37004
37005
37006static int
37007test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037008 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037009
William M. Brack21e4ef22005-01-02 09:53:13 +000037010#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037011 int mem_base;
37012 int ret_val;
37013 int code; /* UCS code point */
37014 int n_code;
37015
37016 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37017 mem_base = xmlMemBlocks();
37018 code = gen_int(n_code, 0);
37019
37020 ret_val = xmlUCSIsCatSm(code);
37021 desret_int(ret_val);
37022 call_tests++;
37023 des_int(n_code, code, 0);
37024 xmlResetLastError();
37025 if (mem_base != xmlMemBlocks()) {
37026 printf("Leak of %d blocks found in xmlUCSIsCatSm",
37027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037028 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037029 printf(" %d", n_code);
37030 printf("\n");
37031 }
37032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037033 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037034#endif
37035
Daniel Veillard42595322004-11-08 10:52:06 +000037036 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037037}
37038
37039
37040static int
37041test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037042 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037043
William M. Brack21e4ef22005-01-02 09:53:13 +000037044#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037045 int mem_base;
37046 int ret_val;
37047 int code; /* UCS code point */
37048 int n_code;
37049
37050 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37051 mem_base = xmlMemBlocks();
37052 code = gen_int(n_code, 0);
37053
37054 ret_val = xmlUCSIsCatSo(code);
37055 desret_int(ret_val);
37056 call_tests++;
37057 des_int(n_code, code, 0);
37058 xmlResetLastError();
37059 if (mem_base != xmlMemBlocks()) {
37060 printf("Leak of %d blocks found in xmlUCSIsCatSo",
37061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037062 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037063 printf(" %d", n_code);
37064 printf("\n");
37065 }
37066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037067 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037068#endif
37069
Daniel Veillard42595322004-11-08 10:52:06 +000037070 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037071}
37072
37073
37074static int
37075test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037076 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037077
William M. Brack21e4ef22005-01-02 09:53:13 +000037078#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037079 int mem_base;
37080 int ret_val;
37081 int code; /* UCS code point */
37082 int n_code;
37083
37084 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37085 mem_base = xmlMemBlocks();
37086 code = gen_int(n_code, 0);
37087
37088 ret_val = xmlUCSIsCatZ(code);
37089 desret_int(ret_val);
37090 call_tests++;
37091 des_int(n_code, code, 0);
37092 xmlResetLastError();
37093 if (mem_base != xmlMemBlocks()) {
37094 printf("Leak of %d blocks found in xmlUCSIsCatZ",
37095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037096 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037097 printf(" %d", n_code);
37098 printf("\n");
37099 }
37100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037101 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037102#endif
37103
Daniel Veillard42595322004-11-08 10:52:06 +000037104 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037105}
37106
37107
37108static int
37109test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037110 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037111
William M. Brack21e4ef22005-01-02 09:53:13 +000037112#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037113 int mem_base;
37114 int ret_val;
37115 int code; /* UCS code point */
37116 int n_code;
37117
37118 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37119 mem_base = xmlMemBlocks();
37120 code = gen_int(n_code, 0);
37121
37122 ret_val = xmlUCSIsCatZl(code);
37123 desret_int(ret_val);
37124 call_tests++;
37125 des_int(n_code, code, 0);
37126 xmlResetLastError();
37127 if (mem_base != xmlMemBlocks()) {
37128 printf("Leak of %d blocks found in xmlUCSIsCatZl",
37129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037130 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037131 printf(" %d", n_code);
37132 printf("\n");
37133 }
37134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037135 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037136#endif
37137
Daniel Veillard42595322004-11-08 10:52:06 +000037138 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037139}
37140
37141
37142static int
37143test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037144 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037145
William M. Brack21e4ef22005-01-02 09:53:13 +000037146#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037147 int mem_base;
37148 int ret_val;
37149 int code; /* UCS code point */
37150 int n_code;
37151
37152 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37153 mem_base = xmlMemBlocks();
37154 code = gen_int(n_code, 0);
37155
37156 ret_val = xmlUCSIsCatZp(code);
37157 desret_int(ret_val);
37158 call_tests++;
37159 des_int(n_code, code, 0);
37160 xmlResetLastError();
37161 if (mem_base != xmlMemBlocks()) {
37162 printf("Leak of %d blocks found in xmlUCSIsCatZp",
37163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037164 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037165 printf(" %d", n_code);
37166 printf("\n");
37167 }
37168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037169 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037170#endif
37171
Daniel Veillard42595322004-11-08 10:52:06 +000037172 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037173}
37174
37175
37176static int
37177test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037178 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037179
William M. Brack21e4ef22005-01-02 09:53:13 +000037180#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037181 int mem_base;
37182 int ret_val;
37183 int code; /* UCS code point */
37184 int n_code;
37185
37186 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37187 mem_base = xmlMemBlocks();
37188 code = gen_int(n_code, 0);
37189
37190 ret_val = xmlUCSIsCatZs(code);
37191 desret_int(ret_val);
37192 call_tests++;
37193 des_int(n_code, code, 0);
37194 xmlResetLastError();
37195 if (mem_base != xmlMemBlocks()) {
37196 printf("Leak of %d blocks found in xmlUCSIsCatZs",
37197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037198 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037199 printf(" %d", n_code);
37200 printf("\n");
37201 }
37202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037203 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037204#endif
37205
Daniel Veillard42595322004-11-08 10:52:06 +000037206 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037207}
37208
37209
37210static int
37211test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037212 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037213
William M. Brack21e4ef22005-01-02 09:53:13 +000037214#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037215 int mem_base;
37216 int ret_val;
37217 int code; /* UCS code point */
37218 int n_code;
37219
37220 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37221 mem_base = xmlMemBlocks();
37222 code = gen_int(n_code, 0);
37223
37224 ret_val = xmlUCSIsCherokee(code);
37225 desret_int(ret_val);
37226 call_tests++;
37227 des_int(n_code, code, 0);
37228 xmlResetLastError();
37229 if (mem_base != xmlMemBlocks()) {
37230 printf("Leak of %d blocks found in xmlUCSIsCherokee",
37231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037232 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037233 printf(" %d", n_code);
37234 printf("\n");
37235 }
37236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037237 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037238#endif
37239
Daniel Veillard42595322004-11-08 10:52:06 +000037240 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037241}
37242
37243
37244static int
37245test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037246 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037247
William M. Brack21e4ef22005-01-02 09:53:13 +000037248#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037249 int mem_base;
37250 int ret_val;
37251 int code; /* UCS code point */
37252 int n_code;
37253
37254 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37255 mem_base = xmlMemBlocks();
37256 code = gen_int(n_code, 0);
37257
37258 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
37259 desret_int(ret_val);
37260 call_tests++;
37261 des_int(n_code, code, 0);
37262 xmlResetLastError();
37263 if (mem_base != xmlMemBlocks()) {
37264 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
37265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037266 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037267 printf(" %d", n_code);
37268 printf("\n");
37269 }
37270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037271 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037272#endif
37273
Daniel Veillard42595322004-11-08 10:52:06 +000037274 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037275}
37276
37277
37278static int
37279test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037280 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037281
William M. Brack21e4ef22005-01-02 09:53:13 +000037282#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037283 int mem_base;
37284 int ret_val;
37285 int code; /* UCS code point */
37286 int n_code;
37287
37288 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37289 mem_base = xmlMemBlocks();
37290 code = gen_int(n_code, 0);
37291
37292 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
37293 desret_int(ret_val);
37294 call_tests++;
37295 des_int(n_code, code, 0);
37296 xmlResetLastError();
37297 if (mem_base != xmlMemBlocks()) {
37298 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
37299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037300 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037301 printf(" %d", n_code);
37302 printf("\n");
37303 }
37304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037305 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037306#endif
37307
Daniel Veillard42595322004-11-08 10:52:06 +000037308 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037309}
37310
37311
37312static int
37313test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037314 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037315
William M. Brack21e4ef22005-01-02 09:53:13 +000037316#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037317 int mem_base;
37318 int ret_val;
37319 int code; /* UCS code point */
37320 int n_code;
37321
37322 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37323 mem_base = xmlMemBlocks();
37324 code = gen_int(n_code, 0);
37325
37326 ret_val = xmlUCSIsCombiningHalfMarks(code);
37327 desret_int(ret_val);
37328 call_tests++;
37329 des_int(n_code, code, 0);
37330 xmlResetLastError();
37331 if (mem_base != xmlMemBlocks()) {
37332 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
37333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037334 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037335 printf(" %d", n_code);
37336 printf("\n");
37337 }
37338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037339 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037340#endif
37341
Daniel Veillard42595322004-11-08 10:52:06 +000037342 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037343}
37344
37345
37346static int
37347test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037348 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037349
William M. Brack21e4ef22005-01-02 09:53:13 +000037350#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037351 int mem_base;
37352 int ret_val;
37353 int code; /* UCS code point */
37354 int n_code;
37355
37356 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37357 mem_base = xmlMemBlocks();
37358 code = gen_int(n_code, 0);
37359
37360 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
37361 desret_int(ret_val);
37362 call_tests++;
37363 des_int(n_code, code, 0);
37364 xmlResetLastError();
37365 if (mem_base != xmlMemBlocks()) {
37366 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
37367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037368 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037369 printf(" %d", n_code);
37370 printf("\n");
37371 }
37372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037373 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037374#endif
37375
Daniel Veillard42595322004-11-08 10:52:06 +000037376 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037377}
37378
37379
37380static int
37381test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037382 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037383
William M. Brack21e4ef22005-01-02 09:53:13 +000037384#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037385 int mem_base;
37386 int ret_val;
37387 int code; /* UCS code point */
37388 int n_code;
37389
37390 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37391 mem_base = xmlMemBlocks();
37392 code = gen_int(n_code, 0);
37393
37394 ret_val = xmlUCSIsControlPictures(code);
37395 desret_int(ret_val);
37396 call_tests++;
37397 des_int(n_code, code, 0);
37398 xmlResetLastError();
37399 if (mem_base != xmlMemBlocks()) {
37400 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
37401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037402 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037403 printf(" %d", n_code);
37404 printf("\n");
37405 }
37406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037407 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037408#endif
37409
Daniel Veillard42595322004-11-08 10:52:06 +000037410 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037411}
37412
37413
37414static int
37415test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037416 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037417
William M. Brack21e4ef22005-01-02 09:53:13 +000037418#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037419 int mem_base;
37420 int ret_val;
37421 int code; /* UCS code point */
37422 int n_code;
37423
37424 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37425 mem_base = xmlMemBlocks();
37426 code = gen_int(n_code, 0);
37427
37428 ret_val = xmlUCSIsCurrencySymbols(code);
37429 desret_int(ret_val);
37430 call_tests++;
37431 des_int(n_code, code, 0);
37432 xmlResetLastError();
37433 if (mem_base != xmlMemBlocks()) {
37434 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
37435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037436 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037437 printf(" %d", n_code);
37438 printf("\n");
37439 }
37440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037441 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037442#endif
37443
Daniel Veillard42595322004-11-08 10:52:06 +000037444 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037445}
37446
37447
37448static int
37449test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037450 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037451
William M. Brack21e4ef22005-01-02 09:53:13 +000037452#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037453 int mem_base;
37454 int ret_val;
37455 int code; /* UCS code point */
37456 int n_code;
37457
37458 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37459 mem_base = xmlMemBlocks();
37460 code = gen_int(n_code, 0);
37461
37462 ret_val = xmlUCSIsCypriotSyllabary(code);
37463 desret_int(ret_val);
37464 call_tests++;
37465 des_int(n_code, code, 0);
37466 xmlResetLastError();
37467 if (mem_base != xmlMemBlocks()) {
37468 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
37469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037470 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037471 printf(" %d", n_code);
37472 printf("\n");
37473 }
37474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037475 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037476#endif
37477
Daniel Veillard42595322004-11-08 10:52:06 +000037478 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037479}
37480
37481
37482static int
37483test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037484 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037485
William M. Brack21e4ef22005-01-02 09:53:13 +000037486#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037487 int mem_base;
37488 int ret_val;
37489 int code; /* UCS code point */
37490 int n_code;
37491
37492 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37493 mem_base = xmlMemBlocks();
37494 code = gen_int(n_code, 0);
37495
37496 ret_val = xmlUCSIsCyrillic(code);
37497 desret_int(ret_val);
37498 call_tests++;
37499 des_int(n_code, code, 0);
37500 xmlResetLastError();
37501 if (mem_base != xmlMemBlocks()) {
37502 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
37503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037504 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037505 printf(" %d", n_code);
37506 printf("\n");
37507 }
37508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037509 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037510#endif
37511
Daniel Veillard42595322004-11-08 10:52:06 +000037512 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037513}
37514
37515
37516static int
37517test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037518 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037519
William M. Brack21e4ef22005-01-02 09:53:13 +000037520#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037521 int mem_base;
37522 int ret_val;
37523 int code; /* UCS code point */
37524 int n_code;
37525
37526 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37527 mem_base = xmlMemBlocks();
37528 code = gen_int(n_code, 0);
37529
37530 ret_val = xmlUCSIsCyrillicSupplement(code);
37531 desret_int(ret_val);
37532 call_tests++;
37533 des_int(n_code, code, 0);
37534 xmlResetLastError();
37535 if (mem_base != xmlMemBlocks()) {
37536 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
37537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037538 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037539 printf(" %d", n_code);
37540 printf("\n");
37541 }
37542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037543 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037544#endif
37545
Daniel Veillard42595322004-11-08 10:52:06 +000037546 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037547}
37548
37549
37550static int
37551test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037552 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037553
William M. Brack21e4ef22005-01-02 09:53:13 +000037554#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037555 int mem_base;
37556 int ret_val;
37557 int code; /* UCS code point */
37558 int n_code;
37559
37560 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37561 mem_base = xmlMemBlocks();
37562 code = gen_int(n_code, 0);
37563
37564 ret_val = xmlUCSIsDeseret(code);
37565 desret_int(ret_val);
37566 call_tests++;
37567 des_int(n_code, code, 0);
37568 xmlResetLastError();
37569 if (mem_base != xmlMemBlocks()) {
37570 printf("Leak of %d blocks found in xmlUCSIsDeseret",
37571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037572 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037573 printf(" %d", n_code);
37574 printf("\n");
37575 }
37576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037577 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037578#endif
37579
Daniel Veillard42595322004-11-08 10:52:06 +000037580 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037581}
37582
37583
37584static int
37585test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037586 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037587
William M. Brack21e4ef22005-01-02 09:53:13 +000037588#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037589 int mem_base;
37590 int ret_val;
37591 int code; /* UCS code point */
37592 int n_code;
37593
37594 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37595 mem_base = xmlMemBlocks();
37596 code = gen_int(n_code, 0);
37597
37598 ret_val = xmlUCSIsDevanagari(code);
37599 desret_int(ret_val);
37600 call_tests++;
37601 des_int(n_code, code, 0);
37602 xmlResetLastError();
37603 if (mem_base != xmlMemBlocks()) {
37604 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
37605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037606 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037607 printf(" %d", n_code);
37608 printf("\n");
37609 }
37610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037611 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037612#endif
37613
Daniel Veillard42595322004-11-08 10:52:06 +000037614 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037615}
37616
37617
37618static int
37619test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037620 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037621
William M. Brack21e4ef22005-01-02 09:53:13 +000037622#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037623 int mem_base;
37624 int ret_val;
37625 int code; /* UCS code point */
37626 int n_code;
37627
37628 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37629 mem_base = xmlMemBlocks();
37630 code = gen_int(n_code, 0);
37631
37632 ret_val = xmlUCSIsDingbats(code);
37633 desret_int(ret_val);
37634 call_tests++;
37635 des_int(n_code, code, 0);
37636 xmlResetLastError();
37637 if (mem_base != xmlMemBlocks()) {
37638 printf("Leak of %d blocks found in xmlUCSIsDingbats",
37639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037640 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037641 printf(" %d", n_code);
37642 printf("\n");
37643 }
37644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037645 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037646#endif
37647
Daniel Veillard42595322004-11-08 10:52:06 +000037648 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037649}
37650
37651
37652static int
37653test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037654 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037655
William M. Brack21e4ef22005-01-02 09:53:13 +000037656#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037657 int mem_base;
37658 int ret_val;
37659 int code; /* UCS code point */
37660 int n_code;
37661
37662 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37663 mem_base = xmlMemBlocks();
37664 code = gen_int(n_code, 0);
37665
37666 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
37667 desret_int(ret_val);
37668 call_tests++;
37669 des_int(n_code, code, 0);
37670 xmlResetLastError();
37671 if (mem_base != xmlMemBlocks()) {
37672 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
37673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037674 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037675 printf(" %d", n_code);
37676 printf("\n");
37677 }
37678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037679 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037680#endif
37681
Daniel Veillard42595322004-11-08 10:52:06 +000037682 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037683}
37684
37685
37686static int
37687test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037688 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037689
William M. Brack21e4ef22005-01-02 09:53:13 +000037690#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037691 int mem_base;
37692 int ret_val;
37693 int code; /* UCS code point */
37694 int n_code;
37695
37696 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37697 mem_base = xmlMemBlocks();
37698 code = gen_int(n_code, 0);
37699
37700 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
37701 desret_int(ret_val);
37702 call_tests++;
37703 des_int(n_code, code, 0);
37704 xmlResetLastError();
37705 if (mem_base != xmlMemBlocks()) {
37706 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
37707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037708 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037709 printf(" %d", n_code);
37710 printf("\n");
37711 }
37712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037713 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037714#endif
37715
Daniel Veillard42595322004-11-08 10:52:06 +000037716 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037717}
37718
37719
37720static int
37721test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037722 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037723
William M. Brack21e4ef22005-01-02 09:53:13 +000037724#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037725 int mem_base;
37726 int ret_val;
37727 int code; /* UCS code point */
37728 int n_code;
37729
37730 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37731 mem_base = xmlMemBlocks();
37732 code = gen_int(n_code, 0);
37733
37734 ret_val = xmlUCSIsEthiopic(code);
37735 desret_int(ret_val);
37736 call_tests++;
37737 des_int(n_code, code, 0);
37738 xmlResetLastError();
37739 if (mem_base != xmlMemBlocks()) {
37740 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037742 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037743 printf(" %d", n_code);
37744 printf("\n");
37745 }
37746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037747 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037748#endif
37749
Daniel Veillard42595322004-11-08 10:52:06 +000037750 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037751}
37752
37753
37754static int
37755test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037756 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037757
William M. Brack21e4ef22005-01-02 09:53:13 +000037758#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037759 int mem_base;
37760 int ret_val;
37761 int code; /* UCS code point */
37762 int n_code;
37763
37764 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37765 mem_base = xmlMemBlocks();
37766 code = gen_int(n_code, 0);
37767
37768 ret_val = xmlUCSIsGeneralPunctuation(code);
37769 desret_int(ret_val);
37770 call_tests++;
37771 des_int(n_code, code, 0);
37772 xmlResetLastError();
37773 if (mem_base != xmlMemBlocks()) {
37774 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037776 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037777 printf(" %d", n_code);
37778 printf("\n");
37779 }
37780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037781 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037782#endif
37783
Daniel Veillard42595322004-11-08 10:52:06 +000037784 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037785}
37786
37787
37788static int
37789test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037790 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037791
William M. Brack21e4ef22005-01-02 09:53:13 +000037792#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037793 int mem_base;
37794 int ret_val;
37795 int code; /* UCS code point */
37796 int n_code;
37797
37798 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37799 mem_base = xmlMemBlocks();
37800 code = gen_int(n_code, 0);
37801
37802 ret_val = xmlUCSIsGeometricShapes(code);
37803 desret_int(ret_val);
37804 call_tests++;
37805 des_int(n_code, code, 0);
37806 xmlResetLastError();
37807 if (mem_base != xmlMemBlocks()) {
37808 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037810 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037811 printf(" %d", n_code);
37812 printf("\n");
37813 }
37814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037815 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037816#endif
37817
Daniel Veillard42595322004-11-08 10:52:06 +000037818 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037819}
37820
37821
37822static int
37823test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037824 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037825
William M. Brack21e4ef22005-01-02 09:53:13 +000037826#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037827 int mem_base;
37828 int ret_val;
37829 int code; /* UCS code point */
37830 int n_code;
37831
37832 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37833 mem_base = xmlMemBlocks();
37834 code = gen_int(n_code, 0);
37835
37836 ret_val = xmlUCSIsGeorgian(code);
37837 desret_int(ret_val);
37838 call_tests++;
37839 des_int(n_code, code, 0);
37840 xmlResetLastError();
37841 if (mem_base != xmlMemBlocks()) {
37842 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037844 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037845 printf(" %d", n_code);
37846 printf("\n");
37847 }
37848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037849 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037850#endif
37851
Daniel Veillard42595322004-11-08 10:52:06 +000037852 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037853}
37854
37855
37856static int
37857test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037858 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037859
William M. Brack21e4ef22005-01-02 09:53:13 +000037860#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037861 int mem_base;
37862 int ret_val;
37863 int code; /* UCS code point */
37864 int n_code;
37865
37866 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37867 mem_base = xmlMemBlocks();
37868 code = gen_int(n_code, 0);
37869
37870 ret_val = xmlUCSIsGothic(code);
37871 desret_int(ret_val);
37872 call_tests++;
37873 des_int(n_code, code, 0);
37874 xmlResetLastError();
37875 if (mem_base != xmlMemBlocks()) {
37876 printf("Leak of %d blocks found in xmlUCSIsGothic",
37877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037878 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037879 printf(" %d", n_code);
37880 printf("\n");
37881 }
37882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037883 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037884#endif
37885
Daniel Veillard42595322004-11-08 10:52:06 +000037886 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037887}
37888
37889
37890static int
37891test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037892 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037893
William M. Brack21e4ef22005-01-02 09:53:13 +000037894#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037895 int mem_base;
37896 int ret_val;
37897 int code; /* UCS code point */
37898 int n_code;
37899
37900 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37901 mem_base = xmlMemBlocks();
37902 code = gen_int(n_code, 0);
37903
37904 ret_val = xmlUCSIsGreek(code);
37905 desret_int(ret_val);
37906 call_tests++;
37907 des_int(n_code, code, 0);
37908 xmlResetLastError();
37909 if (mem_base != xmlMemBlocks()) {
37910 printf("Leak of %d blocks found in xmlUCSIsGreek",
37911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037912 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037913 printf(" %d", n_code);
37914 printf("\n");
37915 }
37916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037917 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037918#endif
37919
Daniel Veillard42595322004-11-08 10:52:06 +000037920 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037921}
37922
37923
37924static int
37925test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037926 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037927
William M. Brack21e4ef22005-01-02 09:53:13 +000037928#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037929 int mem_base;
37930 int ret_val;
37931 int code; /* UCS code point */
37932 int n_code;
37933
37934 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37935 mem_base = xmlMemBlocks();
37936 code = gen_int(n_code, 0);
37937
37938 ret_val = xmlUCSIsGreekExtended(code);
37939 desret_int(ret_val);
37940 call_tests++;
37941 des_int(n_code, code, 0);
37942 xmlResetLastError();
37943 if (mem_base != xmlMemBlocks()) {
37944 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037946 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037947 printf(" %d", n_code);
37948 printf("\n");
37949 }
37950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037951 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037952#endif
37953
Daniel Veillard42595322004-11-08 10:52:06 +000037954 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037955}
37956
37957
37958static int
37959test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037960 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037961
William M. Brack21e4ef22005-01-02 09:53:13 +000037962#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037963 int mem_base;
37964 int ret_val;
37965 int code; /* UCS code point */
37966 int n_code;
37967
37968 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37969 mem_base = xmlMemBlocks();
37970 code = gen_int(n_code, 0);
37971
37972 ret_val = xmlUCSIsGreekandCoptic(code);
37973 desret_int(ret_val);
37974 call_tests++;
37975 des_int(n_code, code, 0);
37976 xmlResetLastError();
37977 if (mem_base != xmlMemBlocks()) {
37978 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037980 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037981 printf(" %d", n_code);
37982 printf("\n");
37983 }
37984 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037985 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037986#endif
37987
Daniel Veillard42595322004-11-08 10:52:06 +000037988 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037989}
37990
37991
37992static int
37993test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037994 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037995
William M. Brack21e4ef22005-01-02 09:53:13 +000037996#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037997 int mem_base;
37998 int ret_val;
37999 int code; /* UCS code point */
38000 int n_code;
38001
38002 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38003 mem_base = xmlMemBlocks();
38004 code = gen_int(n_code, 0);
38005
38006 ret_val = xmlUCSIsGujarati(code);
38007 desret_int(ret_val);
38008 call_tests++;
38009 des_int(n_code, code, 0);
38010 xmlResetLastError();
38011 if (mem_base != xmlMemBlocks()) {
38012 printf("Leak of %d blocks found in xmlUCSIsGujarati",
38013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038014 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038015 printf(" %d", n_code);
38016 printf("\n");
38017 }
38018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038019 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038020#endif
38021
Daniel Veillard42595322004-11-08 10:52:06 +000038022 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038023}
38024
38025
38026static int
38027test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038028 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038029
William M. Brack21e4ef22005-01-02 09:53:13 +000038030#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038031 int mem_base;
38032 int ret_val;
38033 int code; /* UCS code point */
38034 int n_code;
38035
38036 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38037 mem_base = xmlMemBlocks();
38038 code = gen_int(n_code, 0);
38039
38040 ret_val = xmlUCSIsGurmukhi(code);
38041 desret_int(ret_val);
38042 call_tests++;
38043 des_int(n_code, code, 0);
38044 xmlResetLastError();
38045 if (mem_base != xmlMemBlocks()) {
38046 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
38047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038048 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038049 printf(" %d", n_code);
38050 printf("\n");
38051 }
38052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038053 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038054#endif
38055
Daniel Veillard42595322004-11-08 10:52:06 +000038056 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038057}
38058
38059
38060static int
38061test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038062 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038063
William M. Brack21e4ef22005-01-02 09:53:13 +000038064#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038065 int mem_base;
38066 int ret_val;
38067 int code; /* UCS code point */
38068 int n_code;
38069
38070 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38071 mem_base = xmlMemBlocks();
38072 code = gen_int(n_code, 0);
38073
38074 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
38075 desret_int(ret_val);
38076 call_tests++;
38077 des_int(n_code, code, 0);
38078 xmlResetLastError();
38079 if (mem_base != xmlMemBlocks()) {
38080 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
38081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038082 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038083 printf(" %d", n_code);
38084 printf("\n");
38085 }
38086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038087 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038088#endif
38089
Daniel Veillard42595322004-11-08 10:52:06 +000038090 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038091}
38092
38093
38094static int
38095test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038096 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038097
William M. Brack21e4ef22005-01-02 09:53:13 +000038098#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038099 int mem_base;
38100 int ret_val;
38101 int code; /* UCS code point */
38102 int n_code;
38103
38104 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38105 mem_base = xmlMemBlocks();
38106 code = gen_int(n_code, 0);
38107
38108 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
38109 desret_int(ret_val);
38110 call_tests++;
38111 des_int(n_code, code, 0);
38112 xmlResetLastError();
38113 if (mem_base != xmlMemBlocks()) {
38114 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
38115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038116 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038117 printf(" %d", n_code);
38118 printf("\n");
38119 }
38120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038121 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038122#endif
38123
Daniel Veillard42595322004-11-08 10:52:06 +000038124 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038125}
38126
38127
38128static int
38129test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038130 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038131
William M. Brack21e4ef22005-01-02 09:53:13 +000038132#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038133 int mem_base;
38134 int ret_val;
38135 int code; /* UCS code point */
38136 int n_code;
38137
38138 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38139 mem_base = xmlMemBlocks();
38140 code = gen_int(n_code, 0);
38141
38142 ret_val = xmlUCSIsHangulJamo(code);
38143 desret_int(ret_val);
38144 call_tests++;
38145 des_int(n_code, code, 0);
38146 xmlResetLastError();
38147 if (mem_base != xmlMemBlocks()) {
38148 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
38149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038150 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038151 printf(" %d", n_code);
38152 printf("\n");
38153 }
38154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038155 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038156#endif
38157
Daniel Veillard42595322004-11-08 10:52:06 +000038158 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038159}
38160
38161
38162static int
38163test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038164 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038165
William M. Brack21e4ef22005-01-02 09:53:13 +000038166#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038167 int mem_base;
38168 int ret_val;
38169 int code; /* UCS code point */
38170 int n_code;
38171
38172 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38173 mem_base = xmlMemBlocks();
38174 code = gen_int(n_code, 0);
38175
38176 ret_val = xmlUCSIsHangulSyllables(code);
38177 desret_int(ret_val);
38178 call_tests++;
38179 des_int(n_code, code, 0);
38180 xmlResetLastError();
38181 if (mem_base != xmlMemBlocks()) {
38182 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
38183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038184 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038185 printf(" %d", n_code);
38186 printf("\n");
38187 }
38188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038189 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038190#endif
38191
Daniel Veillard42595322004-11-08 10:52:06 +000038192 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038193}
38194
38195
38196static int
38197test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038198 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038199
William M. Brack21e4ef22005-01-02 09:53:13 +000038200#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038201 int mem_base;
38202 int ret_val;
38203 int code; /* UCS code point */
38204 int n_code;
38205
38206 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38207 mem_base = xmlMemBlocks();
38208 code = gen_int(n_code, 0);
38209
38210 ret_val = xmlUCSIsHanunoo(code);
38211 desret_int(ret_val);
38212 call_tests++;
38213 des_int(n_code, code, 0);
38214 xmlResetLastError();
38215 if (mem_base != xmlMemBlocks()) {
38216 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
38217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038218 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038219 printf(" %d", n_code);
38220 printf("\n");
38221 }
38222 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038223 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038224#endif
38225
Daniel Veillard42595322004-11-08 10:52:06 +000038226 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038227}
38228
38229
38230static int
38231test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038232 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038233
William M. Brack21e4ef22005-01-02 09:53:13 +000038234#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038235 int mem_base;
38236 int ret_val;
38237 int code; /* UCS code point */
38238 int n_code;
38239
38240 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38241 mem_base = xmlMemBlocks();
38242 code = gen_int(n_code, 0);
38243
38244 ret_val = xmlUCSIsHebrew(code);
38245 desret_int(ret_val);
38246 call_tests++;
38247 des_int(n_code, code, 0);
38248 xmlResetLastError();
38249 if (mem_base != xmlMemBlocks()) {
38250 printf("Leak of %d blocks found in xmlUCSIsHebrew",
38251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038252 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038253 printf(" %d", n_code);
38254 printf("\n");
38255 }
38256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038257 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038258#endif
38259
Daniel Veillard42595322004-11-08 10:52:06 +000038260 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038261}
38262
38263
38264static int
38265test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038266 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038267
William M. Brack21e4ef22005-01-02 09:53:13 +000038268#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038269 int mem_base;
38270 int ret_val;
38271 int code; /* UCS code point */
38272 int n_code;
38273
38274 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38275 mem_base = xmlMemBlocks();
38276 code = gen_int(n_code, 0);
38277
38278 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
38279 desret_int(ret_val);
38280 call_tests++;
38281 des_int(n_code, code, 0);
38282 xmlResetLastError();
38283 if (mem_base != xmlMemBlocks()) {
38284 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
38285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038286 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038287 printf(" %d", n_code);
38288 printf("\n");
38289 }
38290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038291 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038292#endif
38293
Daniel Veillard42595322004-11-08 10:52:06 +000038294 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038295}
38296
38297
38298static int
38299test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038300 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038301
William M. Brack21e4ef22005-01-02 09:53:13 +000038302#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038303 int mem_base;
38304 int ret_val;
38305 int code; /* UCS code point */
38306 int n_code;
38307
38308 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38309 mem_base = xmlMemBlocks();
38310 code = gen_int(n_code, 0);
38311
38312 ret_val = xmlUCSIsHighSurrogates(code);
38313 desret_int(ret_val);
38314 call_tests++;
38315 des_int(n_code, code, 0);
38316 xmlResetLastError();
38317 if (mem_base != xmlMemBlocks()) {
38318 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
38319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038320 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038321 printf(" %d", n_code);
38322 printf("\n");
38323 }
38324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038325 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038326#endif
38327
Daniel Veillard42595322004-11-08 10:52:06 +000038328 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038329}
38330
38331
38332static int
38333test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038334 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038335
William M. Brack21e4ef22005-01-02 09:53:13 +000038336#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038337 int mem_base;
38338 int ret_val;
38339 int code; /* UCS code point */
38340 int n_code;
38341
38342 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38343 mem_base = xmlMemBlocks();
38344 code = gen_int(n_code, 0);
38345
38346 ret_val = xmlUCSIsHiragana(code);
38347 desret_int(ret_val);
38348 call_tests++;
38349 des_int(n_code, code, 0);
38350 xmlResetLastError();
38351 if (mem_base != xmlMemBlocks()) {
38352 printf("Leak of %d blocks found in xmlUCSIsHiragana",
38353 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038354 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038355 printf(" %d", n_code);
38356 printf("\n");
38357 }
38358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038359 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038360#endif
38361
Daniel Veillard42595322004-11-08 10:52:06 +000038362 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038363}
38364
38365
38366static int
38367test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038368 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038369
William M. Brack21e4ef22005-01-02 09:53:13 +000038370#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038371 int mem_base;
38372 int ret_val;
38373 int code; /* UCS code point */
38374 int n_code;
38375
38376 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38377 mem_base = xmlMemBlocks();
38378 code = gen_int(n_code, 0);
38379
38380 ret_val = xmlUCSIsIPAExtensions(code);
38381 desret_int(ret_val);
38382 call_tests++;
38383 des_int(n_code, code, 0);
38384 xmlResetLastError();
38385 if (mem_base != xmlMemBlocks()) {
38386 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
38387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038388 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038389 printf(" %d", n_code);
38390 printf("\n");
38391 }
38392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038393 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038394#endif
38395
Daniel Veillard42595322004-11-08 10:52:06 +000038396 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038397}
38398
38399
38400static int
38401test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038402 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038403
William M. Brack21e4ef22005-01-02 09:53:13 +000038404#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038405 int mem_base;
38406 int ret_val;
38407 int code; /* UCS code point */
38408 int n_code;
38409
38410 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38411 mem_base = xmlMemBlocks();
38412 code = gen_int(n_code, 0);
38413
38414 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
38415 desret_int(ret_val);
38416 call_tests++;
38417 des_int(n_code, code, 0);
38418 xmlResetLastError();
38419 if (mem_base != xmlMemBlocks()) {
38420 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
38421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038422 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038423 printf(" %d", n_code);
38424 printf("\n");
38425 }
38426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038427 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038428#endif
38429
Daniel Veillard42595322004-11-08 10:52:06 +000038430 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038431}
38432
38433
38434static int
38435test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038436 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038437
William M. Brack21e4ef22005-01-02 09:53:13 +000038438#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038439 int mem_base;
38440 int ret_val;
38441 int code; /* UCS code point */
38442 int n_code;
38443
38444 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38445 mem_base = xmlMemBlocks();
38446 code = gen_int(n_code, 0);
38447
38448 ret_val = xmlUCSIsKanbun(code);
38449 desret_int(ret_val);
38450 call_tests++;
38451 des_int(n_code, code, 0);
38452 xmlResetLastError();
38453 if (mem_base != xmlMemBlocks()) {
38454 printf("Leak of %d blocks found in xmlUCSIsKanbun",
38455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038456 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038457 printf(" %d", n_code);
38458 printf("\n");
38459 }
38460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038461 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038462#endif
38463
Daniel Veillard42595322004-11-08 10:52:06 +000038464 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038465}
38466
38467
38468static int
38469test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038470 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038471
William M. Brack21e4ef22005-01-02 09:53:13 +000038472#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038473 int mem_base;
38474 int ret_val;
38475 int code; /* UCS code point */
38476 int n_code;
38477
38478 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38479 mem_base = xmlMemBlocks();
38480 code = gen_int(n_code, 0);
38481
38482 ret_val = xmlUCSIsKangxiRadicals(code);
38483 desret_int(ret_val);
38484 call_tests++;
38485 des_int(n_code, code, 0);
38486 xmlResetLastError();
38487 if (mem_base != xmlMemBlocks()) {
38488 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
38489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038490 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038491 printf(" %d", n_code);
38492 printf("\n");
38493 }
38494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038495 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038496#endif
38497
Daniel Veillard42595322004-11-08 10:52:06 +000038498 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038499}
38500
38501
38502static int
38503test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038504 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038505
William M. Brack21e4ef22005-01-02 09:53:13 +000038506#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038507 int mem_base;
38508 int ret_val;
38509 int code; /* UCS code point */
38510 int n_code;
38511
38512 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38513 mem_base = xmlMemBlocks();
38514 code = gen_int(n_code, 0);
38515
38516 ret_val = xmlUCSIsKannada(code);
38517 desret_int(ret_val);
38518 call_tests++;
38519 des_int(n_code, code, 0);
38520 xmlResetLastError();
38521 if (mem_base != xmlMemBlocks()) {
38522 printf("Leak of %d blocks found in xmlUCSIsKannada",
38523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038524 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038525 printf(" %d", n_code);
38526 printf("\n");
38527 }
38528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038529 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038530#endif
38531
Daniel Veillard42595322004-11-08 10:52:06 +000038532 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038533}
38534
38535
38536static int
38537test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038538 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038539
William M. Brack21e4ef22005-01-02 09:53:13 +000038540#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038541 int mem_base;
38542 int ret_val;
38543 int code; /* UCS code point */
38544 int n_code;
38545
38546 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38547 mem_base = xmlMemBlocks();
38548 code = gen_int(n_code, 0);
38549
38550 ret_val = xmlUCSIsKatakana(code);
38551 desret_int(ret_val);
38552 call_tests++;
38553 des_int(n_code, code, 0);
38554 xmlResetLastError();
38555 if (mem_base != xmlMemBlocks()) {
38556 printf("Leak of %d blocks found in xmlUCSIsKatakana",
38557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038558 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038559 printf(" %d", n_code);
38560 printf("\n");
38561 }
38562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038563 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038564#endif
38565
Daniel Veillard42595322004-11-08 10:52:06 +000038566 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038567}
38568
38569
38570static int
38571test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038572 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038573
William M. Brack21e4ef22005-01-02 09:53:13 +000038574#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038575 int mem_base;
38576 int ret_val;
38577 int code; /* UCS code point */
38578 int n_code;
38579
38580 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38581 mem_base = xmlMemBlocks();
38582 code = gen_int(n_code, 0);
38583
38584 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
38585 desret_int(ret_val);
38586 call_tests++;
38587 des_int(n_code, code, 0);
38588 xmlResetLastError();
38589 if (mem_base != xmlMemBlocks()) {
38590 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
38591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038592 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038593 printf(" %d", n_code);
38594 printf("\n");
38595 }
38596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038597 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038598#endif
38599
Daniel Veillard42595322004-11-08 10:52:06 +000038600 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038601}
38602
38603
38604static int
38605test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038606 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038607
William M. Brack21e4ef22005-01-02 09:53:13 +000038608#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038609 int mem_base;
38610 int ret_val;
38611 int code; /* UCS code point */
38612 int n_code;
38613
38614 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38615 mem_base = xmlMemBlocks();
38616 code = gen_int(n_code, 0);
38617
38618 ret_val = xmlUCSIsKhmer(code);
38619 desret_int(ret_val);
38620 call_tests++;
38621 des_int(n_code, code, 0);
38622 xmlResetLastError();
38623 if (mem_base != xmlMemBlocks()) {
38624 printf("Leak of %d blocks found in xmlUCSIsKhmer",
38625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038626 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038627 printf(" %d", n_code);
38628 printf("\n");
38629 }
38630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038631 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038632#endif
38633
Daniel Veillard42595322004-11-08 10:52:06 +000038634 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038635}
38636
38637
38638static int
38639test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038640 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038641
William M. Brack21e4ef22005-01-02 09:53:13 +000038642#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038643 int mem_base;
38644 int ret_val;
38645 int code; /* UCS code point */
38646 int n_code;
38647
38648 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38649 mem_base = xmlMemBlocks();
38650 code = gen_int(n_code, 0);
38651
38652 ret_val = xmlUCSIsKhmerSymbols(code);
38653 desret_int(ret_val);
38654 call_tests++;
38655 des_int(n_code, code, 0);
38656 xmlResetLastError();
38657 if (mem_base != xmlMemBlocks()) {
38658 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
38659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038660 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038661 printf(" %d", n_code);
38662 printf("\n");
38663 }
38664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038665 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038666#endif
38667
Daniel Veillard42595322004-11-08 10:52:06 +000038668 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038669}
38670
38671
38672static int
38673test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038674 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038675
William M. Brack21e4ef22005-01-02 09:53:13 +000038676#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038677 int mem_base;
38678 int ret_val;
38679 int code; /* UCS code point */
38680 int n_code;
38681
38682 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38683 mem_base = xmlMemBlocks();
38684 code = gen_int(n_code, 0);
38685
38686 ret_val = xmlUCSIsLao(code);
38687 desret_int(ret_val);
38688 call_tests++;
38689 des_int(n_code, code, 0);
38690 xmlResetLastError();
38691 if (mem_base != xmlMemBlocks()) {
38692 printf("Leak of %d blocks found in xmlUCSIsLao",
38693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038694 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038695 printf(" %d", n_code);
38696 printf("\n");
38697 }
38698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038699 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038700#endif
38701
Daniel Veillard42595322004-11-08 10:52:06 +000038702 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038703}
38704
38705
38706static int
38707test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038708 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038709
William M. Brack21e4ef22005-01-02 09:53:13 +000038710#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038711 int mem_base;
38712 int ret_val;
38713 int code; /* UCS code point */
38714 int n_code;
38715
38716 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38717 mem_base = xmlMemBlocks();
38718 code = gen_int(n_code, 0);
38719
38720 ret_val = xmlUCSIsLatin1Supplement(code);
38721 desret_int(ret_val);
38722 call_tests++;
38723 des_int(n_code, code, 0);
38724 xmlResetLastError();
38725 if (mem_base != xmlMemBlocks()) {
38726 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038728 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038729 printf(" %d", n_code);
38730 printf("\n");
38731 }
38732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038733 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038734#endif
38735
Daniel Veillard42595322004-11-08 10:52:06 +000038736 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038737}
38738
38739
38740static int
38741test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038742 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038743
William M. Brack21e4ef22005-01-02 09:53:13 +000038744#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038745 int mem_base;
38746 int ret_val;
38747 int code; /* UCS code point */
38748 int n_code;
38749
38750 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38751 mem_base = xmlMemBlocks();
38752 code = gen_int(n_code, 0);
38753
38754 ret_val = xmlUCSIsLatinExtendedA(code);
38755 desret_int(ret_val);
38756 call_tests++;
38757 des_int(n_code, code, 0);
38758 xmlResetLastError();
38759 if (mem_base != xmlMemBlocks()) {
38760 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038762 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038763 printf(" %d", n_code);
38764 printf("\n");
38765 }
38766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038767 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038768#endif
38769
Daniel Veillard42595322004-11-08 10:52:06 +000038770 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038771}
38772
38773
38774static int
38775test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038776 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038777
William M. Brack21e4ef22005-01-02 09:53:13 +000038778#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038779 int mem_base;
38780 int ret_val;
38781 int code; /* UCS code point */
38782 int n_code;
38783
38784 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38785 mem_base = xmlMemBlocks();
38786 code = gen_int(n_code, 0);
38787
38788 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38789 desret_int(ret_val);
38790 call_tests++;
38791 des_int(n_code, code, 0);
38792 xmlResetLastError();
38793 if (mem_base != xmlMemBlocks()) {
38794 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038796 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038797 printf(" %d", n_code);
38798 printf("\n");
38799 }
38800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038801 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038802#endif
38803
Daniel Veillard42595322004-11-08 10:52:06 +000038804 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038805}
38806
38807
38808static int
38809test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038810 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038811
William M. Brack21e4ef22005-01-02 09:53:13 +000038812#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038813 int mem_base;
38814 int ret_val;
38815 int code; /* UCS code point */
38816 int n_code;
38817
38818 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38819 mem_base = xmlMemBlocks();
38820 code = gen_int(n_code, 0);
38821
38822 ret_val = xmlUCSIsLatinExtendedB(code);
38823 desret_int(ret_val);
38824 call_tests++;
38825 des_int(n_code, code, 0);
38826 xmlResetLastError();
38827 if (mem_base != xmlMemBlocks()) {
38828 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038830 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038831 printf(" %d", n_code);
38832 printf("\n");
38833 }
38834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038835 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038836#endif
38837
Daniel Veillard42595322004-11-08 10:52:06 +000038838 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038839}
38840
38841
38842static int
38843test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038844 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038845
William M. Brack21e4ef22005-01-02 09:53:13 +000038846#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038847 int mem_base;
38848 int ret_val;
38849 int code; /* UCS code point */
38850 int n_code;
38851
38852 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38853 mem_base = xmlMemBlocks();
38854 code = gen_int(n_code, 0);
38855
38856 ret_val = xmlUCSIsLetterlikeSymbols(code);
38857 desret_int(ret_val);
38858 call_tests++;
38859 des_int(n_code, code, 0);
38860 xmlResetLastError();
38861 if (mem_base != xmlMemBlocks()) {
38862 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038864 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038865 printf(" %d", n_code);
38866 printf("\n");
38867 }
38868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038869 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038870#endif
38871
Daniel Veillard42595322004-11-08 10:52:06 +000038872 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038873}
38874
38875
38876static int
38877test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038878 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038879
William M. Brack21e4ef22005-01-02 09:53:13 +000038880#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038881 int mem_base;
38882 int ret_val;
38883 int code; /* UCS code point */
38884 int n_code;
38885
38886 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38887 mem_base = xmlMemBlocks();
38888 code = gen_int(n_code, 0);
38889
38890 ret_val = xmlUCSIsLimbu(code);
38891 desret_int(ret_val);
38892 call_tests++;
38893 des_int(n_code, code, 0);
38894 xmlResetLastError();
38895 if (mem_base != xmlMemBlocks()) {
38896 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038898 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038899 printf(" %d", n_code);
38900 printf("\n");
38901 }
38902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038903 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038904#endif
38905
Daniel Veillard42595322004-11-08 10:52:06 +000038906 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038907}
38908
38909
38910static int
38911test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038912 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038913
William M. Brack21e4ef22005-01-02 09:53:13 +000038914#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038915 int mem_base;
38916 int ret_val;
38917 int code; /* UCS code point */
38918 int n_code;
38919
38920 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38921 mem_base = xmlMemBlocks();
38922 code = gen_int(n_code, 0);
38923
38924 ret_val = xmlUCSIsLinearBIdeograms(code);
38925 desret_int(ret_val);
38926 call_tests++;
38927 des_int(n_code, code, 0);
38928 xmlResetLastError();
38929 if (mem_base != xmlMemBlocks()) {
38930 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038932 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038933 printf(" %d", n_code);
38934 printf("\n");
38935 }
38936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038937 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038938#endif
38939
Daniel Veillard42595322004-11-08 10:52:06 +000038940 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038941}
38942
38943
38944static int
38945test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038946 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038947
William M. Brack21e4ef22005-01-02 09:53:13 +000038948#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038949 int mem_base;
38950 int ret_val;
38951 int code; /* UCS code point */
38952 int n_code;
38953
38954 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38955 mem_base = xmlMemBlocks();
38956 code = gen_int(n_code, 0);
38957
38958 ret_val = xmlUCSIsLinearBSyllabary(code);
38959 desret_int(ret_val);
38960 call_tests++;
38961 des_int(n_code, code, 0);
38962 xmlResetLastError();
38963 if (mem_base != xmlMemBlocks()) {
38964 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038966 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038967 printf(" %d", n_code);
38968 printf("\n");
38969 }
38970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038971 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038972#endif
38973
Daniel Veillard42595322004-11-08 10:52:06 +000038974 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038975}
38976
38977
38978static int
38979test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038980 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038981
William M. Brack21e4ef22005-01-02 09:53:13 +000038982#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038983 int mem_base;
38984 int ret_val;
38985 int code; /* UCS code point */
38986 int n_code;
38987
38988 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38989 mem_base = xmlMemBlocks();
38990 code = gen_int(n_code, 0);
38991
38992 ret_val = xmlUCSIsLowSurrogates(code);
38993 desret_int(ret_val);
38994 call_tests++;
38995 des_int(n_code, code, 0);
38996 xmlResetLastError();
38997 if (mem_base != xmlMemBlocks()) {
38998 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039000 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039001 printf(" %d", n_code);
39002 printf("\n");
39003 }
39004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039005 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039006#endif
39007
Daniel Veillard42595322004-11-08 10:52:06 +000039008 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039009}
39010
39011
39012static int
39013test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039014 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039015
William M. Brack21e4ef22005-01-02 09:53:13 +000039016#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039017 int mem_base;
39018 int ret_val;
39019 int code; /* UCS code point */
39020 int n_code;
39021
39022 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39023 mem_base = xmlMemBlocks();
39024 code = gen_int(n_code, 0);
39025
39026 ret_val = xmlUCSIsMalayalam(code);
39027 desret_int(ret_val);
39028 call_tests++;
39029 des_int(n_code, code, 0);
39030 xmlResetLastError();
39031 if (mem_base != xmlMemBlocks()) {
39032 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
39033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039034 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039035 printf(" %d", n_code);
39036 printf("\n");
39037 }
39038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039039 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039040#endif
39041
Daniel Veillard42595322004-11-08 10:52:06 +000039042 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039043}
39044
39045
39046static int
39047test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039048 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039049
William M. Brack21e4ef22005-01-02 09:53:13 +000039050#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039051 int mem_base;
39052 int ret_val;
39053 int code; /* UCS code point */
39054 int n_code;
39055
39056 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39057 mem_base = xmlMemBlocks();
39058 code = gen_int(n_code, 0);
39059
39060 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
39061 desret_int(ret_val);
39062 call_tests++;
39063 des_int(n_code, code, 0);
39064 xmlResetLastError();
39065 if (mem_base != xmlMemBlocks()) {
39066 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
39067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039068 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039069 printf(" %d", n_code);
39070 printf("\n");
39071 }
39072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039073 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039074#endif
39075
Daniel Veillard42595322004-11-08 10:52:06 +000039076 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039077}
39078
39079
39080static int
39081test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039082 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039083
William M. Brack21e4ef22005-01-02 09:53:13 +000039084#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039085 int mem_base;
39086 int ret_val;
39087 int code; /* UCS code point */
39088 int n_code;
39089
39090 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39091 mem_base = xmlMemBlocks();
39092 code = gen_int(n_code, 0);
39093
39094 ret_val = xmlUCSIsMathematicalOperators(code);
39095 desret_int(ret_val);
39096 call_tests++;
39097 des_int(n_code, code, 0);
39098 xmlResetLastError();
39099 if (mem_base != xmlMemBlocks()) {
39100 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
39101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039102 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039103 printf(" %d", n_code);
39104 printf("\n");
39105 }
39106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039107 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039108#endif
39109
Daniel Veillard42595322004-11-08 10:52:06 +000039110 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039111}
39112
39113
39114static int
39115test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039116 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039117
William M. Brack21e4ef22005-01-02 09:53:13 +000039118#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039119 int mem_base;
39120 int ret_val;
39121 int code; /* UCS code point */
39122 int n_code;
39123
39124 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39125 mem_base = xmlMemBlocks();
39126 code = gen_int(n_code, 0);
39127
39128 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
39129 desret_int(ret_val);
39130 call_tests++;
39131 des_int(n_code, code, 0);
39132 xmlResetLastError();
39133 if (mem_base != xmlMemBlocks()) {
39134 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
39135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039136 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039137 printf(" %d", n_code);
39138 printf("\n");
39139 }
39140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039141 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039142#endif
39143
Daniel Veillard42595322004-11-08 10:52:06 +000039144 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039145}
39146
39147
39148static int
39149test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039150 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039151
William M. Brack21e4ef22005-01-02 09:53:13 +000039152#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039153 int mem_base;
39154 int ret_val;
39155 int code; /* UCS code point */
39156 int n_code;
39157
39158 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39159 mem_base = xmlMemBlocks();
39160 code = gen_int(n_code, 0);
39161
39162 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
39163 desret_int(ret_val);
39164 call_tests++;
39165 des_int(n_code, code, 0);
39166 xmlResetLastError();
39167 if (mem_base != xmlMemBlocks()) {
39168 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
39169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039170 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039171 printf(" %d", n_code);
39172 printf("\n");
39173 }
39174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039175 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039176#endif
39177
Daniel Veillard42595322004-11-08 10:52:06 +000039178 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039179}
39180
39181
39182static int
39183test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039184 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039185
William M. Brack21e4ef22005-01-02 09:53:13 +000039186#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039187 int mem_base;
39188 int ret_val;
39189 int code; /* UCS code point */
39190 int n_code;
39191
39192 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39193 mem_base = xmlMemBlocks();
39194 code = gen_int(n_code, 0);
39195
39196 ret_val = xmlUCSIsMiscellaneousSymbols(code);
39197 desret_int(ret_val);
39198 call_tests++;
39199 des_int(n_code, code, 0);
39200 xmlResetLastError();
39201 if (mem_base != xmlMemBlocks()) {
39202 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
39203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039204 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039205 printf(" %d", n_code);
39206 printf("\n");
39207 }
39208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039209 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039210#endif
39211
Daniel Veillard42595322004-11-08 10:52:06 +000039212 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039213}
39214
39215
39216static int
39217test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039218 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039219
William M. Brack21e4ef22005-01-02 09:53:13 +000039220#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039221 int mem_base;
39222 int ret_val;
39223 int code; /* UCS code point */
39224 int n_code;
39225
39226 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39227 mem_base = xmlMemBlocks();
39228 code = gen_int(n_code, 0);
39229
39230 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
39231 desret_int(ret_val);
39232 call_tests++;
39233 des_int(n_code, code, 0);
39234 xmlResetLastError();
39235 if (mem_base != xmlMemBlocks()) {
39236 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
39237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039238 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039239 printf(" %d", n_code);
39240 printf("\n");
39241 }
39242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039243 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039244#endif
39245
Daniel Veillard42595322004-11-08 10:52:06 +000039246 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039247}
39248
39249
39250static int
39251test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039252 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039253
William M. Brack21e4ef22005-01-02 09:53:13 +000039254#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039255 int mem_base;
39256 int ret_val;
39257 int code; /* UCS code point */
39258 int n_code;
39259
39260 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39261 mem_base = xmlMemBlocks();
39262 code = gen_int(n_code, 0);
39263
39264 ret_val = xmlUCSIsMiscellaneousTechnical(code);
39265 desret_int(ret_val);
39266 call_tests++;
39267 des_int(n_code, code, 0);
39268 xmlResetLastError();
39269 if (mem_base != xmlMemBlocks()) {
39270 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
39271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039272 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039273 printf(" %d", n_code);
39274 printf("\n");
39275 }
39276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039277 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039278#endif
39279
Daniel Veillard42595322004-11-08 10:52:06 +000039280 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039281}
39282
39283
39284static int
39285test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039286 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039287
William M. Brack21e4ef22005-01-02 09:53:13 +000039288#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039289 int mem_base;
39290 int ret_val;
39291 int code; /* UCS code point */
39292 int n_code;
39293
39294 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39295 mem_base = xmlMemBlocks();
39296 code = gen_int(n_code, 0);
39297
39298 ret_val = xmlUCSIsMongolian(code);
39299 desret_int(ret_val);
39300 call_tests++;
39301 des_int(n_code, code, 0);
39302 xmlResetLastError();
39303 if (mem_base != xmlMemBlocks()) {
39304 printf("Leak of %d blocks found in xmlUCSIsMongolian",
39305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039306 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039307 printf(" %d", n_code);
39308 printf("\n");
39309 }
39310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039311 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039312#endif
39313
Daniel Veillard42595322004-11-08 10:52:06 +000039314 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039315}
39316
39317
39318static int
39319test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039320 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039321
William M. Brack21e4ef22005-01-02 09:53:13 +000039322#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039323 int mem_base;
39324 int ret_val;
39325 int code; /* UCS code point */
39326 int n_code;
39327
39328 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39329 mem_base = xmlMemBlocks();
39330 code = gen_int(n_code, 0);
39331
39332 ret_val = xmlUCSIsMusicalSymbols(code);
39333 desret_int(ret_val);
39334 call_tests++;
39335 des_int(n_code, code, 0);
39336 xmlResetLastError();
39337 if (mem_base != xmlMemBlocks()) {
39338 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
39339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039340 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039341 printf(" %d", n_code);
39342 printf("\n");
39343 }
39344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039345 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039346#endif
39347
Daniel Veillard42595322004-11-08 10:52:06 +000039348 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039349}
39350
39351
39352static int
39353test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039354 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039355
William M. Brack21e4ef22005-01-02 09:53:13 +000039356#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039357 int mem_base;
39358 int ret_val;
39359 int code; /* UCS code point */
39360 int n_code;
39361
39362 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39363 mem_base = xmlMemBlocks();
39364 code = gen_int(n_code, 0);
39365
39366 ret_val = xmlUCSIsMyanmar(code);
39367 desret_int(ret_val);
39368 call_tests++;
39369 des_int(n_code, code, 0);
39370 xmlResetLastError();
39371 if (mem_base != xmlMemBlocks()) {
39372 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
39373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039374 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039375 printf(" %d", n_code);
39376 printf("\n");
39377 }
39378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039379 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039380#endif
39381
Daniel Veillard42595322004-11-08 10:52:06 +000039382 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039383}
39384
39385
39386static int
39387test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039388 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039389
William M. Brack21e4ef22005-01-02 09:53:13 +000039390#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039391 int mem_base;
39392 int ret_val;
39393 int code; /* UCS code point */
39394 int n_code;
39395
39396 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39397 mem_base = xmlMemBlocks();
39398 code = gen_int(n_code, 0);
39399
39400 ret_val = xmlUCSIsNumberForms(code);
39401 desret_int(ret_val);
39402 call_tests++;
39403 des_int(n_code, code, 0);
39404 xmlResetLastError();
39405 if (mem_base != xmlMemBlocks()) {
39406 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
39407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039408 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039409 printf(" %d", n_code);
39410 printf("\n");
39411 }
39412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039413 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039414#endif
39415
Daniel Veillard42595322004-11-08 10:52:06 +000039416 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039417}
39418
39419
39420static int
39421test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039422 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039423
William M. Brack21e4ef22005-01-02 09:53:13 +000039424#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039425 int mem_base;
39426 int ret_val;
39427 int code; /* UCS code point */
39428 int n_code;
39429
39430 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39431 mem_base = xmlMemBlocks();
39432 code = gen_int(n_code, 0);
39433
39434 ret_val = xmlUCSIsOgham(code);
39435 desret_int(ret_val);
39436 call_tests++;
39437 des_int(n_code, code, 0);
39438 xmlResetLastError();
39439 if (mem_base != xmlMemBlocks()) {
39440 printf("Leak of %d blocks found in xmlUCSIsOgham",
39441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039442 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039443 printf(" %d", n_code);
39444 printf("\n");
39445 }
39446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039447 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039448#endif
39449
Daniel Veillard42595322004-11-08 10:52:06 +000039450 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039451}
39452
39453
39454static int
39455test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039456 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039457
William M. Brack21e4ef22005-01-02 09:53:13 +000039458#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039459 int mem_base;
39460 int ret_val;
39461 int code; /* UCS code point */
39462 int n_code;
39463
39464 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39465 mem_base = xmlMemBlocks();
39466 code = gen_int(n_code, 0);
39467
39468 ret_val = xmlUCSIsOldItalic(code);
39469 desret_int(ret_val);
39470 call_tests++;
39471 des_int(n_code, code, 0);
39472 xmlResetLastError();
39473 if (mem_base != xmlMemBlocks()) {
39474 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
39475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039476 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039477 printf(" %d", n_code);
39478 printf("\n");
39479 }
39480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039481 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039482#endif
39483
Daniel Veillard42595322004-11-08 10:52:06 +000039484 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039485}
39486
39487
39488static int
39489test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039490 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039491
William M. Brack21e4ef22005-01-02 09:53:13 +000039492#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039493 int mem_base;
39494 int ret_val;
39495 int code; /* UCS code point */
39496 int n_code;
39497
39498 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39499 mem_base = xmlMemBlocks();
39500 code = gen_int(n_code, 0);
39501
39502 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
39503 desret_int(ret_val);
39504 call_tests++;
39505 des_int(n_code, code, 0);
39506 xmlResetLastError();
39507 if (mem_base != xmlMemBlocks()) {
39508 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
39509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039510 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039511 printf(" %d", n_code);
39512 printf("\n");
39513 }
39514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039515 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039516#endif
39517
Daniel Veillard42595322004-11-08 10:52:06 +000039518 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039519}
39520
39521
39522static int
39523test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039524 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039525
William M. Brack21e4ef22005-01-02 09:53:13 +000039526#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039527 int mem_base;
39528 int ret_val;
39529 int code; /* UCS code point */
39530 int n_code;
39531
39532 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39533 mem_base = xmlMemBlocks();
39534 code = gen_int(n_code, 0);
39535
39536 ret_val = xmlUCSIsOriya(code);
39537 desret_int(ret_val);
39538 call_tests++;
39539 des_int(n_code, code, 0);
39540 xmlResetLastError();
39541 if (mem_base != xmlMemBlocks()) {
39542 printf("Leak of %d blocks found in xmlUCSIsOriya",
39543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039544 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039545 printf(" %d", n_code);
39546 printf("\n");
39547 }
39548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039549 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039550#endif
39551
Daniel Veillard42595322004-11-08 10:52:06 +000039552 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039553}
39554
39555
39556static int
39557test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039558 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039559
William M. Brack21e4ef22005-01-02 09:53:13 +000039560#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039561 int mem_base;
39562 int ret_val;
39563 int code; /* UCS code point */
39564 int n_code;
39565
39566 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39567 mem_base = xmlMemBlocks();
39568 code = gen_int(n_code, 0);
39569
39570 ret_val = xmlUCSIsOsmanya(code);
39571 desret_int(ret_val);
39572 call_tests++;
39573 des_int(n_code, code, 0);
39574 xmlResetLastError();
39575 if (mem_base != xmlMemBlocks()) {
39576 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
39577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039578 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039579 printf(" %d", n_code);
39580 printf("\n");
39581 }
39582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039583 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039584#endif
39585
Daniel Veillard42595322004-11-08 10:52:06 +000039586 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039587}
39588
39589
39590static int
39591test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039592 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039593
William M. Brack21e4ef22005-01-02 09:53:13 +000039594#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039595 int mem_base;
39596 int ret_val;
39597 int code; /* UCS code point */
39598 int n_code;
39599
39600 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39601 mem_base = xmlMemBlocks();
39602 code = gen_int(n_code, 0);
39603
39604 ret_val = xmlUCSIsPhoneticExtensions(code);
39605 desret_int(ret_val);
39606 call_tests++;
39607 des_int(n_code, code, 0);
39608 xmlResetLastError();
39609 if (mem_base != xmlMemBlocks()) {
39610 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
39611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039612 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039613 printf(" %d", n_code);
39614 printf("\n");
39615 }
39616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039617 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039618#endif
39619
Daniel Veillard42595322004-11-08 10:52:06 +000039620 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039621}
39622
39623
39624static int
39625test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039627
William M. Brack21e4ef22005-01-02 09:53:13 +000039628#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039629 int mem_base;
39630 int ret_val;
39631 int code; /* UCS code point */
39632 int n_code;
39633
39634 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39635 mem_base = xmlMemBlocks();
39636 code = gen_int(n_code, 0);
39637
39638 ret_val = xmlUCSIsPrivateUse(code);
39639 desret_int(ret_val);
39640 call_tests++;
39641 des_int(n_code, code, 0);
39642 xmlResetLastError();
39643 if (mem_base != xmlMemBlocks()) {
39644 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
39645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039646 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039647 printf(" %d", n_code);
39648 printf("\n");
39649 }
39650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039651 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039652#endif
39653
Daniel Veillard42595322004-11-08 10:52:06 +000039654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039655}
39656
39657
39658static int
39659test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039661
William M. Brack21e4ef22005-01-02 09:53:13 +000039662#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039663 int mem_base;
39664 int ret_val;
39665 int code; /* UCS code point */
39666 int n_code;
39667
39668 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39669 mem_base = xmlMemBlocks();
39670 code = gen_int(n_code, 0);
39671
39672 ret_val = xmlUCSIsPrivateUseArea(code);
39673 desret_int(ret_val);
39674 call_tests++;
39675 des_int(n_code, code, 0);
39676 xmlResetLastError();
39677 if (mem_base != xmlMemBlocks()) {
39678 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
39679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039680 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039681 printf(" %d", n_code);
39682 printf("\n");
39683 }
39684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039685 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039686#endif
39687
Daniel Veillard42595322004-11-08 10:52:06 +000039688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039689}
39690
39691
39692static int
39693test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039695
William M. Brack21e4ef22005-01-02 09:53:13 +000039696#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039697 int mem_base;
39698 int ret_val;
39699 int code; /* UCS code point */
39700 int n_code;
39701
39702 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39703 mem_base = xmlMemBlocks();
39704 code = gen_int(n_code, 0);
39705
39706 ret_val = xmlUCSIsRunic(code);
39707 desret_int(ret_val);
39708 call_tests++;
39709 des_int(n_code, code, 0);
39710 xmlResetLastError();
39711 if (mem_base != xmlMemBlocks()) {
39712 printf("Leak of %d blocks found in xmlUCSIsRunic",
39713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039714 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039715 printf(" %d", n_code);
39716 printf("\n");
39717 }
39718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039719 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039720#endif
39721
Daniel Veillard42595322004-11-08 10:52:06 +000039722 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039723}
39724
39725
39726static int
39727test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039728 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039729
William M. Brack21e4ef22005-01-02 09:53:13 +000039730#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039731 int mem_base;
39732 int ret_val;
39733 int code; /* UCS code point */
39734 int n_code;
39735
39736 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39737 mem_base = xmlMemBlocks();
39738 code = gen_int(n_code, 0);
39739
39740 ret_val = xmlUCSIsShavian(code);
39741 desret_int(ret_val);
39742 call_tests++;
39743 des_int(n_code, code, 0);
39744 xmlResetLastError();
39745 if (mem_base != xmlMemBlocks()) {
39746 printf("Leak of %d blocks found in xmlUCSIsShavian",
39747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039748 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039749 printf(" %d", n_code);
39750 printf("\n");
39751 }
39752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039753 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039754#endif
39755
Daniel Veillard42595322004-11-08 10:52:06 +000039756 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039757}
39758
39759
39760static int
39761test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039762 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039763
William M. Brack21e4ef22005-01-02 09:53:13 +000039764#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039765 int mem_base;
39766 int ret_val;
39767 int code; /* UCS code point */
39768 int n_code;
39769
39770 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39771 mem_base = xmlMemBlocks();
39772 code = gen_int(n_code, 0);
39773
39774 ret_val = xmlUCSIsSinhala(code);
39775 desret_int(ret_val);
39776 call_tests++;
39777 des_int(n_code, code, 0);
39778 xmlResetLastError();
39779 if (mem_base != xmlMemBlocks()) {
39780 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039782 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039783 printf(" %d", n_code);
39784 printf("\n");
39785 }
39786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039787 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039788#endif
39789
Daniel Veillard42595322004-11-08 10:52:06 +000039790 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039791}
39792
39793
39794static int
39795test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039796 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039797
William M. Brack21e4ef22005-01-02 09:53:13 +000039798#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039799 int mem_base;
39800 int ret_val;
39801 int code; /* UCS code point */
39802 int n_code;
39803
39804 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39805 mem_base = xmlMemBlocks();
39806 code = gen_int(n_code, 0);
39807
39808 ret_val = xmlUCSIsSmallFormVariants(code);
39809 desret_int(ret_val);
39810 call_tests++;
39811 des_int(n_code, code, 0);
39812 xmlResetLastError();
39813 if (mem_base != xmlMemBlocks()) {
39814 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039816 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039817 printf(" %d", n_code);
39818 printf("\n");
39819 }
39820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039821 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039822#endif
39823
Daniel Veillard42595322004-11-08 10:52:06 +000039824 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039825}
39826
39827
39828static int
39829test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039830 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039831
William M. Brack21e4ef22005-01-02 09:53:13 +000039832#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039833 int mem_base;
39834 int ret_val;
39835 int code; /* UCS code point */
39836 int n_code;
39837
39838 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39839 mem_base = xmlMemBlocks();
39840 code = gen_int(n_code, 0);
39841
39842 ret_val = xmlUCSIsSpacingModifierLetters(code);
39843 desret_int(ret_val);
39844 call_tests++;
39845 des_int(n_code, code, 0);
39846 xmlResetLastError();
39847 if (mem_base != xmlMemBlocks()) {
39848 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039850 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039851 printf(" %d", n_code);
39852 printf("\n");
39853 }
39854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039855 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039856#endif
39857
Daniel Veillard42595322004-11-08 10:52:06 +000039858 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039859}
39860
39861
39862static int
39863test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039864 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039865
William M. Brack21e4ef22005-01-02 09:53:13 +000039866#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039867 int mem_base;
39868 int ret_val;
39869 int code; /* UCS code point */
39870 int n_code;
39871
39872 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39873 mem_base = xmlMemBlocks();
39874 code = gen_int(n_code, 0);
39875
39876 ret_val = xmlUCSIsSpecials(code);
39877 desret_int(ret_val);
39878 call_tests++;
39879 des_int(n_code, code, 0);
39880 xmlResetLastError();
39881 if (mem_base != xmlMemBlocks()) {
39882 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039884 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039885 printf(" %d", n_code);
39886 printf("\n");
39887 }
39888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039889 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039890#endif
39891
Daniel Veillard42595322004-11-08 10:52:06 +000039892 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039893}
39894
39895
39896static int
39897test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039898 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039899
William M. Brack21e4ef22005-01-02 09:53:13 +000039900#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039901 int mem_base;
39902 int ret_val;
39903 int code; /* UCS code point */
39904 int n_code;
39905
39906 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39907 mem_base = xmlMemBlocks();
39908 code = gen_int(n_code, 0);
39909
39910 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39911 desret_int(ret_val);
39912 call_tests++;
39913 des_int(n_code, code, 0);
39914 xmlResetLastError();
39915 if (mem_base != xmlMemBlocks()) {
39916 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039918 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039919 printf(" %d", n_code);
39920 printf("\n");
39921 }
39922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039923 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039924#endif
39925
Daniel Veillard42595322004-11-08 10:52:06 +000039926 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039927}
39928
39929
39930static int
39931test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039932 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039933
William M. Brack21e4ef22005-01-02 09:53:13 +000039934#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039935 int mem_base;
39936 int ret_val;
39937 int code; /* UCS code point */
39938 int n_code;
39939
39940 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39941 mem_base = xmlMemBlocks();
39942 code = gen_int(n_code, 0);
39943
39944 ret_val = xmlUCSIsSupplementalArrowsA(code);
39945 desret_int(ret_val);
39946 call_tests++;
39947 des_int(n_code, code, 0);
39948 xmlResetLastError();
39949 if (mem_base != xmlMemBlocks()) {
39950 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039952 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039953 printf(" %d", n_code);
39954 printf("\n");
39955 }
39956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039957 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039958#endif
39959
Daniel Veillard42595322004-11-08 10:52:06 +000039960 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039961}
39962
39963
39964static int
39965test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039966 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039967
William M. Brack21e4ef22005-01-02 09:53:13 +000039968#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039969 int mem_base;
39970 int ret_val;
39971 int code; /* UCS code point */
39972 int n_code;
39973
39974 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39975 mem_base = xmlMemBlocks();
39976 code = gen_int(n_code, 0);
39977
39978 ret_val = xmlUCSIsSupplementalArrowsB(code);
39979 desret_int(ret_val);
39980 call_tests++;
39981 des_int(n_code, code, 0);
39982 xmlResetLastError();
39983 if (mem_base != xmlMemBlocks()) {
39984 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039986 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039987 printf(" %d", n_code);
39988 printf("\n");
39989 }
39990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039991 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039992#endif
39993
Daniel Veillard42595322004-11-08 10:52:06 +000039994 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039995}
39996
39997
39998static int
39999test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040000 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040001
William M. Brack21e4ef22005-01-02 09:53:13 +000040002#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040003 int mem_base;
40004 int ret_val;
40005 int code; /* UCS code point */
40006 int n_code;
40007
40008 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40009 mem_base = xmlMemBlocks();
40010 code = gen_int(n_code, 0);
40011
40012 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
40013 desret_int(ret_val);
40014 call_tests++;
40015 des_int(n_code, code, 0);
40016 xmlResetLastError();
40017 if (mem_base != xmlMemBlocks()) {
40018 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
40019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040020 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040021 printf(" %d", n_code);
40022 printf("\n");
40023 }
40024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040025 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040026#endif
40027
Daniel Veillard42595322004-11-08 10:52:06 +000040028 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040029}
40030
40031
40032static int
40033test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040034 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040035
William M. Brack21e4ef22005-01-02 09:53:13 +000040036#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040037 int mem_base;
40038 int ret_val;
40039 int code; /* UCS code point */
40040 int n_code;
40041
40042 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40043 mem_base = xmlMemBlocks();
40044 code = gen_int(n_code, 0);
40045
40046 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
40047 desret_int(ret_val);
40048 call_tests++;
40049 des_int(n_code, code, 0);
40050 xmlResetLastError();
40051 if (mem_base != xmlMemBlocks()) {
40052 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
40053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040054 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040055 printf(" %d", n_code);
40056 printf("\n");
40057 }
40058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040059 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040060#endif
40061
Daniel Veillard42595322004-11-08 10:52:06 +000040062 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040063}
40064
40065
40066static int
40067test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040068 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040069
William M. Brack21e4ef22005-01-02 09:53:13 +000040070#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040071 int mem_base;
40072 int ret_val;
40073 int code; /* UCS code point */
40074 int n_code;
40075
40076 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40077 mem_base = xmlMemBlocks();
40078 code = gen_int(n_code, 0);
40079
40080 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
40081 desret_int(ret_val);
40082 call_tests++;
40083 des_int(n_code, code, 0);
40084 xmlResetLastError();
40085 if (mem_base != xmlMemBlocks()) {
40086 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
40087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040088 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040089 printf(" %d", n_code);
40090 printf("\n");
40091 }
40092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040093 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040094#endif
40095
Daniel Veillard42595322004-11-08 10:52:06 +000040096 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040097}
40098
40099
40100static int
40101test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040102 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040103
William M. Brack21e4ef22005-01-02 09:53:13 +000040104#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040105 int mem_base;
40106 int ret_val;
40107 int code; /* UCS code point */
40108 int n_code;
40109
40110 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40111 mem_base = xmlMemBlocks();
40112 code = gen_int(n_code, 0);
40113
40114 ret_val = xmlUCSIsSyriac(code);
40115 desret_int(ret_val);
40116 call_tests++;
40117 des_int(n_code, code, 0);
40118 xmlResetLastError();
40119 if (mem_base != xmlMemBlocks()) {
40120 printf("Leak of %d blocks found in xmlUCSIsSyriac",
40121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040122 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040123 printf(" %d", n_code);
40124 printf("\n");
40125 }
40126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040127 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040128#endif
40129
Daniel Veillard42595322004-11-08 10:52:06 +000040130 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040131}
40132
40133
40134static int
40135test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040136 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040137
William M. Brack21e4ef22005-01-02 09:53:13 +000040138#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040139 int mem_base;
40140 int ret_val;
40141 int code; /* UCS code point */
40142 int n_code;
40143
40144 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40145 mem_base = xmlMemBlocks();
40146 code = gen_int(n_code, 0);
40147
40148 ret_val = xmlUCSIsTagalog(code);
40149 desret_int(ret_val);
40150 call_tests++;
40151 des_int(n_code, code, 0);
40152 xmlResetLastError();
40153 if (mem_base != xmlMemBlocks()) {
40154 printf("Leak of %d blocks found in xmlUCSIsTagalog",
40155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040156 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040157 printf(" %d", n_code);
40158 printf("\n");
40159 }
40160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040161 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040162#endif
40163
Daniel Veillard42595322004-11-08 10:52:06 +000040164 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040165}
40166
40167
40168static int
40169test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040170 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040171
William M. Brack21e4ef22005-01-02 09:53:13 +000040172#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040173 int mem_base;
40174 int ret_val;
40175 int code; /* UCS code point */
40176 int n_code;
40177
40178 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40179 mem_base = xmlMemBlocks();
40180 code = gen_int(n_code, 0);
40181
40182 ret_val = xmlUCSIsTagbanwa(code);
40183 desret_int(ret_val);
40184 call_tests++;
40185 des_int(n_code, code, 0);
40186 xmlResetLastError();
40187 if (mem_base != xmlMemBlocks()) {
40188 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
40189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040190 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040191 printf(" %d", n_code);
40192 printf("\n");
40193 }
40194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040195 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040196#endif
40197
Daniel Veillard42595322004-11-08 10:52:06 +000040198 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040199}
40200
40201
40202static int
40203test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040204 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040205
William M. Brack21e4ef22005-01-02 09:53:13 +000040206#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040207 int mem_base;
40208 int ret_val;
40209 int code; /* UCS code point */
40210 int n_code;
40211
40212 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40213 mem_base = xmlMemBlocks();
40214 code = gen_int(n_code, 0);
40215
40216 ret_val = xmlUCSIsTags(code);
40217 desret_int(ret_val);
40218 call_tests++;
40219 des_int(n_code, code, 0);
40220 xmlResetLastError();
40221 if (mem_base != xmlMemBlocks()) {
40222 printf("Leak of %d blocks found in xmlUCSIsTags",
40223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040224 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040225 printf(" %d", n_code);
40226 printf("\n");
40227 }
40228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040229 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040230#endif
40231
Daniel Veillard42595322004-11-08 10:52:06 +000040232 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040233}
40234
40235
40236static int
40237test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040238 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040239
William M. Brack21e4ef22005-01-02 09:53:13 +000040240#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040241 int mem_base;
40242 int ret_val;
40243 int code; /* UCS code point */
40244 int n_code;
40245
40246 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40247 mem_base = xmlMemBlocks();
40248 code = gen_int(n_code, 0);
40249
40250 ret_val = xmlUCSIsTaiLe(code);
40251 desret_int(ret_val);
40252 call_tests++;
40253 des_int(n_code, code, 0);
40254 xmlResetLastError();
40255 if (mem_base != xmlMemBlocks()) {
40256 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
40257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040258 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040259 printf(" %d", n_code);
40260 printf("\n");
40261 }
40262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040263 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040264#endif
40265
Daniel Veillard42595322004-11-08 10:52:06 +000040266 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040267}
40268
40269
40270static int
40271test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040272 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040273
William M. Brack21e4ef22005-01-02 09:53:13 +000040274#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040275 int mem_base;
40276 int ret_val;
40277 int code; /* UCS code point */
40278 int n_code;
40279
40280 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40281 mem_base = xmlMemBlocks();
40282 code = gen_int(n_code, 0);
40283
40284 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
40285 desret_int(ret_val);
40286 call_tests++;
40287 des_int(n_code, code, 0);
40288 xmlResetLastError();
40289 if (mem_base != xmlMemBlocks()) {
40290 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
40291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040292 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040293 printf(" %d", n_code);
40294 printf("\n");
40295 }
40296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040297 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040298#endif
40299
Daniel Veillard42595322004-11-08 10:52:06 +000040300 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040301}
40302
40303
40304static int
40305test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040306 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040307
William M. Brack21e4ef22005-01-02 09:53:13 +000040308#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040309 int mem_base;
40310 int ret_val;
40311 int code; /* UCS code point */
40312 int n_code;
40313
40314 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40315 mem_base = xmlMemBlocks();
40316 code = gen_int(n_code, 0);
40317
40318 ret_val = xmlUCSIsTamil(code);
40319 desret_int(ret_val);
40320 call_tests++;
40321 des_int(n_code, code, 0);
40322 xmlResetLastError();
40323 if (mem_base != xmlMemBlocks()) {
40324 printf("Leak of %d blocks found in xmlUCSIsTamil",
40325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040326 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040327 printf(" %d", n_code);
40328 printf("\n");
40329 }
40330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040331 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040332#endif
40333
Daniel Veillard42595322004-11-08 10:52:06 +000040334 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040335}
40336
40337
40338static int
40339test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040340 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040341
William M. Brack21e4ef22005-01-02 09:53:13 +000040342#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040343 int mem_base;
40344 int ret_val;
40345 int code; /* UCS code point */
40346 int n_code;
40347
40348 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40349 mem_base = xmlMemBlocks();
40350 code = gen_int(n_code, 0);
40351
40352 ret_val = xmlUCSIsTelugu(code);
40353 desret_int(ret_val);
40354 call_tests++;
40355 des_int(n_code, code, 0);
40356 xmlResetLastError();
40357 if (mem_base != xmlMemBlocks()) {
40358 printf("Leak of %d blocks found in xmlUCSIsTelugu",
40359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040360 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040361 printf(" %d", n_code);
40362 printf("\n");
40363 }
40364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040365 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040366#endif
40367
Daniel Veillard42595322004-11-08 10:52:06 +000040368 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040369}
40370
40371
40372static int
40373test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040374 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040375
William M. Brack21e4ef22005-01-02 09:53:13 +000040376#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040377 int mem_base;
40378 int ret_val;
40379 int code; /* UCS code point */
40380 int n_code;
40381
40382 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40383 mem_base = xmlMemBlocks();
40384 code = gen_int(n_code, 0);
40385
40386 ret_val = xmlUCSIsThaana(code);
40387 desret_int(ret_val);
40388 call_tests++;
40389 des_int(n_code, code, 0);
40390 xmlResetLastError();
40391 if (mem_base != xmlMemBlocks()) {
40392 printf("Leak of %d blocks found in xmlUCSIsThaana",
40393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040394 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040395 printf(" %d", n_code);
40396 printf("\n");
40397 }
40398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040399 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040400#endif
40401
Daniel Veillard42595322004-11-08 10:52:06 +000040402 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040403}
40404
40405
40406static int
40407test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040408 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040409
William M. Brack21e4ef22005-01-02 09:53:13 +000040410#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040411 int mem_base;
40412 int ret_val;
40413 int code; /* UCS code point */
40414 int n_code;
40415
40416 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40417 mem_base = xmlMemBlocks();
40418 code = gen_int(n_code, 0);
40419
40420 ret_val = xmlUCSIsThai(code);
40421 desret_int(ret_val);
40422 call_tests++;
40423 des_int(n_code, code, 0);
40424 xmlResetLastError();
40425 if (mem_base != xmlMemBlocks()) {
40426 printf("Leak of %d blocks found in xmlUCSIsThai",
40427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040428 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040429 printf(" %d", n_code);
40430 printf("\n");
40431 }
40432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040433 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040434#endif
40435
Daniel Veillard42595322004-11-08 10:52:06 +000040436 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040437}
40438
40439
40440static int
40441test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040442 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040443
William M. Brack21e4ef22005-01-02 09:53:13 +000040444#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040445 int mem_base;
40446 int ret_val;
40447 int code; /* UCS code point */
40448 int n_code;
40449
40450 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40451 mem_base = xmlMemBlocks();
40452 code = gen_int(n_code, 0);
40453
40454 ret_val = xmlUCSIsTibetan(code);
40455 desret_int(ret_val);
40456 call_tests++;
40457 des_int(n_code, code, 0);
40458 xmlResetLastError();
40459 if (mem_base != xmlMemBlocks()) {
40460 printf("Leak of %d blocks found in xmlUCSIsTibetan",
40461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040462 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040463 printf(" %d", n_code);
40464 printf("\n");
40465 }
40466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040467 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040468#endif
40469
Daniel Veillard42595322004-11-08 10:52:06 +000040470 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040471}
40472
40473
40474static int
40475test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040476 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040477
William M. Brack21e4ef22005-01-02 09:53:13 +000040478#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040479 int mem_base;
40480 int ret_val;
40481 int code; /* UCS code point */
40482 int n_code;
40483
40484 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40485 mem_base = xmlMemBlocks();
40486 code = gen_int(n_code, 0);
40487
40488 ret_val = xmlUCSIsUgaritic(code);
40489 desret_int(ret_val);
40490 call_tests++;
40491 des_int(n_code, code, 0);
40492 xmlResetLastError();
40493 if (mem_base != xmlMemBlocks()) {
40494 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
40495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040496 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040497 printf(" %d", n_code);
40498 printf("\n");
40499 }
40500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040501 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040502#endif
40503
Daniel Veillard42595322004-11-08 10:52:06 +000040504 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040505}
40506
40507
40508static int
40509test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040510 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040511
William M. Brack21e4ef22005-01-02 09:53:13 +000040512#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040513 int mem_base;
40514 int ret_val;
40515 int code; /* UCS code point */
40516 int n_code;
40517
40518 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40519 mem_base = xmlMemBlocks();
40520 code = gen_int(n_code, 0);
40521
40522 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
40523 desret_int(ret_val);
40524 call_tests++;
40525 des_int(n_code, code, 0);
40526 xmlResetLastError();
40527 if (mem_base != xmlMemBlocks()) {
40528 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
40529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040530 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040531 printf(" %d", n_code);
40532 printf("\n");
40533 }
40534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040535 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040536#endif
40537
Daniel Veillard42595322004-11-08 10:52:06 +000040538 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040539}
40540
40541
40542static int
40543test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040544 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040545
William M. Brack21e4ef22005-01-02 09:53:13 +000040546#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040547 int mem_base;
40548 int ret_val;
40549 int code; /* UCS code point */
40550 int n_code;
40551
40552 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40553 mem_base = xmlMemBlocks();
40554 code = gen_int(n_code, 0);
40555
40556 ret_val = xmlUCSIsVariationSelectors(code);
40557 desret_int(ret_val);
40558 call_tests++;
40559 des_int(n_code, code, 0);
40560 xmlResetLastError();
40561 if (mem_base != xmlMemBlocks()) {
40562 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
40563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040564 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040565 printf(" %d", n_code);
40566 printf("\n");
40567 }
40568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040569 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040570#endif
40571
Daniel Veillard42595322004-11-08 10:52:06 +000040572 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040573}
40574
40575
40576static int
40577test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040578 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040579
William M. Brack21e4ef22005-01-02 09:53:13 +000040580#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040581 int mem_base;
40582 int ret_val;
40583 int code; /* UCS code point */
40584 int n_code;
40585
40586 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40587 mem_base = xmlMemBlocks();
40588 code = gen_int(n_code, 0);
40589
40590 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
40591 desret_int(ret_val);
40592 call_tests++;
40593 des_int(n_code, code, 0);
40594 xmlResetLastError();
40595 if (mem_base != xmlMemBlocks()) {
40596 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
40597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040598 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040599 printf(" %d", n_code);
40600 printf("\n");
40601 }
40602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040603 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040604#endif
40605
Daniel Veillard42595322004-11-08 10:52:06 +000040606 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040607}
40608
40609
40610static int
40611test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040612 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040613
William M. Brack21e4ef22005-01-02 09:53:13 +000040614#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040615 int mem_base;
40616 int ret_val;
40617 int code; /* UCS code point */
40618 int n_code;
40619
40620 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40621 mem_base = xmlMemBlocks();
40622 code = gen_int(n_code, 0);
40623
40624 ret_val = xmlUCSIsYiRadicals(code);
40625 desret_int(ret_val);
40626 call_tests++;
40627 des_int(n_code, code, 0);
40628 xmlResetLastError();
40629 if (mem_base != xmlMemBlocks()) {
40630 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
40631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040632 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040633 printf(" %d", n_code);
40634 printf("\n");
40635 }
40636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040637 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040638#endif
40639
Daniel Veillard42595322004-11-08 10:52:06 +000040640 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040641}
40642
40643
40644static int
40645test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040646 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040647
William M. Brack21e4ef22005-01-02 09:53:13 +000040648#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040649 int mem_base;
40650 int ret_val;
40651 int code; /* UCS code point */
40652 int n_code;
40653
40654 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40655 mem_base = xmlMemBlocks();
40656 code = gen_int(n_code, 0);
40657
40658 ret_val = xmlUCSIsYiSyllables(code);
40659 desret_int(ret_val);
40660 call_tests++;
40661 des_int(n_code, code, 0);
40662 xmlResetLastError();
40663 if (mem_base != xmlMemBlocks()) {
40664 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
40665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040666 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040667 printf(" %d", n_code);
40668 printf("\n");
40669 }
40670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040671 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040672#endif
40673
Daniel Veillard42595322004-11-08 10:52:06 +000040674 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040675}
40676
40677
40678static int
40679test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040680 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040681
William M. Brack21e4ef22005-01-02 09:53:13 +000040682#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040683 int mem_base;
40684 int ret_val;
40685 int code; /* UCS code point */
40686 int n_code;
40687
40688 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40689 mem_base = xmlMemBlocks();
40690 code = gen_int(n_code, 0);
40691
40692 ret_val = xmlUCSIsYijingHexagramSymbols(code);
40693 desret_int(ret_val);
40694 call_tests++;
40695 des_int(n_code, code, 0);
40696 xmlResetLastError();
40697 if (mem_base != xmlMemBlocks()) {
40698 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
40699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040700 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040701 printf(" %d", n_code);
40702 printf("\n");
40703 }
40704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040705 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040706#endif
40707
Daniel Veillard42595322004-11-08 10:52:06 +000040708 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040709}
40710
40711static int
40712test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040713 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040714
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040715 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000040716 test_ret += test_xmlUCSIsAegeanNumbers();
40717 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
40718 test_ret += test_xmlUCSIsArabic();
40719 test_ret += test_xmlUCSIsArabicPresentationFormsA();
40720 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40721 test_ret += test_xmlUCSIsArmenian();
40722 test_ret += test_xmlUCSIsArrows();
40723 test_ret += test_xmlUCSIsBasicLatin();
40724 test_ret += test_xmlUCSIsBengali();
40725 test_ret += test_xmlUCSIsBlock();
40726 test_ret += test_xmlUCSIsBlockElements();
40727 test_ret += test_xmlUCSIsBopomofo();
40728 test_ret += test_xmlUCSIsBopomofoExtended();
40729 test_ret += test_xmlUCSIsBoxDrawing();
40730 test_ret += test_xmlUCSIsBraillePatterns();
40731 test_ret += test_xmlUCSIsBuhid();
40732 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40733 test_ret += test_xmlUCSIsCJKCompatibility();
40734 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40735 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40736 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40737 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40738 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40739 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40740 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40741 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40742 test_ret += test_xmlUCSIsCat();
40743 test_ret += test_xmlUCSIsCatC();
40744 test_ret += test_xmlUCSIsCatCc();
40745 test_ret += test_xmlUCSIsCatCf();
40746 test_ret += test_xmlUCSIsCatCo();
40747 test_ret += test_xmlUCSIsCatCs();
40748 test_ret += test_xmlUCSIsCatL();
40749 test_ret += test_xmlUCSIsCatLl();
40750 test_ret += test_xmlUCSIsCatLm();
40751 test_ret += test_xmlUCSIsCatLo();
40752 test_ret += test_xmlUCSIsCatLt();
40753 test_ret += test_xmlUCSIsCatLu();
40754 test_ret += test_xmlUCSIsCatM();
40755 test_ret += test_xmlUCSIsCatMc();
40756 test_ret += test_xmlUCSIsCatMe();
40757 test_ret += test_xmlUCSIsCatMn();
40758 test_ret += test_xmlUCSIsCatN();
40759 test_ret += test_xmlUCSIsCatNd();
40760 test_ret += test_xmlUCSIsCatNl();
40761 test_ret += test_xmlUCSIsCatNo();
40762 test_ret += test_xmlUCSIsCatP();
40763 test_ret += test_xmlUCSIsCatPc();
40764 test_ret += test_xmlUCSIsCatPd();
40765 test_ret += test_xmlUCSIsCatPe();
40766 test_ret += test_xmlUCSIsCatPf();
40767 test_ret += test_xmlUCSIsCatPi();
40768 test_ret += test_xmlUCSIsCatPo();
40769 test_ret += test_xmlUCSIsCatPs();
40770 test_ret += test_xmlUCSIsCatS();
40771 test_ret += test_xmlUCSIsCatSc();
40772 test_ret += test_xmlUCSIsCatSk();
40773 test_ret += test_xmlUCSIsCatSm();
40774 test_ret += test_xmlUCSIsCatSo();
40775 test_ret += test_xmlUCSIsCatZ();
40776 test_ret += test_xmlUCSIsCatZl();
40777 test_ret += test_xmlUCSIsCatZp();
40778 test_ret += test_xmlUCSIsCatZs();
40779 test_ret += test_xmlUCSIsCherokee();
40780 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40781 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40782 test_ret += test_xmlUCSIsCombiningHalfMarks();
40783 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40784 test_ret += test_xmlUCSIsControlPictures();
40785 test_ret += test_xmlUCSIsCurrencySymbols();
40786 test_ret += test_xmlUCSIsCypriotSyllabary();
40787 test_ret += test_xmlUCSIsCyrillic();
40788 test_ret += test_xmlUCSIsCyrillicSupplement();
40789 test_ret += test_xmlUCSIsDeseret();
40790 test_ret += test_xmlUCSIsDevanagari();
40791 test_ret += test_xmlUCSIsDingbats();
40792 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40793 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40794 test_ret += test_xmlUCSIsEthiopic();
40795 test_ret += test_xmlUCSIsGeneralPunctuation();
40796 test_ret += test_xmlUCSIsGeometricShapes();
40797 test_ret += test_xmlUCSIsGeorgian();
40798 test_ret += test_xmlUCSIsGothic();
40799 test_ret += test_xmlUCSIsGreek();
40800 test_ret += test_xmlUCSIsGreekExtended();
40801 test_ret += test_xmlUCSIsGreekandCoptic();
40802 test_ret += test_xmlUCSIsGujarati();
40803 test_ret += test_xmlUCSIsGurmukhi();
40804 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40805 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40806 test_ret += test_xmlUCSIsHangulJamo();
40807 test_ret += test_xmlUCSIsHangulSyllables();
40808 test_ret += test_xmlUCSIsHanunoo();
40809 test_ret += test_xmlUCSIsHebrew();
40810 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40811 test_ret += test_xmlUCSIsHighSurrogates();
40812 test_ret += test_xmlUCSIsHiragana();
40813 test_ret += test_xmlUCSIsIPAExtensions();
40814 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40815 test_ret += test_xmlUCSIsKanbun();
40816 test_ret += test_xmlUCSIsKangxiRadicals();
40817 test_ret += test_xmlUCSIsKannada();
40818 test_ret += test_xmlUCSIsKatakana();
40819 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40820 test_ret += test_xmlUCSIsKhmer();
40821 test_ret += test_xmlUCSIsKhmerSymbols();
40822 test_ret += test_xmlUCSIsLao();
40823 test_ret += test_xmlUCSIsLatin1Supplement();
40824 test_ret += test_xmlUCSIsLatinExtendedA();
40825 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40826 test_ret += test_xmlUCSIsLatinExtendedB();
40827 test_ret += test_xmlUCSIsLetterlikeSymbols();
40828 test_ret += test_xmlUCSIsLimbu();
40829 test_ret += test_xmlUCSIsLinearBIdeograms();
40830 test_ret += test_xmlUCSIsLinearBSyllabary();
40831 test_ret += test_xmlUCSIsLowSurrogates();
40832 test_ret += test_xmlUCSIsMalayalam();
40833 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40834 test_ret += test_xmlUCSIsMathematicalOperators();
40835 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40836 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40837 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40838 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40839 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40840 test_ret += test_xmlUCSIsMongolian();
40841 test_ret += test_xmlUCSIsMusicalSymbols();
40842 test_ret += test_xmlUCSIsMyanmar();
40843 test_ret += test_xmlUCSIsNumberForms();
40844 test_ret += test_xmlUCSIsOgham();
40845 test_ret += test_xmlUCSIsOldItalic();
40846 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40847 test_ret += test_xmlUCSIsOriya();
40848 test_ret += test_xmlUCSIsOsmanya();
40849 test_ret += test_xmlUCSIsPhoneticExtensions();
40850 test_ret += test_xmlUCSIsPrivateUse();
40851 test_ret += test_xmlUCSIsPrivateUseArea();
40852 test_ret += test_xmlUCSIsRunic();
40853 test_ret += test_xmlUCSIsShavian();
40854 test_ret += test_xmlUCSIsSinhala();
40855 test_ret += test_xmlUCSIsSmallFormVariants();
40856 test_ret += test_xmlUCSIsSpacingModifierLetters();
40857 test_ret += test_xmlUCSIsSpecials();
40858 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40859 test_ret += test_xmlUCSIsSupplementalArrowsA();
40860 test_ret += test_xmlUCSIsSupplementalArrowsB();
40861 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40862 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40863 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40864 test_ret += test_xmlUCSIsSyriac();
40865 test_ret += test_xmlUCSIsTagalog();
40866 test_ret += test_xmlUCSIsTagbanwa();
40867 test_ret += test_xmlUCSIsTags();
40868 test_ret += test_xmlUCSIsTaiLe();
40869 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40870 test_ret += test_xmlUCSIsTamil();
40871 test_ret += test_xmlUCSIsTelugu();
40872 test_ret += test_xmlUCSIsThaana();
40873 test_ret += test_xmlUCSIsThai();
40874 test_ret += test_xmlUCSIsTibetan();
40875 test_ret += test_xmlUCSIsUgaritic();
40876 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40877 test_ret += test_xmlUCSIsVariationSelectors();
40878 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40879 test_ret += test_xmlUCSIsYiRadicals();
40880 test_ret += test_xmlUCSIsYiSyllables();
40881 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040882
Daniel Veillard42595322004-11-08 10:52:06 +000040883 if (test_ret != 0)
40884 printf("Module xmlunicode: %d errors\n", test_ret);
40885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040886}
40887
40888static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040889test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040891
William M. Brack21e4ef22005-01-02 09:53:13 +000040892#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040893 int mem_base;
40894 xmlTextWriterPtr ret_val;
40895 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40896 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040897
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040898 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40899 mem_base = xmlMemBlocks();
40900 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040901
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040902 ret_val = xmlNewTextWriter(out);
40903 if (ret_val != NULL) out = NULL;
40904 desret_xmlTextWriterPtr(ret_val);
40905 call_tests++;
40906 des_xmlOutputBufferPtr(n_out, out, 0);
40907 xmlResetLastError();
40908 if (mem_base != xmlMemBlocks()) {
40909 printf("Leak of %d blocks found in xmlNewTextWriter",
40910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040911 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040912 printf(" %d", n_out);
40913 printf("\n");
40914 }
40915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040916 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040917#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040918
Daniel Veillard42595322004-11-08 10:52:06 +000040919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040920}
40921
40922
40923static int
40924test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040926
William M. Brack21e4ef22005-01-02 09:53:13 +000040927#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040928 int mem_base;
40929 xmlTextWriterPtr ret_val;
40930 const char * uri; /* the URI of the resource for the output */
40931 int n_uri;
40932 int compression; /* compress the output? */
40933 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040934
Daniel Veillard42595322004-11-08 10:52:06 +000040935 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040936 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40937 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040938 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040939 compression = gen_int(n_compression, 1);
40940
40941 ret_val = xmlNewTextWriterFilename(uri, compression);
40942 desret_xmlTextWriterPtr(ret_val);
40943 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040944 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040945 des_int(n_compression, compression, 1);
40946 xmlResetLastError();
40947 if (mem_base != xmlMemBlocks()) {
40948 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040950 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040951 printf(" %d", n_uri);
40952 printf(" %d", n_compression);
40953 printf("\n");
40954 }
40955 }
40956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040957 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040958#endif
40959
Daniel Veillard42595322004-11-08 10:52:06 +000040960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040961}
40962
40963
40964static int
40965test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040967
William M. Brack21e4ef22005-01-02 09:53:13 +000040968#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040969 int mem_base;
40970 xmlTextWriterPtr ret_val;
40971 xmlBufferPtr buf; /* xmlBufferPtr */
40972 int n_buf;
40973 int compression; /* compress the output? */
40974 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040975
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040976 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40977 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40978 mem_base = xmlMemBlocks();
40979 buf = gen_xmlBufferPtr(n_buf, 0);
40980 compression = gen_int(n_compression, 1);
40981
40982 ret_val = xmlNewTextWriterMemory(buf, compression);
40983 desret_xmlTextWriterPtr(ret_val);
40984 call_tests++;
40985 des_xmlBufferPtr(n_buf, buf, 0);
40986 des_int(n_compression, compression, 1);
40987 xmlResetLastError();
40988 if (mem_base != xmlMemBlocks()) {
40989 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040991 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040992 printf(" %d", n_buf);
40993 printf(" %d", n_compression);
40994 printf("\n");
40995 }
40996 }
40997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040998 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040999#endif
41000
Daniel Veillard42595322004-11-08 10:52:06 +000041001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041002}
41003
41004
41005static int
41006test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041008
William M. Brack21e4ef22005-01-02 09:53:13 +000041009#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041010 int mem_base;
41011 xmlTextWriterPtr ret_val;
41012 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
41013 int n_ctxt;
41014 int compression; /* compress the output? */
41015 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041016
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
41018 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
41019 mem_base = xmlMemBlocks();
41020 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
41021 compression = gen_int(n_compression, 1);
41022
41023 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000041024 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041025 desret_xmlTextWriterPtr(ret_val);
41026 call_tests++;
41027 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
41028 des_int(n_compression, compression, 1);
41029 xmlResetLastError();
41030 if (mem_base != xmlMemBlocks()) {
41031 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
41032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041033 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041034 printf(" %d", n_ctxt);
41035 printf(" %d", n_compression);
41036 printf("\n");
41037 }
41038 }
41039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041040 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041041#endif
41042
Daniel Veillard42595322004-11-08 10:52:06 +000041043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041044}
41045
41046
41047static int
41048test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041050
William M. Brack21e4ef22005-01-02 09:53:13 +000041051#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041052 int mem_base;
41053 xmlTextWriterPtr ret_val;
41054 xmlDocPtr doc; /* xmlDocPtr */
41055 int n_doc;
41056 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
41057 int n_node;
41058 int compression; /* compress the output? */
41059 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041060
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041061 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
41062 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
41063 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
41064 mem_base = xmlMemBlocks();
41065 doc = gen_xmlDocPtr(n_doc, 0);
41066 node = gen_xmlNodePtr(n_node, 1);
41067 compression = gen_int(n_compression, 2);
41068
41069 ret_val = xmlNewTextWriterTree(doc, node, compression);
41070 desret_xmlTextWriterPtr(ret_val);
41071 call_tests++;
41072 des_xmlDocPtr(n_doc, doc, 0);
41073 des_xmlNodePtr(n_node, node, 1);
41074 des_int(n_compression, compression, 2);
41075 xmlResetLastError();
41076 if (mem_base != xmlMemBlocks()) {
41077 printf("Leak of %d blocks found in xmlNewTextWriterTree",
41078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041079 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041080 printf(" %d", n_doc);
41081 printf(" %d", n_node);
41082 printf(" %d", n_compression);
41083 printf("\n");
41084 }
41085 }
41086 }
41087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041088 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041089#endif
41090
Daniel Veillard42595322004-11-08 10:52:06 +000041091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041092}
41093
41094
41095static int
41096test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041098
William M. Brack21e4ef22005-01-02 09:53:13 +000041099#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041100 int mem_base;
41101 int ret_val;
41102 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41103 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041104
Daniel Veillarde43cc572004-11-03 11:50:29 +000041105 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041107 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041108
41109 ret_val = xmlTextWriterEndAttribute(writer);
41110 desret_int(ret_val);
41111 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041112 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041113 xmlResetLastError();
41114 if (mem_base != xmlMemBlocks()) {
41115 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
41116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041117 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041118 printf(" %d", n_writer);
41119 printf("\n");
41120 }
41121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041122 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041123#endif
41124
Daniel Veillard42595322004-11-08 10:52:06 +000041125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041126}
41127
41128
41129static int
41130test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041132
William M. Brack21e4ef22005-01-02 09:53:13 +000041133#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041134 int mem_base;
41135 int ret_val;
41136 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41137 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041138
Daniel Veillarde43cc572004-11-03 11:50:29 +000041139 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041141 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041142
41143 ret_val = xmlTextWriterEndCDATA(writer);
41144 desret_int(ret_val);
41145 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041146 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041147 xmlResetLastError();
41148 if (mem_base != xmlMemBlocks()) {
41149 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
41150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041151 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041152 printf(" %d", n_writer);
41153 printf("\n");
41154 }
41155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041156 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041157#endif
41158
Daniel Veillard42595322004-11-08 10:52:06 +000041159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041160}
41161
41162
41163static int
41164test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041166
William M. Brack21e4ef22005-01-02 09:53:13 +000041167#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041168 int mem_base;
41169 int ret_val;
41170 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41171 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041172
Daniel Veillarde43cc572004-11-03 11:50:29 +000041173 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41174 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041175 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041176
41177 ret_val = xmlTextWriterEndComment(writer);
41178 desret_int(ret_val);
41179 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041180 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041181 xmlResetLastError();
41182 if (mem_base != xmlMemBlocks()) {
41183 printf("Leak of %d blocks found in xmlTextWriterEndComment",
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("\n");
41188 }
41189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041190 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041191#endif
41192
Daniel Veillard42595322004-11-08 10:52:06 +000041193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041194}
41195
41196
41197static int
41198test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041200
William M. Brack21e4ef22005-01-02 09:53:13 +000041201#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041202 int mem_base;
41203 int ret_val;
41204 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41205 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041206
Daniel Veillarde43cc572004-11-03 11:50:29 +000041207 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041209 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041210
41211 ret_val = xmlTextWriterEndDTD(writer);
41212 desret_int(ret_val);
41213 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041214 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041215 xmlResetLastError();
41216 if (mem_base != xmlMemBlocks()) {
41217 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
41218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041219 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041220 printf(" %d", n_writer);
41221 printf("\n");
41222 }
41223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041224 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041225#endif
41226
Daniel Veillard42595322004-11-08 10:52:06 +000041227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041228}
41229
41230
41231static int
41232test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041234
William M. Brack21e4ef22005-01-02 09:53:13 +000041235#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041236 int mem_base;
41237 int ret_val;
41238 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41239 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041240
Daniel Veillarde43cc572004-11-03 11:50:29 +000041241 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041243 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041244
41245 ret_val = xmlTextWriterEndDTDAttlist(writer);
41246 desret_int(ret_val);
41247 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041248 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041249 xmlResetLastError();
41250 if (mem_base != xmlMemBlocks()) {
41251 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
41252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041253 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041254 printf(" %d", n_writer);
41255 printf("\n");
41256 }
41257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041258 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041259#endif
41260
Daniel Veillard42595322004-11-08 10:52:06 +000041261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041262}
41263
41264
41265static int
41266test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041268
William M. Brack21e4ef22005-01-02 09:53:13 +000041269#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041270 int mem_base;
41271 int ret_val;
41272 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41273 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041274
Daniel Veillarde43cc572004-11-03 11:50:29 +000041275 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41276 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041277 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041278
41279 ret_val = xmlTextWriterEndDTDElement(writer);
41280 desret_int(ret_val);
41281 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041282 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041283 xmlResetLastError();
41284 if (mem_base != xmlMemBlocks()) {
41285 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
41286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041287 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041288 printf(" %d", n_writer);
41289 printf("\n");
41290 }
41291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041292 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041293#endif
41294
Daniel Veillard42595322004-11-08 10:52:06 +000041295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041296}
41297
41298
41299static int
41300test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041302
William M. Brack21e4ef22005-01-02 09:53:13 +000041303#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041304 int mem_base;
41305 int ret_val;
41306 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41307 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041308
Daniel Veillarde43cc572004-11-03 11:50:29 +000041309 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41310 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041311 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041312
41313 ret_val = xmlTextWriterEndDTDEntity(writer);
41314 desret_int(ret_val);
41315 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041316 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041317 xmlResetLastError();
41318 if (mem_base != xmlMemBlocks()) {
41319 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
41320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041321 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041322 printf(" %d", n_writer);
41323 printf("\n");
41324 }
41325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041326 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041327#endif
41328
Daniel Veillard42595322004-11-08 10:52:06 +000041329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041330}
41331
41332
41333static int
41334test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041336
William M. Brack21e4ef22005-01-02 09:53:13 +000041337#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041338 int mem_base;
41339 int ret_val;
41340 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41341 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041342
Daniel Veillarde43cc572004-11-03 11:50:29 +000041343 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041345 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041346
41347 ret_val = xmlTextWriterEndDocument(writer);
41348 desret_int(ret_val);
41349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041350 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041351 xmlResetLastError();
41352 if (mem_base != xmlMemBlocks()) {
41353 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
41354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041355 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041356 printf(" %d", n_writer);
41357 printf("\n");
41358 }
41359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041360 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041361#endif
41362
Daniel Veillard42595322004-11-08 10:52:06 +000041363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041364}
41365
41366
41367static int
41368test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041370
William M. Brack21e4ef22005-01-02 09:53:13 +000041371#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041372 int mem_base;
41373 int ret_val;
41374 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41375 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041376
Daniel Veillarde43cc572004-11-03 11:50:29 +000041377 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041379 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041380
41381 ret_val = xmlTextWriterEndElement(writer);
41382 desret_int(ret_val);
41383 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041384 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041385 xmlResetLastError();
41386 if (mem_base != xmlMemBlocks()) {
41387 printf("Leak of %d blocks found in xmlTextWriterEndElement",
41388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041389 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041390 printf(" %d", n_writer);
41391 printf("\n");
41392 }
41393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041394 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041395#endif
41396
Daniel Veillard42595322004-11-08 10:52:06 +000041397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041398}
41399
41400
41401static int
41402test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041404
William M. Brack21e4ef22005-01-02 09:53:13 +000041405#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041406 int mem_base;
41407 int ret_val;
41408 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41409 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041410
Daniel Veillarde43cc572004-11-03 11:50:29 +000041411 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41412 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041413 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041414
41415 ret_val = xmlTextWriterEndPI(writer);
41416 desret_int(ret_val);
41417 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041418 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041419 xmlResetLastError();
41420 if (mem_base != xmlMemBlocks()) {
41421 printf("Leak of %d blocks found in xmlTextWriterEndPI",
41422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041423 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041424 printf(" %d", n_writer);
41425 printf("\n");
41426 }
41427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041428 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041429#endif
41430
Daniel Veillard42595322004-11-08 10:52:06 +000041431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041432}
41433
41434
41435static int
41436test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041438
William M. Brack21e4ef22005-01-02 09:53:13 +000041439#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041440 int mem_base;
41441 int ret_val;
41442 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41443 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041444
Daniel Veillarde43cc572004-11-03 11:50:29 +000041445 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41446 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041447 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041448
41449 ret_val = xmlTextWriterFlush(writer);
41450 desret_int(ret_val);
41451 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041452 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041453 xmlResetLastError();
41454 if (mem_base != xmlMemBlocks()) {
41455 printf("Leak of %d blocks found in xmlTextWriterFlush",
41456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041457 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041458 printf(" %d", n_writer);
41459 printf("\n");
41460 }
41461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041462 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041463#endif
41464
Daniel Veillard42595322004-11-08 10:52:06 +000041465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041466}
41467
41468
41469static int
41470test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041472
William M. Brack21e4ef22005-01-02 09:53:13 +000041473#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041474 int mem_base;
41475 int ret_val;
41476 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41477 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041478
Daniel Veillarde43cc572004-11-03 11:50:29 +000041479 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041481 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482
41483 ret_val = xmlTextWriterFullEndElement(writer);
41484 desret_int(ret_val);
41485 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041486 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041487 xmlResetLastError();
41488 if (mem_base != xmlMemBlocks()) {
41489 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
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("\n");
41494 }
41495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041496 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041497#endif
41498
Daniel Veillard42595322004-11-08 10:52:06 +000041499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041500}
41501
41502
41503static int
41504test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041506
William M. Brack21e4ef22005-01-02 09:53:13 +000041507#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041508 int mem_base;
41509 int ret_val;
41510 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41511 int n_writer;
41512 int indent; /* do indentation? */
41513 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041514
Daniel Veillarde43cc572004-11-03 11:50:29 +000041515 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41516 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
41517 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041518 writer = gen_xmlTextWriterPtr(n_writer, 0);
41519 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041520
41521 ret_val = xmlTextWriterSetIndent(writer, indent);
41522 desret_int(ret_val);
41523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041524 des_xmlTextWriterPtr(n_writer, writer, 0);
41525 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041526 xmlResetLastError();
41527 if (mem_base != xmlMemBlocks()) {
41528 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
41529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041530 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 printf(" %d", n_writer);
41532 printf(" %d", n_indent);
41533 printf("\n");
41534 }
41535 }
41536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041537 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041538#endif
41539
Daniel Veillard42595322004-11-08 10:52:06 +000041540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041541}
41542
41543
41544static int
41545test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041547
William M. Brack21e4ef22005-01-02 09:53:13 +000041548#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041549 int mem_base;
41550 int ret_val;
41551 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41552 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041553 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041554 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041555
Daniel Veillarde43cc572004-11-03 11:50:29 +000041556 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41557 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
41558 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041559 writer = gen_xmlTextWriterPtr(n_writer, 0);
41560 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041561
William M. Brackf13f77f2004-11-12 16:03:48 +000041562 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041563 desret_int(ret_val);
41564 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041565 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041566 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041567 xmlResetLastError();
41568 if (mem_base != xmlMemBlocks()) {
41569 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
41570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041571 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041572 printf(" %d", n_writer);
41573 printf(" %d", n_str);
41574 printf("\n");
41575 }
41576 }
41577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041578 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041579#endif
41580
Daniel Veillard42595322004-11-08 10:52:06 +000041581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041582}
41583
41584
41585static int
41586test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041588
William M. Brack21e4ef22005-01-02 09:53:13 +000041589#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041590 int mem_base;
41591 int ret_val;
41592 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41593 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041594 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041595 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041596
Daniel Veillarde43cc572004-11-03 11:50:29 +000041597 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41598 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041600 writer = gen_xmlTextWriterPtr(n_writer, 0);
41601 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041602
William M. Brackf13f77f2004-11-12 16:03:48 +000041603 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041604 desret_int(ret_val);
41605 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041606 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041607 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041608 xmlResetLastError();
41609 if (mem_base != xmlMemBlocks()) {
41610 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
41611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041612 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041613 printf(" %d", n_writer);
41614 printf(" %d", n_name);
41615 printf("\n");
41616 }
41617 }
41618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041619 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041620#endif
41621
Daniel Veillard42595322004-11-08 10:52:06 +000041622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041623}
41624
41625
41626static int
41627test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041629
William M. Brack21e4ef22005-01-02 09:53:13 +000041630#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041631 int mem_base;
41632 int ret_val;
41633 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41634 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041635 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041636 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041637 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041638 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041639 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041640 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041641
Daniel Veillarde43cc572004-11-03 11:50:29 +000041642 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41643 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41644 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41645 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41646 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041647 writer = gen_xmlTextWriterPtr(n_writer, 0);
41648 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41649 name = gen_const_xmlChar_ptr(n_name, 2);
41650 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041651
William M. Brackf13f77f2004-11-12 16:03:48 +000041652 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041653 desret_int(ret_val);
41654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041655 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041656 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41657 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41658 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041659 xmlResetLastError();
41660 if (mem_base != xmlMemBlocks()) {
41661 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
41662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041663 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041664 printf(" %d", n_writer);
41665 printf(" %d", n_prefix);
41666 printf(" %d", n_name);
41667 printf(" %d", n_namespaceURI);
41668 printf("\n");
41669 }
41670 }
41671 }
41672 }
41673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041674 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041675#endif
41676
Daniel Veillard42595322004-11-08 10:52:06 +000041677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041678}
41679
41680
41681static int
41682test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041684
William M. Brack21e4ef22005-01-02 09:53:13 +000041685#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041686 int mem_base;
41687 int ret_val;
41688 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41689 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041690
Daniel Veillarde43cc572004-11-03 11:50:29 +000041691 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41692 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041693 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041694
41695 ret_val = xmlTextWriterStartCDATA(writer);
41696 desret_int(ret_val);
41697 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041698 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041699 xmlResetLastError();
41700 if (mem_base != xmlMemBlocks()) {
41701 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
41702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041703 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041704 printf(" %d", n_writer);
41705 printf("\n");
41706 }
41707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041708 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041709#endif
41710
Daniel Veillard42595322004-11-08 10:52:06 +000041711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041712}
41713
41714
41715static int
41716test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041718
William M. Brack21e4ef22005-01-02 09:53:13 +000041719#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041720 int mem_base;
41721 int ret_val;
41722 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41723 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041724
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041727 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041728
41729 ret_val = xmlTextWriterStartComment(writer);
41730 desret_int(ret_val);
41731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041732 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041733 xmlResetLastError();
41734 if (mem_base != xmlMemBlocks()) {
41735 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041737 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738 printf(" %d", n_writer);
41739 printf("\n");
41740 }
41741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041742 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041743#endif
41744
Daniel Veillard42595322004-11-08 10:52:06 +000041745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041746}
41747
41748
41749static int
41750test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041752
William M. Brack21e4ef22005-01-02 09:53:13 +000041753#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041754 int mem_base;
41755 int ret_val;
41756 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41757 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041758 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041759 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041760 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041761 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041762 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041763 int n_sysid;
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_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41767 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41768 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041770 writer = gen_xmlTextWriterPtr(n_writer, 0);
41771 name = gen_const_xmlChar_ptr(n_name, 1);
41772 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41773 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041774
William M. Brackf13f77f2004-11-12 16:03:48 +000041775 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041776 desret_int(ret_val);
41777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041778 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041779 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41780 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41781 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 xmlResetLastError();
41783 if (mem_base != xmlMemBlocks()) {
41784 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041786 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041787 printf(" %d", n_writer);
41788 printf(" %d", n_name);
41789 printf(" %d", n_pubid);
41790 printf(" %d", n_sysid);
41791 printf("\n");
41792 }
41793 }
41794 }
41795 }
41796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041797 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041798#endif
41799
Daniel Veillard42595322004-11-08 10:52:06 +000041800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041801}
41802
41803
41804static int
41805test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041807
William M. Brack21e4ef22005-01-02 09:53:13 +000041808#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041809 int mem_base;
41810 int ret_val;
41811 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41812 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041813 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041815
Daniel Veillarde43cc572004-11-03 11:50:29 +000041816 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41817 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41818 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041819 writer = gen_xmlTextWriterPtr(n_writer, 0);
41820 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041821
William M. Brackf13f77f2004-11-12 16:03:48 +000041822 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041823 desret_int(ret_val);
41824 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041825 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041826 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041827 xmlResetLastError();
41828 if (mem_base != xmlMemBlocks()) {
41829 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041831 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041832 printf(" %d", n_writer);
41833 printf(" %d", n_name);
41834 printf("\n");
41835 }
41836 }
41837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041838 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041839#endif
41840
Daniel Veillard42595322004-11-08 10:52:06 +000041841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041842}
41843
41844
41845static int
41846test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041848
William M. Brack21e4ef22005-01-02 09:53:13 +000041849#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041850 int mem_base;
41851 int ret_val;
41852 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41853 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041854 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041855 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041856
Daniel Veillarde43cc572004-11-03 11:50:29 +000041857 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41858 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041860 writer = gen_xmlTextWriterPtr(n_writer, 0);
41861 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041862
William M. Brackf13f77f2004-11-12 16:03:48 +000041863 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041864 desret_int(ret_val);
41865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041866 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041867 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041868 xmlResetLastError();
41869 if (mem_base != xmlMemBlocks()) {
41870 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041872 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041873 printf(" %d", n_writer);
41874 printf(" %d", n_name);
41875 printf("\n");
41876 }
41877 }
41878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041879 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041880#endif
41881
Daniel Veillard42595322004-11-08 10:52:06 +000041882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041883}
41884
41885
41886static int
41887test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041889
William M. Brack21e4ef22005-01-02 09:53:13 +000041890#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041891 int mem_base;
41892 int ret_val;
41893 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41894 int n_writer;
41895 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41896 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041897 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041898 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041899
Daniel Veillarde43cc572004-11-03 11:50:29 +000041900 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41901 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41902 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41903 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041904 writer = gen_xmlTextWriterPtr(n_writer, 0);
41905 pe = gen_int(n_pe, 1);
41906 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041907
William M. Brackf13f77f2004-11-12 16:03:48 +000041908 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041909 desret_int(ret_val);
41910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041911 des_xmlTextWriterPtr(n_writer, writer, 0);
41912 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041913 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041914 xmlResetLastError();
41915 if (mem_base != xmlMemBlocks()) {
41916 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041918 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041919 printf(" %d", n_writer);
41920 printf(" %d", n_pe);
41921 printf(" %d", n_name);
41922 printf("\n");
41923 }
41924 }
41925 }
41926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041927 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041928#endif
41929
Daniel Veillard42595322004-11-08 10:52:06 +000041930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041931}
41932
41933
41934static int
41935test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041937
William M. Brack21e4ef22005-01-02 09:53:13 +000041938#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041939 int mem_base;
41940 int ret_val;
41941 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41942 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041943 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041944 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041945 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041946 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041947 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041948 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041949
Daniel Veillarde43cc572004-11-03 11:50:29 +000041950 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41951 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41952 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41953 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041955 writer = gen_xmlTextWriterPtr(n_writer, 0);
41956 version = gen_const_char_ptr(n_version, 1);
41957 encoding = gen_const_char_ptr(n_encoding, 2);
41958 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041959
William M. Brackf13f77f2004-11-12 16:03:48 +000041960 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041961 desret_int(ret_val);
41962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041963 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041964 des_const_char_ptr(n_version, (const char *)version, 1);
41965 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41966 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041967 xmlResetLastError();
41968 if (mem_base != xmlMemBlocks()) {
41969 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041971 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041972 printf(" %d", n_writer);
41973 printf(" %d", n_version);
41974 printf(" %d", n_encoding);
41975 printf(" %d", n_standalone);
41976 printf("\n");
41977 }
41978 }
41979 }
41980 }
41981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041982 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041983#endif
41984
Daniel Veillard42595322004-11-08 10:52:06 +000041985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041986}
41987
41988
41989static int
41990test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041992
William M. Brack21e4ef22005-01-02 09:53:13 +000041993#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041994 int mem_base;
41995 int ret_val;
41996 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41997 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041998 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041999 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042000
Daniel Veillarde43cc572004-11-03 11:50:29 +000042001 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42002 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42003 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042004 writer = gen_xmlTextWriterPtr(n_writer, 0);
42005 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042006
William M. Brackf13f77f2004-11-12 16:03:48 +000042007 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042008 desret_int(ret_val);
42009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042010 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042011 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042012 xmlResetLastError();
42013 if (mem_base != xmlMemBlocks()) {
42014 printf("Leak of %d blocks found in xmlTextWriterStartElement",
42015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042016 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042017 printf(" %d", n_writer);
42018 printf(" %d", n_name);
42019 printf("\n");
42020 }
42021 }
42022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042023 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042024#endif
42025
Daniel Veillard42595322004-11-08 10:52:06 +000042026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042027}
42028
42029
42030static int
42031test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042033
William M. Brack21e4ef22005-01-02 09:53:13 +000042034#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042035 int mem_base;
42036 int ret_val;
42037 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42038 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042039 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042040 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042041 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042042 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042043 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042044 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042045
Daniel Veillarde43cc572004-11-03 11:50:29 +000042046 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42047 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42048 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42049 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042051 writer = gen_xmlTextWriterPtr(n_writer, 0);
42052 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42053 name = gen_const_xmlChar_ptr(n_name, 2);
42054 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042055
William M. Brackf13f77f2004-11-12 16:03:48 +000042056 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042057 desret_int(ret_val);
42058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042059 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042060 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42061 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42062 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042063 xmlResetLastError();
42064 if (mem_base != xmlMemBlocks()) {
42065 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
42066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042067 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042068 printf(" %d", n_writer);
42069 printf(" %d", n_prefix);
42070 printf(" %d", n_name);
42071 printf(" %d", n_namespaceURI);
42072 printf("\n");
42073 }
42074 }
42075 }
42076 }
42077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042078 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042079#endif
42080
Daniel Veillard42595322004-11-08 10:52:06 +000042081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042082}
42083
42084
42085static int
42086test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042088
William M. Brack21e4ef22005-01-02 09:53:13 +000042089#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042090 int mem_base;
42091 int ret_val;
42092 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42093 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042094 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042095 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042096
Daniel Veillarde43cc572004-11-03 11:50:29 +000042097 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42098 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42099 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042100 writer = gen_xmlTextWriterPtr(n_writer, 0);
42101 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042102
William M. Brackf13f77f2004-11-12 16:03:48 +000042103 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042104 desret_int(ret_val);
42105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042106 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042107 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042108 xmlResetLastError();
42109 if (mem_base != xmlMemBlocks()) {
42110 printf("Leak of %d blocks found in xmlTextWriterStartPI",
42111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042112 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042113 printf(" %d", n_writer);
42114 printf(" %d", n_target);
42115 printf("\n");
42116 }
42117 }
42118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042119 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042120#endif
42121
Daniel Veillard42595322004-11-08 10:52:06 +000042122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042123}
42124
42125
42126static int
42127test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042129
William M. Brack21e4ef22005-01-02 09:53:13 +000042130#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042131 int mem_base;
42132 int ret_val;
42133 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42134 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042135 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042136 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042137 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042138 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042139
Daniel Veillarde43cc572004-11-03 11:50:29 +000042140 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42141 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42142 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042144 writer = gen_xmlTextWriterPtr(n_writer, 0);
42145 name = gen_const_xmlChar_ptr(n_name, 1);
42146 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042147
William M. Brackf13f77f2004-11-12 16:03:48 +000042148 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042149 desret_int(ret_val);
42150 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042151 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042152 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42153 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042154 xmlResetLastError();
42155 if (mem_base != xmlMemBlocks()) {
42156 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
42157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042158 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042159 printf(" %d", n_writer);
42160 printf(" %d", n_name);
42161 printf(" %d", n_content);
42162 printf("\n");
42163 }
42164 }
42165 }
42166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042167 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042168#endif
42169
Daniel Veillard42595322004-11-08 10:52:06 +000042170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042171}
42172
42173
42174static int
42175test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042177
William M. Brack21e4ef22005-01-02 09:53:13 +000042178#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042179 int mem_base;
42180 int ret_val;
42181 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42182 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042183 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042184 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042185 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042186 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042187 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042188 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042189 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042190 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042191
Daniel Veillarde43cc572004-11-03 11:50:29 +000042192 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42193 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42195 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42196 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042198 writer = gen_xmlTextWriterPtr(n_writer, 0);
42199 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42200 name = gen_const_xmlChar_ptr(n_name, 2);
42201 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42202 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042203
William M. Brackf13f77f2004-11-12 16:03:48 +000042204 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042205 desret_int(ret_val);
42206 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042207 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042208 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42209 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42210 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42211 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042212 xmlResetLastError();
42213 if (mem_base != xmlMemBlocks()) {
42214 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
42215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042216 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042217 printf(" %d", n_writer);
42218 printf(" %d", n_prefix);
42219 printf(" %d", n_name);
42220 printf(" %d", n_namespaceURI);
42221 printf(" %d", n_content);
42222 printf("\n");
42223 }
42224 }
42225 }
42226 }
42227 }
42228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042229 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042230#endif
42231
Daniel Veillard42595322004-11-08 10:52:06 +000042232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042233}
42234
42235
42236static int
42237test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042239
William M. Brack21e4ef22005-01-02 09:53:13 +000042240#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042241 int mem_base;
42242 int ret_val;
42243 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42244 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042245 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042246 int n_data;
42247 int start; /* the position within the data of the first byte to encode */
42248 int n_start;
42249 int len; /* the number of bytes to encode */
42250 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042251
Daniel Veillarde43cc572004-11-03 11:50:29 +000042252 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42253 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
42254 for (n_start = 0;n_start < gen_nb_int;n_start++) {
42255 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042257 writer = gen_xmlTextWriterPtr(n_writer, 0);
42258 data = gen_const_char_ptr(n_data, 1);
42259 start = gen_int(n_start, 2);
42260 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042261
William M. Brackf13f77f2004-11-12 16:03:48 +000042262 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042263 desret_int(ret_val);
42264 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042265 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042266 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042267 des_int(n_start, start, 2);
42268 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042269 xmlResetLastError();
42270 if (mem_base != xmlMemBlocks()) {
42271 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
42272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042273 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042274 printf(" %d", n_writer);
42275 printf(" %d", n_data);
42276 printf(" %d", n_start);
42277 printf(" %d", n_len);
42278 printf("\n");
42279 }
42280 }
42281 }
42282 }
42283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042284 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042285#endif
42286
Daniel Veillard42595322004-11-08 10:52:06 +000042287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042288}
42289
42290
42291static int
42292test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042294
William M. Brack21e4ef22005-01-02 09:53:13 +000042295#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042296 int mem_base;
42297 int ret_val;
42298 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42299 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042300 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042301 int n_data;
42302 int start; /* the position within the data of the first byte to encode */
42303 int n_start;
42304 int len; /* the number of bytes to encode */
42305 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042306
Daniel Veillarde43cc572004-11-03 11:50:29 +000042307 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42308 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
42309 for (n_start = 0;n_start < gen_nb_int;n_start++) {
42310 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042312 writer = gen_xmlTextWriterPtr(n_writer, 0);
42313 data = gen_const_char_ptr(n_data, 1);
42314 start = gen_int(n_start, 2);
42315 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042316
William M. Brackf13f77f2004-11-12 16:03:48 +000042317 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042318 desret_int(ret_val);
42319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042320 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042321 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042322 des_int(n_start, start, 2);
42323 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042324 xmlResetLastError();
42325 if (mem_base != xmlMemBlocks()) {
42326 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
42327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042328 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042329 printf(" %d", n_writer);
42330 printf(" %d", n_data);
42331 printf(" %d", n_start);
42332 printf(" %d", n_len);
42333 printf("\n");
42334 }
42335 }
42336 }
42337 }
42338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042339 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042340#endif
42341
Daniel Veillard42595322004-11-08 10:52:06 +000042342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042343}
42344
42345
42346static int
42347test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042349
William M. Brack21e4ef22005-01-02 09:53:13 +000042350#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042351 int mem_base;
42352 int ret_val;
42353 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42354 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042355 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042356 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042357
Daniel Veillarde43cc572004-11-03 11:50:29 +000042358 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42359 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042361 writer = gen_xmlTextWriterPtr(n_writer, 0);
42362 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042363
William M. Brackf13f77f2004-11-12 16:03:48 +000042364 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042365 desret_int(ret_val);
42366 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042367 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042368 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042369 xmlResetLastError();
42370 if (mem_base != xmlMemBlocks()) {
42371 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
42372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042373 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042374 printf(" %d", n_writer);
42375 printf(" %d", n_content);
42376 printf("\n");
42377 }
42378 }
42379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042380 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042381#endif
42382
Daniel Veillard42595322004-11-08 10:52:06 +000042383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384}
42385
42386
42387static int
42388test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390
William M. Brack21e4ef22005-01-02 09:53:13 +000042391#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042392 int mem_base;
42393 int ret_val;
42394 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42395 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042396 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042397 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042398
Daniel Veillarde43cc572004-11-03 11:50:29 +000042399 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42400 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042402 writer = gen_xmlTextWriterPtr(n_writer, 0);
42403 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042404
William M. Brackf13f77f2004-11-12 16:03:48 +000042405 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042406 desret_int(ret_val);
42407 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042408 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042409 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042410 xmlResetLastError();
42411 if (mem_base != xmlMemBlocks()) {
42412 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
42413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042414 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042415 printf(" %d", n_writer);
42416 printf(" %d", n_content);
42417 printf("\n");
42418 }
42419 }
42420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042421 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042422#endif
42423
Daniel Veillard42595322004-11-08 10:52:06 +000042424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042425}
42426
42427
42428static int
42429test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042431
William M. Brack21e4ef22005-01-02 09:53:13 +000042432#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042433 int mem_base;
42434 int ret_val;
42435 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42436 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042437 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042438 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042439 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042440 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042441 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042442 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042443 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042444 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042445
Daniel Veillarde43cc572004-11-03 11:50:29 +000042446 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42447 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42448 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42449 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42450 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
42451 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042452 writer = gen_xmlTextWriterPtr(n_writer, 0);
42453 name = gen_const_xmlChar_ptr(n_name, 1);
42454 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42455 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
42456 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042457
William M. Brackf13f77f2004-11-12 16:03:48 +000042458 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042459 desret_int(ret_val);
42460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042461 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042462 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42463 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42464 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
42465 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042466 xmlResetLastError();
42467 if (mem_base != xmlMemBlocks()) {
42468 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
42469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042470 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042471 printf(" %d", n_writer);
42472 printf(" %d", n_name);
42473 printf(" %d", n_pubid);
42474 printf(" %d", n_sysid);
42475 printf(" %d", n_subset);
42476 printf("\n");
42477 }
42478 }
42479 }
42480 }
42481 }
42482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042483 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042484#endif
42485
Daniel Veillard42595322004-11-08 10:52:06 +000042486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042487}
42488
42489
42490static int
42491test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042493
William M. Brack21e4ef22005-01-02 09:53:13 +000042494#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042495 int mem_base;
42496 int ret_val;
42497 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42498 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042499 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042500 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042501 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042502 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042503
Daniel Veillarde43cc572004-11-03 11:50:29 +000042504 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42505 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42506 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42507 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042508 writer = gen_xmlTextWriterPtr(n_writer, 0);
42509 name = gen_const_xmlChar_ptr(n_name, 1);
42510 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042511
William M. Brackf13f77f2004-11-12 16:03:48 +000042512 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042513 desret_int(ret_val);
42514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042515 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042516 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42517 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042518 xmlResetLastError();
42519 if (mem_base != xmlMemBlocks()) {
42520 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
42521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042522 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042523 printf(" %d", n_writer);
42524 printf(" %d", n_name);
42525 printf(" %d", n_content);
42526 printf("\n");
42527 }
42528 }
42529 }
42530 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042531 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042532#endif
42533
Daniel Veillard42595322004-11-08 10:52:06 +000042534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042535}
42536
42537
42538static int
42539test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042541
William M. Brack21e4ef22005-01-02 09:53:13 +000042542#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042543 int mem_base;
42544 int ret_val;
42545 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42546 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042547 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042548 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042549 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042550 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042551
Daniel Veillarde43cc572004-11-03 11:50:29 +000042552 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42553 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42554 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042556 writer = gen_xmlTextWriterPtr(n_writer, 0);
42557 name = gen_const_xmlChar_ptr(n_name, 1);
42558 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042559
William M. Brackf13f77f2004-11-12 16:03:48 +000042560 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042561 desret_int(ret_val);
42562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042563 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042564 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42565 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042566 xmlResetLastError();
42567 if (mem_base != xmlMemBlocks()) {
42568 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
42569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042570 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042571 printf(" %d", n_writer);
42572 printf(" %d", n_name);
42573 printf(" %d", n_content);
42574 printf("\n");
42575 }
42576 }
42577 }
42578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042579 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042580#endif
42581
Daniel Veillard42595322004-11-08 10:52:06 +000042582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042583}
42584
42585
42586static int
42587test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042589
William M. Brack21e4ef22005-01-02 09:53:13 +000042590#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042591 int mem_base;
42592 int ret_val;
42593 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42594 int n_writer;
42595 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42596 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042597 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042598 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042599 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042600 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042601 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042602 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042603 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042604 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042605 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042606 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042607
Daniel Veillarde43cc572004-11-03 11:50:29 +000042608 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42609 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42610 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42611 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42612 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42613 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42614 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42615 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042616 writer = gen_xmlTextWriterPtr(n_writer, 0);
42617 pe = gen_int(n_pe, 1);
42618 name = gen_const_xmlChar_ptr(n_name, 2);
42619 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42620 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42621 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
42622 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042623
William M. Brackf13f77f2004-11-12 16:03:48 +000042624 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 +000042625 desret_int(ret_val);
42626 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042627 des_xmlTextWriterPtr(n_writer, writer, 0);
42628 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042629 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42630 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42631 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42632 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
42633 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042634 xmlResetLastError();
42635 if (mem_base != xmlMemBlocks()) {
42636 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
42637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042638 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042639 printf(" %d", n_writer);
42640 printf(" %d", n_pe);
42641 printf(" %d", n_name);
42642 printf(" %d", n_pubid);
42643 printf(" %d", n_sysid);
42644 printf(" %d", n_ndataid);
42645 printf(" %d", n_content);
42646 printf("\n");
42647 }
42648 }
42649 }
42650 }
42651 }
42652 }
42653 }
42654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042655 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042656#endif
42657
Daniel Veillard42595322004-11-08 10:52:06 +000042658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042659}
42660
42661
42662static int
42663test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042665
William M. Brack21e4ef22005-01-02 09:53:13 +000042666#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042667 int mem_base;
42668 int ret_val;
42669 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42670 int n_writer;
42671 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42672 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042673 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042674 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042675 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042676 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042677 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042678 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042679 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042680 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042681
Daniel Veillarde43cc572004-11-03 11:50:29 +000042682 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42683 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42684 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42685 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42686 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42687 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042689 writer = gen_xmlTextWriterPtr(n_writer, 0);
42690 pe = gen_int(n_pe, 1);
42691 name = gen_const_xmlChar_ptr(n_name, 2);
42692 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42693 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42694 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042695
William M. Brackf13f77f2004-11-12 16:03:48 +000042696 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042697 desret_int(ret_val);
42698 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042699 des_xmlTextWriterPtr(n_writer, writer, 0);
42700 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042701 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42702 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42703 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42704 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042705 xmlResetLastError();
42706 if (mem_base != xmlMemBlocks()) {
42707 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
42708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042709 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042710 printf(" %d", n_writer);
42711 printf(" %d", n_pe);
42712 printf(" %d", n_name);
42713 printf(" %d", n_pubid);
42714 printf(" %d", n_sysid);
42715 printf(" %d", n_ndataid);
42716 printf("\n");
42717 }
42718 }
42719 }
42720 }
42721 }
42722 }
42723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042724 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042725#endif
42726
Daniel Veillard42595322004-11-08 10:52:06 +000042727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042728}
42729
42730
42731static int
42732test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042734
William M. Brack21e4ef22005-01-02 09:53:13 +000042735#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042736 int mem_base;
42737 int ret_val;
42738 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42739 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042740 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042741 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042742 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042743 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042744 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042745 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042746
Daniel Veillarde43cc572004-11-03 11:50:29 +000042747 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42748 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42749 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42750 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42751 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042752 writer = gen_xmlTextWriterPtr(n_writer, 0);
42753 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42754 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42755 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042756
William M. Brackf13f77f2004-11-12 16:03:48 +000042757 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042758 desret_int(ret_val);
42759 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042760 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042761 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42762 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42763 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042764 xmlResetLastError();
42765 if (mem_base != xmlMemBlocks()) {
42766 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042768 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042769 printf(" %d", n_writer);
42770 printf(" %d", n_pubid);
42771 printf(" %d", n_sysid);
42772 printf(" %d", n_ndataid);
42773 printf("\n");
42774 }
42775 }
42776 }
42777 }
42778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042779 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042780#endif
42781
Daniel Veillard42595322004-11-08 10:52:06 +000042782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042783}
42784
42785
42786static int
42787test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042789
William M. Brack21e4ef22005-01-02 09:53:13 +000042790#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042791 int mem_base;
42792 int ret_val;
42793 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42794 int n_writer;
42795 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42796 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042797 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042798 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042799 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042800 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042801
Daniel Veillarde43cc572004-11-03 11:50:29 +000042802 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42803 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42804 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42805 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42806 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042807 writer = gen_xmlTextWriterPtr(n_writer, 0);
42808 pe = gen_int(n_pe, 1);
42809 name = gen_const_xmlChar_ptr(n_name, 2);
42810 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042811
William M. Brackf13f77f2004-11-12 16:03:48 +000042812 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042813 desret_int(ret_val);
42814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042815 des_xmlTextWriterPtr(n_writer, writer, 0);
42816 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042817 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42818 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042819 xmlResetLastError();
42820 if (mem_base != xmlMemBlocks()) {
42821 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042823 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042824 printf(" %d", n_writer);
42825 printf(" %d", n_pe);
42826 printf(" %d", n_name);
42827 printf(" %d", n_content);
42828 printf("\n");
42829 }
42830 }
42831 }
42832 }
42833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042834 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042835#endif
42836
Daniel Veillard42595322004-11-08 10:52:06 +000042837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042838}
42839
42840
42841static int
42842test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042844
William M. Brack21e4ef22005-01-02 09:53:13 +000042845#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042846 int mem_base;
42847 int ret_val;
42848 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42849 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042850 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042851 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042852 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042853 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042854 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042855 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042856
Daniel Veillarde43cc572004-11-03 11:50:29 +000042857 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42858 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42859 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42860 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042862 writer = gen_xmlTextWriterPtr(n_writer, 0);
42863 name = gen_const_xmlChar_ptr(n_name, 1);
42864 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42865 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042866
William M. Brackf13f77f2004-11-12 16:03:48 +000042867 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042868 desret_int(ret_val);
42869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042870 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042871 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42872 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42873 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042874 xmlResetLastError();
42875 if (mem_base != xmlMemBlocks()) {
42876 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042878 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042879 printf(" %d", n_writer);
42880 printf(" %d", n_name);
42881 printf(" %d", n_pubid);
42882 printf(" %d", n_sysid);
42883 printf("\n");
42884 }
42885 }
42886 }
42887 }
42888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042889 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042890#endif
42891
Daniel Veillard42595322004-11-08 10:52:06 +000042892 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042893}
42894
42895
42896static int
42897test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042899
William M. Brack21e4ef22005-01-02 09:53:13 +000042900#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042901 int mem_base;
42902 int ret_val;
42903 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42904 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042905 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042906 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042907 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042908 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042909
Daniel Veillarde43cc572004-11-03 11:50:29 +000042910 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42912 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042914 writer = gen_xmlTextWriterPtr(n_writer, 0);
42915 name = gen_const_xmlChar_ptr(n_name, 1);
42916 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042917
William M. Brackf13f77f2004-11-12 16:03:48 +000042918 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042919 desret_int(ret_val);
42920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042921 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042922 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42923 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042924 xmlResetLastError();
42925 if (mem_base != xmlMemBlocks()) {
42926 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042928 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042929 printf(" %d", n_writer);
42930 printf(" %d", n_name);
42931 printf(" %d", n_content);
42932 printf("\n");
42933 }
42934 }
42935 }
42936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042937 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042938#endif
42939
Daniel Veillard42595322004-11-08 10:52:06 +000042940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042941}
42942
42943
42944static int
42945test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042947
William M. Brack21e4ef22005-01-02 09:53:13 +000042948#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042949 int mem_base;
42950 int ret_val;
42951 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42952 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042953 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042954 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042955 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042956 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042957 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042958 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042959 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042960 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042961
Daniel Veillarde43cc572004-11-03 11:50:29 +000042962 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42963 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42964 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42965 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42966 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042968 writer = gen_xmlTextWriterPtr(n_writer, 0);
42969 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42970 name = gen_const_xmlChar_ptr(n_name, 2);
42971 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42972 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042973
William M. Brackf13f77f2004-11-12 16:03:48 +000042974 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042975 desret_int(ret_val);
42976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042977 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042978 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42979 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42980 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42981 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042982 xmlResetLastError();
42983 if (mem_base != xmlMemBlocks()) {
42984 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042986 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042987 printf(" %d", n_writer);
42988 printf(" %d", n_prefix);
42989 printf(" %d", n_name);
42990 printf(" %d", n_namespaceURI);
42991 printf(" %d", n_content);
42992 printf("\n");
42993 }
42994 }
42995 }
42996 }
42997 }
42998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042999 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043000#endif
43001
Daniel Veillard42595322004-11-08 10:52:06 +000043002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043003}
43004
43005
43006static int
43007test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043009
43010
43011 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043013}
43014
43015
43016static int
43017test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043019
43020
43021 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043023}
43024
43025
43026static int
43027test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043029
43030
43031 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043033}
43034
43035
43036static int
43037test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043039
43040
43041 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043043}
43044
43045
43046static int
43047test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043049
43050
43051 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043053}
43054
43055
43056static int
43057test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043059
43060
43061 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043063}
43064
43065
43066static int
43067test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043069
43070
43071 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043073}
43074
43075
43076static int
43077test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043079
43080
43081 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043083}
43084
43085
43086static int
43087test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043089
43090
43091 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043093}
43094
43095
43096static int
43097test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043099
43100
43101 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043103}
43104
43105
43106static int
43107test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043109
43110
43111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043113}
43114
43115
43116static int
43117test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043119
43120
43121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043123}
43124
43125
43126static int
43127test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043129
43130
43131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043133}
43134
43135
43136static int
43137test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043139
William M. Brack21e4ef22005-01-02 09:53:13 +000043140#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043141 int mem_base;
43142 int ret_val;
43143 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43144 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043145 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043146 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043147 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043148 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043149
Daniel Veillarde43cc572004-11-03 11:50:29 +000043150 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43151 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
43152 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043154 writer = gen_xmlTextWriterPtr(n_writer, 0);
43155 target = gen_const_xmlChar_ptr(n_target, 1);
43156 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043157
William M. Brackf13f77f2004-11-12 16:03:48 +000043158 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043159 desret_int(ret_val);
43160 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043161 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043162 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
43163 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043164 xmlResetLastError();
43165 if (mem_base != xmlMemBlocks()) {
43166 printf("Leak of %d blocks found in xmlTextWriterWritePI",
43167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043168 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043169 printf(" %d", n_writer);
43170 printf(" %d", n_target);
43171 printf(" %d", n_content);
43172 printf("\n");
43173 }
43174 }
43175 }
43176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043177 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043178#endif
43179
Daniel Veillard42595322004-11-08 10:52:06 +000043180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043181}
43182
43183
43184static int
43185test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043187
William M. Brack21e4ef22005-01-02 09:53:13 +000043188#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043189 int mem_base;
43190 int ret_val;
43191 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43192 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043193 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043194 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043195
Daniel Veillarde43cc572004-11-03 11:50:29 +000043196 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43197 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043199 writer = gen_xmlTextWriterPtr(n_writer, 0);
43200 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043201
William M. Brackf13f77f2004-11-12 16:03:48 +000043202 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043203 desret_int(ret_val);
43204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043205 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043206 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043207 xmlResetLastError();
43208 if (mem_base != xmlMemBlocks()) {
43209 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
43210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043211 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043212 printf(" %d", n_writer);
43213 printf(" %d", n_content);
43214 printf("\n");
43215 }
43216 }
43217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043218 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043219#endif
43220
Daniel Veillard42595322004-11-08 10:52:06 +000043221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043222}
43223
43224
43225static int
43226test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043228
William M. Brack21e4ef22005-01-02 09:53:13 +000043229#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043230 int mem_base;
43231 int ret_val;
43232 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43233 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043234 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043235 int n_content;
43236 int len; /* length of the text string */
43237 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043238
Daniel Veillarde43cc572004-11-03 11:50:29 +000043239 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43240 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43241 for (n_len = 0;n_len < gen_nb_int;n_len++) {
43242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043243 writer = gen_xmlTextWriterPtr(n_writer, 0);
43244 content = gen_const_xmlChar_ptr(n_content, 1);
43245 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043246
William M. Brackf13f77f2004-11-12 16:03:48 +000043247 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043248 desret_int(ret_val);
43249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043250 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043251 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000043252 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043253 xmlResetLastError();
43254 if (mem_base != xmlMemBlocks()) {
43255 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
43256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043257 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043258 printf(" %d", n_writer);
43259 printf(" %d", n_content);
43260 printf(" %d", n_len);
43261 printf("\n");
43262 }
43263 }
43264 }
43265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043266 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043267#endif
43268
Daniel Veillard42595322004-11-08 10:52:06 +000043269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043270}
43271
43272
43273static int
43274test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043276
William M. Brack21e4ef22005-01-02 09:53:13 +000043277#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043278 int mem_base;
43279 int ret_val;
43280 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43281 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043282 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043283 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043284
Daniel Veillarde43cc572004-11-03 11:50:29 +000043285 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43286 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043288 writer = gen_xmlTextWriterPtr(n_writer, 0);
43289 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043290
William M. Brackf13f77f2004-11-12 16:03:48 +000043291 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043292 desret_int(ret_val);
43293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043294 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043295 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043296 xmlResetLastError();
43297 if (mem_base != xmlMemBlocks()) {
43298 printf("Leak of %d blocks found in xmlTextWriterWriteString",
43299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043300 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043301 printf(" %d", n_writer);
43302 printf(" %d", n_content);
43303 printf("\n");
43304 }
43305 }
43306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043307 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043308#endif
43309
Daniel Veillard42595322004-11-08 10:52:06 +000043310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043311}
43312
43313
43314static int
43315test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043317
43318
43319 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043321}
43322
43323
43324static int
43325test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043327
43328
43329 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043331}
43332
43333
43334static int
43335test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043337
43338
43339 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043341}
43342
43343
43344static int
43345test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043347
43348
43349 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043351}
43352
43353
43354static int
43355test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043357
43358
43359 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043361}
43362
43363
43364static int
43365test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043367
43368
43369 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043371}
43372
43373
43374static int
43375test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043377
43378
43379 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043381}
43382
43383
43384static int
43385test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043387
43388
43389 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043391}
43392
43393
43394static int
43395test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043397
43398
43399 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043401}
43402
43403
43404static int
43405test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043407
43408
43409 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043411}
43412
43413
43414static int
43415test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043417
43418
43419 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043421}
43422
43423
43424static int
43425test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043427
43428
43429 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043431}
43432
43433
43434static int
43435test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043437
43438
43439 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043441}
43442
43443static int
43444test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043446
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043447 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043448 test_ret += test_xmlNewTextWriter();
43449 test_ret += test_xmlNewTextWriterFilename();
43450 test_ret += test_xmlNewTextWriterMemory();
43451 test_ret += test_xmlNewTextWriterPushParser();
43452 test_ret += test_xmlNewTextWriterTree();
43453 test_ret += test_xmlTextWriterEndAttribute();
43454 test_ret += test_xmlTextWriterEndCDATA();
43455 test_ret += test_xmlTextWriterEndComment();
43456 test_ret += test_xmlTextWriterEndDTD();
43457 test_ret += test_xmlTextWriterEndDTDAttlist();
43458 test_ret += test_xmlTextWriterEndDTDElement();
43459 test_ret += test_xmlTextWriterEndDTDEntity();
43460 test_ret += test_xmlTextWriterEndDocument();
43461 test_ret += test_xmlTextWriterEndElement();
43462 test_ret += test_xmlTextWriterEndPI();
43463 test_ret += test_xmlTextWriterFlush();
43464 test_ret += test_xmlTextWriterFullEndElement();
43465 test_ret += test_xmlTextWriterSetIndent();
43466 test_ret += test_xmlTextWriterSetIndentString();
43467 test_ret += test_xmlTextWriterStartAttribute();
43468 test_ret += test_xmlTextWriterStartAttributeNS();
43469 test_ret += test_xmlTextWriterStartCDATA();
43470 test_ret += test_xmlTextWriterStartComment();
43471 test_ret += test_xmlTextWriterStartDTD();
43472 test_ret += test_xmlTextWriterStartDTDAttlist();
43473 test_ret += test_xmlTextWriterStartDTDElement();
43474 test_ret += test_xmlTextWriterStartDTDEntity();
43475 test_ret += test_xmlTextWriterStartDocument();
43476 test_ret += test_xmlTextWriterStartElement();
43477 test_ret += test_xmlTextWriterStartElementNS();
43478 test_ret += test_xmlTextWriterStartPI();
43479 test_ret += test_xmlTextWriterWriteAttribute();
43480 test_ret += test_xmlTextWriterWriteAttributeNS();
43481 test_ret += test_xmlTextWriterWriteBase64();
43482 test_ret += test_xmlTextWriterWriteBinHex();
43483 test_ret += test_xmlTextWriterWriteCDATA();
43484 test_ret += test_xmlTextWriterWriteComment();
43485 test_ret += test_xmlTextWriterWriteDTD();
43486 test_ret += test_xmlTextWriterWriteDTDAttlist();
43487 test_ret += test_xmlTextWriterWriteDTDElement();
43488 test_ret += test_xmlTextWriterWriteDTDEntity();
43489 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
43490 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
43491 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
43492 test_ret += test_xmlTextWriterWriteDTDNotation();
43493 test_ret += test_xmlTextWriterWriteElement();
43494 test_ret += test_xmlTextWriterWriteElementNS();
43495 test_ret += test_xmlTextWriterWriteFormatAttribute();
43496 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
43497 test_ret += test_xmlTextWriterWriteFormatCDATA();
43498 test_ret += test_xmlTextWriterWriteFormatComment();
43499 test_ret += test_xmlTextWriterWriteFormatDTD();
43500 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
43501 test_ret += test_xmlTextWriterWriteFormatDTDElement();
43502 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
43503 test_ret += test_xmlTextWriterWriteFormatElement();
43504 test_ret += test_xmlTextWriterWriteFormatElementNS();
43505 test_ret += test_xmlTextWriterWriteFormatPI();
43506 test_ret += test_xmlTextWriterWriteFormatRaw();
43507 test_ret += test_xmlTextWriterWriteFormatString();
43508 test_ret += test_xmlTextWriterWritePI();
43509 test_ret += test_xmlTextWriterWriteRaw();
43510 test_ret += test_xmlTextWriterWriteRawLen();
43511 test_ret += test_xmlTextWriterWriteString();
43512 test_ret += test_xmlTextWriterWriteVFormatAttribute();
43513 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
43514 test_ret += test_xmlTextWriterWriteVFormatCDATA();
43515 test_ret += test_xmlTextWriterWriteVFormatComment();
43516 test_ret += test_xmlTextWriterWriteVFormatDTD();
43517 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
43518 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
43519 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
43520 test_ret += test_xmlTextWriterWriteVFormatElement();
43521 test_ret += test_xmlTextWriterWriteVFormatElementNS();
43522 test_ret += test_xmlTextWriterWriteVFormatPI();
43523 test_ret += test_xmlTextWriterWriteVFormatRaw();
43524 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043525
Daniel Veillard42595322004-11-08 10:52:06 +000043526 if (test_ret != 0)
43527 printf("Module xmlwriter: %d errors\n", test_ret);
43528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043529}
43530
43531static int
43532test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043534
William M. Brack21e4ef22005-01-02 09:53:13 +000043535#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043536 int mem_base;
43537 double ret_val;
43538 int val; /* a boolean */
43539 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043540
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043541 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43542 mem_base = xmlMemBlocks();
43543 val = gen_int(n_val, 0);
43544
43545 ret_val = xmlXPathCastBooleanToNumber(val);
43546 desret_double(ret_val);
43547 call_tests++;
43548 des_int(n_val, val, 0);
43549 xmlResetLastError();
43550 if (mem_base != xmlMemBlocks()) {
43551 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
43552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043553 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043554 printf(" %d", n_val);
43555 printf("\n");
43556 }
43557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043558 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043559#endif
43560
Daniel Veillard42595322004-11-08 10:52:06 +000043561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043562}
43563
43564
43565static int
43566test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043568
William M. Brack21e4ef22005-01-02 09:53:13 +000043569#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043570 int mem_base;
43571 xmlChar * ret_val;
43572 int val; /* a boolean */
43573 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043574
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043575 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43576 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043577 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043578
43579 ret_val = xmlXPathCastBooleanToString(val);
43580 desret_xmlChar_ptr(ret_val);
43581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043582 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043583 xmlResetLastError();
43584 if (mem_base != xmlMemBlocks()) {
43585 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
43586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043587 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043588 printf(" %d", n_val);
43589 printf("\n");
43590 }
43591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043592 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043593#endif
43594
Daniel Veillard42595322004-11-08 10:52:06 +000043595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043596}
43597
43598
43599static int
43600test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043602
William M. Brack21e4ef22005-01-02 09:53:13 +000043603#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043604 int mem_base;
43605 int ret_val;
43606 xmlNodeSetPtr ns; /* a node-set */
43607 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043608
Daniel Veillardce682bc2004-11-05 17:22:25 +000043609 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43610 mem_base = xmlMemBlocks();
43611 ns = gen_xmlNodeSetPtr(n_ns, 0);
43612
43613 ret_val = xmlXPathCastNodeSetToBoolean(ns);
43614 desret_int(ret_val);
43615 call_tests++;
43616 des_xmlNodeSetPtr(n_ns, ns, 0);
43617 xmlResetLastError();
43618 if (mem_base != xmlMemBlocks()) {
43619 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
43620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043621 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043622 printf(" %d", n_ns);
43623 printf("\n");
43624 }
43625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043626 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043627#endif
43628
Daniel Veillard42595322004-11-08 10:52:06 +000043629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043630}
43631
43632
43633static int
43634test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043636
William M. Brack21e4ef22005-01-02 09:53:13 +000043637#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043638 int mem_base;
43639 double ret_val;
43640 xmlNodeSetPtr ns; /* a node-set */
43641 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043642
Daniel Veillardce682bc2004-11-05 17:22:25 +000043643 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43644 mem_base = xmlMemBlocks();
43645 ns = gen_xmlNodeSetPtr(n_ns, 0);
43646
43647 ret_val = xmlXPathCastNodeSetToNumber(ns);
43648 desret_double(ret_val);
43649 call_tests++;
43650 des_xmlNodeSetPtr(n_ns, ns, 0);
43651 xmlResetLastError();
43652 if (mem_base != xmlMemBlocks()) {
43653 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
43654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043655 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043656 printf(" %d", n_ns);
43657 printf("\n");
43658 }
43659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043660 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043661#endif
43662
Daniel Veillard42595322004-11-08 10:52:06 +000043663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043664}
43665
43666
43667static int
43668test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043670
William M. Brack21e4ef22005-01-02 09:53:13 +000043671#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043672 int mem_base;
43673 xmlChar * ret_val;
43674 xmlNodeSetPtr ns; /* a node-set */
43675 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043676
Daniel Veillardce682bc2004-11-05 17:22:25 +000043677 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43678 mem_base = xmlMemBlocks();
43679 ns = gen_xmlNodeSetPtr(n_ns, 0);
43680
43681 ret_val = xmlXPathCastNodeSetToString(ns);
43682 desret_xmlChar_ptr(ret_val);
43683 call_tests++;
43684 des_xmlNodeSetPtr(n_ns, ns, 0);
43685 xmlResetLastError();
43686 if (mem_base != xmlMemBlocks()) {
43687 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
43688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043690 printf(" %d", n_ns);
43691 printf("\n");
43692 }
43693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043694 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043695#endif
43696
Daniel Veillard42595322004-11-08 10:52:06 +000043697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043698}
43699
43700
43701static int
43702test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043704
William M. Brack21e4ef22005-01-02 09:53:13 +000043705#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043706 int mem_base;
43707 double ret_val;
43708 xmlNodePtr node; /* a node */
43709 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043710
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043711 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43712 mem_base = xmlMemBlocks();
43713 node = gen_xmlNodePtr(n_node, 0);
43714
43715 ret_val = xmlXPathCastNodeToNumber(node);
43716 desret_double(ret_val);
43717 call_tests++;
43718 des_xmlNodePtr(n_node, node, 0);
43719 xmlResetLastError();
43720 if (mem_base != xmlMemBlocks()) {
43721 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043723 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043724 printf(" %d", n_node);
43725 printf("\n");
43726 }
43727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043728 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043729#endif
43730
Daniel Veillard42595322004-11-08 10:52:06 +000043731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043732}
43733
43734
43735static int
43736test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043738
William M. Brack21e4ef22005-01-02 09:53:13 +000043739#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043740 int mem_base;
43741 xmlChar * ret_val;
43742 xmlNodePtr node; /* a node */
43743 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043744
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043745 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043747 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043748
43749 ret_val = xmlXPathCastNodeToString(node);
43750 desret_xmlChar_ptr(ret_val);
43751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043752 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043753 xmlResetLastError();
43754 if (mem_base != xmlMemBlocks()) {
43755 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043757 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043758 printf(" %d", n_node);
43759 printf("\n");
43760 }
43761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043762 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043763#endif
43764
Daniel Veillard42595322004-11-08 10:52:06 +000043765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043766}
43767
43768
43769static int
43770test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043772
William M. Brack21e4ef22005-01-02 09:53:13 +000043773#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043774 int mem_base;
43775 int ret_val;
43776 double val; /* a number */
43777 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043778
Daniel Veillard3d95c732004-11-06 22:25:14 +000043779 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43780 mem_base = xmlMemBlocks();
43781 val = gen_double(n_val, 0);
43782
43783 ret_val = xmlXPathCastNumberToBoolean(val);
43784 desret_int(ret_val);
43785 call_tests++;
43786 des_double(n_val, val, 0);
43787 xmlResetLastError();
43788 if (mem_base != xmlMemBlocks()) {
43789 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043791 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043792 printf(" %d", n_val);
43793 printf("\n");
43794 }
43795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043796 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043797#endif
43798
Daniel Veillard42595322004-11-08 10:52:06 +000043799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043800}
43801
43802
43803static int
43804test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043806
William M. Brack21e4ef22005-01-02 09:53:13 +000043807#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043808 int mem_base;
43809 xmlChar * ret_val;
43810 double val; /* a number */
43811 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043812
Daniel Veillard3d95c732004-11-06 22:25:14 +000043813 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43814 mem_base = xmlMemBlocks();
43815 val = gen_double(n_val, 0);
43816
43817 ret_val = xmlXPathCastNumberToString(val);
43818 desret_xmlChar_ptr(ret_val);
43819 call_tests++;
43820 des_double(n_val, val, 0);
43821 xmlResetLastError();
43822 if (mem_base != xmlMemBlocks()) {
43823 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043825 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043826 printf(" %d", n_val);
43827 printf("\n");
43828 }
43829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043830 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043831#endif
43832
Daniel Veillard42595322004-11-08 10:52:06 +000043833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043834}
43835
43836
43837static int
43838test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043840
William M. Brack21e4ef22005-01-02 09:53:13 +000043841#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043842 int mem_base;
43843 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043844 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043845 int n_val;
43846
43847 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043849 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043850
William M. Brackf13f77f2004-11-12 16:03:48 +000043851 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043852 desret_int(ret_val);
43853 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043854 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043855 xmlResetLastError();
43856 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043857 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043859 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043860 printf(" %d", n_val);
43861 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043862 }
43863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043864 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043865#endif
43866
Daniel Veillard42595322004-11-08 10:52:06 +000043867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043868}
43869
43870
43871static int
43872test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043874
William M. Brack21e4ef22005-01-02 09:53:13 +000043875#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043876 int mem_base;
43877 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043878 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043879 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043880
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043881 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43882 mem_base = xmlMemBlocks();
43883 val = gen_const_xmlChar_ptr(n_val, 0);
43884
William M. Brackf13f77f2004-11-12 16:03:48 +000043885 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043886 desret_double(ret_val);
43887 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043888 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043889 xmlResetLastError();
43890 if (mem_base != xmlMemBlocks()) {
43891 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043893 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043894 printf(" %d", n_val);
43895 printf("\n");
43896 }
43897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043898 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043899#endif
43900
Daniel Veillard42595322004-11-08 10:52:06 +000043901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043902}
43903
43904
43905static int
43906test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043908
William M. Brack21e4ef22005-01-02 09:53:13 +000043909#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043910 int mem_base;
43911 int ret_val;
43912 xmlXPathObjectPtr val; /* an XPath object */
43913 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043914
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043915 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043917 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043918
43919 ret_val = xmlXPathCastToBoolean(val);
43920 desret_int(ret_val);
43921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043922 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043923 xmlResetLastError();
43924 if (mem_base != xmlMemBlocks()) {
43925 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043927 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043928 printf(" %d", n_val);
43929 printf("\n");
43930 }
43931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043932 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043933#endif
43934
Daniel Veillard42595322004-11-08 10:52:06 +000043935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043936}
43937
43938
43939static int
43940test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043942
William M. Brack21e4ef22005-01-02 09:53:13 +000043943#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043944 int mem_base;
43945 double ret_val;
43946 xmlXPathObjectPtr val; /* an XPath object */
43947 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043948
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043949 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43950 mem_base = xmlMemBlocks();
43951 val = gen_xmlXPathObjectPtr(n_val, 0);
43952
43953 ret_val = xmlXPathCastToNumber(val);
43954 desret_double(ret_val);
43955 call_tests++;
43956 des_xmlXPathObjectPtr(n_val, val, 0);
43957 xmlResetLastError();
43958 if (mem_base != xmlMemBlocks()) {
43959 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043961 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043962 printf(" %d", n_val);
43963 printf("\n");
43964 }
43965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043966 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043967#endif
43968
Daniel Veillard42595322004-11-08 10:52:06 +000043969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043970}
43971
43972
43973static int
43974test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043976
William M. Brack21e4ef22005-01-02 09:53:13 +000043977#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043978 int mem_base;
43979 xmlChar * ret_val;
43980 xmlXPathObjectPtr val; /* an XPath object */
43981 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043982
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043983 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43984 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043985 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043986
43987 ret_val = xmlXPathCastToString(val);
43988 desret_xmlChar_ptr(ret_val);
43989 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043990 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043991 xmlResetLastError();
43992 if (mem_base != xmlMemBlocks()) {
43993 printf("Leak of %d blocks found in xmlXPathCastToString",
43994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043995 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043996 printf(" %d", n_val);
43997 printf("\n");
43998 }
43999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044000 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044001#endif
44002
Daniel Veillard42595322004-11-08 10:52:06 +000044003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044004}
44005
44006
44007static int
44008test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044010
William M. Brack21e4ef22005-01-02 09:53:13 +000044011#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000044012 int mem_base;
44013 int ret_val;
44014 xmlNodePtr node1; /* the first node */
44015 int n_node1;
44016 xmlNodePtr node2; /* the second node */
44017 int n_node2;
44018
44019 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
44020 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
44021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000044022 node1 = gen_xmlNodePtr(n_node1, 0);
44023 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044024
44025 ret_val = xmlXPathCmpNodes(node1, node2);
44026 desret_int(ret_val);
44027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044028 des_xmlNodePtr(n_node1, node1, 0);
44029 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044030 xmlResetLastError();
44031 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000044032 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000044033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044034 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000044035 printf(" %d", n_node1);
44036 printf(" %d", n_node2);
44037 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000044038 }
44039 }
44040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044041 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044042#endif
44043
Daniel Veillard42595322004-11-08 10:52:06 +000044044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044045}
44046
44047
44048static int
44049test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044051
44052
44053 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044055}
44056
Daniel Veillarda521d282004-11-09 14:59:59 +000044057#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044058
Daniel Veillardce682bc2004-11-05 17:22:25 +000044059#define gen_nb_xmlXPathCompExprPtr 1
44060static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44061 return(NULL);
44062}
44063static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44064}
Daniel Veillarda521d282004-11-09 14:59:59 +000044065#endif
44066
44067#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000044068
44069#define gen_nb_xmlXPathContextPtr 1
44070static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44071 return(NULL);
44072}
44073static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44074}
Daniel Veillarda521d282004-11-09 14:59:59 +000044075#endif
44076
Daniel Veillardce682bc2004-11-05 17:22:25 +000044077
Daniel Veillardd93f6252004-11-02 15:53:51 +000044078static int
44079test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044081
William M. Brack21e4ef22005-01-02 09:53:13 +000044082#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044083 int mem_base;
44084 xmlXPathObjectPtr ret_val;
44085 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
44086 int n_comp;
44087 xmlXPathContextPtr ctx; /* the XPath context */
44088 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044089
Daniel Veillardce682bc2004-11-05 17:22:25 +000044090 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44091 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
44092 mem_base = xmlMemBlocks();
44093 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
44094 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
44095
44096 ret_val = xmlXPathCompiledEval(comp, ctx);
44097 desret_xmlXPathObjectPtr(ret_val);
44098 call_tests++;
44099 des_xmlXPathCompExprPtr(n_comp, comp, 0);
44100 des_xmlXPathContextPtr(n_ctx, ctx, 1);
44101 xmlResetLastError();
44102 if (mem_base != xmlMemBlocks()) {
44103 printf("Leak of %d blocks found in xmlXPathCompiledEval",
44104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044105 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044106 printf(" %d", n_comp);
44107 printf(" %d", n_ctx);
44108 printf("\n");
44109 }
44110 }
44111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044112 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044113#endif
44114
Daniel Veillard42595322004-11-08 10:52:06 +000044115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044116}
44117
44118
44119static int
44120test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044122
William M. Brack21e4ef22005-01-02 09:53:13 +000044123#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044124 int mem_base;
44125 xmlXPathObjectPtr ret_val;
44126 xmlXPathObjectPtr val; /* an XPath object */
44127 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044128
Daniel Veillard3d97e662004-11-04 10:49:00 +000044129 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44130 mem_base = xmlMemBlocks();
44131 val = gen_xmlXPathObjectPtr(n_val, 0);
44132
44133 ret_val = xmlXPathConvertBoolean(val);
44134 val = NULL;
44135 desret_xmlXPathObjectPtr(ret_val);
44136 call_tests++;
44137 des_xmlXPathObjectPtr(n_val, val, 0);
44138 xmlResetLastError();
44139 if (mem_base != xmlMemBlocks()) {
44140 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
44141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044142 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044143 printf(" %d", n_val);
44144 printf("\n");
44145 }
44146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044147 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044148#endif
44149
Daniel Veillard42595322004-11-08 10:52:06 +000044150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044151}
44152
44153
44154static int
44155test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044157
William M. Brack21e4ef22005-01-02 09:53:13 +000044158#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044159 int mem_base;
44160 xmlXPathObjectPtr ret_val;
44161 xmlXPathObjectPtr val; /* an XPath object */
44162 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044163
Daniel Veillard3d97e662004-11-04 10:49:00 +000044164 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44165 mem_base = xmlMemBlocks();
44166 val = gen_xmlXPathObjectPtr(n_val, 0);
44167
44168 ret_val = xmlXPathConvertNumber(val);
44169 val = NULL;
44170 desret_xmlXPathObjectPtr(ret_val);
44171 call_tests++;
44172 des_xmlXPathObjectPtr(n_val, val, 0);
44173 xmlResetLastError();
44174 if (mem_base != xmlMemBlocks()) {
44175 printf("Leak of %d blocks found in xmlXPathConvertNumber",
44176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044177 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044178 printf(" %d", n_val);
44179 printf("\n");
44180 }
44181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044182 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044183#endif
44184
Daniel Veillard42595322004-11-08 10:52:06 +000044185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044186}
44187
44188
44189static int
44190test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044192
William M. Brack21e4ef22005-01-02 09:53:13 +000044193#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044194 int mem_base;
44195 xmlXPathObjectPtr ret_val;
44196 xmlXPathObjectPtr val; /* an XPath object */
44197 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044198
Daniel Veillard3d97e662004-11-04 10:49:00 +000044199 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44200 mem_base = xmlMemBlocks();
44201 val = gen_xmlXPathObjectPtr(n_val, 0);
44202
44203 ret_val = xmlXPathConvertString(val);
44204 val = NULL;
44205 desret_xmlXPathObjectPtr(ret_val);
44206 call_tests++;
44207 des_xmlXPathObjectPtr(n_val, val, 0);
44208 xmlResetLastError();
44209 if (mem_base != xmlMemBlocks()) {
44210 printf("Leak of %d blocks found in xmlXPathConvertString",
44211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044212 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044213 printf(" %d", n_val);
44214 printf("\n");
44215 }
44216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044217 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044218#endif
44219
Daniel Veillard42595322004-11-08 10:52:06 +000044220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044221}
44222
44223
44224static int
44225test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044227
44228
44229 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044231}
44232
44233
44234static int
44235test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044237
William M. Brack21e4ef22005-01-02 09:53:13 +000044238#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044239 int mem_base;
44240 xmlXPathObjectPtr ret_val;
44241 xmlChar * str; /* the XPath expression */
44242 int n_str;
44243 xmlXPathContextPtr ctx; /* the XPath context */
44244 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044245
Daniel Veillardce682bc2004-11-05 17:22:25 +000044246 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
44247 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
44248 mem_base = xmlMemBlocks();
44249 str = gen_const_xmlChar_ptr(n_str, 0);
44250 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
44251
William M. Brackf13f77f2004-11-12 16:03:48 +000044252 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044253 desret_xmlXPathObjectPtr(ret_val);
44254 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044255 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044256 des_xmlXPathContextPtr(n_ctx, ctx, 1);
44257 xmlResetLastError();
44258 if (mem_base != xmlMemBlocks()) {
44259 printf("Leak of %d blocks found in xmlXPathEval",
44260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044261 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044262 printf(" %d", n_str);
44263 printf(" %d", n_ctx);
44264 printf("\n");
44265 }
44266 }
44267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044268 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044269#endif
44270
Daniel Veillard42595322004-11-08 10:52:06 +000044271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044272}
44273
44274
44275static int
44276test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044278
William M. Brack21e4ef22005-01-02 09:53:13 +000044279#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044280 int mem_base;
44281 xmlXPathObjectPtr ret_val;
44282 xmlChar * str; /* the XPath expression */
44283 int n_str;
44284 xmlXPathContextPtr ctxt; /* the XPath context */
44285 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044286
Daniel Veillardce682bc2004-11-05 17:22:25 +000044287 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
44288 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44289 mem_base = xmlMemBlocks();
44290 str = gen_const_xmlChar_ptr(n_str, 0);
44291 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
44292
William M. Brackf13f77f2004-11-12 16:03:48 +000044293 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044294 desret_xmlXPathObjectPtr(ret_val);
44295 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044296 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044297 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
44298 xmlResetLastError();
44299 if (mem_base != xmlMemBlocks()) {
44300 printf("Leak of %d blocks found in xmlXPathEvalExpression",
44301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044302 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044303 printf(" %d", n_str);
44304 printf(" %d", n_ctxt);
44305 printf("\n");
44306 }
44307 }
44308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044309 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044310#endif
44311
Daniel Veillard42595322004-11-08 10:52:06 +000044312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044313}
44314
44315
44316static int
44317test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044319
William M. Brack21e4ef22005-01-02 09:53:13 +000044320#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044321 int mem_base;
44322 int ret_val;
44323 xmlXPathContextPtr ctxt; /* the XPath context */
44324 int n_ctxt;
44325 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44326 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044327
Daniel Veillardce682bc2004-11-05 17:22:25 +000044328 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44329 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44330 mem_base = xmlMemBlocks();
44331 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44332 res = gen_xmlXPathObjectPtr(n_res, 1);
44333
44334 ret_val = xmlXPathEvalPredicate(ctxt, res);
44335 desret_int(ret_val);
44336 call_tests++;
44337 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44338 des_xmlXPathObjectPtr(n_res, res, 1);
44339 xmlResetLastError();
44340 if (mem_base != xmlMemBlocks()) {
44341 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
44342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044343 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044344 printf(" %d", n_ctxt);
44345 printf(" %d", n_res);
44346 printf("\n");
44347 }
44348 }
44349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044350 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044351#endif
44352
Daniel Veillard42595322004-11-08 10:52:06 +000044353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044354}
44355
44356
44357static int
44358test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044360
William M. Brack21e4ef22005-01-02 09:53:13 +000044361#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000044362 int mem_base;
44363
44364 mem_base = xmlMemBlocks();
44365
44366 xmlXPathInit();
44367 call_tests++;
44368 xmlResetLastError();
44369 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000044370 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000044371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044372 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000044373 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000044374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044375 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044376#endif
44377
Daniel Veillard42595322004-11-08 10:52:06 +000044378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044379}
44380
44381
44382static int
44383test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044385
William M. Brack21e4ef22005-01-02 09:53:13 +000044386#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000044387 int mem_base;
44388 int ret_val;
44389 double val; /* a double value */
44390 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044391
Daniel Veillard3d95c732004-11-06 22:25:14 +000044392 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44393 mem_base = xmlMemBlocks();
44394 val = gen_double(n_val, 0);
44395
44396 ret_val = xmlXPathIsInf(val);
44397 desret_int(ret_val);
44398 call_tests++;
44399 des_double(n_val, val, 0);
44400 xmlResetLastError();
44401 if (mem_base != xmlMemBlocks()) {
44402 printf("Leak of %d blocks found in xmlXPathIsInf",
44403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044404 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044405 printf(" %d", n_val);
44406 printf("\n");
44407 }
44408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044409 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044410#endif
44411
Daniel Veillard42595322004-11-08 10:52:06 +000044412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044413}
44414
44415
44416static int
44417test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044419
William M. Brack21e4ef22005-01-02 09:53:13 +000044420#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000044421 int mem_base;
44422 int ret_val;
44423 double val; /* a double value */
44424 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044425
Daniel Veillard3d95c732004-11-06 22:25:14 +000044426 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44427 mem_base = xmlMemBlocks();
44428 val = gen_double(n_val, 0);
44429
44430 ret_val = xmlXPathIsNaN(val);
44431 desret_int(ret_val);
44432 call_tests++;
44433 des_double(n_val, val, 0);
44434 xmlResetLastError();
44435 if (mem_base != xmlMemBlocks()) {
44436 printf("Leak of %d blocks found in xmlXPathIsNaN",
44437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044438 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044439 printf(" %d", n_val);
44440 printf("\n");
44441 }
44442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044443 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044444#endif
44445
Daniel Veillard42595322004-11-08 10:52:06 +000044446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044447}
44448
44449
44450static int
44451test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044453
44454
44455 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044457}
44458
44459
44460static int
44461test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044463
William M. Brack21e4ef22005-01-02 09:53:13 +000044464#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044465 int mem_base;
44466 xmlNodeSetPtr ret_val;
44467 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
44468 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044469
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044470 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44471 mem_base = xmlMemBlocks();
44472 val = gen_xmlNodePtr(n_val, 0);
44473
44474 ret_val = xmlXPathNodeSetCreate(val);
44475 desret_xmlNodeSetPtr(ret_val);
44476 call_tests++;
44477 des_xmlNodePtr(n_val, val, 0);
44478 xmlResetLastError();
44479 if (mem_base != xmlMemBlocks()) {
44480 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
44481 xmlMemBlocks() - mem_base);
44482 test_ret++;
44483 printf(" %d", n_val);
44484 printf("\n");
44485 }
44486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044487 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044488#endif
44489
Daniel Veillard42595322004-11-08 10:52:06 +000044490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044491}
44492
44493
44494static int
44495test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044497
William M. Brack21e4ef22005-01-02 09:53:13 +000044498#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044499 int mem_base;
44500 xmlXPathObjectPtr ret_val;
44501 xmlXPathObjectPtr val; /* the original object */
44502 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044503
Daniel Veillard3d97e662004-11-04 10:49:00 +000044504 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44505 mem_base = xmlMemBlocks();
44506 val = gen_xmlXPathObjectPtr(n_val, 0);
44507
44508 ret_val = xmlXPathObjectCopy(val);
44509 desret_xmlXPathObjectPtr(ret_val);
44510 call_tests++;
44511 des_xmlXPathObjectPtr(n_val, val, 0);
44512 xmlResetLastError();
44513 if (mem_base != xmlMemBlocks()) {
44514 printf("Leak of %d blocks found in xmlXPathObjectCopy",
44515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044516 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044517 printf(" %d", n_val);
44518 printf("\n");
44519 }
44520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044521 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044522#endif
44523
Daniel Veillard42595322004-11-08 10:52:06 +000044524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044525}
44526
44527
44528static int
44529test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044531
William M. Brack21e4ef22005-01-02 09:53:13 +000044532#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044533 int mem_base;
44534 long ret_val;
44535 xmlDocPtr doc; /* an input document */
44536 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044537
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044538 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
44539 mem_base = xmlMemBlocks();
44540 doc = gen_xmlDocPtr(n_doc, 0);
44541
44542 ret_val = xmlXPathOrderDocElems(doc);
44543 desret_long(ret_val);
44544 call_tests++;
44545 des_xmlDocPtr(n_doc, doc, 0);
44546 xmlResetLastError();
44547 if (mem_base != xmlMemBlocks()) {
44548 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
44549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044550 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044551 printf(" %d", n_doc);
44552 printf("\n");
44553 }
44554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044555 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044556#endif
44557
Daniel Veillard42595322004-11-08 10:52:06 +000044558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044559}
44560
44561static int
44562test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044564
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044565 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000044566 test_ret += test_xmlXPathCastBooleanToNumber();
44567 test_ret += test_xmlXPathCastBooleanToString();
44568 test_ret += test_xmlXPathCastNodeSetToBoolean();
44569 test_ret += test_xmlXPathCastNodeSetToNumber();
44570 test_ret += test_xmlXPathCastNodeSetToString();
44571 test_ret += test_xmlXPathCastNodeToNumber();
44572 test_ret += test_xmlXPathCastNodeToString();
44573 test_ret += test_xmlXPathCastNumberToBoolean();
44574 test_ret += test_xmlXPathCastNumberToString();
44575 test_ret += test_xmlXPathCastStringToBoolean();
44576 test_ret += test_xmlXPathCastStringToNumber();
44577 test_ret += test_xmlXPathCastToBoolean();
44578 test_ret += test_xmlXPathCastToNumber();
44579 test_ret += test_xmlXPathCastToString();
44580 test_ret += test_xmlXPathCmpNodes();
44581 test_ret += test_xmlXPathCompile();
44582 test_ret += test_xmlXPathCompiledEval();
44583 test_ret += test_xmlXPathConvertBoolean();
44584 test_ret += test_xmlXPathConvertNumber();
44585 test_ret += test_xmlXPathConvertString();
44586 test_ret += test_xmlXPathCtxtCompile();
44587 test_ret += test_xmlXPathEval();
44588 test_ret += test_xmlXPathEvalExpression();
44589 test_ret += test_xmlXPathEvalPredicate();
44590 test_ret += test_xmlXPathInit();
44591 test_ret += test_xmlXPathIsInf();
44592 test_ret += test_xmlXPathIsNaN();
44593 test_ret += test_xmlXPathNewContext();
44594 test_ret += test_xmlXPathNodeSetCreate();
44595 test_ret += test_xmlXPathObjectCopy();
44596 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000044597
Daniel Veillard42595322004-11-08 10:52:06 +000044598 if (test_ret != 0)
44599 printf("Module xpath: %d errors\n", test_ret);
44600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044601}
Daniel Veillarda521d282004-11-09 14:59:59 +000044602#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044603
Daniel Veillarda82b1822004-11-08 16:24:57 +000044604#define gen_nb_xmlXPathParserContextPtr 1
44605static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44606 return(NULL);
44607}
44608static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44609}
Daniel Veillarda521d282004-11-09 14:59:59 +000044610#endif
44611
Daniel Veillarda82b1822004-11-08 16:24:57 +000044612
44613static int
44614test_valuePop(void) {
44615 int test_ret = 0;
44616
William M. Brack21e4ef22005-01-02 09:53:13 +000044617#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044618 int mem_base;
44619 xmlXPathObjectPtr ret_val;
44620 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44621 int n_ctxt;
44622
44623 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44624 mem_base = xmlMemBlocks();
44625 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44626
44627 ret_val = valuePop(ctxt);
44628 desret_xmlXPathObjectPtr(ret_val);
44629 call_tests++;
44630 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44631 xmlResetLastError();
44632 if (mem_base != xmlMemBlocks()) {
44633 printf("Leak of %d blocks found in valuePop",
44634 xmlMemBlocks() - mem_base);
44635 test_ret++;
44636 printf(" %d", n_ctxt);
44637 printf("\n");
44638 }
44639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044640 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044641#endif
44642
Daniel Veillarda82b1822004-11-08 16:24:57 +000044643 return(test_ret);
44644}
44645
44646
44647static int
44648test_valuePush(void) {
44649 int test_ret = 0;
44650
William M. Brack21e4ef22005-01-02 09:53:13 +000044651#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044652 int mem_base;
44653 int ret_val;
44654 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44655 int n_ctxt;
44656 xmlXPathObjectPtr value; /* the XPath object */
44657 int n_value;
44658
44659 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44660 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44661 mem_base = xmlMemBlocks();
44662 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44663 value = gen_xmlXPathObjectPtr(n_value, 1);
44664
44665 ret_val = valuePush(ctxt, value);
44666 desret_int(ret_val);
44667 call_tests++;
44668 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44669 des_xmlXPathObjectPtr(n_value, value, 1);
44670 xmlResetLastError();
44671 if (mem_base != xmlMemBlocks()) {
44672 printf("Leak of %d blocks found in valuePush",
44673 xmlMemBlocks() - mem_base);
44674 test_ret++;
44675 printf(" %d", n_ctxt);
44676 printf(" %d", n_value);
44677 printf("\n");
44678 }
44679 }
44680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044681 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044682#endif
44683
Daniel Veillarda82b1822004-11-08 16:24:57 +000044684 return(test_ret);
44685}
44686
44687
44688static int
44689test_xmlXPathAddValues(void) {
44690 int test_ret = 0;
44691
William M. Brack21e4ef22005-01-02 09:53:13 +000044692#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044693 int mem_base;
44694 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44695 int n_ctxt;
44696
44697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44698 mem_base = xmlMemBlocks();
44699 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44700
44701 xmlXPathAddValues(ctxt);
44702 call_tests++;
44703 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44704 xmlResetLastError();
44705 if (mem_base != xmlMemBlocks()) {
44706 printf("Leak of %d blocks found in xmlXPathAddValues",
44707 xmlMemBlocks() - mem_base);
44708 test_ret++;
44709 printf(" %d", n_ctxt);
44710 printf("\n");
44711 }
44712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044713 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044714#endif
44715
Daniel Veillarda82b1822004-11-08 16:24:57 +000044716 return(test_ret);
44717}
44718
44719
44720static int
44721test_xmlXPathBooleanFunction(void) {
44722 int test_ret = 0;
44723
William M. Brack21e4ef22005-01-02 09:53:13 +000044724#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044725 int mem_base;
44726 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44727 int n_ctxt;
44728 int nargs; /* the number of arguments */
44729 int n_nargs;
44730
44731 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44732 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44733 mem_base = xmlMemBlocks();
44734 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44735 nargs = gen_int(n_nargs, 1);
44736
44737 xmlXPathBooleanFunction(ctxt, nargs);
44738 call_tests++;
44739 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44740 des_int(n_nargs, nargs, 1);
44741 xmlResetLastError();
44742 if (mem_base != xmlMemBlocks()) {
44743 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44744 xmlMemBlocks() - mem_base);
44745 test_ret++;
44746 printf(" %d", n_ctxt);
44747 printf(" %d", n_nargs);
44748 printf("\n");
44749 }
44750 }
44751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044752 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044753#endif
44754
Daniel Veillarda82b1822004-11-08 16:24:57 +000044755 return(test_ret);
44756}
44757
44758
44759static int
44760test_xmlXPathCeilingFunction(void) {
44761 int test_ret = 0;
44762
William M. Brack21e4ef22005-01-02 09:53:13 +000044763#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044764 int mem_base;
44765 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44766 int n_ctxt;
44767 int nargs; /* the number of arguments */
44768 int n_nargs;
44769
44770 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44771 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44772 mem_base = xmlMemBlocks();
44773 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44774 nargs = gen_int(n_nargs, 1);
44775
44776 xmlXPathCeilingFunction(ctxt, nargs);
44777 call_tests++;
44778 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44779 des_int(n_nargs, nargs, 1);
44780 xmlResetLastError();
44781 if (mem_base != xmlMemBlocks()) {
44782 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44783 xmlMemBlocks() - mem_base);
44784 test_ret++;
44785 printf(" %d", n_ctxt);
44786 printf(" %d", n_nargs);
44787 printf("\n");
44788 }
44789 }
44790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044791 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044792#endif
44793
Daniel Veillarda82b1822004-11-08 16:24:57 +000044794 return(test_ret);
44795}
44796
44797
44798static int
44799test_xmlXPathCompareValues(void) {
44800 int test_ret = 0;
44801
William M. Brack21e4ef22005-01-02 09:53:13 +000044802#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044803 int mem_base;
44804 int ret_val;
44805 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44806 int n_ctxt;
44807 int inf; /* less than (1) or greater than (0) */
44808 int n_inf;
44809 int strict; /* is the comparison strict */
44810 int n_strict;
44811
44812 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44813 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44814 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44815 mem_base = xmlMemBlocks();
44816 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44817 inf = gen_int(n_inf, 1);
44818 strict = gen_int(n_strict, 2);
44819
44820 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44821 desret_int(ret_val);
44822 call_tests++;
44823 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44824 des_int(n_inf, inf, 1);
44825 des_int(n_strict, strict, 2);
44826 xmlResetLastError();
44827 if (mem_base != xmlMemBlocks()) {
44828 printf("Leak of %d blocks found in xmlXPathCompareValues",
44829 xmlMemBlocks() - mem_base);
44830 test_ret++;
44831 printf(" %d", n_ctxt);
44832 printf(" %d", n_inf);
44833 printf(" %d", n_strict);
44834 printf("\n");
44835 }
44836 }
44837 }
44838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044839 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044840#endif
44841
Daniel Veillarda82b1822004-11-08 16:24:57 +000044842 return(test_ret);
44843}
44844
44845
44846static int
44847test_xmlXPathConcatFunction(void) {
44848 int test_ret = 0;
44849
William M. Brack21e4ef22005-01-02 09:53:13 +000044850#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044851 int mem_base;
44852 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44853 int n_ctxt;
44854 int nargs; /* the number of arguments */
44855 int n_nargs;
44856
44857 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44858 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44859 mem_base = xmlMemBlocks();
44860 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44861 nargs = gen_int(n_nargs, 1);
44862
44863 xmlXPathConcatFunction(ctxt, nargs);
44864 call_tests++;
44865 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44866 des_int(n_nargs, nargs, 1);
44867 xmlResetLastError();
44868 if (mem_base != xmlMemBlocks()) {
44869 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44870 xmlMemBlocks() - mem_base);
44871 test_ret++;
44872 printf(" %d", n_ctxt);
44873 printf(" %d", n_nargs);
44874 printf("\n");
44875 }
44876 }
44877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044878 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044879#endif
44880
Daniel Veillarda82b1822004-11-08 16:24:57 +000044881 return(test_ret);
44882}
44883
44884
44885static int
44886test_xmlXPathContainsFunction(void) {
44887 int test_ret = 0;
44888
William M. Brack21e4ef22005-01-02 09:53:13 +000044889#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044890 int mem_base;
44891 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44892 int n_ctxt;
44893 int nargs; /* the number of arguments */
44894 int n_nargs;
44895
44896 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44897 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44898 mem_base = xmlMemBlocks();
44899 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44900 nargs = gen_int(n_nargs, 1);
44901
44902 xmlXPathContainsFunction(ctxt, nargs);
44903 call_tests++;
44904 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44905 des_int(n_nargs, nargs, 1);
44906 xmlResetLastError();
44907 if (mem_base != xmlMemBlocks()) {
44908 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44909 xmlMemBlocks() - mem_base);
44910 test_ret++;
44911 printf(" %d", n_ctxt);
44912 printf(" %d", n_nargs);
44913 printf("\n");
44914 }
44915 }
44916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044917 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044918#endif
44919
Daniel Veillarda82b1822004-11-08 16:24:57 +000044920 return(test_ret);
44921}
44922
44923
44924static int
44925test_xmlXPathCountFunction(void) {
44926 int test_ret = 0;
44927
William M. Brack21e4ef22005-01-02 09:53:13 +000044928#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044929 int mem_base;
44930 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44931 int n_ctxt;
44932 int nargs; /* the number of arguments */
44933 int n_nargs;
44934
44935 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44936 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44937 mem_base = xmlMemBlocks();
44938 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44939 nargs = gen_int(n_nargs, 1);
44940
44941 xmlXPathCountFunction(ctxt, nargs);
44942 call_tests++;
44943 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44944 des_int(n_nargs, nargs, 1);
44945 xmlResetLastError();
44946 if (mem_base != xmlMemBlocks()) {
44947 printf("Leak of %d blocks found in xmlXPathCountFunction",
44948 xmlMemBlocks() - mem_base);
44949 test_ret++;
44950 printf(" %d", n_ctxt);
44951 printf(" %d", n_nargs);
44952 printf("\n");
44953 }
44954 }
44955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044956 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044957#endif
44958
Daniel Veillarda82b1822004-11-08 16:24:57 +000044959 return(test_ret);
44960}
44961
44962
44963static int
44964test_xmlXPathDebugDumpCompExpr(void) {
44965 int test_ret = 0;
44966
William M. Brack21e4ef22005-01-02 09:53:13 +000044967#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044968 int mem_base;
44969 FILE * output; /* the FILE * for the output */
44970 int n_output;
44971 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44972 int n_comp;
44973 int depth; /* the indentation level. */
44974 int n_depth;
44975
44976 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44977 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44978 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44979 mem_base = xmlMemBlocks();
44980 output = gen_FILE_ptr(n_output, 0);
44981 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44982 depth = gen_int(n_depth, 2);
44983
44984 xmlXPathDebugDumpCompExpr(output, comp, depth);
44985 call_tests++;
44986 des_FILE_ptr(n_output, output, 0);
44987 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44988 des_int(n_depth, depth, 2);
44989 xmlResetLastError();
44990 if (mem_base != xmlMemBlocks()) {
44991 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44992 xmlMemBlocks() - mem_base);
44993 test_ret++;
44994 printf(" %d", n_output);
44995 printf(" %d", n_comp);
44996 printf(" %d", n_depth);
44997 printf("\n");
44998 }
44999 }
45000 }
45001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045002 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045003#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000045004
Daniel Veillarda82b1822004-11-08 16:24:57 +000045005 return(test_ret);
45006}
45007
45008
45009static int
45010test_xmlXPathDebugDumpObject(void) {
45011 int test_ret = 0;
45012
William M. Brack21e4ef22005-01-02 09:53:13 +000045013#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045014 int mem_base;
45015 FILE * output; /* the FILE * to dump the output */
45016 int n_output;
45017 xmlXPathObjectPtr cur; /* the object to inspect */
45018 int n_cur;
45019 int depth; /* indentation level */
45020 int n_depth;
45021
45022 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
45023 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
45024 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
45025 mem_base = xmlMemBlocks();
45026 output = gen_FILE_ptr(n_output, 0);
45027 cur = gen_xmlXPathObjectPtr(n_cur, 1);
45028 depth = gen_int(n_depth, 2);
45029
45030 xmlXPathDebugDumpObject(output, cur, depth);
45031 call_tests++;
45032 des_FILE_ptr(n_output, output, 0);
45033 des_xmlXPathObjectPtr(n_cur, cur, 1);
45034 des_int(n_depth, depth, 2);
45035 xmlResetLastError();
45036 if (mem_base != xmlMemBlocks()) {
45037 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
45038 xmlMemBlocks() - mem_base);
45039 test_ret++;
45040 printf(" %d", n_output);
45041 printf(" %d", n_cur);
45042 printf(" %d", n_depth);
45043 printf("\n");
45044 }
45045 }
45046 }
45047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045049#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000045050
Daniel Veillarda82b1822004-11-08 16:24:57 +000045051 return(test_ret);
45052}
45053
45054
45055static int
45056test_xmlXPathDifference(void) {
45057 int test_ret = 0;
45058
William M. Brack21e4ef22005-01-02 09:53:13 +000045059#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045060 int mem_base;
45061 xmlNodeSetPtr ret_val;
45062 xmlNodeSetPtr nodes1; /* a node-set */
45063 int n_nodes1;
45064 xmlNodeSetPtr nodes2; /* a node-set */
45065 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045066
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045067 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45068 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45069 mem_base = xmlMemBlocks();
45070 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45071 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45072
45073 ret_val = xmlXPathDifference(nodes1, nodes2);
45074 desret_xmlNodeSetPtr(ret_val);
45075 call_tests++;
45076 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45077 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45078 xmlResetLastError();
45079 if (mem_base != xmlMemBlocks()) {
45080 printf("Leak of %d blocks found in xmlXPathDifference",
45081 xmlMemBlocks() - mem_base);
45082 test_ret++;
45083 printf(" %d", n_nodes1);
45084 printf(" %d", n_nodes2);
45085 printf("\n");
45086 }
45087 }
45088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045089 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045090#endif
45091
Daniel Veillarda82b1822004-11-08 16:24:57 +000045092 return(test_ret);
45093}
45094
45095
45096static int
45097test_xmlXPathDistinct(void) {
45098 int test_ret = 0;
45099
William M. Brack21e4ef22005-01-02 09:53:13 +000045100#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045101 int mem_base;
45102 xmlNodeSetPtr ret_val;
45103 xmlNodeSetPtr nodes; /* a node-set */
45104 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045105
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045106 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45107 mem_base = xmlMemBlocks();
45108 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45109
45110 ret_val = xmlXPathDistinct(nodes);
45111 desret_xmlNodeSetPtr(ret_val);
45112 call_tests++;
45113 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45114 xmlResetLastError();
45115 if (mem_base != xmlMemBlocks()) {
45116 printf("Leak of %d blocks found in xmlXPathDistinct",
45117 xmlMemBlocks() - mem_base);
45118 test_ret++;
45119 printf(" %d", n_nodes);
45120 printf("\n");
45121 }
45122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045123 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045124#endif
45125
Daniel Veillarda82b1822004-11-08 16:24:57 +000045126 return(test_ret);
45127}
45128
45129
45130static int
45131test_xmlXPathDistinctSorted(void) {
45132 int test_ret = 0;
45133
William M. Brack21e4ef22005-01-02 09:53:13 +000045134#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045135 int mem_base;
45136 xmlNodeSetPtr ret_val;
45137 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45138 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045139
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045140 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45141 mem_base = xmlMemBlocks();
45142 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45143
45144 ret_val = xmlXPathDistinctSorted(nodes);
45145 desret_xmlNodeSetPtr(ret_val);
45146 call_tests++;
45147 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45148 xmlResetLastError();
45149 if (mem_base != xmlMemBlocks()) {
45150 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
45151 xmlMemBlocks() - mem_base);
45152 test_ret++;
45153 printf(" %d", n_nodes);
45154 printf("\n");
45155 }
45156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045157 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045158#endif
45159
Daniel Veillarda82b1822004-11-08 16:24:57 +000045160 return(test_ret);
45161}
45162
45163
45164static int
45165test_xmlXPathDivValues(void) {
45166 int test_ret = 0;
45167
William M. Brack21e4ef22005-01-02 09:53:13 +000045168#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045169 int mem_base;
45170 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45171 int n_ctxt;
45172
45173 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45174 mem_base = xmlMemBlocks();
45175 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45176
45177 xmlXPathDivValues(ctxt);
45178 call_tests++;
45179 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45180 xmlResetLastError();
45181 if (mem_base != xmlMemBlocks()) {
45182 printf("Leak of %d blocks found in xmlXPathDivValues",
45183 xmlMemBlocks() - mem_base);
45184 test_ret++;
45185 printf(" %d", n_ctxt);
45186 printf("\n");
45187 }
45188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045189 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045190#endif
45191
Daniel Veillarda82b1822004-11-08 16:24:57 +000045192 return(test_ret);
45193}
45194
45195
45196static int
45197test_xmlXPathEqualValues(void) {
45198 int test_ret = 0;
45199
William M. Brack21e4ef22005-01-02 09:53:13 +000045200#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045201 int mem_base;
45202 int ret_val;
45203 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45204 int n_ctxt;
45205
45206 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45207 mem_base = xmlMemBlocks();
45208 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45209
45210 ret_val = xmlXPathEqualValues(ctxt);
45211 desret_int(ret_val);
45212 call_tests++;
45213 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45214 xmlResetLastError();
45215 if (mem_base != xmlMemBlocks()) {
45216 printf("Leak of %d blocks found in xmlXPathEqualValues",
45217 xmlMemBlocks() - mem_base);
45218 test_ret++;
45219 printf(" %d", n_ctxt);
45220 printf("\n");
45221 }
45222 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045223 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045224#endif
45225
Daniel Veillarda82b1822004-11-08 16:24:57 +000045226 return(test_ret);
45227}
45228
45229
45230static int
45231test_xmlXPathErr(void) {
45232 int test_ret = 0;
45233
William M. Brack21e4ef22005-01-02 09:53:13 +000045234#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045235 int mem_base;
45236 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
45237 int n_ctxt;
45238 int error; /* the error code */
45239 int n_error;
45240
45241 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45242 for (n_error = 0;n_error < gen_nb_int;n_error++) {
45243 mem_base = xmlMemBlocks();
45244 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45245 error = gen_int(n_error, 1);
45246
45247 xmlXPathErr(ctxt, error);
45248 call_tests++;
45249 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45250 des_int(n_error, error, 1);
45251 xmlResetLastError();
45252 if (mem_base != xmlMemBlocks()) {
45253 printf("Leak of %d blocks found in xmlXPathErr",
45254 xmlMemBlocks() - mem_base);
45255 test_ret++;
45256 printf(" %d", n_ctxt);
45257 printf(" %d", n_error);
45258 printf("\n");
45259 }
45260 }
45261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045262 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045263#endif
45264
Daniel Veillarda82b1822004-11-08 16:24:57 +000045265 return(test_ret);
45266}
45267
45268
45269static int
45270test_xmlXPathEvalExpr(void) {
45271 int test_ret = 0;
45272
William M. Brack21e4ef22005-01-02 09:53:13 +000045273#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045274 int mem_base;
45275 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45276 int n_ctxt;
45277
45278 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45279 mem_base = xmlMemBlocks();
45280 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45281
45282 xmlXPathEvalExpr(ctxt);
45283 call_tests++;
45284 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45285 xmlResetLastError();
45286 if (mem_base != xmlMemBlocks()) {
45287 printf("Leak of %d blocks found in xmlXPathEvalExpr",
45288 xmlMemBlocks() - mem_base);
45289 test_ret++;
45290 printf(" %d", n_ctxt);
45291 printf("\n");
45292 }
45293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045294 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045295#endif
45296
Daniel Veillarda82b1822004-11-08 16:24:57 +000045297 return(test_ret);
45298}
45299
45300
45301static int
45302test_xmlXPathEvaluatePredicateResult(void) {
45303 int test_ret = 0;
45304
William M. Brack21e4ef22005-01-02 09:53:13 +000045305#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045306 int mem_base;
45307 int ret_val;
45308 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45309 int n_ctxt;
45310 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
45311 int n_res;
45312
45313 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45314 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
45315 mem_base = xmlMemBlocks();
45316 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45317 res = gen_xmlXPathObjectPtr(n_res, 1);
45318
45319 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
45320 desret_int(ret_val);
45321 call_tests++;
45322 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45323 des_xmlXPathObjectPtr(n_res, res, 1);
45324 xmlResetLastError();
45325 if (mem_base != xmlMemBlocks()) {
45326 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
45327 xmlMemBlocks() - mem_base);
45328 test_ret++;
45329 printf(" %d", n_ctxt);
45330 printf(" %d", n_res);
45331 printf("\n");
45332 }
45333 }
45334 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045335 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045336#endif
45337
Daniel Veillarda82b1822004-11-08 16:24:57 +000045338 return(test_ret);
45339}
45340
45341
45342static int
45343test_xmlXPathFalseFunction(void) {
45344 int test_ret = 0;
45345
William M. Brack21e4ef22005-01-02 09:53:13 +000045346#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045347 int mem_base;
45348 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45349 int n_ctxt;
45350 int nargs; /* the number of arguments */
45351 int n_nargs;
45352
45353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45354 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45355 mem_base = xmlMemBlocks();
45356 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45357 nargs = gen_int(n_nargs, 1);
45358
45359 xmlXPathFalseFunction(ctxt, nargs);
45360 call_tests++;
45361 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45362 des_int(n_nargs, nargs, 1);
45363 xmlResetLastError();
45364 if (mem_base != xmlMemBlocks()) {
45365 printf("Leak of %d blocks found in xmlXPathFalseFunction",
45366 xmlMemBlocks() - mem_base);
45367 test_ret++;
45368 printf(" %d", n_ctxt);
45369 printf(" %d", n_nargs);
45370 printf("\n");
45371 }
45372 }
45373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045374 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045375#endif
45376
Daniel Veillarda82b1822004-11-08 16:24:57 +000045377 return(test_ret);
45378}
45379
45380
45381static int
45382test_xmlXPathFloorFunction(void) {
45383 int test_ret = 0;
45384
William M. Brack21e4ef22005-01-02 09:53:13 +000045385#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045386 int mem_base;
45387 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45388 int n_ctxt;
45389 int nargs; /* the number of arguments */
45390 int n_nargs;
45391
45392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45393 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45394 mem_base = xmlMemBlocks();
45395 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45396 nargs = gen_int(n_nargs, 1);
45397
45398 xmlXPathFloorFunction(ctxt, nargs);
45399 call_tests++;
45400 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45401 des_int(n_nargs, nargs, 1);
45402 xmlResetLastError();
45403 if (mem_base != xmlMemBlocks()) {
45404 printf("Leak of %d blocks found in xmlXPathFloorFunction",
45405 xmlMemBlocks() - mem_base);
45406 test_ret++;
45407 printf(" %d", n_ctxt);
45408 printf(" %d", n_nargs);
45409 printf("\n");
45410 }
45411 }
45412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045413 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045414#endif
45415
Daniel Veillarda82b1822004-11-08 16:24:57 +000045416 return(test_ret);
45417}
45418
45419
45420static int
45421test_xmlXPathFunctionLookup(void) {
45422 int test_ret = 0;
45423
45424
45425 /* missing type support */
45426 return(test_ret);
45427}
45428
45429
45430static int
45431test_xmlXPathFunctionLookupNS(void) {
45432 int test_ret = 0;
45433
45434
45435 /* missing type support */
45436 return(test_ret);
45437}
45438
45439
45440static int
45441test_xmlXPathHasSameNodes(void) {
45442 int test_ret = 0;
45443
William M. Brack21e4ef22005-01-02 09:53:13 +000045444#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045445 int mem_base;
45446 int ret_val;
45447 xmlNodeSetPtr nodes1; /* a node-set */
45448 int n_nodes1;
45449 xmlNodeSetPtr nodes2; /* a node-set */
45450 int n_nodes2;
45451
45452 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45453 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45454 mem_base = xmlMemBlocks();
45455 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45456 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45457
45458 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
45459 desret_int(ret_val);
45460 call_tests++;
45461 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45462 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45463 xmlResetLastError();
45464 if (mem_base != xmlMemBlocks()) {
45465 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
45466 xmlMemBlocks() - mem_base);
45467 test_ret++;
45468 printf(" %d", n_nodes1);
45469 printf(" %d", n_nodes2);
45470 printf("\n");
45471 }
45472 }
45473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045474 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045475#endif
45476
Daniel Veillarda82b1822004-11-08 16:24:57 +000045477 return(test_ret);
45478}
45479
45480
45481static int
45482test_xmlXPathIdFunction(void) {
45483 int test_ret = 0;
45484
William M. Brack21e4ef22005-01-02 09:53:13 +000045485#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045486 int mem_base;
45487 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45488 int n_ctxt;
45489 int nargs; /* the number of arguments */
45490 int n_nargs;
45491
45492 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45493 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45494 mem_base = xmlMemBlocks();
45495 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45496 nargs = gen_int(n_nargs, 1);
45497
45498 xmlXPathIdFunction(ctxt, nargs);
45499 call_tests++;
45500 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45501 des_int(n_nargs, nargs, 1);
45502 xmlResetLastError();
45503 if (mem_base != xmlMemBlocks()) {
45504 printf("Leak of %d blocks found in xmlXPathIdFunction",
45505 xmlMemBlocks() - mem_base);
45506 test_ret++;
45507 printf(" %d", n_ctxt);
45508 printf(" %d", n_nargs);
45509 printf("\n");
45510 }
45511 }
45512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045513 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045514#endif
45515
Daniel Veillarda82b1822004-11-08 16:24:57 +000045516 return(test_ret);
45517}
45518
45519
45520static int
45521test_xmlXPathIntersection(void) {
45522 int test_ret = 0;
45523
William M. Brack21e4ef22005-01-02 09:53:13 +000045524#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045525 int mem_base;
45526 xmlNodeSetPtr ret_val;
45527 xmlNodeSetPtr nodes1; /* a node-set */
45528 int n_nodes1;
45529 xmlNodeSetPtr nodes2; /* a node-set */
45530 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045531
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045532 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45533 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45534 mem_base = xmlMemBlocks();
45535 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45536 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45537
45538 ret_val = xmlXPathIntersection(nodes1, nodes2);
45539 desret_xmlNodeSetPtr(ret_val);
45540 call_tests++;
45541 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45542 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45543 xmlResetLastError();
45544 if (mem_base != xmlMemBlocks()) {
45545 printf("Leak of %d blocks found in xmlXPathIntersection",
45546 xmlMemBlocks() - mem_base);
45547 test_ret++;
45548 printf(" %d", n_nodes1);
45549 printf(" %d", n_nodes2);
45550 printf("\n");
45551 }
45552 }
45553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045554 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045555#endif
45556
Daniel Veillarda82b1822004-11-08 16:24:57 +000045557 return(test_ret);
45558}
45559
45560
45561static int
45562test_xmlXPathIsNodeType(void) {
45563 int test_ret = 0;
45564
William M. Brack21e4ef22005-01-02 09:53:13 +000045565#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045566 int mem_base;
45567 int ret_val;
45568 xmlChar * name; /* a name string */
45569 int n_name;
45570
45571 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45572 mem_base = xmlMemBlocks();
45573 name = gen_const_xmlChar_ptr(n_name, 0);
45574
William M. Brackf13f77f2004-11-12 16:03:48 +000045575 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045576 desret_int(ret_val);
45577 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045578 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045579 xmlResetLastError();
45580 if (mem_base != xmlMemBlocks()) {
45581 printf("Leak of %d blocks found in xmlXPathIsNodeType",
45582 xmlMemBlocks() - mem_base);
45583 test_ret++;
45584 printf(" %d", n_name);
45585 printf("\n");
45586 }
45587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045588 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045589#endif
45590
Daniel Veillarda82b1822004-11-08 16:24:57 +000045591 return(test_ret);
45592}
45593
45594
45595static int
45596test_xmlXPathLangFunction(void) {
45597 int test_ret = 0;
45598
William M. Brack21e4ef22005-01-02 09:53:13 +000045599#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045600 int mem_base;
45601 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45602 int n_ctxt;
45603 int nargs; /* the number of arguments */
45604 int n_nargs;
45605
45606 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45607 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45608 mem_base = xmlMemBlocks();
45609 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45610 nargs = gen_int(n_nargs, 1);
45611
45612 xmlXPathLangFunction(ctxt, nargs);
45613 call_tests++;
45614 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45615 des_int(n_nargs, nargs, 1);
45616 xmlResetLastError();
45617 if (mem_base != xmlMemBlocks()) {
45618 printf("Leak of %d blocks found in xmlXPathLangFunction",
45619 xmlMemBlocks() - mem_base);
45620 test_ret++;
45621 printf(" %d", n_ctxt);
45622 printf(" %d", n_nargs);
45623 printf("\n");
45624 }
45625 }
45626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045627 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045628#endif
45629
Daniel Veillarda82b1822004-11-08 16:24:57 +000045630 return(test_ret);
45631}
45632
45633
45634static int
45635test_xmlXPathLastFunction(void) {
45636 int test_ret = 0;
45637
William M. Brack21e4ef22005-01-02 09:53:13 +000045638#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045639 int mem_base;
45640 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45641 int n_ctxt;
45642 int nargs; /* the number of arguments */
45643 int n_nargs;
45644
45645 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45646 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45647 mem_base = xmlMemBlocks();
45648 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45649 nargs = gen_int(n_nargs, 1);
45650
45651 xmlXPathLastFunction(ctxt, nargs);
45652 call_tests++;
45653 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45654 des_int(n_nargs, nargs, 1);
45655 xmlResetLastError();
45656 if (mem_base != xmlMemBlocks()) {
45657 printf("Leak of %d blocks found in xmlXPathLastFunction",
45658 xmlMemBlocks() - mem_base);
45659 test_ret++;
45660 printf(" %d", n_ctxt);
45661 printf(" %d", n_nargs);
45662 printf("\n");
45663 }
45664 }
45665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045666 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045667#endif
45668
Daniel Veillarda82b1822004-11-08 16:24:57 +000045669 return(test_ret);
45670}
45671
45672
45673static int
45674test_xmlXPathLeading(void) {
45675 int test_ret = 0;
45676
William M. Brack21e4ef22005-01-02 09:53:13 +000045677#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045678 int mem_base;
45679 xmlNodeSetPtr ret_val;
45680 xmlNodeSetPtr nodes1; /* a node-set */
45681 int n_nodes1;
45682 xmlNodeSetPtr nodes2; /* a node-set */
45683 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045684
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045685 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45686 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45687 mem_base = xmlMemBlocks();
45688 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45689 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45690
45691 ret_val = xmlXPathLeading(nodes1, nodes2);
45692 desret_xmlNodeSetPtr(ret_val);
45693 call_tests++;
45694 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45695 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45696 xmlResetLastError();
45697 if (mem_base != xmlMemBlocks()) {
45698 printf("Leak of %d blocks found in xmlXPathLeading",
45699 xmlMemBlocks() - mem_base);
45700 test_ret++;
45701 printf(" %d", n_nodes1);
45702 printf(" %d", n_nodes2);
45703 printf("\n");
45704 }
45705 }
45706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045707 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045708#endif
45709
Daniel Veillarda82b1822004-11-08 16:24:57 +000045710 return(test_ret);
45711}
45712
45713
45714static int
45715test_xmlXPathLeadingSorted(void) {
45716 int test_ret = 0;
45717
William M. Brack21e4ef22005-01-02 09:53:13 +000045718#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045719 int mem_base;
45720 xmlNodeSetPtr ret_val;
45721 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45722 int n_nodes1;
45723 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45724 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045725
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045726 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45727 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45728 mem_base = xmlMemBlocks();
45729 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45730 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45731
45732 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45733 desret_xmlNodeSetPtr(ret_val);
45734 call_tests++;
45735 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45736 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45737 xmlResetLastError();
45738 if (mem_base != xmlMemBlocks()) {
45739 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45740 xmlMemBlocks() - mem_base);
45741 test_ret++;
45742 printf(" %d", n_nodes1);
45743 printf(" %d", n_nodes2);
45744 printf("\n");
45745 }
45746 }
45747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045748 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045749#endif
45750
Daniel Veillarda82b1822004-11-08 16:24:57 +000045751 return(test_ret);
45752}
45753
45754
45755static int
45756test_xmlXPathLocalNameFunction(void) {
45757 int test_ret = 0;
45758
William M. Brack21e4ef22005-01-02 09:53:13 +000045759#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045760 int mem_base;
45761 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45762 int n_ctxt;
45763 int nargs; /* the number of arguments */
45764 int n_nargs;
45765
45766 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45767 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45768 mem_base = xmlMemBlocks();
45769 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45770 nargs = gen_int(n_nargs, 1);
45771
45772 xmlXPathLocalNameFunction(ctxt, nargs);
45773 call_tests++;
45774 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45775 des_int(n_nargs, nargs, 1);
45776 xmlResetLastError();
45777 if (mem_base != xmlMemBlocks()) {
45778 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45779 xmlMemBlocks() - mem_base);
45780 test_ret++;
45781 printf(" %d", n_ctxt);
45782 printf(" %d", n_nargs);
45783 printf("\n");
45784 }
45785 }
45786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045787 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045788#endif
45789
Daniel Veillarda82b1822004-11-08 16:24:57 +000045790 return(test_ret);
45791}
45792
45793
45794static int
45795test_xmlXPathModValues(void) {
45796 int test_ret = 0;
45797
William M. Brack21e4ef22005-01-02 09:53:13 +000045798#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045799 int mem_base;
45800 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45801 int n_ctxt;
45802
45803 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45804 mem_base = xmlMemBlocks();
45805 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45806
45807 xmlXPathModValues(ctxt);
45808 call_tests++;
45809 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45810 xmlResetLastError();
45811 if (mem_base != xmlMemBlocks()) {
45812 printf("Leak of %d blocks found in xmlXPathModValues",
45813 xmlMemBlocks() - mem_base);
45814 test_ret++;
45815 printf(" %d", n_ctxt);
45816 printf("\n");
45817 }
45818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045819 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045820#endif
45821
Daniel Veillarda82b1822004-11-08 16:24:57 +000045822 return(test_ret);
45823}
45824
45825
45826static int
45827test_xmlXPathMultValues(void) {
45828 int test_ret = 0;
45829
William M. Brack21e4ef22005-01-02 09:53:13 +000045830#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045831 int mem_base;
45832 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45833 int n_ctxt;
45834
45835 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45836 mem_base = xmlMemBlocks();
45837 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45838
45839 xmlXPathMultValues(ctxt);
45840 call_tests++;
45841 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45842 xmlResetLastError();
45843 if (mem_base != xmlMemBlocks()) {
45844 printf("Leak of %d blocks found in xmlXPathMultValues",
45845 xmlMemBlocks() - mem_base);
45846 test_ret++;
45847 printf(" %d", n_ctxt);
45848 printf("\n");
45849 }
45850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045851 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045852#endif
45853
Daniel Veillarda82b1822004-11-08 16:24:57 +000045854 return(test_ret);
45855}
45856
45857
45858static int
45859test_xmlXPathNamespaceURIFunction(void) {
45860 int test_ret = 0;
45861
William M. Brack21e4ef22005-01-02 09:53:13 +000045862#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045863 int mem_base;
45864 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45865 int n_ctxt;
45866 int nargs; /* the number of arguments */
45867 int n_nargs;
45868
45869 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45870 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45871 mem_base = xmlMemBlocks();
45872 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45873 nargs = gen_int(n_nargs, 1);
45874
45875 xmlXPathNamespaceURIFunction(ctxt, nargs);
45876 call_tests++;
45877 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45878 des_int(n_nargs, nargs, 1);
45879 xmlResetLastError();
45880 if (mem_base != xmlMemBlocks()) {
45881 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45882 xmlMemBlocks() - mem_base);
45883 test_ret++;
45884 printf(" %d", n_ctxt);
45885 printf(" %d", n_nargs);
45886 printf("\n");
45887 }
45888 }
45889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045890 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045891#endif
45892
Daniel Veillarda82b1822004-11-08 16:24:57 +000045893 return(test_ret);
45894}
45895
45896
45897static int
45898test_xmlXPathNewBoolean(void) {
45899 int test_ret = 0;
45900
William M. Brack21e4ef22005-01-02 09:53:13 +000045901#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045902 int mem_base;
45903 xmlXPathObjectPtr ret_val;
45904 int val; /* the boolean value */
45905 int n_val;
45906
45907 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45908 mem_base = xmlMemBlocks();
45909 val = gen_int(n_val, 0);
45910
45911 ret_val = xmlXPathNewBoolean(val);
45912 desret_xmlXPathObjectPtr(ret_val);
45913 call_tests++;
45914 des_int(n_val, val, 0);
45915 xmlResetLastError();
45916 if (mem_base != xmlMemBlocks()) {
45917 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45918 xmlMemBlocks() - mem_base);
45919 test_ret++;
45920 printf(" %d", n_val);
45921 printf("\n");
45922 }
45923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045924 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045925#endif
45926
Daniel Veillarda82b1822004-11-08 16:24:57 +000045927 return(test_ret);
45928}
45929
45930
45931static int
45932test_xmlXPathNewCString(void) {
45933 int test_ret = 0;
45934
William M. Brack21e4ef22005-01-02 09:53:13 +000045935#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045936 int mem_base;
45937 xmlXPathObjectPtr ret_val;
45938 char * val; /* the char * value */
45939 int n_val;
45940
45941 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45942 mem_base = xmlMemBlocks();
45943 val = gen_const_char_ptr(n_val, 0);
45944
William M. Brackf13f77f2004-11-12 16:03:48 +000045945 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045946 desret_xmlXPathObjectPtr(ret_val);
45947 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045948 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045949 xmlResetLastError();
45950 if (mem_base != xmlMemBlocks()) {
45951 printf("Leak of %d blocks found in xmlXPathNewCString",
45952 xmlMemBlocks() - mem_base);
45953 test_ret++;
45954 printf(" %d", n_val);
45955 printf("\n");
45956 }
45957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045958 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045959#endif
45960
Daniel Veillarda82b1822004-11-08 16:24:57 +000045961 return(test_ret);
45962}
45963
45964
45965static int
45966test_xmlXPathNewFloat(void) {
45967 int test_ret = 0;
45968
William M. Brack21e4ef22005-01-02 09:53:13 +000045969#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045970 int mem_base;
45971 xmlXPathObjectPtr ret_val;
45972 double val; /* the double value */
45973 int n_val;
45974
45975 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45976 mem_base = xmlMemBlocks();
45977 val = gen_double(n_val, 0);
45978
45979 ret_val = xmlXPathNewFloat(val);
45980 desret_xmlXPathObjectPtr(ret_val);
45981 call_tests++;
45982 des_double(n_val, val, 0);
45983 xmlResetLastError();
45984 if (mem_base != xmlMemBlocks()) {
45985 printf("Leak of %d blocks found in xmlXPathNewFloat",
45986 xmlMemBlocks() - mem_base);
45987 test_ret++;
45988 printf(" %d", n_val);
45989 printf("\n");
45990 }
45991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045992 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045993#endif
45994
Daniel Veillarda82b1822004-11-08 16:24:57 +000045995 return(test_ret);
45996}
45997
45998
45999static int
46000test_xmlXPathNewNodeSet(void) {
46001 int test_ret = 0;
46002
William M. Brack21e4ef22005-01-02 09:53:13 +000046003#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046004 int mem_base;
46005 xmlXPathObjectPtr ret_val;
46006 xmlNodePtr val; /* the NodePtr value */
46007 int n_val;
46008
46009 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46010 mem_base = xmlMemBlocks();
46011 val = gen_xmlNodePtr(n_val, 0);
46012
46013 ret_val = xmlXPathNewNodeSet(val);
46014 desret_xmlXPathObjectPtr(ret_val);
46015 call_tests++;
46016 des_xmlNodePtr(n_val, val, 0);
46017 xmlResetLastError();
46018 if (mem_base != xmlMemBlocks()) {
46019 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
46020 xmlMemBlocks() - mem_base);
46021 test_ret++;
46022 printf(" %d", n_val);
46023 printf("\n");
46024 }
46025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046026 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046027#endif
46028
Daniel Veillarda82b1822004-11-08 16:24:57 +000046029 return(test_ret);
46030}
46031
46032
46033static int
46034test_xmlXPathNewNodeSetList(void) {
46035 int test_ret = 0;
46036
William M. Brack21e4ef22005-01-02 09:53:13 +000046037#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046038 int mem_base;
46039 xmlXPathObjectPtr ret_val;
46040 xmlNodeSetPtr val; /* an existing NodeSet */
46041 int n_val;
46042
46043 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
46044 mem_base = xmlMemBlocks();
46045 val = gen_xmlNodeSetPtr(n_val, 0);
46046
46047 ret_val = xmlXPathNewNodeSetList(val);
46048 desret_xmlXPathObjectPtr(ret_val);
46049 call_tests++;
46050 des_xmlNodeSetPtr(n_val, val, 0);
46051 xmlResetLastError();
46052 if (mem_base != xmlMemBlocks()) {
46053 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
46054 xmlMemBlocks() - mem_base);
46055 test_ret++;
46056 printf(" %d", n_val);
46057 printf("\n");
46058 }
46059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046060 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046061#endif
46062
Daniel Veillarda82b1822004-11-08 16:24:57 +000046063 return(test_ret);
46064}
46065
46066
46067static int
46068test_xmlXPathNewParserContext(void) {
46069 int test_ret = 0;
46070
46071
46072 /* missing type support */
46073 return(test_ret);
46074}
46075
46076
46077static int
46078test_xmlXPathNewString(void) {
46079 int test_ret = 0;
46080
William M. Brack21e4ef22005-01-02 09:53:13 +000046081#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046082 int mem_base;
46083 xmlXPathObjectPtr ret_val;
46084 xmlChar * val; /* the xmlChar * value */
46085 int n_val;
46086
46087 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
46088 mem_base = xmlMemBlocks();
46089 val = gen_const_xmlChar_ptr(n_val, 0);
46090
William M. Brackf13f77f2004-11-12 16:03:48 +000046091 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046092 desret_xmlXPathObjectPtr(ret_val);
46093 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000046094 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046095 xmlResetLastError();
46096 if (mem_base != xmlMemBlocks()) {
46097 printf("Leak of %d blocks found in xmlXPathNewString",
46098 xmlMemBlocks() - mem_base);
46099 test_ret++;
46100 printf(" %d", n_val);
46101 printf("\n");
46102 }
46103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046104 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046105#endif
46106
Daniel Veillarda82b1822004-11-08 16:24:57 +000046107 return(test_ret);
46108}
46109
46110
46111static int
46112test_xmlXPathNextAncestor(void) {
46113 int test_ret = 0;
46114
William M. Brack21e4ef22005-01-02 09:53:13 +000046115#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046116 int mem_base;
46117 xmlNodePtr ret_val;
46118 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46119 int n_ctxt;
46120 xmlNodePtr cur; /* the current node in the traversal */
46121 int n_cur;
46122
46123 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46124 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46125 mem_base = xmlMemBlocks();
46126 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46127 cur = gen_xmlNodePtr(n_cur, 1);
46128
46129 ret_val = xmlXPathNextAncestor(ctxt, cur);
46130 desret_xmlNodePtr(ret_val);
46131 call_tests++;
46132 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46133 des_xmlNodePtr(n_cur, cur, 1);
46134 xmlResetLastError();
46135 if (mem_base != xmlMemBlocks()) {
46136 printf("Leak of %d blocks found in xmlXPathNextAncestor",
46137 xmlMemBlocks() - mem_base);
46138 test_ret++;
46139 printf(" %d", n_ctxt);
46140 printf(" %d", n_cur);
46141 printf("\n");
46142 }
46143 }
46144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046145 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046146#endif
46147
Daniel Veillarda82b1822004-11-08 16:24:57 +000046148 return(test_ret);
46149}
46150
46151
46152static int
46153test_xmlXPathNextAncestorOrSelf(void) {
46154 int test_ret = 0;
46155
William M. Brack21e4ef22005-01-02 09:53:13 +000046156#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046157 int mem_base;
46158 xmlNodePtr ret_val;
46159 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46160 int n_ctxt;
46161 xmlNodePtr cur; /* the current node in the traversal */
46162 int n_cur;
46163
46164 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46165 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46166 mem_base = xmlMemBlocks();
46167 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46168 cur = gen_xmlNodePtr(n_cur, 1);
46169
46170 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
46171 desret_xmlNodePtr(ret_val);
46172 call_tests++;
46173 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46174 des_xmlNodePtr(n_cur, cur, 1);
46175 xmlResetLastError();
46176 if (mem_base != xmlMemBlocks()) {
46177 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
46178 xmlMemBlocks() - mem_base);
46179 test_ret++;
46180 printf(" %d", n_ctxt);
46181 printf(" %d", n_cur);
46182 printf("\n");
46183 }
46184 }
46185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046186 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046187#endif
46188
Daniel Veillarda82b1822004-11-08 16:24:57 +000046189 return(test_ret);
46190}
46191
46192
46193static int
46194test_xmlXPathNextAttribute(void) {
46195 int test_ret = 0;
46196
William M. Brack21e4ef22005-01-02 09:53:13 +000046197#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046198 int mem_base;
46199 xmlNodePtr ret_val;
46200 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46201 int n_ctxt;
46202 xmlNodePtr cur; /* the current attribute in the traversal */
46203 int n_cur;
46204
46205 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46206 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46207 mem_base = xmlMemBlocks();
46208 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46209 cur = gen_xmlNodePtr(n_cur, 1);
46210
46211 ret_val = xmlXPathNextAttribute(ctxt, cur);
46212 desret_xmlNodePtr(ret_val);
46213 call_tests++;
46214 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46215 des_xmlNodePtr(n_cur, cur, 1);
46216 xmlResetLastError();
46217 if (mem_base != xmlMemBlocks()) {
46218 printf("Leak of %d blocks found in xmlXPathNextAttribute",
46219 xmlMemBlocks() - mem_base);
46220 test_ret++;
46221 printf(" %d", n_ctxt);
46222 printf(" %d", n_cur);
46223 printf("\n");
46224 }
46225 }
46226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046227 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046228#endif
46229
Daniel Veillarda82b1822004-11-08 16:24:57 +000046230 return(test_ret);
46231}
46232
46233
46234static int
46235test_xmlXPathNextChild(void) {
46236 int test_ret = 0;
46237
William M. Brack21e4ef22005-01-02 09:53:13 +000046238#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046239 int mem_base;
46240 xmlNodePtr ret_val;
46241 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46242 int n_ctxt;
46243 xmlNodePtr cur; /* the current node in the traversal */
46244 int n_cur;
46245
46246 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46247 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46248 mem_base = xmlMemBlocks();
46249 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46250 cur = gen_xmlNodePtr(n_cur, 1);
46251
46252 ret_val = xmlXPathNextChild(ctxt, cur);
46253 desret_xmlNodePtr(ret_val);
46254 call_tests++;
46255 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46256 des_xmlNodePtr(n_cur, cur, 1);
46257 xmlResetLastError();
46258 if (mem_base != xmlMemBlocks()) {
46259 printf("Leak of %d blocks found in xmlXPathNextChild",
46260 xmlMemBlocks() - mem_base);
46261 test_ret++;
46262 printf(" %d", n_ctxt);
46263 printf(" %d", n_cur);
46264 printf("\n");
46265 }
46266 }
46267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046268 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046269#endif
46270
Daniel Veillarda82b1822004-11-08 16:24:57 +000046271 return(test_ret);
46272}
46273
46274
46275static int
46276test_xmlXPathNextDescendant(void) {
46277 int test_ret = 0;
46278
William M. Brack21e4ef22005-01-02 09:53:13 +000046279#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046280 int mem_base;
46281 xmlNodePtr ret_val;
46282 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46283 int n_ctxt;
46284 xmlNodePtr cur; /* the current node in the traversal */
46285 int n_cur;
46286
46287 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46288 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46289 mem_base = xmlMemBlocks();
46290 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46291 cur = gen_xmlNodePtr(n_cur, 1);
46292
46293 ret_val = xmlXPathNextDescendant(ctxt, cur);
46294 desret_xmlNodePtr(ret_val);
46295 call_tests++;
46296 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46297 des_xmlNodePtr(n_cur, cur, 1);
46298 xmlResetLastError();
46299 if (mem_base != xmlMemBlocks()) {
46300 printf("Leak of %d blocks found in xmlXPathNextDescendant",
46301 xmlMemBlocks() - mem_base);
46302 test_ret++;
46303 printf(" %d", n_ctxt);
46304 printf(" %d", n_cur);
46305 printf("\n");
46306 }
46307 }
46308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046309 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046310#endif
46311
Daniel Veillarda82b1822004-11-08 16:24:57 +000046312 return(test_ret);
46313}
46314
46315
46316static int
46317test_xmlXPathNextDescendantOrSelf(void) {
46318 int test_ret = 0;
46319
William M. Brack21e4ef22005-01-02 09:53:13 +000046320#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046321 int mem_base;
46322 xmlNodePtr ret_val;
46323 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46324 int n_ctxt;
46325 xmlNodePtr cur; /* the current node in the traversal */
46326 int n_cur;
46327
46328 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46329 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46330 mem_base = xmlMemBlocks();
46331 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46332 cur = gen_xmlNodePtr(n_cur, 1);
46333
46334 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
46335 desret_xmlNodePtr(ret_val);
46336 call_tests++;
46337 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46338 des_xmlNodePtr(n_cur, cur, 1);
46339 xmlResetLastError();
46340 if (mem_base != xmlMemBlocks()) {
46341 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
46342 xmlMemBlocks() - mem_base);
46343 test_ret++;
46344 printf(" %d", n_ctxt);
46345 printf(" %d", n_cur);
46346 printf("\n");
46347 }
46348 }
46349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046350 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046351#endif
46352
Daniel Veillarda82b1822004-11-08 16:24:57 +000046353 return(test_ret);
46354}
46355
46356
46357static int
46358test_xmlXPathNextFollowing(void) {
46359 int test_ret = 0;
46360
William M. Brack21e4ef22005-01-02 09:53:13 +000046361#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046362 int mem_base;
46363 xmlNodePtr ret_val;
46364 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46365 int n_ctxt;
46366 xmlNodePtr cur; /* the current node in the traversal */
46367 int n_cur;
46368
46369 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46370 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46371 mem_base = xmlMemBlocks();
46372 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46373 cur = gen_xmlNodePtr(n_cur, 1);
46374
46375 ret_val = xmlXPathNextFollowing(ctxt, cur);
46376 desret_xmlNodePtr(ret_val);
46377 call_tests++;
46378 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46379 des_xmlNodePtr(n_cur, cur, 1);
46380 xmlResetLastError();
46381 if (mem_base != xmlMemBlocks()) {
46382 printf("Leak of %d blocks found in xmlXPathNextFollowing",
46383 xmlMemBlocks() - mem_base);
46384 test_ret++;
46385 printf(" %d", n_ctxt);
46386 printf(" %d", n_cur);
46387 printf("\n");
46388 }
46389 }
46390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046391 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046392#endif
46393
Daniel Veillarda82b1822004-11-08 16:24:57 +000046394 return(test_ret);
46395}
46396
46397
46398static int
46399test_xmlXPathNextFollowingSibling(void) {
46400 int test_ret = 0;
46401
William M. Brack21e4ef22005-01-02 09:53:13 +000046402#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046403 int mem_base;
46404 xmlNodePtr ret_val;
46405 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46406 int n_ctxt;
46407 xmlNodePtr cur; /* the current node in the traversal */
46408 int n_cur;
46409
46410 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46411 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46412 mem_base = xmlMemBlocks();
46413 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46414 cur = gen_xmlNodePtr(n_cur, 1);
46415
46416 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
46417 desret_xmlNodePtr(ret_val);
46418 call_tests++;
46419 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46420 des_xmlNodePtr(n_cur, cur, 1);
46421 xmlResetLastError();
46422 if (mem_base != xmlMemBlocks()) {
46423 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
46424 xmlMemBlocks() - mem_base);
46425 test_ret++;
46426 printf(" %d", n_ctxt);
46427 printf(" %d", n_cur);
46428 printf("\n");
46429 }
46430 }
46431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046432 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046433#endif
46434
Daniel Veillarda82b1822004-11-08 16:24:57 +000046435 return(test_ret);
46436}
46437
46438
46439static int
46440test_xmlXPathNextNamespace(void) {
46441 int test_ret = 0;
46442
William M. Brack21e4ef22005-01-02 09:53:13 +000046443#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046444 int mem_base;
46445 xmlNodePtr ret_val;
46446 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46447 int n_ctxt;
46448 xmlNodePtr cur; /* the current attribute in the traversal */
46449 int n_cur;
46450
46451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46452 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46453 mem_base = xmlMemBlocks();
46454 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46455 cur = gen_xmlNodePtr(n_cur, 1);
46456
46457 ret_val = xmlXPathNextNamespace(ctxt, cur);
46458 desret_xmlNodePtr(ret_val);
46459 call_tests++;
46460 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46461 des_xmlNodePtr(n_cur, cur, 1);
46462 xmlResetLastError();
46463 if (mem_base != xmlMemBlocks()) {
46464 printf("Leak of %d blocks found in xmlXPathNextNamespace",
46465 xmlMemBlocks() - mem_base);
46466 test_ret++;
46467 printf(" %d", n_ctxt);
46468 printf(" %d", n_cur);
46469 printf("\n");
46470 }
46471 }
46472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046473 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046474#endif
46475
Daniel Veillarda82b1822004-11-08 16:24:57 +000046476 return(test_ret);
46477}
46478
46479
46480static int
46481test_xmlXPathNextParent(void) {
46482 int test_ret = 0;
46483
William M. Brack21e4ef22005-01-02 09:53:13 +000046484#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046485 int mem_base;
46486 xmlNodePtr ret_val;
46487 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46488 int n_ctxt;
46489 xmlNodePtr cur; /* the current node in the traversal */
46490 int n_cur;
46491
46492 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46493 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46494 mem_base = xmlMemBlocks();
46495 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46496 cur = gen_xmlNodePtr(n_cur, 1);
46497
46498 ret_val = xmlXPathNextParent(ctxt, cur);
46499 desret_xmlNodePtr(ret_val);
46500 call_tests++;
46501 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46502 des_xmlNodePtr(n_cur, cur, 1);
46503 xmlResetLastError();
46504 if (mem_base != xmlMemBlocks()) {
46505 printf("Leak of %d blocks found in xmlXPathNextParent",
46506 xmlMemBlocks() - mem_base);
46507 test_ret++;
46508 printf(" %d", n_ctxt);
46509 printf(" %d", n_cur);
46510 printf("\n");
46511 }
46512 }
46513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046514 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046515#endif
46516
Daniel Veillarda82b1822004-11-08 16:24:57 +000046517 return(test_ret);
46518}
46519
46520
46521static int
46522test_xmlXPathNextPreceding(void) {
46523 int test_ret = 0;
46524
William M. Brack21e4ef22005-01-02 09:53:13 +000046525#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046526 int mem_base;
46527 xmlNodePtr ret_val;
46528 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46529 int n_ctxt;
46530 xmlNodePtr cur; /* the current node in the traversal */
46531 int n_cur;
46532
46533 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46534 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46535 mem_base = xmlMemBlocks();
46536 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46537 cur = gen_xmlNodePtr(n_cur, 1);
46538
46539 ret_val = xmlXPathNextPreceding(ctxt, cur);
46540 desret_xmlNodePtr(ret_val);
46541 call_tests++;
46542 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46543 des_xmlNodePtr(n_cur, cur, 1);
46544 xmlResetLastError();
46545 if (mem_base != xmlMemBlocks()) {
46546 printf("Leak of %d blocks found in xmlXPathNextPreceding",
46547 xmlMemBlocks() - mem_base);
46548 test_ret++;
46549 printf(" %d", n_ctxt);
46550 printf(" %d", n_cur);
46551 printf("\n");
46552 }
46553 }
46554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046555 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046556#endif
46557
Daniel Veillarda82b1822004-11-08 16:24:57 +000046558 return(test_ret);
46559}
46560
46561
46562static int
46563test_xmlXPathNextPrecedingSibling(void) {
46564 int test_ret = 0;
46565
William M. Brack21e4ef22005-01-02 09:53:13 +000046566#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046567 int mem_base;
46568 xmlNodePtr ret_val;
46569 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46570 int n_ctxt;
46571 xmlNodePtr cur; /* the current node in the traversal */
46572 int n_cur;
46573
46574 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46575 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46576 mem_base = xmlMemBlocks();
46577 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46578 cur = gen_xmlNodePtr(n_cur, 1);
46579
46580 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
46581 desret_xmlNodePtr(ret_val);
46582 call_tests++;
46583 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46584 des_xmlNodePtr(n_cur, cur, 1);
46585 xmlResetLastError();
46586 if (mem_base != xmlMemBlocks()) {
46587 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
46588 xmlMemBlocks() - mem_base);
46589 test_ret++;
46590 printf(" %d", n_ctxt);
46591 printf(" %d", n_cur);
46592 printf("\n");
46593 }
46594 }
46595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046596 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046597#endif
46598
Daniel Veillarda82b1822004-11-08 16:24:57 +000046599 return(test_ret);
46600}
46601
46602
46603static int
46604test_xmlXPathNextSelf(void) {
46605 int test_ret = 0;
46606
William M. Brack21e4ef22005-01-02 09:53:13 +000046607#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046608 int mem_base;
46609 xmlNodePtr ret_val;
46610 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46611 int n_ctxt;
46612 xmlNodePtr cur; /* the current node in the traversal */
46613 int n_cur;
46614
46615 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46616 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46617 mem_base = xmlMemBlocks();
46618 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46619 cur = gen_xmlNodePtr(n_cur, 1);
46620
46621 ret_val = xmlXPathNextSelf(ctxt, cur);
46622 desret_xmlNodePtr(ret_val);
46623 call_tests++;
46624 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46625 des_xmlNodePtr(n_cur, cur, 1);
46626 xmlResetLastError();
46627 if (mem_base != xmlMemBlocks()) {
46628 printf("Leak of %d blocks found in xmlXPathNextSelf",
46629 xmlMemBlocks() - mem_base);
46630 test_ret++;
46631 printf(" %d", n_ctxt);
46632 printf(" %d", n_cur);
46633 printf("\n");
46634 }
46635 }
46636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046637 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046638#endif
46639
Daniel Veillarda82b1822004-11-08 16:24:57 +000046640 return(test_ret);
46641}
46642
46643
46644static int
46645test_xmlXPathNodeLeading(void) {
46646 int test_ret = 0;
46647
William M. Brack21e4ef22005-01-02 09:53:13 +000046648#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046649 int mem_base;
46650 xmlNodeSetPtr ret_val;
46651 xmlNodeSetPtr nodes; /* a node-set */
46652 int n_nodes;
46653 xmlNodePtr node; /* a node */
46654 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046655
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046656 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46657 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46658 mem_base = xmlMemBlocks();
46659 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46660 node = gen_xmlNodePtr(n_node, 1);
46661
46662 ret_val = xmlXPathNodeLeading(nodes, node);
46663 desret_xmlNodeSetPtr(ret_val);
46664 call_tests++;
46665 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46666 des_xmlNodePtr(n_node, node, 1);
46667 xmlResetLastError();
46668 if (mem_base != xmlMemBlocks()) {
46669 printf("Leak of %d blocks found in xmlXPathNodeLeading",
46670 xmlMemBlocks() - mem_base);
46671 test_ret++;
46672 printf(" %d", n_nodes);
46673 printf(" %d", n_node);
46674 printf("\n");
46675 }
46676 }
46677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046678 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046679#endif
46680
Daniel Veillarda82b1822004-11-08 16:24:57 +000046681 return(test_ret);
46682}
46683
46684
46685static int
46686test_xmlXPathNodeLeadingSorted(void) {
46687 int test_ret = 0;
46688
William M. Brack21e4ef22005-01-02 09:53:13 +000046689#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046690 int mem_base;
46691 xmlNodeSetPtr ret_val;
46692 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46693 int n_nodes;
46694 xmlNodePtr node; /* a node */
46695 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046696
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046697 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46698 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46699 mem_base = xmlMemBlocks();
46700 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46701 node = gen_xmlNodePtr(n_node, 1);
46702
46703 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
46704 desret_xmlNodeSetPtr(ret_val);
46705 call_tests++;
46706 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46707 des_xmlNodePtr(n_node, node, 1);
46708 xmlResetLastError();
46709 if (mem_base != xmlMemBlocks()) {
46710 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
46711 xmlMemBlocks() - mem_base);
46712 test_ret++;
46713 printf(" %d", n_nodes);
46714 printf(" %d", n_node);
46715 printf("\n");
46716 }
46717 }
46718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046719 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046720#endif
46721
Daniel Veillarda82b1822004-11-08 16:24:57 +000046722 return(test_ret);
46723}
46724
46725
46726static int
46727test_xmlXPathNodeSetAdd(void) {
46728 int test_ret = 0;
46729
William M. Brack21e4ef22005-01-02 09:53:13 +000046730#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046731 int mem_base;
46732 xmlNodeSetPtr cur; /* the initial node set */
46733 int n_cur;
46734 xmlNodePtr val; /* a new xmlNodePtr */
46735 int n_val;
46736
46737 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46738 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46739 mem_base = xmlMemBlocks();
46740 cur = gen_xmlNodeSetPtr(n_cur, 0);
46741 val = gen_xmlNodePtr(n_val, 1);
46742
46743 xmlXPathNodeSetAdd(cur, val);
46744 call_tests++;
46745 des_xmlNodeSetPtr(n_cur, cur, 0);
46746 des_xmlNodePtr(n_val, val, 1);
46747 xmlResetLastError();
46748 if (mem_base != xmlMemBlocks()) {
46749 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46750 xmlMemBlocks() - mem_base);
46751 test_ret++;
46752 printf(" %d", n_cur);
46753 printf(" %d", n_val);
46754 printf("\n");
46755 }
46756 }
46757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046758 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046759#endif
46760
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761 return(test_ret);
46762}
46763
46764
46765static int
46766test_xmlXPathNodeSetAddNs(void) {
46767 int test_ret = 0;
46768
William M. Brack21e4ef22005-01-02 09:53:13 +000046769#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046770 int mem_base;
46771 xmlNodeSetPtr cur; /* the initial node set */
46772 int n_cur;
46773 xmlNodePtr node; /* the hosting node */
46774 int n_node;
46775 xmlNsPtr ns; /* a the namespace node */
46776 int n_ns;
46777
46778 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46779 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46780 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46781 mem_base = xmlMemBlocks();
46782 cur = gen_xmlNodeSetPtr(n_cur, 0);
46783 node = gen_xmlNodePtr(n_node, 1);
46784 ns = gen_xmlNsPtr(n_ns, 2);
46785
46786 xmlXPathNodeSetAddNs(cur, node, ns);
46787 call_tests++;
46788 des_xmlNodeSetPtr(n_cur, cur, 0);
46789 des_xmlNodePtr(n_node, node, 1);
46790 des_xmlNsPtr(n_ns, ns, 2);
46791 xmlResetLastError();
46792 if (mem_base != xmlMemBlocks()) {
46793 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46794 xmlMemBlocks() - mem_base);
46795 test_ret++;
46796 printf(" %d", n_cur);
46797 printf(" %d", n_node);
46798 printf(" %d", n_ns);
46799 printf("\n");
46800 }
46801 }
46802 }
46803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046804 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046805#endif
46806
Daniel Veillarda82b1822004-11-08 16:24:57 +000046807 return(test_ret);
46808}
46809
46810
46811static int
46812test_xmlXPathNodeSetAddUnique(void) {
46813 int test_ret = 0;
46814
William M. Brack21e4ef22005-01-02 09:53:13 +000046815#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046816 int mem_base;
46817 xmlNodeSetPtr cur; /* the initial node set */
46818 int n_cur;
46819 xmlNodePtr val; /* a new xmlNodePtr */
46820 int n_val;
46821
46822 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46823 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46824 mem_base = xmlMemBlocks();
46825 cur = gen_xmlNodeSetPtr(n_cur, 0);
46826 val = gen_xmlNodePtr(n_val, 1);
46827
46828 xmlXPathNodeSetAddUnique(cur, val);
46829 call_tests++;
46830 des_xmlNodeSetPtr(n_cur, cur, 0);
46831 des_xmlNodePtr(n_val, val, 1);
46832 xmlResetLastError();
46833 if (mem_base != xmlMemBlocks()) {
46834 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46835 xmlMemBlocks() - mem_base);
46836 test_ret++;
46837 printf(" %d", n_cur);
46838 printf(" %d", n_val);
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_xmlXPathNodeSetContains(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 int ret_val;
46857 xmlNodeSetPtr cur; /* the node-set */
46858 int n_cur;
46859 xmlNodePtr val; /* the node */
46860 int n_val;
46861
46862 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46863 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46864 mem_base = xmlMemBlocks();
46865 cur = gen_xmlNodeSetPtr(n_cur, 0);
46866 val = gen_xmlNodePtr(n_val, 1);
46867
46868 ret_val = xmlXPathNodeSetContains(cur, val);
46869 desret_int(ret_val);
46870 call_tests++;
46871 des_xmlNodeSetPtr(n_cur, cur, 0);
46872 des_xmlNodePtr(n_val, val, 1);
46873 xmlResetLastError();
46874 if (mem_base != xmlMemBlocks()) {
46875 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46876 xmlMemBlocks() - mem_base);
46877 test_ret++;
46878 printf(" %d", n_cur);
46879 printf(" %d", n_val);
46880 printf("\n");
46881 }
46882 }
46883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046884 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046885#endif
46886
Daniel Veillarda82b1822004-11-08 16:24:57 +000046887 return(test_ret);
46888}
46889
46890
46891static int
46892test_xmlXPathNodeSetDel(void) {
46893 int test_ret = 0;
46894
William M. Brack21e4ef22005-01-02 09:53:13 +000046895#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046896 int mem_base;
46897 xmlNodeSetPtr cur; /* the initial node set */
46898 int n_cur;
46899 xmlNodePtr val; /* an xmlNodePtr */
46900 int n_val;
46901
46902 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46903 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46904 mem_base = xmlMemBlocks();
46905 cur = gen_xmlNodeSetPtr(n_cur, 0);
46906 val = gen_xmlNodePtr(n_val, 1);
46907
46908 xmlXPathNodeSetDel(cur, val);
46909 call_tests++;
46910 des_xmlNodeSetPtr(n_cur, cur, 0);
46911 des_xmlNodePtr(n_val, val, 1);
46912 xmlResetLastError();
46913 if (mem_base != xmlMemBlocks()) {
46914 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46915 xmlMemBlocks() - mem_base);
46916 test_ret++;
46917 printf(" %d", n_cur);
46918 printf(" %d", n_val);
46919 printf("\n");
46920 }
46921 }
46922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046923 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046924#endif
46925
Daniel Veillarda82b1822004-11-08 16:24:57 +000046926 return(test_ret);
46927}
46928
46929
46930static int
46931test_xmlXPathNodeSetMerge(void) {
46932 int test_ret = 0;
46933
William M. Brack21e4ef22005-01-02 09:53:13 +000046934#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046935 int mem_base;
46936 xmlNodeSetPtr ret_val;
46937 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46938 int n_val1;
46939 xmlNodeSetPtr val2; /* the second NodeSet */
46940 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046941
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046942 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46943 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46944 mem_base = xmlMemBlocks();
46945 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46946 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46947
46948 ret_val = xmlXPathNodeSetMerge(val1, val2);
46949 desret_xmlNodeSetPtr(ret_val);
46950 call_tests++;
46951 des_xmlNodeSetPtr(n_val1, val1, 0);
46952 des_xmlNodeSetPtr(n_val2, val2, 1);
46953 xmlResetLastError();
46954 if (mem_base != xmlMemBlocks()) {
46955 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46956 xmlMemBlocks() - mem_base);
46957 test_ret++;
46958 printf(" %d", n_val1);
46959 printf(" %d", n_val2);
46960 printf("\n");
46961 }
46962 }
46963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046964 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046965#endif
46966
Daniel Veillarda82b1822004-11-08 16:24:57 +000046967 return(test_ret);
46968}
46969
46970
46971static int
46972test_xmlXPathNodeSetRemove(void) {
46973 int test_ret = 0;
46974
William M. Brack21e4ef22005-01-02 09:53:13 +000046975#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046976 int mem_base;
46977 xmlNodeSetPtr cur; /* the initial node set */
46978 int n_cur;
46979 int val; /* the index to remove */
46980 int n_val;
46981
46982 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46983 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46984 mem_base = xmlMemBlocks();
46985 cur = gen_xmlNodeSetPtr(n_cur, 0);
46986 val = gen_int(n_val, 1);
46987
46988 xmlXPathNodeSetRemove(cur, val);
46989 call_tests++;
46990 des_xmlNodeSetPtr(n_cur, cur, 0);
46991 des_int(n_val, val, 1);
46992 xmlResetLastError();
46993 if (mem_base != xmlMemBlocks()) {
46994 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46995 xmlMemBlocks() - mem_base);
46996 test_ret++;
46997 printf(" %d", n_cur);
46998 printf(" %d", n_val);
46999 printf("\n");
47000 }
47001 }
47002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047003 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047004#endif
47005
Daniel Veillarda82b1822004-11-08 16:24:57 +000047006 return(test_ret);
47007}
47008
47009
47010static int
47011test_xmlXPathNodeSetSort(void) {
47012 int test_ret = 0;
47013
William M. Brack21e4ef22005-01-02 09:53:13 +000047014#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047015 int mem_base;
47016 xmlNodeSetPtr set; /* the node set */
47017 int n_set;
47018
47019 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
47020 mem_base = xmlMemBlocks();
47021 set = gen_xmlNodeSetPtr(n_set, 0);
47022
47023 xmlXPathNodeSetSort(set);
47024 call_tests++;
47025 des_xmlNodeSetPtr(n_set, set, 0);
47026 xmlResetLastError();
47027 if (mem_base != xmlMemBlocks()) {
47028 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
47029 xmlMemBlocks() - mem_base);
47030 test_ret++;
47031 printf(" %d", n_set);
47032 printf("\n");
47033 }
47034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047035 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047036#endif
47037
Daniel Veillarda82b1822004-11-08 16:24:57 +000047038 return(test_ret);
47039}
47040
47041
47042static int
47043test_xmlXPathNodeTrailing(void) {
47044 int test_ret = 0;
47045
William M. Brack21e4ef22005-01-02 09:53:13 +000047046#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047047 int mem_base;
47048 xmlNodeSetPtr ret_val;
47049 xmlNodeSetPtr nodes; /* a node-set */
47050 int n_nodes;
47051 xmlNodePtr node; /* a node */
47052 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047053
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047054 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
47055 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
47056 mem_base = xmlMemBlocks();
47057 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
47058 node = gen_xmlNodePtr(n_node, 1);
47059
47060 ret_val = xmlXPathNodeTrailing(nodes, node);
47061 desret_xmlNodeSetPtr(ret_val);
47062 call_tests++;
47063 des_xmlNodeSetPtr(n_nodes, nodes, 0);
47064 des_xmlNodePtr(n_node, node, 1);
47065 xmlResetLastError();
47066 if (mem_base != xmlMemBlocks()) {
47067 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
47068 xmlMemBlocks() - mem_base);
47069 test_ret++;
47070 printf(" %d", n_nodes);
47071 printf(" %d", n_node);
47072 printf("\n");
47073 }
47074 }
47075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047076 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047077#endif
47078
Daniel Veillarda82b1822004-11-08 16:24:57 +000047079 return(test_ret);
47080}
47081
47082
47083static int
47084test_xmlXPathNodeTrailingSorted(void) {
47085 int test_ret = 0;
47086
William M. Brack21e4ef22005-01-02 09:53:13 +000047087#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047088 int mem_base;
47089 xmlNodeSetPtr ret_val;
47090 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
47091 int n_nodes;
47092 xmlNodePtr node; /* a node */
47093 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047094
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047095 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
47096 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
47097 mem_base = xmlMemBlocks();
47098 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
47099 node = gen_xmlNodePtr(n_node, 1);
47100
47101 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
47102 desret_xmlNodeSetPtr(ret_val);
47103 call_tests++;
47104 des_xmlNodeSetPtr(n_nodes, nodes, 0);
47105 des_xmlNodePtr(n_node, node, 1);
47106 xmlResetLastError();
47107 if (mem_base != xmlMemBlocks()) {
47108 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
47109 xmlMemBlocks() - mem_base);
47110 test_ret++;
47111 printf(" %d", n_nodes);
47112 printf(" %d", n_node);
47113 printf("\n");
47114 }
47115 }
47116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047117 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047118#endif
47119
Daniel Veillarda82b1822004-11-08 16:24:57 +000047120 return(test_ret);
47121}
47122
47123
47124static int
47125test_xmlXPathNormalizeFunction(void) {
47126 int test_ret = 0;
47127
William M. Brack21e4ef22005-01-02 09:53:13 +000047128#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047129 int mem_base;
47130 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47131 int n_ctxt;
47132 int nargs; /* the number of arguments */
47133 int n_nargs;
47134
47135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47136 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47137 mem_base = xmlMemBlocks();
47138 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47139 nargs = gen_int(n_nargs, 1);
47140
47141 xmlXPathNormalizeFunction(ctxt, nargs);
47142 call_tests++;
47143 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47144 des_int(n_nargs, nargs, 1);
47145 xmlResetLastError();
47146 if (mem_base != xmlMemBlocks()) {
47147 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
47148 xmlMemBlocks() - mem_base);
47149 test_ret++;
47150 printf(" %d", n_ctxt);
47151 printf(" %d", n_nargs);
47152 printf("\n");
47153 }
47154 }
47155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047156 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047157#endif
47158
Daniel Veillarda82b1822004-11-08 16:24:57 +000047159 return(test_ret);
47160}
47161
47162
47163static int
47164test_xmlXPathNotEqualValues(void) {
47165 int test_ret = 0;
47166
William M. Brack21e4ef22005-01-02 09:53:13 +000047167#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047168 int mem_base;
47169 int ret_val;
47170 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47171 int n_ctxt;
47172
47173 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47174 mem_base = xmlMemBlocks();
47175 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47176
47177 ret_val = xmlXPathNotEqualValues(ctxt);
47178 desret_int(ret_val);
47179 call_tests++;
47180 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47181 xmlResetLastError();
47182 if (mem_base != xmlMemBlocks()) {
47183 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
47184 xmlMemBlocks() - mem_base);
47185 test_ret++;
47186 printf(" %d", n_ctxt);
47187 printf("\n");
47188 }
47189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047190 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047191#endif
47192
Daniel Veillarda82b1822004-11-08 16:24:57 +000047193 return(test_ret);
47194}
47195
47196
47197static int
47198test_xmlXPathNotFunction(void) {
47199 int test_ret = 0;
47200
William M. Brack21e4ef22005-01-02 09:53:13 +000047201#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047202 int mem_base;
47203 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47204 int n_ctxt;
47205 int nargs; /* the number of arguments */
47206 int n_nargs;
47207
47208 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47209 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47210 mem_base = xmlMemBlocks();
47211 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47212 nargs = gen_int(n_nargs, 1);
47213
47214 xmlXPathNotFunction(ctxt, nargs);
47215 call_tests++;
47216 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47217 des_int(n_nargs, nargs, 1);
47218 xmlResetLastError();
47219 if (mem_base != xmlMemBlocks()) {
47220 printf("Leak of %d blocks found in xmlXPathNotFunction",
47221 xmlMemBlocks() - mem_base);
47222 test_ret++;
47223 printf(" %d", n_ctxt);
47224 printf(" %d", n_nargs);
47225 printf("\n");
47226 }
47227 }
47228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047229 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047230#endif
47231
Daniel Veillarda82b1822004-11-08 16:24:57 +000047232 return(test_ret);
47233}
47234
47235
47236static int
47237test_xmlXPathNsLookup(void) {
47238 int test_ret = 0;
47239
William M. Brack21e4ef22005-01-02 09:53:13 +000047240#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047241 int mem_base;
47242 const xmlChar * ret_val;
47243 xmlXPathContextPtr ctxt; /* the XPath context */
47244 int n_ctxt;
47245 xmlChar * prefix; /* the namespace prefix value */
47246 int n_prefix;
47247
47248 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47249 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47250 mem_base = xmlMemBlocks();
47251 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47252 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47253
William M. Brackf13f77f2004-11-12 16:03:48 +000047254 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047255 desret_const_xmlChar_ptr(ret_val);
47256 call_tests++;
47257 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047258 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047259 xmlResetLastError();
47260 if (mem_base != xmlMemBlocks()) {
47261 printf("Leak of %d blocks found in xmlXPathNsLookup",
47262 xmlMemBlocks() - mem_base);
47263 test_ret++;
47264 printf(" %d", n_ctxt);
47265 printf(" %d", n_prefix);
47266 printf("\n");
47267 }
47268 }
47269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047270 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047271#endif
47272
Daniel Veillarda82b1822004-11-08 16:24:57 +000047273 return(test_ret);
47274}
47275
47276
47277static int
47278test_xmlXPathNumberFunction(void) {
47279 int test_ret = 0;
47280
William M. Brack21e4ef22005-01-02 09:53:13 +000047281#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047282 int mem_base;
47283 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47284 int n_ctxt;
47285 int nargs; /* the number of arguments */
47286 int n_nargs;
47287
47288 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47289 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47290 mem_base = xmlMemBlocks();
47291 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47292 nargs = gen_int(n_nargs, 1);
47293
47294 xmlXPathNumberFunction(ctxt, nargs);
47295 call_tests++;
47296 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47297 des_int(n_nargs, nargs, 1);
47298 xmlResetLastError();
47299 if (mem_base != xmlMemBlocks()) {
47300 printf("Leak of %d blocks found in xmlXPathNumberFunction",
47301 xmlMemBlocks() - mem_base);
47302 test_ret++;
47303 printf(" %d", n_ctxt);
47304 printf(" %d", n_nargs);
47305 printf("\n");
47306 }
47307 }
47308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047309 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047310#endif
47311
Daniel Veillarda82b1822004-11-08 16:24:57 +000047312 return(test_ret);
47313}
47314
47315
47316static int
47317test_xmlXPathParseNCName(void) {
47318 int test_ret = 0;
47319
William M. Brack21e4ef22005-01-02 09:53:13 +000047320#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047321 int mem_base;
47322 xmlChar * ret_val;
47323 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47324 int n_ctxt;
47325
47326 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47327 mem_base = xmlMemBlocks();
47328 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47329
47330 ret_val = xmlXPathParseNCName(ctxt);
47331 desret_xmlChar_ptr(ret_val);
47332 call_tests++;
47333 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47334 xmlResetLastError();
47335 if (mem_base != xmlMemBlocks()) {
47336 printf("Leak of %d blocks found in xmlXPathParseNCName",
47337 xmlMemBlocks() - mem_base);
47338 test_ret++;
47339 printf(" %d", n_ctxt);
47340 printf("\n");
47341 }
47342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047343 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047344#endif
47345
Daniel Veillarda82b1822004-11-08 16:24:57 +000047346 return(test_ret);
47347}
47348
47349
47350static int
47351test_xmlXPathParseName(void) {
47352 int test_ret = 0;
47353
William M. Brack21e4ef22005-01-02 09:53:13 +000047354#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047355 int mem_base;
47356 xmlChar * ret_val;
47357 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47358 int n_ctxt;
47359
47360 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47361 mem_base = xmlMemBlocks();
47362 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47363
47364 ret_val = xmlXPathParseName(ctxt);
47365 desret_xmlChar_ptr(ret_val);
47366 call_tests++;
47367 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47368 xmlResetLastError();
47369 if (mem_base != xmlMemBlocks()) {
47370 printf("Leak of %d blocks found in xmlXPathParseName",
47371 xmlMemBlocks() - mem_base);
47372 test_ret++;
47373 printf(" %d", n_ctxt);
47374 printf("\n");
47375 }
47376 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047377 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047378#endif
47379
Daniel Veillarda82b1822004-11-08 16:24:57 +000047380 return(test_ret);
47381}
47382
47383
47384static int
47385test_xmlXPathPopBoolean(void) {
47386 int test_ret = 0;
47387
William M. Brack21e4ef22005-01-02 09:53:13 +000047388#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047389 int mem_base;
47390 int ret_val;
47391 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47392 int n_ctxt;
47393
47394 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47395 mem_base = xmlMemBlocks();
47396 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47397
47398 ret_val = xmlXPathPopBoolean(ctxt);
47399 desret_int(ret_val);
47400 call_tests++;
47401 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47402 xmlResetLastError();
47403 if (mem_base != xmlMemBlocks()) {
47404 printf("Leak of %d blocks found in xmlXPathPopBoolean",
47405 xmlMemBlocks() - mem_base);
47406 test_ret++;
47407 printf(" %d", n_ctxt);
47408 printf("\n");
47409 }
47410 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047411 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047412#endif
47413
Daniel Veillarda82b1822004-11-08 16:24:57 +000047414 return(test_ret);
47415}
47416
47417
47418static int
47419test_xmlXPathPopExternal(void) {
47420 int test_ret = 0;
47421
William M. Brack21e4ef22005-01-02 09:53:13 +000047422#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047423 int mem_base;
47424 void * ret_val;
47425 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47426 int n_ctxt;
47427
47428 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47429 mem_base = xmlMemBlocks();
47430 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47431
47432 ret_val = xmlXPathPopExternal(ctxt);
47433 desret_void_ptr(ret_val);
47434 call_tests++;
47435 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47436 xmlResetLastError();
47437 if (mem_base != xmlMemBlocks()) {
47438 printf("Leak of %d blocks found in xmlXPathPopExternal",
47439 xmlMemBlocks() - mem_base);
47440 test_ret++;
47441 printf(" %d", n_ctxt);
47442 printf("\n");
47443 }
47444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047445 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047446#endif
47447
Daniel Veillarda82b1822004-11-08 16:24:57 +000047448 return(test_ret);
47449}
47450
47451
47452static int
47453test_xmlXPathPopNodeSet(void) {
47454 int test_ret = 0;
47455
William M. Brack21e4ef22005-01-02 09:53:13 +000047456#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047457 int mem_base;
47458 xmlNodeSetPtr ret_val;
47459 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47460 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047461
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47463 mem_base = xmlMemBlocks();
47464 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47465
47466 ret_val = xmlXPathPopNodeSet(ctxt);
47467 desret_xmlNodeSetPtr(ret_val);
47468 call_tests++;
47469 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47470 xmlResetLastError();
47471 if (mem_base != xmlMemBlocks()) {
47472 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
47473 xmlMemBlocks() - mem_base);
47474 test_ret++;
47475 printf(" %d", n_ctxt);
47476 printf("\n");
47477 }
47478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047479 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047480#endif
47481
Daniel Veillarda82b1822004-11-08 16:24:57 +000047482 return(test_ret);
47483}
47484
47485
47486static int
47487test_xmlXPathPopNumber(void) {
47488 int test_ret = 0;
47489
William M. Brack21e4ef22005-01-02 09:53:13 +000047490#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047491 int mem_base;
47492 double ret_val;
47493 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47494 int n_ctxt;
47495
47496 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47497 mem_base = xmlMemBlocks();
47498 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47499
47500 ret_val = xmlXPathPopNumber(ctxt);
47501 desret_double(ret_val);
47502 call_tests++;
47503 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47504 xmlResetLastError();
47505 if (mem_base != xmlMemBlocks()) {
47506 printf("Leak of %d blocks found in xmlXPathPopNumber",
47507 xmlMemBlocks() - mem_base);
47508 test_ret++;
47509 printf(" %d", n_ctxt);
47510 printf("\n");
47511 }
47512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047513 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047514#endif
47515
Daniel Veillarda82b1822004-11-08 16:24:57 +000047516 return(test_ret);
47517}
47518
47519
47520static int
47521test_xmlXPathPopString(void) {
47522 int test_ret = 0;
47523
William M. Brack21e4ef22005-01-02 09:53:13 +000047524#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047525 int mem_base;
47526 xmlChar * ret_val;
47527 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47528 int n_ctxt;
47529
47530 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47531 mem_base = xmlMemBlocks();
47532 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47533
47534 ret_val = xmlXPathPopString(ctxt);
47535 desret_xmlChar_ptr(ret_val);
47536 call_tests++;
47537 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47538 xmlResetLastError();
47539 if (mem_base != xmlMemBlocks()) {
47540 printf("Leak of %d blocks found in xmlXPathPopString",
47541 xmlMemBlocks() - mem_base);
47542 test_ret++;
47543 printf(" %d", n_ctxt);
47544 printf("\n");
47545 }
47546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047547 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047548#endif
47549
Daniel Veillarda82b1822004-11-08 16:24:57 +000047550 return(test_ret);
47551}
47552
47553
47554static int
47555test_xmlXPathPositionFunction(void) {
47556 int test_ret = 0;
47557
William M. Brack21e4ef22005-01-02 09:53:13 +000047558#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047559 int mem_base;
47560 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47561 int n_ctxt;
47562 int nargs; /* the number of arguments */
47563 int n_nargs;
47564
47565 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47566 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47567 mem_base = xmlMemBlocks();
47568 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47569 nargs = gen_int(n_nargs, 1);
47570
47571 xmlXPathPositionFunction(ctxt, nargs);
47572 call_tests++;
47573 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47574 des_int(n_nargs, nargs, 1);
47575 xmlResetLastError();
47576 if (mem_base != xmlMemBlocks()) {
47577 printf("Leak of %d blocks found in xmlXPathPositionFunction",
47578 xmlMemBlocks() - mem_base);
47579 test_ret++;
47580 printf(" %d", n_ctxt);
47581 printf(" %d", n_nargs);
47582 printf("\n");
47583 }
47584 }
47585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047586 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047587#endif
47588
Daniel Veillarda82b1822004-11-08 16:24:57 +000047589 return(test_ret);
47590}
47591
47592
47593static int
47594test_xmlXPathRegisterAllFunctions(void) {
47595 int test_ret = 0;
47596
William M. Brack21e4ef22005-01-02 09:53:13 +000047597#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047598 int mem_base;
47599 xmlXPathContextPtr ctxt; /* the XPath context */
47600 int n_ctxt;
47601
47602 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47603 mem_base = xmlMemBlocks();
47604 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47605
47606 xmlXPathRegisterAllFunctions(ctxt);
47607 call_tests++;
47608 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47609 xmlResetLastError();
47610 if (mem_base != xmlMemBlocks()) {
47611 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
47612 xmlMemBlocks() - mem_base);
47613 test_ret++;
47614 printf(" %d", n_ctxt);
47615 printf("\n");
47616 }
47617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047618 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047619#endif
47620
Daniel Veillarda82b1822004-11-08 16:24:57 +000047621 return(test_ret);
47622}
47623
47624
47625static int
47626test_xmlXPathRegisterFunc(void) {
47627 int test_ret = 0;
47628
47629
47630 /* missing type support */
47631 return(test_ret);
47632}
47633
47634
47635static int
47636test_xmlXPathRegisterFuncLookup(void) {
47637 int test_ret = 0;
47638
47639
47640 /* missing type support */
47641 return(test_ret);
47642}
47643
47644
47645static int
47646test_xmlXPathRegisterFuncNS(void) {
47647 int test_ret = 0;
47648
47649
47650 /* missing type support */
47651 return(test_ret);
47652}
47653
47654
47655static int
47656test_xmlXPathRegisterNs(void) {
47657 int test_ret = 0;
47658
William M. Brack21e4ef22005-01-02 09:53:13 +000047659#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047660 int mem_base;
47661 int ret_val;
47662 xmlXPathContextPtr ctxt; /* the XPath context */
47663 int n_ctxt;
47664 xmlChar * prefix; /* the namespace prefix */
47665 int n_prefix;
47666 xmlChar * ns_uri; /* the namespace name */
47667 int n_ns_uri;
47668
47669 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47670 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47671 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47672 mem_base = xmlMemBlocks();
47673 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47674 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47675 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47676
William M. Brackf13f77f2004-11-12 16:03:48 +000047677 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047678 desret_int(ret_val);
47679 call_tests++;
47680 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047681 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
47682 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047683 xmlResetLastError();
47684 if (mem_base != xmlMemBlocks()) {
47685 printf("Leak of %d blocks found in xmlXPathRegisterNs",
47686 xmlMemBlocks() - mem_base);
47687 test_ret++;
47688 printf(" %d", n_ctxt);
47689 printf(" %d", n_prefix);
47690 printf(" %d", n_ns_uri);
47691 printf("\n");
47692 }
47693 }
47694 }
47695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047696 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047697#endif
47698
Daniel Veillarda82b1822004-11-08 16:24:57 +000047699 return(test_ret);
47700}
47701
47702
47703static int
47704test_xmlXPathRegisterVariable(void) {
47705 int test_ret = 0;
47706
William M. Brack21e4ef22005-01-02 09:53:13 +000047707#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047708 int mem_base;
47709 int ret_val;
47710 xmlXPathContextPtr ctxt; /* the XPath context */
47711 int n_ctxt;
47712 xmlChar * name; /* the variable name */
47713 int n_name;
47714 xmlXPathObjectPtr value; /* the variable value or NULL */
47715 int n_value;
47716
47717 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47718 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47719 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47720 mem_base = xmlMemBlocks();
47721 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47722 name = gen_const_xmlChar_ptr(n_name, 1);
47723 value = gen_xmlXPathObjectPtr(n_value, 2);
47724
William M. Brackf13f77f2004-11-12 16:03:48 +000047725 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047726 desret_int(ret_val);
47727 call_tests++;
47728 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047729 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047730 des_xmlXPathObjectPtr(n_value, value, 2);
47731 xmlResetLastError();
47732 if (mem_base != xmlMemBlocks()) {
47733 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47734 xmlMemBlocks() - mem_base);
47735 test_ret++;
47736 printf(" %d", n_ctxt);
47737 printf(" %d", n_name);
47738 printf(" %d", n_value);
47739 printf("\n");
47740 }
47741 }
47742 }
47743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047744 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047745#endif
47746
Daniel Veillarda82b1822004-11-08 16:24:57 +000047747 return(test_ret);
47748}
47749
47750
47751static int
47752test_xmlXPathRegisterVariableLookup(void) {
47753 int test_ret = 0;
47754
47755
47756 /* missing type support */
47757 return(test_ret);
47758}
47759
47760
47761static int
47762test_xmlXPathRegisterVariableNS(void) {
47763 int test_ret = 0;
47764
William M. Brack21e4ef22005-01-02 09:53:13 +000047765#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047766 int mem_base;
47767 int ret_val;
47768 xmlXPathContextPtr ctxt; /* the XPath context */
47769 int n_ctxt;
47770 xmlChar * name; /* the variable name */
47771 int n_name;
47772 xmlChar * ns_uri; /* the variable namespace URI */
47773 int n_ns_uri;
47774 xmlXPathObjectPtr value; /* the variable value or NULL */
47775 int n_value;
47776
47777 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47778 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47779 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47780 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47781 mem_base = xmlMemBlocks();
47782 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47783 name = gen_const_xmlChar_ptr(n_name, 1);
47784 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47785 value = gen_xmlXPathObjectPtr(n_value, 3);
47786
William M. Brackf13f77f2004-11-12 16:03:48 +000047787 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047788 desret_int(ret_val);
47789 call_tests++;
47790 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047791 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47792 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047793 des_xmlXPathObjectPtr(n_value, value, 3);
47794 xmlResetLastError();
47795 if (mem_base != xmlMemBlocks()) {
47796 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47797 xmlMemBlocks() - mem_base);
47798 test_ret++;
47799 printf(" %d", n_ctxt);
47800 printf(" %d", n_name);
47801 printf(" %d", n_ns_uri);
47802 printf(" %d", n_value);
47803 printf("\n");
47804 }
47805 }
47806 }
47807 }
47808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047809 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047810#endif
47811
Daniel Veillarda82b1822004-11-08 16:24:57 +000047812 return(test_ret);
47813}
47814
47815
47816static int
47817test_xmlXPathRegisteredFuncsCleanup(void) {
47818 int test_ret = 0;
47819
William M. Brack21e4ef22005-01-02 09:53:13 +000047820#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047821 int mem_base;
47822 xmlXPathContextPtr ctxt; /* the XPath context */
47823 int n_ctxt;
47824
47825 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47826 mem_base = xmlMemBlocks();
47827 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47828
47829 xmlXPathRegisteredFuncsCleanup(ctxt);
47830 call_tests++;
47831 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47832 xmlResetLastError();
47833 if (mem_base != xmlMemBlocks()) {
47834 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
47835 xmlMemBlocks() - mem_base);
47836 test_ret++;
47837 printf(" %d", n_ctxt);
47838 printf("\n");
47839 }
47840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047841 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047842#endif
47843
Daniel Veillarda82b1822004-11-08 16:24:57 +000047844 return(test_ret);
47845}
47846
47847
47848static int
47849test_xmlXPathRegisteredNsCleanup(void) {
47850 int test_ret = 0;
47851
William M. Brack21e4ef22005-01-02 09:53:13 +000047852#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047853 int mem_base;
47854 xmlXPathContextPtr ctxt; /* the XPath context */
47855 int n_ctxt;
47856
47857 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47858 mem_base = xmlMemBlocks();
47859 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47860
47861 xmlXPathRegisteredNsCleanup(ctxt);
47862 call_tests++;
47863 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47864 xmlResetLastError();
47865 if (mem_base != xmlMemBlocks()) {
47866 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47867 xmlMemBlocks() - mem_base);
47868 test_ret++;
47869 printf(" %d", n_ctxt);
47870 printf("\n");
47871 }
47872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047873 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047874#endif
47875
Daniel Veillarda82b1822004-11-08 16:24:57 +000047876 return(test_ret);
47877}
47878
47879
47880static int
47881test_xmlXPathRegisteredVariablesCleanup(void) {
47882 int test_ret = 0;
47883
William M. Brack21e4ef22005-01-02 09:53:13 +000047884#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047885 int mem_base;
47886 xmlXPathContextPtr ctxt; /* the XPath context */
47887 int n_ctxt;
47888
47889 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47890 mem_base = xmlMemBlocks();
47891 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47892
47893 xmlXPathRegisteredVariablesCleanup(ctxt);
47894 call_tests++;
47895 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47896 xmlResetLastError();
47897 if (mem_base != xmlMemBlocks()) {
47898 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47899 xmlMemBlocks() - mem_base);
47900 test_ret++;
47901 printf(" %d", n_ctxt);
47902 printf("\n");
47903 }
47904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047905 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047906#endif
47907
Daniel Veillarda82b1822004-11-08 16:24:57 +000047908 return(test_ret);
47909}
47910
47911
47912static int
47913test_xmlXPathRoot(void) {
47914 int test_ret = 0;
47915
William M. Brack21e4ef22005-01-02 09:53:13 +000047916#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047917 int mem_base;
47918 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47919 int n_ctxt;
47920
47921 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47922 mem_base = xmlMemBlocks();
47923 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47924
47925 xmlXPathRoot(ctxt);
47926 call_tests++;
47927 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47928 xmlResetLastError();
47929 if (mem_base != xmlMemBlocks()) {
47930 printf("Leak of %d blocks found in xmlXPathRoot",
47931 xmlMemBlocks() - mem_base);
47932 test_ret++;
47933 printf(" %d", n_ctxt);
47934 printf("\n");
47935 }
47936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047937 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047938#endif
47939
Daniel Veillarda82b1822004-11-08 16:24:57 +000047940 return(test_ret);
47941}
47942
47943
47944static int
47945test_xmlXPathRoundFunction(void) {
47946 int test_ret = 0;
47947
William M. Brack21e4ef22005-01-02 09:53:13 +000047948#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047949 int mem_base;
47950 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47951 int n_ctxt;
47952 int nargs; /* the number of arguments */
47953 int n_nargs;
47954
47955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47956 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47957 mem_base = xmlMemBlocks();
47958 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47959 nargs = gen_int(n_nargs, 1);
47960
47961 xmlXPathRoundFunction(ctxt, nargs);
47962 call_tests++;
47963 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47964 des_int(n_nargs, nargs, 1);
47965 xmlResetLastError();
47966 if (mem_base != xmlMemBlocks()) {
47967 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47968 xmlMemBlocks() - mem_base);
47969 test_ret++;
47970 printf(" %d", n_ctxt);
47971 printf(" %d", n_nargs);
47972 printf("\n");
47973 }
47974 }
47975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047976 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047977#endif
47978
Daniel Veillarda82b1822004-11-08 16:24:57 +000047979 return(test_ret);
47980}
47981
47982
47983static int
47984test_xmlXPathStartsWithFunction(void) {
47985 int test_ret = 0;
47986
William M. Brack21e4ef22005-01-02 09:53:13 +000047987#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047988 int mem_base;
47989 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47990 int n_ctxt;
47991 int nargs; /* the number of arguments */
47992 int n_nargs;
47993
47994 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47995 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47996 mem_base = xmlMemBlocks();
47997 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47998 nargs = gen_int(n_nargs, 1);
47999
48000 xmlXPathStartsWithFunction(ctxt, nargs);
48001 call_tests++;
48002 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48003 des_int(n_nargs, nargs, 1);
48004 xmlResetLastError();
48005 if (mem_base != xmlMemBlocks()) {
48006 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
48007 xmlMemBlocks() - mem_base);
48008 test_ret++;
48009 printf(" %d", n_ctxt);
48010 printf(" %d", n_nargs);
48011 printf("\n");
48012 }
48013 }
48014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048015 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048016#endif
48017
Daniel Veillarda82b1822004-11-08 16:24:57 +000048018 return(test_ret);
48019}
48020
48021
48022static int
48023test_xmlXPathStringEvalNumber(void) {
48024 int test_ret = 0;
48025
William M. Brack21e4ef22005-01-02 09:53:13 +000048026#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048027 int mem_base;
48028 double ret_val;
48029 xmlChar * str; /* A string to scan */
48030 int n_str;
48031
48032 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48033 mem_base = xmlMemBlocks();
48034 str = gen_const_xmlChar_ptr(n_str, 0);
48035
William M. Brackf13f77f2004-11-12 16:03:48 +000048036 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048037 desret_double(ret_val);
48038 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048039 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048040 xmlResetLastError();
48041 if (mem_base != xmlMemBlocks()) {
48042 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
48043 xmlMemBlocks() - mem_base);
48044 test_ret++;
48045 printf(" %d", n_str);
48046 printf("\n");
48047 }
48048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048049 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048050#endif
48051
Daniel Veillarda82b1822004-11-08 16:24:57 +000048052 return(test_ret);
48053}
48054
48055
48056static int
48057test_xmlXPathStringFunction(void) {
48058 int test_ret = 0;
48059
William M. Brack21e4ef22005-01-02 09:53:13 +000048060#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048061 int mem_base;
48062 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48063 int n_ctxt;
48064 int nargs; /* the number of arguments */
48065 int n_nargs;
48066
48067 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48068 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48069 mem_base = xmlMemBlocks();
48070 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48071 nargs = gen_int(n_nargs, 1);
48072
48073 xmlXPathStringFunction(ctxt, nargs);
48074 call_tests++;
48075 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48076 des_int(n_nargs, nargs, 1);
48077 xmlResetLastError();
48078 if (mem_base != xmlMemBlocks()) {
48079 printf("Leak of %d blocks found in xmlXPathStringFunction",
48080 xmlMemBlocks() - mem_base);
48081 test_ret++;
48082 printf(" %d", n_ctxt);
48083 printf(" %d", n_nargs);
48084 printf("\n");
48085 }
48086 }
48087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048088 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048089#endif
48090
Daniel Veillarda82b1822004-11-08 16:24:57 +000048091 return(test_ret);
48092}
48093
48094
48095static int
48096test_xmlXPathStringLengthFunction(void) {
48097 int test_ret = 0;
48098
William M. Brack21e4ef22005-01-02 09:53:13 +000048099#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048100 int mem_base;
48101 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48102 int n_ctxt;
48103 int nargs; /* the number of arguments */
48104 int n_nargs;
48105
48106 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48107 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48108 mem_base = xmlMemBlocks();
48109 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48110 nargs = gen_int(n_nargs, 1);
48111
48112 xmlXPathStringLengthFunction(ctxt, nargs);
48113 call_tests++;
48114 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48115 des_int(n_nargs, nargs, 1);
48116 xmlResetLastError();
48117 if (mem_base != xmlMemBlocks()) {
48118 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
48119 xmlMemBlocks() - mem_base);
48120 test_ret++;
48121 printf(" %d", n_ctxt);
48122 printf(" %d", n_nargs);
48123 printf("\n");
48124 }
48125 }
48126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048127 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048128#endif
48129
Daniel Veillarda82b1822004-11-08 16:24:57 +000048130 return(test_ret);
48131}
48132
48133
48134static int
48135test_xmlXPathSubValues(void) {
48136 int test_ret = 0;
48137
William M. Brack21e4ef22005-01-02 09:53:13 +000048138#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048139 int mem_base;
48140 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48141 int n_ctxt;
48142
48143 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48144 mem_base = xmlMemBlocks();
48145 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48146
48147 xmlXPathSubValues(ctxt);
48148 call_tests++;
48149 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48150 xmlResetLastError();
48151 if (mem_base != xmlMemBlocks()) {
48152 printf("Leak of %d blocks found in xmlXPathSubValues",
48153 xmlMemBlocks() - mem_base);
48154 test_ret++;
48155 printf(" %d", n_ctxt);
48156 printf("\n");
48157 }
48158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048159 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048160#endif
48161
Daniel Veillarda82b1822004-11-08 16:24:57 +000048162 return(test_ret);
48163}
48164
48165
48166static int
48167test_xmlXPathSubstringAfterFunction(void) {
48168 int test_ret = 0;
48169
William M. Brack21e4ef22005-01-02 09:53:13 +000048170#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048171 int mem_base;
48172 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48173 int n_ctxt;
48174 int nargs; /* the number of arguments */
48175 int n_nargs;
48176
48177 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48178 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48179 mem_base = xmlMemBlocks();
48180 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48181 nargs = gen_int(n_nargs, 1);
48182
48183 xmlXPathSubstringAfterFunction(ctxt, nargs);
48184 call_tests++;
48185 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48186 des_int(n_nargs, nargs, 1);
48187 xmlResetLastError();
48188 if (mem_base != xmlMemBlocks()) {
48189 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
48190 xmlMemBlocks() - mem_base);
48191 test_ret++;
48192 printf(" %d", n_ctxt);
48193 printf(" %d", n_nargs);
48194 printf("\n");
48195 }
48196 }
48197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048198 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048199#endif
48200
Daniel Veillarda82b1822004-11-08 16:24:57 +000048201 return(test_ret);
48202}
48203
48204
48205static int
48206test_xmlXPathSubstringBeforeFunction(void) {
48207 int test_ret = 0;
48208
William M. Brack21e4ef22005-01-02 09:53:13 +000048209#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048210 int mem_base;
48211 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48212 int n_ctxt;
48213 int nargs; /* the number of arguments */
48214 int n_nargs;
48215
48216 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48217 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48218 mem_base = xmlMemBlocks();
48219 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48220 nargs = gen_int(n_nargs, 1);
48221
48222 xmlXPathSubstringBeforeFunction(ctxt, nargs);
48223 call_tests++;
48224 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48225 des_int(n_nargs, nargs, 1);
48226 xmlResetLastError();
48227 if (mem_base != xmlMemBlocks()) {
48228 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
48229 xmlMemBlocks() - mem_base);
48230 test_ret++;
48231 printf(" %d", n_ctxt);
48232 printf(" %d", n_nargs);
48233 printf("\n");
48234 }
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_xmlXPathSubstringFunction(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 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48251 int n_ctxt;
48252 int nargs; /* the number of arguments */
48253 int n_nargs;
48254
48255 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48256 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48257 mem_base = xmlMemBlocks();
48258 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48259 nargs = gen_int(n_nargs, 1);
48260
48261 xmlXPathSubstringFunction(ctxt, nargs);
48262 call_tests++;
48263 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48264 des_int(n_nargs, nargs, 1);
48265 xmlResetLastError();
48266 if (mem_base != xmlMemBlocks()) {
48267 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
48268 xmlMemBlocks() - mem_base);
48269 test_ret++;
48270 printf(" %d", n_ctxt);
48271 printf(" %d", n_nargs);
48272 printf("\n");
48273 }
48274 }
48275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048276 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048277#endif
48278
Daniel Veillarda82b1822004-11-08 16:24:57 +000048279 return(test_ret);
48280}
48281
48282
48283static int
48284test_xmlXPathSumFunction(void) {
48285 int test_ret = 0;
48286
William M. Brack21e4ef22005-01-02 09:53:13 +000048287#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048288 int mem_base;
48289 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48290 int n_ctxt;
48291 int nargs; /* the number of arguments */
48292 int n_nargs;
48293
48294 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48295 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48296 mem_base = xmlMemBlocks();
48297 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48298 nargs = gen_int(n_nargs, 1);
48299
48300 xmlXPathSumFunction(ctxt, nargs);
48301 call_tests++;
48302 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48303 des_int(n_nargs, nargs, 1);
48304 xmlResetLastError();
48305 if (mem_base != xmlMemBlocks()) {
48306 printf("Leak of %d blocks found in xmlXPathSumFunction",
48307 xmlMemBlocks() - mem_base);
48308 test_ret++;
48309 printf(" %d", n_ctxt);
48310 printf(" %d", n_nargs);
48311 printf("\n");
48312 }
48313 }
48314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048315 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048316#endif
48317
Daniel Veillarda82b1822004-11-08 16:24:57 +000048318 return(test_ret);
48319}
48320
48321
48322static int
48323test_xmlXPathTrailing(void) {
48324 int test_ret = 0;
48325
William M. Brack21e4ef22005-01-02 09:53:13 +000048326#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048327 int mem_base;
48328 xmlNodeSetPtr ret_val;
48329 xmlNodeSetPtr nodes1; /* a node-set */
48330 int n_nodes1;
48331 xmlNodeSetPtr nodes2; /* a node-set */
48332 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048333
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048334 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
48335 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
48336 mem_base = xmlMemBlocks();
48337 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
48338 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
48339
48340 ret_val = xmlXPathTrailing(nodes1, nodes2);
48341 desret_xmlNodeSetPtr(ret_val);
48342 call_tests++;
48343 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
48344 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
48345 xmlResetLastError();
48346 if (mem_base != xmlMemBlocks()) {
48347 printf("Leak of %d blocks found in xmlXPathTrailing",
48348 xmlMemBlocks() - mem_base);
48349 test_ret++;
48350 printf(" %d", n_nodes1);
48351 printf(" %d", n_nodes2);
48352 printf("\n");
48353 }
48354 }
48355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048356 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048357#endif
48358
Daniel Veillarda82b1822004-11-08 16:24:57 +000048359 return(test_ret);
48360}
48361
48362
48363static int
48364test_xmlXPathTrailingSorted(void) {
48365 int test_ret = 0;
48366
William M. Brack21e4ef22005-01-02 09:53:13 +000048367#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048368 int mem_base;
48369 xmlNodeSetPtr ret_val;
48370 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
48371 int n_nodes1;
48372 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
48373 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048374
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048375 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
48376 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
48377 mem_base = xmlMemBlocks();
48378 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
48379 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
48380
48381 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
48382 desret_xmlNodeSetPtr(ret_val);
48383 call_tests++;
48384 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
48385 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
48386 xmlResetLastError();
48387 if (mem_base != xmlMemBlocks()) {
48388 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
48389 xmlMemBlocks() - mem_base);
48390 test_ret++;
48391 printf(" %d", n_nodes1);
48392 printf(" %d", n_nodes2);
48393 printf("\n");
48394 }
48395 }
48396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048397 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048398#endif
48399
Daniel Veillarda82b1822004-11-08 16:24:57 +000048400 return(test_ret);
48401}
48402
48403
48404static int
48405test_xmlXPathTranslateFunction(void) {
48406 int test_ret = 0;
48407
William M. Brack21e4ef22005-01-02 09:53:13 +000048408#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048409 int mem_base;
48410 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48411 int n_ctxt;
48412 int nargs; /* the number of arguments */
48413 int n_nargs;
48414
48415 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48416 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48417 mem_base = xmlMemBlocks();
48418 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48419 nargs = gen_int(n_nargs, 1);
48420
48421 xmlXPathTranslateFunction(ctxt, nargs);
48422 call_tests++;
48423 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48424 des_int(n_nargs, nargs, 1);
48425 xmlResetLastError();
48426 if (mem_base != xmlMemBlocks()) {
48427 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
48428 xmlMemBlocks() - mem_base);
48429 test_ret++;
48430 printf(" %d", n_ctxt);
48431 printf(" %d", n_nargs);
48432 printf("\n");
48433 }
48434 }
48435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048436 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048437#endif
48438
Daniel Veillarda82b1822004-11-08 16:24:57 +000048439 return(test_ret);
48440}
48441
48442
48443static int
48444test_xmlXPathTrueFunction(void) {
48445 int test_ret = 0;
48446
William M. Brack21e4ef22005-01-02 09:53:13 +000048447#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048448 int mem_base;
48449 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48450 int n_ctxt;
48451 int nargs; /* the number of arguments */
48452 int n_nargs;
48453
48454 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48455 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48456 mem_base = xmlMemBlocks();
48457 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48458 nargs = gen_int(n_nargs, 1);
48459
48460 xmlXPathTrueFunction(ctxt, nargs);
48461 call_tests++;
48462 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48463 des_int(n_nargs, nargs, 1);
48464 xmlResetLastError();
48465 if (mem_base != xmlMemBlocks()) {
48466 printf("Leak of %d blocks found in xmlXPathTrueFunction",
48467 xmlMemBlocks() - mem_base);
48468 test_ret++;
48469 printf(" %d", n_ctxt);
48470 printf(" %d", n_nargs);
48471 printf("\n");
48472 }
48473 }
48474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048475 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048476#endif
48477
Daniel Veillarda82b1822004-11-08 16:24:57 +000048478 return(test_ret);
48479}
48480
48481
48482static int
48483test_xmlXPathValueFlipSign(void) {
48484 int test_ret = 0;
48485
William M. Brack21e4ef22005-01-02 09:53:13 +000048486#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048487 int mem_base;
48488 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48489 int n_ctxt;
48490
48491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48492 mem_base = xmlMemBlocks();
48493 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48494
48495 xmlXPathValueFlipSign(ctxt);
48496 call_tests++;
48497 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48498 xmlResetLastError();
48499 if (mem_base != xmlMemBlocks()) {
48500 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
48501 xmlMemBlocks() - mem_base);
48502 test_ret++;
48503 printf(" %d", n_ctxt);
48504 printf("\n");
48505 }
48506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048507 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048508#endif
48509
Daniel Veillarda82b1822004-11-08 16:24:57 +000048510 return(test_ret);
48511}
48512
48513
48514static int
48515test_xmlXPathVariableLookup(void) {
48516 int test_ret = 0;
48517
William M. Brack21e4ef22005-01-02 09:53:13 +000048518#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048519 int mem_base;
48520 xmlXPathObjectPtr ret_val;
48521 xmlXPathContextPtr ctxt; /* the XPath context */
48522 int n_ctxt;
48523 xmlChar * name; /* the variable name */
48524 int n_name;
48525
48526 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48527 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48528 mem_base = xmlMemBlocks();
48529 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48530 name = gen_const_xmlChar_ptr(n_name, 1);
48531
William M. Brackf13f77f2004-11-12 16:03:48 +000048532 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048533 desret_xmlXPathObjectPtr(ret_val);
48534 call_tests++;
48535 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048536 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048537 xmlResetLastError();
48538 if (mem_base != xmlMemBlocks()) {
48539 printf("Leak of %d blocks found in xmlXPathVariableLookup",
48540 xmlMemBlocks() - mem_base);
48541 test_ret++;
48542 printf(" %d", n_ctxt);
48543 printf(" %d", n_name);
48544 printf("\n");
48545 }
48546 }
48547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048548 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048549#endif
48550
Daniel Veillarda82b1822004-11-08 16:24:57 +000048551 return(test_ret);
48552}
48553
48554
48555static int
48556test_xmlXPathVariableLookupNS(void) {
48557 int test_ret = 0;
48558
William M. Brack21e4ef22005-01-02 09:53:13 +000048559#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048560 int mem_base;
48561 xmlXPathObjectPtr ret_val;
48562 xmlXPathContextPtr ctxt; /* the XPath context */
48563 int n_ctxt;
48564 xmlChar * name; /* the variable name */
48565 int n_name;
48566 xmlChar * ns_uri; /* the variable namespace URI */
48567 int n_ns_uri;
48568
48569 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48570 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48571 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
48572 mem_base = xmlMemBlocks();
48573 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48574 name = gen_const_xmlChar_ptr(n_name, 1);
48575 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
48576
William M. Brackf13f77f2004-11-12 16:03:48 +000048577 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048578 desret_xmlXPathObjectPtr(ret_val);
48579 call_tests++;
48580 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048581 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
48582 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048583 xmlResetLastError();
48584 if (mem_base != xmlMemBlocks()) {
48585 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
48586 xmlMemBlocks() - mem_base);
48587 test_ret++;
48588 printf(" %d", n_ctxt);
48589 printf(" %d", n_name);
48590 printf(" %d", n_ns_uri);
48591 printf("\n");
48592 }
48593 }
48594 }
48595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048596 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048597#endif
48598
Daniel Veillarda82b1822004-11-08 16:24:57 +000048599 return(test_ret);
48600}
48601
48602
48603static int
48604test_xmlXPathWrapCString(void) {
48605 int test_ret = 0;
48606
William M. Brack21e4ef22005-01-02 09:53:13 +000048607#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048608 int mem_base;
48609 xmlXPathObjectPtr ret_val;
48610 char * val; /* the char * value */
48611 int n_val;
48612
48613 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
48614 mem_base = xmlMemBlocks();
48615 val = gen_char_ptr(n_val, 0);
48616
48617 ret_val = xmlXPathWrapCString(val);
48618 desret_xmlXPathObjectPtr(ret_val);
48619 call_tests++;
48620 des_char_ptr(n_val, val, 0);
48621 xmlResetLastError();
48622 if (mem_base != xmlMemBlocks()) {
48623 printf("Leak of %d blocks found in xmlXPathWrapCString",
48624 xmlMemBlocks() - mem_base);
48625 test_ret++;
48626 printf(" %d", n_val);
48627 printf("\n");
48628 }
48629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048630 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048631#endif
48632
Daniel Veillarda82b1822004-11-08 16:24:57 +000048633 return(test_ret);
48634}
48635
48636
48637static int
48638test_xmlXPathWrapExternal(void) {
48639 int test_ret = 0;
48640
William M. Brack21e4ef22005-01-02 09:53:13 +000048641#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048642 int mem_base;
48643 xmlXPathObjectPtr ret_val;
48644 void * val; /* the user data */
48645 int n_val;
48646
48647 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
48648 mem_base = xmlMemBlocks();
48649 val = gen_void_ptr(n_val, 0);
48650
48651 ret_val = xmlXPathWrapExternal(val);
48652 desret_xmlXPathObjectPtr(ret_val);
48653 call_tests++;
48654 des_void_ptr(n_val, val, 0);
48655 xmlResetLastError();
48656 if (mem_base != xmlMemBlocks()) {
48657 printf("Leak of %d blocks found in xmlXPathWrapExternal",
48658 xmlMemBlocks() - mem_base);
48659 test_ret++;
48660 printf(" %d", n_val);
48661 printf("\n");
48662 }
48663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048664 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048665#endif
48666
Daniel Veillarda82b1822004-11-08 16:24:57 +000048667 return(test_ret);
48668}
48669
48670
48671static int
48672test_xmlXPathWrapNodeSet(void) {
48673 int test_ret = 0;
48674
William M. Brack21e4ef22005-01-02 09:53:13 +000048675#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048676 int mem_base;
48677 xmlXPathObjectPtr ret_val;
48678 xmlNodeSetPtr val; /* the NodePtr value */
48679 int n_val;
48680
48681 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
48682 mem_base = xmlMemBlocks();
48683 val = gen_xmlNodeSetPtr(n_val, 0);
48684
48685 ret_val = xmlXPathWrapNodeSet(val);
48686 desret_xmlXPathObjectPtr(ret_val);
48687 call_tests++;
48688 des_xmlNodeSetPtr(n_val, val, 0);
48689 xmlResetLastError();
48690 if (mem_base != xmlMemBlocks()) {
48691 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
48692 xmlMemBlocks() - mem_base);
48693 test_ret++;
48694 printf(" %d", n_val);
48695 printf("\n");
48696 }
48697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048698 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048699#endif
48700
Daniel Veillarda82b1822004-11-08 16:24:57 +000048701 return(test_ret);
48702}
48703
48704
48705static int
48706test_xmlXPatherror(void) {
48707 int test_ret = 0;
48708
William M. Brack21e4ef22005-01-02 09:53:13 +000048709#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048710 int mem_base;
48711 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48712 int n_ctxt;
48713 const char * file; /* the file name */
48714 int n_file;
48715 int line; /* the line number */
48716 int n_line;
48717 int no; /* the error number */
48718 int n_no;
48719
48720 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48721 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48722 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48723 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48724 mem_base = xmlMemBlocks();
48725 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48726 file = gen_filepath(n_file, 1);
48727 line = gen_int(n_line, 2);
48728 no = gen_int(n_no, 3);
48729
48730 xmlXPatherror(ctxt, file, line, no);
48731 call_tests++;
48732 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48733 des_filepath(n_file, file, 1);
48734 des_int(n_line, line, 2);
48735 des_int(n_no, no, 3);
48736 xmlResetLastError();
48737 if (mem_base != xmlMemBlocks()) {
48738 printf("Leak of %d blocks found in xmlXPatherror",
48739 xmlMemBlocks() - mem_base);
48740 test_ret++;
48741 printf(" %d", n_ctxt);
48742 printf(" %d", n_file);
48743 printf(" %d", n_line);
48744 printf(" %d", n_no);
48745 printf("\n");
48746 }
48747 }
48748 }
48749 }
48750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048751 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048752#endif
48753
Daniel Veillarda82b1822004-11-08 16:24:57 +000048754 return(test_ret);
48755}
48756
48757static int
48758test_xpathInternals(void) {
48759 int test_ret = 0;
48760
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048761 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048762 test_ret += test_valuePop();
48763 test_ret += test_valuePush();
48764 test_ret += test_xmlXPathAddValues();
48765 test_ret += test_xmlXPathBooleanFunction();
48766 test_ret += test_xmlXPathCeilingFunction();
48767 test_ret += test_xmlXPathCompareValues();
48768 test_ret += test_xmlXPathConcatFunction();
48769 test_ret += test_xmlXPathContainsFunction();
48770 test_ret += test_xmlXPathCountFunction();
48771 test_ret += test_xmlXPathDebugDumpCompExpr();
48772 test_ret += test_xmlXPathDebugDumpObject();
48773 test_ret += test_xmlXPathDifference();
48774 test_ret += test_xmlXPathDistinct();
48775 test_ret += test_xmlXPathDistinctSorted();
48776 test_ret += test_xmlXPathDivValues();
48777 test_ret += test_xmlXPathEqualValues();
48778 test_ret += test_xmlXPathErr();
48779 test_ret += test_xmlXPathEvalExpr();
48780 test_ret += test_xmlXPathEvaluatePredicateResult();
48781 test_ret += test_xmlXPathFalseFunction();
48782 test_ret += test_xmlXPathFloorFunction();
48783 test_ret += test_xmlXPathFunctionLookup();
48784 test_ret += test_xmlXPathFunctionLookupNS();
48785 test_ret += test_xmlXPathHasSameNodes();
48786 test_ret += test_xmlXPathIdFunction();
48787 test_ret += test_xmlXPathIntersection();
48788 test_ret += test_xmlXPathIsNodeType();
48789 test_ret += test_xmlXPathLangFunction();
48790 test_ret += test_xmlXPathLastFunction();
48791 test_ret += test_xmlXPathLeading();
48792 test_ret += test_xmlXPathLeadingSorted();
48793 test_ret += test_xmlXPathLocalNameFunction();
48794 test_ret += test_xmlXPathModValues();
48795 test_ret += test_xmlXPathMultValues();
48796 test_ret += test_xmlXPathNamespaceURIFunction();
48797 test_ret += test_xmlXPathNewBoolean();
48798 test_ret += test_xmlXPathNewCString();
48799 test_ret += test_xmlXPathNewFloat();
48800 test_ret += test_xmlXPathNewNodeSet();
48801 test_ret += test_xmlXPathNewNodeSetList();
48802 test_ret += test_xmlXPathNewParserContext();
48803 test_ret += test_xmlXPathNewString();
48804 test_ret += test_xmlXPathNextAncestor();
48805 test_ret += test_xmlXPathNextAncestorOrSelf();
48806 test_ret += test_xmlXPathNextAttribute();
48807 test_ret += test_xmlXPathNextChild();
48808 test_ret += test_xmlXPathNextDescendant();
48809 test_ret += test_xmlXPathNextDescendantOrSelf();
48810 test_ret += test_xmlXPathNextFollowing();
48811 test_ret += test_xmlXPathNextFollowingSibling();
48812 test_ret += test_xmlXPathNextNamespace();
48813 test_ret += test_xmlXPathNextParent();
48814 test_ret += test_xmlXPathNextPreceding();
48815 test_ret += test_xmlXPathNextPrecedingSibling();
48816 test_ret += test_xmlXPathNextSelf();
48817 test_ret += test_xmlXPathNodeLeading();
48818 test_ret += test_xmlXPathNodeLeadingSorted();
48819 test_ret += test_xmlXPathNodeSetAdd();
48820 test_ret += test_xmlXPathNodeSetAddNs();
48821 test_ret += test_xmlXPathNodeSetAddUnique();
48822 test_ret += test_xmlXPathNodeSetContains();
48823 test_ret += test_xmlXPathNodeSetDel();
48824 test_ret += test_xmlXPathNodeSetMerge();
48825 test_ret += test_xmlXPathNodeSetRemove();
48826 test_ret += test_xmlXPathNodeSetSort();
48827 test_ret += test_xmlXPathNodeTrailing();
48828 test_ret += test_xmlXPathNodeTrailingSorted();
48829 test_ret += test_xmlXPathNormalizeFunction();
48830 test_ret += test_xmlXPathNotEqualValues();
48831 test_ret += test_xmlXPathNotFunction();
48832 test_ret += test_xmlXPathNsLookup();
48833 test_ret += test_xmlXPathNumberFunction();
48834 test_ret += test_xmlXPathParseNCName();
48835 test_ret += test_xmlXPathParseName();
48836 test_ret += test_xmlXPathPopBoolean();
48837 test_ret += test_xmlXPathPopExternal();
48838 test_ret += test_xmlXPathPopNodeSet();
48839 test_ret += test_xmlXPathPopNumber();
48840 test_ret += test_xmlXPathPopString();
48841 test_ret += test_xmlXPathPositionFunction();
48842 test_ret += test_xmlXPathRegisterAllFunctions();
48843 test_ret += test_xmlXPathRegisterFunc();
48844 test_ret += test_xmlXPathRegisterFuncLookup();
48845 test_ret += test_xmlXPathRegisterFuncNS();
48846 test_ret += test_xmlXPathRegisterNs();
48847 test_ret += test_xmlXPathRegisterVariable();
48848 test_ret += test_xmlXPathRegisterVariableLookup();
48849 test_ret += test_xmlXPathRegisterVariableNS();
48850 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48851 test_ret += test_xmlXPathRegisteredNsCleanup();
48852 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48853 test_ret += test_xmlXPathRoot();
48854 test_ret += test_xmlXPathRoundFunction();
48855 test_ret += test_xmlXPathStartsWithFunction();
48856 test_ret += test_xmlXPathStringEvalNumber();
48857 test_ret += test_xmlXPathStringFunction();
48858 test_ret += test_xmlXPathStringLengthFunction();
48859 test_ret += test_xmlXPathSubValues();
48860 test_ret += test_xmlXPathSubstringAfterFunction();
48861 test_ret += test_xmlXPathSubstringBeforeFunction();
48862 test_ret += test_xmlXPathSubstringFunction();
48863 test_ret += test_xmlXPathSumFunction();
48864 test_ret += test_xmlXPathTrailing();
48865 test_ret += test_xmlXPathTrailingSorted();
48866 test_ret += test_xmlXPathTranslateFunction();
48867 test_ret += test_xmlXPathTrueFunction();
48868 test_ret += test_xmlXPathValueFlipSign();
48869 test_ret += test_xmlXPathVariableLookup();
48870 test_ret += test_xmlXPathVariableLookupNS();
48871 test_ret += test_xmlXPathWrapCString();
48872 test_ret += test_xmlXPathWrapExternal();
48873 test_ret += test_xmlXPathWrapNodeSet();
48874 test_ret += test_xmlXPatherror();
48875
48876 if (test_ret != 0)
48877 printf("Module xpathInternals: %d errors\n", test_ret);
48878 return(test_ret);
48879}
48880
Daniel Veillardd93f6252004-11-02 15:53:51 +000048881static int
48882test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048884
William M. Brack21e4ef22005-01-02 09:53:13 +000048885#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048886 int mem_base;
48887 xmlNodePtr ret_val;
48888 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48889 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048890
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048891 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48892 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048893 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048894
48895 ret_val = xmlXPtrBuildNodeList(obj);
48896 desret_xmlNodePtr(ret_val);
48897 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048898 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048899 xmlResetLastError();
48900 if (mem_base != xmlMemBlocks()) {
48901 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048903 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048904 printf(" %d", n_obj);
48905 printf("\n");
48906 }
48907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048908 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048909#endif
48910
Daniel Veillard42595322004-11-08 10:52:06 +000048911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048912}
48913
48914
48915static int
48916test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048918
William M. Brack21e4ef22005-01-02 09:53:13 +000048919#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048920 int mem_base;
48921 xmlXPathObjectPtr ret_val;
48922 xmlChar * str; /* the XPointer expression */
48923 int n_str;
48924 xmlXPathContextPtr ctx; /* the XPointer context */
48925 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048926
Daniel Veillardce682bc2004-11-05 17:22:25 +000048927 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48928 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48929 mem_base = xmlMemBlocks();
48930 str = gen_const_xmlChar_ptr(n_str, 0);
48931 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48932
William M. Brackf13f77f2004-11-12 16:03:48 +000048933 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048934 desret_xmlXPathObjectPtr(ret_val);
48935 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048936 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048937 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48938 xmlResetLastError();
48939 if (mem_base != xmlMemBlocks()) {
48940 printf("Leak of %d blocks found in xmlXPtrEval",
48941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048942 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048943 printf(" %d", n_str);
48944 printf(" %d", n_ctx);
48945 printf("\n");
48946 }
48947 }
48948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048949 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048950#endif
48951
Daniel Veillard42595322004-11-08 10:52:06 +000048952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048953}
48954
48955
48956static int
48957test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048959
William M. Brack21e4ef22005-01-02 09:53:13 +000048960#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048961 int mem_base;
48962 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48963 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048964
Daniel Veillardce682bc2004-11-05 17:22:25 +000048965 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48966 mem_base = xmlMemBlocks();
48967 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48968
48969 xmlXPtrEvalRangePredicate(ctxt);
48970 call_tests++;
48971 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48972 xmlResetLastError();
48973 if (mem_base != xmlMemBlocks()) {
48974 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048976 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048977 printf(" %d", n_ctxt);
48978 printf("\n");
48979 }
48980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048981 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048982#endif
48983
Daniel Veillard42595322004-11-08 10:52:06 +000048984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048985}
48986
Daniel Veillarda521d282004-11-09 14:59:59 +000048987#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048988
Daniel Veillardce682bc2004-11-05 17:22:25 +000048989#define gen_nb_xmlLocationSetPtr 1
48990static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48991 return(NULL);
48992}
48993static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48994}
Daniel Veillarda521d282004-11-09 14:59:59 +000048995#endif
48996
Daniel Veillardce682bc2004-11-05 17:22:25 +000048997
Daniel Veillardd93f6252004-11-02 15:53:51 +000048998static int
48999test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049001
William M. Brack21e4ef22005-01-02 09:53:13 +000049002#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049003 int mem_base;
49004 xmlLocationSetPtr cur; /* the initial range set */
49005 int n_cur;
49006 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
49007 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049008
Daniel Veillardce682bc2004-11-05 17:22:25 +000049009 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
49010 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
49011 mem_base = xmlMemBlocks();
49012 cur = gen_xmlLocationSetPtr(n_cur, 0);
49013 val = gen_xmlXPathObjectPtr(n_val, 1);
49014
49015 xmlXPtrLocationSetAdd(cur, val);
49016 call_tests++;
49017 des_xmlLocationSetPtr(n_cur, cur, 0);
49018 des_xmlXPathObjectPtr(n_val, val, 1);
49019 xmlResetLastError();
49020 if (mem_base != xmlMemBlocks()) {
49021 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
49022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049023 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049024 printf(" %d", n_cur);
49025 printf(" %d", n_val);
49026 printf("\n");
49027 }
49028 }
49029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049030 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049031#endif
49032
Daniel Veillard42595322004-11-08 10:52:06 +000049033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049034}
49035
49036
49037static int
49038test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049040
49041
49042 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000049043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049044}
49045
49046
49047static int
49048test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049050
William M. Brack21e4ef22005-01-02 09:53:13 +000049051#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049052 int mem_base;
49053 xmlLocationSetPtr cur; /* the initial range set */
49054 int n_cur;
49055 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
49056 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049057
Daniel Veillardce682bc2004-11-05 17:22:25 +000049058 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
49059 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
49060 mem_base = xmlMemBlocks();
49061 cur = gen_xmlLocationSetPtr(n_cur, 0);
49062 val = gen_xmlXPathObjectPtr(n_val, 1);
49063
49064 xmlXPtrLocationSetDel(cur, val);
49065 call_tests++;
49066 des_xmlLocationSetPtr(n_cur, cur, 0);
49067 des_xmlXPathObjectPtr(n_val, val, 1);
49068 xmlResetLastError();
49069 if (mem_base != xmlMemBlocks()) {
49070 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
49071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049072 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049073 printf(" %d", n_cur);
49074 printf(" %d", n_val);
49075 printf("\n");
49076 }
49077 }
49078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049079 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049080#endif
49081
Daniel Veillard42595322004-11-08 10:52:06 +000049082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049083}
49084
49085
49086static int
49087test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049089
49090
49091 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000049092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049093}
49094
49095
49096static int
49097test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049099
William M. Brack21e4ef22005-01-02 09:53:13 +000049100#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049101 int mem_base;
49102 xmlLocationSetPtr cur; /* the initial range set */
49103 int n_cur;
49104 int val; /* the index to remove */
49105 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049106
Daniel Veillardce682bc2004-11-05 17:22:25 +000049107 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
49108 for (n_val = 0;n_val < gen_nb_int;n_val++) {
49109 mem_base = xmlMemBlocks();
49110 cur = gen_xmlLocationSetPtr(n_cur, 0);
49111 val = gen_int(n_val, 1);
49112
49113 xmlXPtrLocationSetRemove(cur, val);
49114 call_tests++;
49115 des_xmlLocationSetPtr(n_cur, cur, 0);
49116 des_int(n_val, val, 1);
49117 xmlResetLastError();
49118 if (mem_base != xmlMemBlocks()) {
49119 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
49120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049121 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049122 printf(" %d", n_cur);
49123 printf(" %d", n_val);
49124 printf("\n");
49125 }
49126 }
49127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049128 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049129#endif
49130
Daniel Veillard42595322004-11-08 10:52:06 +000049131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049132}
49133
49134
49135static int
49136test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049138
William M. Brack21e4ef22005-01-02 09:53:13 +000049139#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049140 int mem_base;
49141 xmlXPathObjectPtr ret_val;
49142 xmlNodePtr start; /* the starting and ending node */
49143 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049144
Daniel Veillard3d97e662004-11-04 10:49:00 +000049145 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49146 mem_base = xmlMemBlocks();
49147 start = gen_xmlNodePtr(n_start, 0);
49148
49149 ret_val = xmlXPtrNewCollapsedRange(start);
49150 desret_xmlXPathObjectPtr(ret_val);
49151 call_tests++;
49152 des_xmlNodePtr(n_start, start, 0);
49153 xmlResetLastError();
49154 if (mem_base != xmlMemBlocks()) {
49155 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
49156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049157 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049158 printf(" %d", n_start);
49159 printf("\n");
49160 }
49161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049162 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049163#endif
49164
Daniel Veillard42595322004-11-08 10:52:06 +000049165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049166}
49167
49168
49169static int
49170test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049172
49173
49174 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000049175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049176}
49177
49178
49179static int
49180test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049182
William M. Brack21e4ef22005-01-02 09:53:13 +000049183#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049184 int mem_base;
49185 xmlXPathObjectPtr ret_val;
49186 xmlNodeSetPtr set; /* a node set */
49187 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049188
Daniel Veillardce682bc2004-11-05 17:22:25 +000049189 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
49190 mem_base = xmlMemBlocks();
49191 set = gen_xmlNodeSetPtr(n_set, 0);
49192
49193 ret_val = xmlXPtrNewLocationSetNodeSet(set);
49194 desret_xmlXPathObjectPtr(ret_val);
49195 call_tests++;
49196 des_xmlNodeSetPtr(n_set, set, 0);
49197 xmlResetLastError();
49198 if (mem_base != xmlMemBlocks()) {
49199 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
49200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049201 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049202 printf(" %d", n_set);
49203 printf("\n");
49204 }
49205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049206 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049207#endif
49208
Daniel Veillard42595322004-11-08 10:52:06 +000049209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049210}
49211
49212
49213static int
49214test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049216
William M. Brack21e4ef22005-01-02 09:53:13 +000049217#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049218 int mem_base;
49219 xmlXPathObjectPtr ret_val;
49220 xmlNodePtr start; /* the start NodePtr value */
49221 int n_start;
49222 xmlNodePtr end; /* the end NodePtr value or NULL */
49223 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049224
Daniel Veillard3d97e662004-11-04 10:49:00 +000049225 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49226 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49227 mem_base = xmlMemBlocks();
49228 start = gen_xmlNodePtr(n_start, 0);
49229 end = gen_xmlNodePtr(n_end, 1);
49230
49231 ret_val = xmlXPtrNewLocationSetNodes(start, end);
49232 desret_xmlXPathObjectPtr(ret_val);
49233 call_tests++;
49234 des_xmlNodePtr(n_start, start, 0);
49235 des_xmlNodePtr(n_end, end, 1);
49236 xmlResetLastError();
49237 if (mem_base != xmlMemBlocks()) {
49238 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
49239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049240 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049241 printf(" %d", n_start);
49242 printf(" %d", n_end);
49243 printf("\n");
49244 }
49245 }
49246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049247 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049248#endif
49249
Daniel Veillard42595322004-11-08 10:52:06 +000049250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049251}
49252
49253
49254static int
49255test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049257
William M. Brack21e4ef22005-01-02 09:53:13 +000049258#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049259 int mem_base;
49260 xmlXPathObjectPtr ret_val;
49261 xmlNodePtr start; /* the starting node */
49262 int n_start;
49263 int startindex; /* the start index */
49264 int n_startindex;
49265 xmlNodePtr end; /* the ending point */
49266 int n_end;
49267 int endindex; /* the ending index */
49268 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049269
Daniel Veillard3d97e662004-11-04 10:49:00 +000049270 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49271 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
49272 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49273 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
49274 mem_base = xmlMemBlocks();
49275 start = gen_xmlNodePtr(n_start, 0);
49276 startindex = gen_int(n_startindex, 1);
49277 end = gen_xmlNodePtr(n_end, 2);
49278 endindex = gen_int(n_endindex, 3);
49279
49280 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
49281 desret_xmlXPathObjectPtr(ret_val);
49282 call_tests++;
49283 des_xmlNodePtr(n_start, start, 0);
49284 des_int(n_startindex, startindex, 1);
49285 des_xmlNodePtr(n_end, end, 2);
49286 des_int(n_endindex, endindex, 3);
49287 xmlResetLastError();
49288 if (mem_base != xmlMemBlocks()) {
49289 printf("Leak of %d blocks found in xmlXPtrNewRange",
49290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049291 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049292 printf(" %d", n_start);
49293 printf(" %d", n_startindex);
49294 printf(" %d", n_end);
49295 printf(" %d", n_endindex);
49296 printf("\n");
49297 }
49298 }
49299 }
49300 }
49301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049302 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049303#endif
49304
Daniel Veillard42595322004-11-08 10:52:06 +000049305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049306}
49307
49308
49309static int
49310test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049312
William M. Brack21e4ef22005-01-02 09:53:13 +000049313#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049314 int mem_base;
49315 xmlXPathObjectPtr ret_val;
49316 xmlNodePtr start; /* the starting node */
49317 int n_start;
49318 xmlXPathObjectPtr end; /* the ending object */
49319 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049320
Daniel Veillard3d97e662004-11-04 10:49:00 +000049321 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49322 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49323 mem_base = xmlMemBlocks();
49324 start = gen_xmlNodePtr(n_start, 0);
49325 end = gen_xmlXPathObjectPtr(n_end, 1);
49326
49327 ret_val = xmlXPtrNewRangeNodeObject(start, end);
49328 desret_xmlXPathObjectPtr(ret_val);
49329 call_tests++;
49330 des_xmlNodePtr(n_start, start, 0);
49331 des_xmlXPathObjectPtr(n_end, end, 1);
49332 xmlResetLastError();
49333 if (mem_base != xmlMemBlocks()) {
49334 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
49335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049336 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049337 printf(" %d", n_start);
49338 printf(" %d", n_end);
49339 printf("\n");
49340 }
49341 }
49342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049343 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049344#endif
49345
Daniel Veillard42595322004-11-08 10:52:06 +000049346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049347}
49348
49349
49350static int
49351test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049353
William M. Brack21e4ef22005-01-02 09:53:13 +000049354#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049355 int mem_base;
49356 xmlXPathObjectPtr ret_val;
49357 xmlNodePtr start; /* the starting node */
49358 int n_start;
49359 xmlXPathObjectPtr end; /* the ending point */
49360 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049361
Daniel Veillard3d97e662004-11-04 10:49:00 +000049362 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49363 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49364 mem_base = xmlMemBlocks();
49365 start = gen_xmlNodePtr(n_start, 0);
49366 end = gen_xmlXPathObjectPtr(n_end, 1);
49367
49368 ret_val = xmlXPtrNewRangeNodePoint(start, end);
49369 desret_xmlXPathObjectPtr(ret_val);
49370 call_tests++;
49371 des_xmlNodePtr(n_start, start, 0);
49372 des_xmlXPathObjectPtr(n_end, end, 1);
49373 xmlResetLastError();
49374 if (mem_base != xmlMemBlocks()) {
49375 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
49376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049377 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049378 printf(" %d", n_start);
49379 printf(" %d", n_end);
49380 printf("\n");
49381 }
49382 }
49383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049384 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049385#endif
49386
Daniel Veillard42595322004-11-08 10:52:06 +000049387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049388}
49389
49390
49391static int
49392test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049394
William M. Brack21e4ef22005-01-02 09:53:13 +000049395#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049396 int mem_base;
49397 xmlXPathObjectPtr ret_val;
49398 xmlNodePtr start; /* the starting node */
49399 int n_start;
49400 xmlNodePtr end; /* the ending node */
49401 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049402
Daniel Veillard3d97e662004-11-04 10:49:00 +000049403 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49404 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49405 mem_base = xmlMemBlocks();
49406 start = gen_xmlNodePtr(n_start, 0);
49407 end = gen_xmlNodePtr(n_end, 1);
49408
49409 ret_val = xmlXPtrNewRangeNodes(start, end);
49410 desret_xmlXPathObjectPtr(ret_val);
49411 call_tests++;
49412 des_xmlNodePtr(n_start, start, 0);
49413 des_xmlNodePtr(n_end, end, 1);
49414 xmlResetLastError();
49415 if (mem_base != xmlMemBlocks()) {
49416 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
49417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049418 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049419 printf(" %d", n_start);
49420 printf(" %d", n_end);
49421 printf("\n");
49422 }
49423 }
49424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049425 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049426#endif
49427
Daniel Veillard42595322004-11-08 10:52:06 +000049428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049429}
49430
49431
49432static int
49433test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049435
William M. Brack21e4ef22005-01-02 09:53:13 +000049436#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049437 int mem_base;
49438 xmlXPathObjectPtr ret_val;
49439 xmlXPathObjectPtr start; /* the starting point */
49440 int n_start;
49441 xmlNodePtr end; /* the ending node */
49442 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049443
Daniel Veillard3d97e662004-11-04 10:49:00 +000049444 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49445 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49446 mem_base = xmlMemBlocks();
49447 start = gen_xmlXPathObjectPtr(n_start, 0);
49448 end = gen_xmlNodePtr(n_end, 1);
49449
49450 ret_val = xmlXPtrNewRangePointNode(start, end);
49451 desret_xmlXPathObjectPtr(ret_val);
49452 call_tests++;
49453 des_xmlXPathObjectPtr(n_start, start, 0);
49454 des_xmlNodePtr(n_end, end, 1);
49455 xmlResetLastError();
49456 if (mem_base != xmlMemBlocks()) {
49457 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
49458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049459 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049460 printf(" %d", n_start);
49461 printf(" %d", n_end);
49462 printf("\n");
49463 }
49464 }
49465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049466 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049467#endif
49468
Daniel Veillard42595322004-11-08 10:52:06 +000049469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049470}
49471
49472
49473static int
49474test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049476
William M. Brack21e4ef22005-01-02 09:53:13 +000049477#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049478 int mem_base;
49479 xmlXPathObjectPtr ret_val;
49480 xmlXPathObjectPtr start; /* the starting point */
49481 int n_start;
49482 xmlXPathObjectPtr end; /* the ending point */
49483 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049484
Daniel Veillard3d97e662004-11-04 10:49:00 +000049485 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49486 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49487 mem_base = xmlMemBlocks();
49488 start = gen_xmlXPathObjectPtr(n_start, 0);
49489 end = gen_xmlXPathObjectPtr(n_end, 1);
49490
49491 ret_val = xmlXPtrNewRangePoints(start, end);
49492 desret_xmlXPathObjectPtr(ret_val);
49493 call_tests++;
49494 des_xmlXPathObjectPtr(n_start, start, 0);
49495 des_xmlXPathObjectPtr(n_end, end, 1);
49496 xmlResetLastError();
49497 if (mem_base != xmlMemBlocks()) {
49498 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
49499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049500 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049501 printf(" %d", n_start);
49502 printf(" %d", n_end);
49503 printf("\n");
49504 }
49505 }
49506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049507 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049508#endif
49509
Daniel Veillard42595322004-11-08 10:52:06 +000049510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049511}
49512
49513
49514static int
49515test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049517
William M. Brack21e4ef22005-01-02 09:53:13 +000049518#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049519 int mem_base;
49520 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
49521 int n_ctxt;
49522 int nargs; /* the number of args */
49523 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049524
Daniel Veillardce682bc2004-11-05 17:22:25 +000049525 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
49526 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
49527 mem_base = xmlMemBlocks();
49528 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
49529 nargs = gen_int(n_nargs, 1);
49530
49531 xmlXPtrRangeToFunction(ctxt, nargs);
49532 call_tests++;
49533 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
49534 des_int(n_nargs, nargs, 1);
49535 xmlResetLastError();
49536 if (mem_base != xmlMemBlocks()) {
49537 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
49538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049539 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049540 printf(" %d", n_ctxt);
49541 printf(" %d", n_nargs);
49542 printf("\n");
49543 }
49544 }
49545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049546 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049547#endif
49548
Daniel Veillard42595322004-11-08 10:52:06 +000049549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049550}
49551
49552
49553static int
49554test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049556
William M. Brack21e4ef22005-01-02 09:53:13 +000049557#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049558 int mem_base;
49559 xmlXPathObjectPtr ret_val;
49560 xmlLocationSetPtr val; /* the LocationSet value */
49561 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049562
Daniel Veillardce682bc2004-11-05 17:22:25 +000049563 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
49564 mem_base = xmlMemBlocks();
49565 val = gen_xmlLocationSetPtr(n_val, 0);
49566
49567 ret_val = xmlXPtrWrapLocationSet(val);
49568 desret_xmlXPathObjectPtr(ret_val);
49569 call_tests++;
49570 des_xmlLocationSetPtr(n_val, val, 0);
49571 xmlResetLastError();
49572 if (mem_base != xmlMemBlocks()) {
49573 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
49574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049575 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049576 printf(" %d", n_val);
49577 printf("\n");
49578 }
49579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049580 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049581#endif
49582
Daniel Veillard42595322004-11-08 10:52:06 +000049583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049584}
49585
49586static int
49587test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049589
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049590 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000049591 test_ret += test_xmlXPtrBuildNodeList();
49592 test_ret += test_xmlXPtrEval();
49593 test_ret += test_xmlXPtrEvalRangePredicate();
49594 test_ret += test_xmlXPtrLocationSetAdd();
49595 test_ret += test_xmlXPtrLocationSetCreate();
49596 test_ret += test_xmlXPtrLocationSetDel();
49597 test_ret += test_xmlXPtrLocationSetMerge();
49598 test_ret += test_xmlXPtrLocationSetRemove();
49599 test_ret += test_xmlXPtrNewCollapsedRange();
49600 test_ret += test_xmlXPtrNewContext();
49601 test_ret += test_xmlXPtrNewLocationSetNodeSet();
49602 test_ret += test_xmlXPtrNewLocationSetNodes();
49603 test_ret += test_xmlXPtrNewRange();
49604 test_ret += test_xmlXPtrNewRangeNodeObject();
49605 test_ret += test_xmlXPtrNewRangeNodePoint();
49606 test_ret += test_xmlXPtrNewRangeNodes();
49607 test_ret += test_xmlXPtrNewRangePointNode();
49608 test_ret += test_xmlXPtrNewRangePoints();
49609 test_ret += test_xmlXPtrRangeToFunction();
49610 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000049611
Daniel Veillard42595322004-11-08 10:52:06 +000049612 if (test_ret != 0)
49613 printf("Module xpointer: %d errors\n", test_ret);
49614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049615}
Daniel Veillardce244ad2004-11-05 10:03:46 +000049616static int
49617test_module(const char *module) {
49618 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
49619 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049620 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049621 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049622 if (!strcmp(module, "catalog")) return(test_catalog());
49623 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049624 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049625 if (!strcmp(module, "dict")) return(test_dict());
49626 if (!strcmp(module, "encoding")) return(test_encoding());
49627 if (!strcmp(module, "entities")) return(test_entities());
49628 if (!strcmp(module, "hash")) return(test_hash());
49629 if (!strcmp(module, "list")) return(test_list());
49630 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
49631 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
49632 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049633 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049634 if (!strcmp(module, "pattern")) return(test_pattern());
49635 if (!strcmp(module, "relaxng")) return(test_relaxng());
49636 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
49637 if (!strcmp(module, "tree")) return(test_tree());
49638 if (!strcmp(module, "uri")) return(test_uri());
49639 if (!strcmp(module, "valid")) return(test_valid());
49640 if (!strcmp(module, "xinclude")) return(test_xinclude());
49641 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049642 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049643 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049644 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049645 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049646 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049647 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
49648 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
49649 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
49650 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000049651 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049652 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
49653 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049654 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049655 if (!strcmp(module, "xpointer")) return(test_xpointer());
49656 return(0);
49657}