blob: c3d7045f62da16f937560b1a79cafd3dae9376ac [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
William M. Brack015ccb22005-02-13 08:18:52 +0000196/*
197 We need some "remote" addresses, but want to avoid getting into
198 name resolution delays, so we use these
199*/
200#define REMOTE1GOOD "http://localhost/"
201#define REMOTE1BAD "http://missing. example.org/"
202#define REMOTE2GOOD "ftp://localhost/foo"
203
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000204#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000205
Daniel Veillard3d97e662004-11-04 10:49:00 +0000206static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000207 return(NULL);
208}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000209static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000210}
211
Daniel Veillardce244ad2004-11-05 10:03:46 +0000212#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000213#define gen_nb_const_void_ptr 2
214
215static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
216 if (no == 0) return((const void *) "immutable string");
217 return(NULL);
218}
219static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
220}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000221#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000222
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223#define gen_nb_userdata 3
224
Daniel Veillard3d97e662004-11-04 10:49:00 +0000225static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000226 if (no == 0) return((void *) &call_tests);
227 if (no == 1) return((void *) -1);
228 return(NULL);
229}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000230static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000231}
232
233
Daniel Veillardd93f6252004-11-02 15:53:51 +0000234#define gen_nb_int 4
235
Daniel Veillard3d97e662004-11-04 10:49:00 +0000236static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
237 if (no == 0) return(0);
238 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000239 if (no == 2) return(-1);
240 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000241 return(-1);
242}
243
244static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
245}
246
Daniel Veillard6128c012004-11-08 17:16:15 +0000247#define gen_nb_parseroptions 5
248
249static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
250 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
251 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
252 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
253 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
254 return(XML_PARSE_SAX1);
255}
256
257static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
258}
259
Daniel Veillardce244ad2004-11-05 10:03:46 +0000260#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000261#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000262
263static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
264 if (no == 0) return(0);
265 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000266 if (no == 2) return(-1);
267 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000268 return(-1);
269}
270
271static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
272}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000273#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000274
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000275#define gen_nb_xmlChar 4
276
277static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
278 if (no == 0) return('a');
279 if (no == 1) return(' ');
280 if (no == 2) return('ø');
281 return(0);
282}
283
284static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
285}
286
Daniel Veillard3d97e662004-11-04 10:49:00 +0000287#define gen_nb_unsigned_int 3
288
289static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000290 if (no == 0) return(0);
291 if (no == 1) return(1);
292 if (no == 2) return(122);
293 return(-1);
294}
295
Daniel Veillard3d97e662004-11-04 10:49:00 +0000296static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000297}
298
Daniel Veillard3d95c732004-11-06 22:25:14 +0000299#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000300
301static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
302 if (no == 0) return(0);
303 if (no == 1) return(1);
304 if (no == 2) return(122);
305 return(-1);
306}
307
308static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
309}
310
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311#define gen_nb_double 4
312
313static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
314 if (no == 0) return(0);
315 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000316#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000317 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000318#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000319 return(-1);
320}
321
322static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
323}
324
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000325#define gen_nb_unsigned_long_ptr 2
326
327static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
328 if (no == 0) return(&longtab[nr]);
329 return(NULL);
330}
331
332static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
333}
334
335#define gen_nb_int_ptr 2
336
337static int *gen_int_ptr(int no, int nr) {
338 if (no == 0) return(&inttab[nr]);
339 return(NULL);
340}
341
342static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
343}
344
Daniel Veillardd93f6252004-11-02 15:53:51 +0000345#define gen_nb_const_char_ptr 4
346
Daniel Veillardce682bc2004-11-05 17:22:25 +0000347static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
348 if (no == 0) return((char *) "foo");
349 if (no == 1) return((char *) "<foo/>");
350 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000351 return(NULL);
352}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000353static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000354}
355
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000356#define gen_nb_xmlChar_ptr 2
357
Daniel Veillard3d97e662004-11-04 10:49:00 +0000358static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000359 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000360 return(NULL);
361}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000362static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000363}
364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000365#define gen_nb_FILE_ptr 2
366
367static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
368 if (no == 0) return(fopen("test.out", "a+"));
369 return(NULL);
370}
371static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillarda82b1822004-11-08 16:24:57 +0000375#define gen_nb_debug_FILE_ptr 2
376static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
377 return(fopen("test.out", "a+"));
378}
379static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
380 if (val != NULL) fclose(val);
381}
382
Daniel Veillardd93f6252004-11-02 15:53:51 +0000383#define gen_nb_const_xmlChar_ptr 5
384
Daniel Veillardce682bc2004-11-05 17:22:25 +0000385static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
386 if (no == 0) return((xmlChar *) "foo");
387 if (no == 1) return((xmlChar *) "<foo/>");
388 if (no == 2) return((xmlChar *) "nøne");
389 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 return(NULL);
391}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000392static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000393}
394
395#define gen_nb_filepath 8
396
Daniel Veillard3d97e662004-11-04 10:49:00 +0000397static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000398 if (no == 0) return("missing.xml");
399 if (no == 1) return("<foo/>");
400 if (no == 2) return("test/ent2");
401 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000402 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
William M. Brack015ccb22005-02-13 08:18:52 +0000403 if (no == 5) return(REMOTE1GOOD);
404 if (no == 6) return(REMOTE1BAD);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000405 return(NULL);
406}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000407static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000408}
409
Daniel Veillard27f20102004-11-05 11:50:11 +0000410#define gen_nb_eaten_name 2
411
412static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000413 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000414 return(NULL);
415}
416static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
417}
418
Daniel Veillardd93f6252004-11-02 15:53:51 +0000419#define gen_nb_fileoutput 6
420
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422 if (no == 0) return("/missing.xml");
423 if (no == 1) return("<foo/>");
William M. Brack015ccb22005-02-13 08:18:52 +0000424 if (no == 2) return(REMOTE2GOOD);
425 if (no == 3) return(REMOTE1GOOD);
426 if (no == 4) return(REMOTE1BAD);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000427 return(NULL);
428}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000429static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000430}
431
Daniel Veillarda521d282004-11-09 14:59:59 +0000432#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000433static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000434 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000435 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000436 return(NULL);
437}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000438static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000439 if (val != NULL)
440 xmlFreeParserCtxt(val);
441}
442
Daniel Veillard34099b42004-11-04 17:34:35 +0000443#define gen_nb_xmlSAXHandlerPtr 2
444static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000445#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000446 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000448 return(NULL);
449}
450static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
451}
452
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000453#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000454static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000455#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000456 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000457#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000458 return(NULL);
459}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000460static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000461#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000462 if (val != NULL)
463 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000464#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000465}
466
Daniel Veillard34099b42004-11-04 17:34:35 +0000467#define gen_nb_xmlParserInputBufferPtr 8
468
469static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
470 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
471 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
472 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
473 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
474 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
William M. Brack015ccb22005-02-13 08:18:52 +0000475 if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE));
476 if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE));
Daniel Veillard34099b42004-11-04 17:34:35 +0000477 return(NULL);
478}
479static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
480 xmlFreeParserInputBuffer(val);
481}
482
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000484static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000485 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
486 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
487 return(NULL);
488}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000489static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000490 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000491 xmlFreeDoc(val);
492}
493
Daniel Veillardce244ad2004-11-05 10:03:46 +0000494#define gen_nb_xmlAttrPtr 2
495static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
496 if (no == 0) return(get_api_attr());
497 return(NULL);
498}
499static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
500 if (no == 0) free_api_doc();
501}
502
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000503#define gen_nb_xmlDictPtr 2
504static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
505 if (no == 0) return(xmlDictCreate());
506 return(NULL);
507}
508static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
509 if (val != NULL)
510 xmlDictFree(val);
511}
512
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000514static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000516 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000517 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000518/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000519}
Daniel Veillard27f20102004-11-05 11:50:11 +0000520static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000521 if (no == 1) free_api_doc();
522 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000523 xmlUnlinkNode(val);
524 xmlFreeNode(val);
525 }
526}
527
Daniel Veillard27f20102004-11-05 11:50:11 +0000528#define gen_nb_xmlDtdPtr 3
529static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 if (no == 0)
531 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 if (no == 1) return(get_api_dtd());
533 return(NULL);
534}
535static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
536 if (no == 1) free_api_doc();
537 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000538 xmlUnlinkNode((xmlNodePtr) val);
539 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000540 }
541}
542
543#define gen_nb_xmlNsPtr 2
544static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
545 if (no == 0) return(get_api_ns());
546 return(NULL);
547}
548static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
549 if (no == 0) free_api_doc();
550}
551
Daniel Veillardd93f6252004-11-02 15:53:51 +0000552#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000553static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000554 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
555 if (no == 0) return(xmlNewText(BAD_CAST "text"));
556 return(NULL);
557}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000558static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000559}
560
Daniel Veillardc8311492004-11-08 16:51:13 +0000561#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000562#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000563static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000564 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
565 return(NULL);
566}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000567static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000568 if (val != NULL) xmlFreeTextWriter(val);
569}
Daniel Veillardc8311492004-11-08 16:51:13 +0000570#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000571
Daniel Veillardc8311492004-11-08 16:51:13 +0000572#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000574static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000575 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
576 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
577 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
578 return(NULL);
579}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000580static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000581 if (val != NULL) xmlFreeTextReader(val);
582}
Daniel Veillardc8311492004-11-08 16:51:13 +0000583#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000584
Daniel Veillard34099b42004-11-04 17:34:35 +0000585#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000586static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000587 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000588 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000589 return(NULL);
590}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000591static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000592 if (val != NULL) {
593 xmlBufferFree(val);
594 }
595}
596
597#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000598static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000599 if (no == 0) return(xmlListCreate(NULL, NULL));
600 return(NULL);
601}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000602static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000603 if (val != NULL) {
604 xmlListDelete(val);
605 }
606}
607
608#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000609static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000610 if (no == 0) return(xmlHashCreate(10));
611 return(NULL);
612}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000613static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614 if (val != NULL) {
615 xmlHashFree(val, NULL);
616 }
617}
618
619#include <libxml/xpathInternals.h>
620
Daniel Veillardc8311492004-11-08 16:51:13 +0000621#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000622#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000623static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000624 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
625 if (no == 1) return(xmlXPathNewFloat(1.1));
626 if (no == 2) return(xmlXPathNewBoolean(1));
627 if (no == 3) return(xmlXPathNewNodeSet(NULL));
628 return(NULL);
629}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000631 if (val != NULL) {
632 xmlXPathFreeObject(val);
633 }
634}
Daniel Veillardc8311492004-11-08 16:51:13 +0000635#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000636
Daniel Veillardc8311492004-11-08 16:51:13 +0000637#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000638#define gen_nb_xmlOutputBufferPtr 2
639static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
640 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
641 return(NULL);
642}
643static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
644 if (val != NULL) {
645 xmlOutputBufferClose(val);
646 }
647}
Daniel Veillardc8311492004-11-08 16:51:13 +0000648#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000649
Daniel Veillardc8311492004-11-08 16:51:13 +0000650#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000651#define gen_nb_xmlNanoFTPCtxtPtr 4
652static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
William M. Brack015ccb22005-02-13 08:18:52 +0000653 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
654 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
Daniel Veillard27f20102004-11-05 11:50:11 +0000655 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
656 return(NULL);
657}
658static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
659 if (val != NULL) {
660 xmlNanoFTPFreeCtxt(val);
661 }
662}
Daniel Veillardc8311492004-11-08 16:51:13 +0000663#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000664
Daniel Veillardc8311492004-11-08 16:51:13 +0000665#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000666#define gen_nb_xmlNanoHTTPCtxtPtr 1
William M. Brack015ccb22005-02-13 08:18:52 +0000667static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
669 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL));
670 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL));
Daniel Veillard27f20102004-11-05 11:50:11 +0000671 return(NULL);
672}
William M. Brack015ccb22005-02-13 08:18:52 +0000673static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
674 if (val != NULL) {
675 xmlNanoHTTPClose(val);
676 }
Daniel Veillard27f20102004-11-05 11:50:11 +0000677}
Daniel Veillardc8311492004-11-08 16:51:13 +0000678#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000679
Daniel Veillard3d97e662004-11-04 10:49:00 +0000680#define gen_nb_xmlCharEncoding 4
681static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
683 if (no == 1) return(XML_CHAR_ENCODING_NONE);
William M. Brack015ccb22005-02-13 08:18:52 +0000684 if (no == 2) return(XML_CHAR_ENCODING_8859_1);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000685 return(XML_CHAR_ENCODING_ERROR);
686}
687static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
688}
689
Daniel Veillard42595322004-11-08 10:52:06 +0000690#define gen_nb_xmlHashDeallocator 2
691static void
692test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
693}
694
695static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
696 if (no == 0) return(test_xmlHashDeallocator);
697 return(NULL);
698}
699static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
700}
701
Daniel Veillardd93f6252004-11-02 15:53:51 +0000702
703static void desret_int(int val ATTRIBUTE_UNUSED) {
704}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000705static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
706}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000707static void desret_long(long val ATTRIBUTE_UNUSED) {
708}
William M. Brack094dd862004-11-14 14:28:34 +0000709static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000711static void desret_double(double val ATTRIBUTE_UNUSED) {
712}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000713static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
714}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000715#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000716static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
717}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000718#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000719static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
720}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000721static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
722}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000723static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
724}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000725static void desret_xmlChar_ptr(xmlChar *val) {
726 if (val != NULL)
727 xmlFree(val);
728}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000729static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000730 if (val != api_doc)
731 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000733static void desret_xmlDictPtr(xmlDictPtr val) {
734 xmlDictFree(val);
735}
Daniel Veillardc8311492004-11-08 16:51:13 +0000736#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000737static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
738 xmlOutputBufferClose(val);
739}
Daniel Veillardc8311492004-11-08 16:51:13 +0000740#endif
741#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000742static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
743 xmlFreeTextReader(val);
744}
Daniel Veillardc8311492004-11-08 16:51:13 +0000745#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000746static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000747 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
748 xmlUnlinkNode(val);
749 xmlFreeNode(val);
750 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000751}
Daniel Veillard57b25162004-11-06 14:50:18 +0000752static void desret_xmlAttrPtr(xmlAttrPtr val) {
753 if (val != NULL) {
754 xmlUnlinkNode((xmlNodePtr) val);
755 xmlFreeNode((xmlNodePtr) val);
756 }
757}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000758static void desret_xmlEntityPtr(xmlEntityPtr val) {
759 if (val != NULL) {
760 xmlUnlinkNode((xmlNodePtr) val);
761 xmlFreeNode((xmlNodePtr) val);
762 }
763}
Daniel Veillard42595322004-11-08 10:52:06 +0000764static void desret_xmlElementPtr(xmlElementPtr val) {
765 if (val != NULL) {
766 xmlUnlinkNode((xmlNodePtr) val);
767 }
768}
769static void desret_xmlAttributePtr(xmlAttributePtr val) {
770 if (val != NULL) {
771 xmlUnlinkNode((xmlNodePtr) val);
772 }
773}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000774static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
775}
Daniel Veillard34099b42004-11-04 17:34:35 +0000776static void desret_xmlDtdPtr(xmlDtdPtr val) {
777 desret_xmlNodePtr((xmlNodePtr)val);
778}
Daniel Veillardc8311492004-11-08 16:51:13 +0000779#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000780static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000781 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000782}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000783static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
784 xmlXPathFreeNodeSet(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000787static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
788 xmlFreeParserCtxt(val);
789}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000790static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
791 xmlFreeParserInputBuffer(val);
792}
Daniel Veillard42595322004-11-08 10:52:06 +0000793static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
794 xmlFreeInputStream(val);
795}
Daniel Veillardc8311492004-11-08 16:51:13 +0000796#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000797static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
798 xmlFreeTextWriter(val);
799}
Daniel Veillardc8311492004-11-08 16:51:13 +0000800#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000801static void desret_xmlBufferPtr(xmlBufferPtr val) {
802 xmlBufferFree(val);
803}
Daniel Veillardc8311492004-11-08 16:51:13 +0000804#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000805static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
806 xmlSchemaFreeParserCtxt(val);
807}
808static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
809}
810static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
811 xmlRelaxNGFreeParserCtxt(val);
812}
Daniel Veillardc8311492004-11-08 16:51:13 +0000813#endif
814#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000815static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000816}
William M. Brack015ccb22005-02-13 08:18:52 +0000817static void desret_xmlNanoHTTPCtxtPtr(void *val) {
818 xmlNanoHTTPClose(val);
819}
Daniel Veillardc8311492004-11-08 16:51:13 +0000820#endif
William M. Brack015ccb22005-02-13 08:18:52 +0000821#ifdef LIBXML_FTP_ENABLED
822static void desret_xmlNanoFTPCtxtPtr(void *val) {
823 xmlNanoFTPClose(val);
824}
825#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000826/* cut and pasted from autogenerated to avoid troubles */
827#define gen_nb_const_xmlChar_ptr_ptr 1
828static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
829 return(NULL);
830}
831static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
832}
833
834#define gen_nb_unsigned_char_ptr 1
835static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
836 return(NULL);
837}
838static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839}
840
841#define gen_nb_const_unsigned_char_ptr 1
842static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
843 return(NULL);
844}
845static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
846}
847
848#ifdef LIBXML_HTML_ENABLED
849#define gen_nb_const_htmlNodePtr 1
850static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
851 return(NULL);
852}
853static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
854}
855#endif
856
857#ifdef LIBXML_HTML_ENABLED
858#define gen_nb_htmlDocPtr 3
859static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
860 if (no == 0) return(htmlNewDoc(NULL, NULL));
861 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
862 return(NULL);
863}
864static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
865 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
866 xmlFreeDoc(val);
867}
868static void desret_htmlDocPtr(htmlDocPtr val) {
869 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
870 xmlFreeDoc(val);
871}
872#define gen_nb_htmlParserCtxtPtr 3
873static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
874 if (no == 0) return(xmlNewParserCtxt());
875 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
876 return(NULL);
877}
878static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
879 if (val != NULL)
880 htmlFreeParserCtxt(val);
881}
882static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
883 if (val != NULL)
884 htmlFreeParserCtxt(val);
885}
886#endif
887
888#ifdef LIBXML_XPATH_ENABLED
889#define gen_nb_xmlNodeSetPtr 1
890static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
891 return(NULL);
892}
893static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
894}
895#endif
896
897#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000898#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000899#define gen_nb_xmlShellCtxtPtr 1
900static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
901 return(NULL);
902}
903static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
904}
905#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000906#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000907
908#ifdef LIBXML_PATTERN_ENABLED
909#define gen_nb_xmlPatternPtr 1
910static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915#endif
916
William M. Brack094dd862004-11-14 14:28:34 +0000917#define gen_nb_xmlElementContentPtr 1
918static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
919 return(NULL);
920}
921static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
922 if (val != NULL)
923 xmlFreeElementContent(val);
924}
925static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
926 if (val != NULL)
927 xmlFreeElementContent(val);
928}
929
930#define gen_nb_xmlParserNodeInfoSeqPtr 1
931static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
932 return(NULL);
933}
934static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
935}
936
937static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
938}
939
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000940/************************************************************************
941 * *
942 * WARNING: end of the manually maintained part of the test code *
943 * do not remove or alter the CUT HERE line *
944 * *
945 ************************************************************************/
946
Daniel Veillard34099b42004-11-04 17:34:35 +0000947/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000948#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000949static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
950}
951
Daniel Veillarda521d282004-11-09 14:59:59 +0000952#endif
953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954#define gen_nb_xmlAttributeDefault 4
955static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
956 if (no == 1) return(XML_ATTRIBUTE_FIXED);
957 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
958 if (no == 3) return(XML_ATTRIBUTE_NONE);
959 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
960 return(0);
961}
William M. Brack094dd862004-11-14 14:28:34 +0000962
Daniel Veillard57b25162004-11-06 14:50:18 +0000963static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
964}
Daniel Veillard57b25162004-11-06 14:50:18 +0000965
966#define gen_nb_xmlAttributeType 4
967static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
968 if (no == 1) return(XML_ATTRIBUTE_CDATA);
969 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
970 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
971 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
972 return(0);
973}
William M. Brack094dd862004-11-14 14:28:34 +0000974
Daniel Veillard57b25162004-11-06 14:50:18 +0000975static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
976}
Daniel Veillard57b25162004-11-06 14:50:18 +0000977
978#define gen_nb_xmlBufferAllocationScheme 3
979static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
980 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
981 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
982 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
983 return(0);
984}
William M. Brack094dd862004-11-14 14:28:34 +0000985
Daniel Veillard57b25162004-11-06 14:50:18 +0000986static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
987}
William M. Brack094dd862004-11-14 14:28:34 +0000988
Daniel Veillard57b25162004-11-06 14:50:18 +0000989static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
990}
991
Daniel Veillarda521d282004-11-09 14:59:59 +0000992#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000993#define gen_nb_xmlCatalogAllow 4
994static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
995 if (no == 1) return(XML_CATA_ALLOW_ALL);
996 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
997 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
998 if (no == 4) return(XML_CATA_ALLOW_NONE);
999 return(0);
1000}
William M. Brack094dd862004-11-14 14:28:34 +00001001
Daniel Veillard57b25162004-11-06 14:50:18 +00001002static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1003}
William M. Brack094dd862004-11-14 14:28:34 +00001004
Daniel Veillard57b25162004-11-06 14:50:18 +00001005static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1006}
1007
Daniel Veillarda521d282004-11-09 14:59:59 +00001008#endif
1009
1010#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001011#define gen_nb_xmlCatalogPrefer 3
1012static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1013 if (no == 1) return(XML_CATA_PREFER_NONE);
1014 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1015 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1016 return(0);
1017}
William M. Brack094dd862004-11-14 14:28:34 +00001018
Daniel Veillard57b25162004-11-06 14:50:18 +00001019static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1020}
William M. Brack094dd862004-11-14 14:28:34 +00001021
Daniel Veillard57b25162004-11-06 14:50:18 +00001022static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1023}
1024
Daniel Veillarda521d282004-11-09 14:59:59 +00001025#endif
1026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027#define gen_nb_xmlElementContentType 4
1028static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1029 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1030 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1031 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1032 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1033 return(0);
1034}
Daniel Veillard57b25162004-11-06 14:50:18 +00001035
William M. Brack094dd862004-11-14 14:28:34 +00001036static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001037}
1038
1039#define gen_nb_xmlElementTypeVal 4
1040static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1041 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1042 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1043 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1044 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1045 return(0);
1046}
William M. Brack094dd862004-11-14 14:28:34 +00001047
Daniel Veillard57b25162004-11-06 14:50:18 +00001048static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1049}
Daniel Veillard57b25162004-11-06 14:50:18 +00001050
Daniel Veillard57b25162004-11-06 14:50:18 +00001051static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1052}
1053
Daniel Veillarda521d282004-11-09 14:59:59 +00001054#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001055#define gen_nb_xmlSchemaValType 4
1056static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1057 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1058 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1059 if (no == 3) return(XML_SCHEMAS_ANYURI);
1060 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1061 return(0);
1062}
William M. Brack094dd862004-11-14 14:28:34 +00001063
Daniel Veillard57b25162004-11-06 14:50:18 +00001064static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1065}
Daniel Veillard57b25162004-11-06 14:50:18 +00001066
Daniel Veillarda521d282004-11-09 14:59:59 +00001067#endif
1068
Daniel Veillardb5839c32005-02-19 18:27:14 +00001069#ifdef LIBXML_SCHEMAS_ENABLED
1070#define gen_nb_xmlSchemaWhitespaceValueType 4
1071static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
1072 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1073 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1074 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1075 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1076 return(0);
1077}
1078
1079static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1080}
1081
1082#endif
1083
Daniel Veillard34099b42004-11-04 17:34:35 +00001084#include <libxml/HTMLparser.h>
1085#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001086#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001087#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001088#include <libxml/catalog.h>
1089#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001090#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001091#include <libxml/dict.h>
1092#include <libxml/encoding.h>
1093#include <libxml/entities.h>
1094#include <libxml/hash.h>
1095#include <libxml/list.h>
1096#include <libxml/nanoftp.h>
1097#include <libxml/nanohttp.h>
1098#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001099#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001100#include <libxml/pattern.h>
1101#include <libxml/relaxng.h>
1102#include <libxml/schemasInternals.h>
1103#include <libxml/tree.h>
1104#include <libxml/uri.h>
1105#include <libxml/valid.h>
1106#include <libxml/xinclude.h>
1107#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001108#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001109#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001110#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001111#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001112#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001113#include <libxml/xmlsave.h>
1114#include <libxml/xmlschemas.h>
1115#include <libxml/xmlschemastypes.h>
1116#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001117#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001118#include <libxml/xmlwriter.h>
1119#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001120#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001121#include <libxml/xpointer.h>
1122static int test_HTMLparser(void);
1123static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001124static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001125static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001126static int test_catalog(void);
1127static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001128static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001129static int test_dict(void);
1130static int test_encoding(void);
1131static int test_entities(void);
1132static int test_hash(void);
1133static int test_list(void);
1134static int test_nanoftp(void);
1135static int test_nanohttp(void);
1136static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001137static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001138static int test_pattern(void);
1139static int test_relaxng(void);
1140static int test_schemasInternals(void);
1141static int test_tree(void);
1142static int test_uri(void);
1143static int test_valid(void);
1144static int test_xinclude(void);
1145static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001146static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001147static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001148static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001149static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001150static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001151static int test_xmlsave(void);
1152static int test_xmlschemas(void);
1153static int test_xmlschemastypes(void);
1154static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001155static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001156static int test_xmlwriter(void);
1157static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001158static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001159static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001160
1161/**
1162 * testlibxml2:
1163 *
1164 * Main entry point of the tester for the full libxml2 module,
1165 * it calls all the tester entry point for each module.
1166 *
1167 * Returns the number of error found
1168 */
1169static int
1170testlibxml2(void)
1171{
Daniel Veillard42595322004-11-08 10:52:06 +00001172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001173
Daniel Veillard42595322004-11-08 10:52:06 +00001174 test_ret += test_HTMLparser();
1175 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001176 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001177 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001178 test_ret += test_catalog();
1179 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001180 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001181 test_ret += test_dict();
1182 test_ret += test_encoding();
1183 test_ret += test_entities();
1184 test_ret += test_hash();
1185 test_ret += test_list();
1186 test_ret += test_nanoftp();
1187 test_ret += test_nanohttp();
1188 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001189 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001190 test_ret += test_pattern();
1191 test_ret += test_relaxng();
1192 test_ret += test_schemasInternals();
1193 test_ret += test_tree();
1194 test_ret += test_uri();
1195 test_ret += test_valid();
1196 test_ret += test_xinclude();
1197 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001198 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001199 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001200 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001201 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001202 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001203 test_ret += test_xmlsave();
1204 test_ret += test_xmlschemas();
1205 test_ret += test_xmlschemastypes();
1206 test_ret += test_xmlstring();
1207 test_ret += test_xmlunicode();
1208 test_ret += test_xmlwriter();
1209 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001210 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001211 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001212
Daniel Veillard3d97e662004-11-04 10:49:00 +00001213 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001214 function_tests, call_tests, test_ret);
1215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001216}
1217
1218
1219static int
1220test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001222
William M. Brack21e4ef22005-01-02 09:53:13 +00001223#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001224 int mem_base;
1225 int ret_val;
1226 unsigned char * out; /* a pointer to an array of bytes to store the result */
1227 int n_out;
1228 int * outlen; /* the length of @out */
1229 int n_outlen;
1230 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1231 int n_in;
1232 int * inlen; /* the length of @in */
1233 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001234
Daniel Veillardce682bc2004-11-05 17:22:25 +00001235 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1236 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1237 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1238 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1239 mem_base = xmlMemBlocks();
1240 out = gen_unsigned_char_ptr(n_out, 0);
1241 outlen = gen_int_ptr(n_outlen, 1);
1242 in = gen_const_unsigned_char_ptr(n_in, 2);
1243 inlen = gen_int_ptr(n_inlen, 3);
1244
William M. Brackf13f77f2004-11-12 16:03:48 +00001245 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001246 desret_int(ret_val);
1247 call_tests++;
1248 des_unsigned_char_ptr(n_out, out, 0);
1249 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001250 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001251 des_int_ptr(n_inlen, inlen, 3);
1252 xmlResetLastError();
1253 if (mem_base != xmlMemBlocks()) {
1254 printf("Leak of %d blocks found in UTF8ToHtml",
1255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001256 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001257 printf(" %d", n_out);
1258 printf(" %d", n_outlen);
1259 printf(" %d", n_in);
1260 printf(" %d", n_inlen);
1261 printf("\n");
1262 }
1263 }
1264 }
1265 }
1266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001267 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001268#endif
1269
Daniel Veillard42595322004-11-08 10:52:06 +00001270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001271}
1272
Daniel Veillarda521d282004-11-09 14:59:59 +00001273#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001274
Daniel Veillardce682bc2004-11-05 17:22:25 +00001275#define gen_nb_const_htmlElemDesc_ptr 1
1276static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1277 return(NULL);
1278}
1279static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1280}
Daniel Veillarda521d282004-11-09 14:59:59 +00001281#endif
1282
Daniel Veillardce682bc2004-11-05 17:22:25 +00001283
Daniel Veillardd93f6252004-11-02 15:53:51 +00001284static int
1285test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001287
William M. Brack21e4ef22005-01-02 09:53:13 +00001288#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001289 int mem_base;
1290 htmlStatus ret_val;
1291 htmlElemDesc * elt; /* HTML element */
1292 int n_elt;
1293 xmlChar * attr; /* HTML attribute */
1294 int n_attr;
1295 int legacy; /* whether to allow deprecated attributes */
1296 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001297
Daniel Veillard57b25162004-11-06 14:50:18 +00001298 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1299 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1300 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1301 mem_base = xmlMemBlocks();
1302 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1303 attr = gen_const_xmlChar_ptr(n_attr, 1);
1304 legacy = gen_int(n_legacy, 2);
1305
William M. Brackf13f77f2004-11-12 16:03:48 +00001306 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001307 desret_htmlStatus(ret_val);
1308 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001309 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1310 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001311 des_int(n_legacy, legacy, 2);
1312 xmlResetLastError();
1313 if (mem_base != xmlMemBlocks()) {
1314 printf("Leak of %d blocks found in htmlAttrAllowed",
1315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001316 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001317 printf(" %d", n_elt);
1318 printf(" %d", n_attr);
1319 printf(" %d", n_legacy);
1320 printf("\n");
1321 }
1322 }
1323 }
1324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001325 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001326#endif
1327
Daniel Veillard42595322004-11-08 10:52:06 +00001328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001329}
1330
Daniel Veillarda521d282004-11-09 14:59:59 +00001331#ifdef LIBXML_HTML_ENABLED
1332
1333#define gen_nb_htmlNodePtr 1
1334static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1335 return(NULL);
1336}
1337static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1338}
1339#endif
1340
Daniel Veillardd93f6252004-11-02 15:53:51 +00001341
1342static int
1343test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001345
William M. Brack21e4ef22005-01-02 09:53:13 +00001346#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001347 int mem_base;
1348 int ret_val;
1349 htmlDocPtr doc; /* the HTML document */
1350 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001351 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001352 int n_name;
1353 htmlNodePtr elem; /* the HTML element */
1354 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001355
Daniel Veillarda521d282004-11-09 14:59:59 +00001356 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001358 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001359 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001360 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001361 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001362 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001363
William M. Brackf13f77f2004-11-12 16:03:48 +00001364 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001365 desret_int(ret_val);
1366 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001367 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001368 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001369 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001370 xmlResetLastError();
1371 if (mem_base != xmlMemBlocks()) {
1372 printf("Leak of %d blocks found in htmlAutoCloseTag",
1373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001374 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001375 printf(" %d", n_doc);
1376 printf(" %d", n_name);
1377 printf(" %d", n_elem);
1378 printf("\n");
1379 }
1380 }
1381 }
1382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001383 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001384#endif
1385
Daniel Veillard42595322004-11-08 10:52:06 +00001386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001387}
1388
1389
1390static int
1391test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001393
William M. Brack21e4ef22005-01-02 09:53:13 +00001394#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001395 int mem_base;
1396 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001397 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001398 int n_buffer;
1399 int size; /* the size of the array */
1400 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001401
Daniel Veillard34099b42004-11-04 17:34:35 +00001402 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1403 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1404 mem_base = xmlMemBlocks();
1405 buffer = gen_const_char_ptr(n_buffer, 0);
1406 size = gen_int(n_size, 1);
1407
William M. Brackf13f77f2004-11-12 16:03:48 +00001408 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001409 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001410 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001411 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001412 des_int(n_size, size, 1);
1413 xmlResetLastError();
1414 if (mem_base != xmlMemBlocks()) {
1415 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001417 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001418 printf(" %d", n_buffer);
1419 printf(" %d", n_size);
1420 printf("\n");
1421 }
1422 }
1423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001424 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001425#endif
1426
Daniel Veillard42595322004-11-08 10:52:06 +00001427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001428}
1429
Daniel Veillarda521d282004-11-09 14:59:59 +00001430#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001431
Daniel Veillardce682bc2004-11-05 17:22:25 +00001432#define gen_nb_htmlSAXHandlerPtr 1
1433static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1434 return(NULL);
1435}
1436static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1437}
Daniel Veillarda521d282004-11-09 14:59:59 +00001438#endif
1439
Daniel Veillardce682bc2004-11-05 17:22:25 +00001440
Daniel Veillardd93f6252004-11-02 15:53:51 +00001441static int
1442test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001444
William M. Brack21e4ef22005-01-02 09:53:13 +00001445#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001446 int mem_base;
1447 htmlParserCtxtPtr ret_val;
1448 htmlSAXHandlerPtr sax; /* a SAX handler */
1449 int n_sax;
1450 void * user_data; /* The user data returned on SAX callbacks */
1451 int n_user_data;
1452 char * chunk; /* a pointer to an array of chars */
1453 int n_chunk;
1454 int size; /* number of chars in the array */
1455 int n_size;
1456 const char * filename; /* an optional file name or URI */
1457 int n_filename;
1458 xmlCharEncoding enc; /* an optional encoding */
1459 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001460
Daniel Veillardce682bc2004-11-05 17:22:25 +00001461 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1462 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1463 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1464 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001465 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1467 mem_base = xmlMemBlocks();
1468 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1469 user_data = gen_userdata(n_user_data, 1);
1470 chunk = gen_const_char_ptr(n_chunk, 2);
1471 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001472 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001473 enc = gen_xmlCharEncoding(n_enc, 5);
1474
William M. Brackf13f77f2004-11-12 16:03:48 +00001475 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001476 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001477 call_tests++;
1478 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1479 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001480 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001481 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001482 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001483 des_xmlCharEncoding(n_enc, enc, 5);
1484 xmlResetLastError();
1485 if (mem_base != xmlMemBlocks()) {
1486 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001488 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001489 printf(" %d", n_sax);
1490 printf(" %d", n_user_data);
1491 printf(" %d", n_chunk);
1492 printf(" %d", n_size);
1493 printf(" %d", n_filename);
1494 printf(" %d", n_enc);
1495 printf("\n");
1496 }
1497 }
1498 }
1499 }
1500 }
1501 }
1502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001503 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001504#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001505
Daniel Veillard42595322004-11-08 10:52:06 +00001506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001507}
1508
1509
1510static int
1511test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001513
William M. Brack21e4ef22005-01-02 09:53:13 +00001514#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001515 int mem_base;
1516 htmlDocPtr ret_val;
1517 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1518 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001519 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001520 int n_cur;
1521 const char * URL; /* the base URL to use for the document */
1522 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001523 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001524 int n_encoding;
1525 int options; /* a combination of htmlParserOption(s) */
1526 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001527
Daniel Veillarda521d282004-11-09 14:59:59 +00001528 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001529 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1530 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1531 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1532 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1533 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001534 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001535 cur = gen_const_xmlChar_ptr(n_cur, 1);
1536 URL = gen_filepath(n_URL, 2);
1537 encoding = gen_const_char_ptr(n_encoding, 3);
1538 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001539
William M. Brackf13f77f2004-11-12 16:03:48 +00001540 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001541 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001542 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001543 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001544 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001545 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001546 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001547 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001548 xmlResetLastError();
1549 if (mem_base != xmlMemBlocks()) {
1550 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001552 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001553 printf(" %d", n_ctxt);
1554 printf(" %d", n_cur);
1555 printf(" %d", n_URL);
1556 printf(" %d", n_encoding);
1557 printf(" %d", n_options);
1558 printf("\n");
1559 }
1560 }
1561 }
1562 }
1563 }
1564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001565 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001566#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001567
Daniel Veillard42595322004-11-08 10:52:06 +00001568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001569}
1570
1571
1572static int
1573test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001575
William M. Brack21e4ef22005-01-02 09:53:13 +00001576#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001577 htmlDocPtr ret_val;
1578 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1579 int n_ctxt;
1580 const char * filename; /* a file or URL */
1581 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001582 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001583 int n_encoding;
1584 int options; /* a combination of htmlParserOption(s) */
1585 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001586
Daniel Veillarda521d282004-11-09 14:59:59 +00001587 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001588 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1589 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1590 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001591 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001592 filename = gen_filepath(n_filename, 1);
1593 encoding = gen_const_char_ptr(n_encoding, 2);
1594 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001595
William M. Brackf13f77f2004-11-12 16:03:48 +00001596 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001597 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001598 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001599 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001600 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001601 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001602 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001603 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001604 }
1605 }
1606 }
1607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001608 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001609#endif
1610
Daniel Veillard42595322004-11-08 10:52:06 +00001611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001612}
1613
1614
1615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001616test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001618
William M. Brack21e4ef22005-01-02 09:53:13 +00001619#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001620 int mem_base;
1621 htmlDocPtr ret_val;
1622 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1623 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001624 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001625 int n_buffer;
1626 int size; /* the size of the array */
1627 int n_size;
1628 const char * URL; /* the base URL to use for the document */
1629 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001630 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001631 int n_encoding;
1632 int options; /* a combination of htmlParserOption(s) */
1633 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001634
Daniel Veillarda521d282004-11-09 14:59:59 +00001635 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001636 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1637 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1638 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1639 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1640 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1641 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001642 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001643 buffer = gen_const_char_ptr(n_buffer, 1);
1644 size = gen_int(n_size, 2);
1645 URL = gen_filepath(n_URL, 3);
1646 encoding = gen_const_char_ptr(n_encoding, 4);
1647 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001648
William M. Brackf13f77f2004-11-12 16:03:48 +00001649 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001650 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001651 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001652 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001653 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001654 des_int(n_size, size, 2);
1655 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001656 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001657 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001658 xmlResetLastError();
1659 if (mem_base != xmlMemBlocks()) {
1660 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001663 printf(" %d", n_ctxt);
1664 printf(" %d", n_buffer);
1665 printf(" %d", n_size);
1666 printf(" %d", n_URL);
1667 printf(" %d", n_encoding);
1668 printf(" %d", n_options);
1669 printf("\n");
1670 }
1671 }
1672 }
1673 }
1674 }
1675 }
1676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001677 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001678#endif
1679
Daniel Veillard42595322004-11-08 10:52:06 +00001680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001681}
1682
1683
1684static int
1685test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001687
William M. Brack21e4ef22005-01-02 09:53:13 +00001688#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001689 int mem_base;
1690 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1691 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001692
Daniel Veillarda521d282004-11-09 14:59:59 +00001693 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001694 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001695 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001696
1697 htmlCtxtReset(ctxt);
1698 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001699 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001700 xmlResetLastError();
1701 if (mem_base != xmlMemBlocks()) {
1702 printf("Leak of %d blocks found in htmlCtxtReset",
1703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001705 printf(" %d", n_ctxt);
1706 printf("\n");
1707 }
1708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001709 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001710#endif
1711
Daniel Veillard42595322004-11-08 10:52:06 +00001712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001713}
1714
1715
1716static int
1717test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001719
William M. Brack21e4ef22005-01-02 09:53:13 +00001720#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001721 int mem_base;
1722 int ret_val;
1723 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1724 int n_ctxt;
1725 int options; /* a combination of htmlParserOption(s) */
1726 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001727
Daniel Veillarda521d282004-11-09 14:59:59 +00001728 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001729 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1730 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001731 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001732 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001733
1734 ret_val = htmlCtxtUseOptions(ctxt, options);
1735 desret_int(ret_val);
1736 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001737 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001738 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001739 xmlResetLastError();
1740 if (mem_base != xmlMemBlocks()) {
1741 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001743 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001744 printf(" %d", n_ctxt);
1745 printf(" %d", n_options);
1746 printf("\n");
1747 }
1748 }
1749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001750 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001751#endif
1752
Daniel Veillard42595322004-11-08 10:52:06 +00001753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001754}
1755
1756
1757static int
1758test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001760
William M. Brack21e4ef22005-01-02 09:53:13 +00001761#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001762 int mem_base;
1763 int ret_val;
1764 htmlElemDesc * parent; /* HTML parent element */
1765 int n_parent;
1766 xmlChar * elt; /* HTML element */
1767 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001768
Daniel Veillardce682bc2004-11-05 17:22:25 +00001769 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1770 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1771 mem_base = xmlMemBlocks();
1772 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1773 elt = gen_const_xmlChar_ptr(n_elt, 1);
1774
William M. Brackf13f77f2004-11-12 16:03:48 +00001775 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001776 desret_int(ret_val);
1777 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001778 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1779 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001780 xmlResetLastError();
1781 if (mem_base != xmlMemBlocks()) {
1782 printf("Leak of %d blocks found in htmlElementAllowedHere",
1783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001784 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001785 printf(" %d", n_parent);
1786 printf(" %d", n_elt);
1787 printf("\n");
1788 }
1789 }
1790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001791 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001792#endif
1793
Daniel Veillard42595322004-11-08 10:52:06 +00001794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001795}
1796
1797
1798static int
1799test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001801
William M. Brack21e4ef22005-01-02 09:53:13 +00001802#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001803 int mem_base;
1804 htmlStatus ret_val;
1805 htmlElemDesc * parent; /* HTML parent element */
1806 int n_parent;
1807 htmlElemDesc * elt; /* HTML element */
1808 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001809
Daniel Veillard57b25162004-11-06 14:50:18 +00001810 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1811 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1812 mem_base = xmlMemBlocks();
1813 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1814 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1815
William M. Brackf13f77f2004-11-12 16:03:48 +00001816 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001817 desret_htmlStatus(ret_val);
1818 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001819 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1820 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001821 xmlResetLastError();
1822 if (mem_base != xmlMemBlocks()) {
1823 printf("Leak of %d blocks found in htmlElementStatusHere",
1824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001825 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001826 printf(" %d", n_parent);
1827 printf(" %d", n_elt);
1828 printf("\n");
1829 }
1830 }
1831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001832 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001833#endif
1834
Daniel Veillard42595322004-11-08 10:52:06 +00001835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001836}
1837
1838
1839static int
1840test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001842
William M. Brack21e4ef22005-01-02 09:53:13 +00001843#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001844 int mem_base;
1845 int ret_val;
1846 unsigned char * out; /* a pointer to an array of bytes to store the result */
1847 int n_out;
1848 int * outlen; /* the length of @out */
1849 int n_outlen;
1850 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1851 int n_in;
1852 int * inlen; /* the length of @in */
1853 int n_inlen;
1854 int quoteChar; /* the quote character to escape (' or ") or zero. */
1855 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001856
Daniel Veillardce682bc2004-11-05 17:22:25 +00001857 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1858 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1859 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1860 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1861 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1862 mem_base = xmlMemBlocks();
1863 out = gen_unsigned_char_ptr(n_out, 0);
1864 outlen = gen_int_ptr(n_outlen, 1);
1865 in = gen_const_unsigned_char_ptr(n_in, 2);
1866 inlen = gen_int_ptr(n_inlen, 3);
1867 quoteChar = gen_int(n_quoteChar, 4);
1868
William M. Brackf13f77f2004-11-12 16:03:48 +00001869 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001870 desret_int(ret_val);
1871 call_tests++;
1872 des_unsigned_char_ptr(n_out, out, 0);
1873 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001874 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001875 des_int_ptr(n_inlen, inlen, 3);
1876 des_int(n_quoteChar, quoteChar, 4);
1877 xmlResetLastError();
1878 if (mem_base != xmlMemBlocks()) {
1879 printf("Leak of %d blocks found in htmlEncodeEntities",
1880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001881 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001882 printf(" %d", n_out);
1883 printf(" %d", n_outlen);
1884 printf(" %d", n_in);
1885 printf(" %d", n_inlen);
1886 printf(" %d", n_quoteChar);
1887 printf("\n");
1888 }
1889 }
1890 }
1891 }
1892 }
1893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001894 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001895#endif
1896
Daniel Veillard42595322004-11-08 10:52:06 +00001897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001898}
1899
1900
1901static int
1902test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001904
William M. Brack21e4ef22005-01-02 09:53:13 +00001905#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001906 int mem_base;
1907 const htmlEntityDesc * ret_val;
1908 xmlChar * name; /* the entity name */
1909 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001910
Daniel Veillard42595322004-11-08 10:52:06 +00001911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1912 mem_base = xmlMemBlocks();
1913 name = gen_const_xmlChar_ptr(n_name, 0);
1914
William M. Brackf13f77f2004-11-12 16:03:48 +00001915 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001916 desret_const_htmlEntityDesc_ptr(ret_val);
1917 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001918 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001919 xmlResetLastError();
1920 if (mem_base != xmlMemBlocks()) {
1921 printf("Leak of %d blocks found in htmlEntityLookup",
1922 xmlMemBlocks() - mem_base);
1923 test_ret++;
1924 printf(" %d", n_name);
1925 printf("\n");
1926 }
1927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001929#endif
1930
Daniel Veillard42595322004-11-08 10:52:06 +00001931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001932}
1933
1934
1935static int
1936test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001938
William M. Brack21e4ef22005-01-02 09:53:13 +00001939#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001940 int mem_base;
1941 const htmlEntityDesc * ret_val;
1942 unsigned int value; /* the entity's unicode value */
1943 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001944
Daniel Veillard42595322004-11-08 10:52:06 +00001945 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1946 mem_base = xmlMemBlocks();
1947 value = gen_unsigned_int(n_value, 0);
1948
1949 ret_val = htmlEntityValueLookup(value);
1950 desret_const_htmlEntityDesc_ptr(ret_val);
1951 call_tests++;
1952 des_unsigned_int(n_value, value, 0);
1953 xmlResetLastError();
1954 if (mem_base != xmlMemBlocks()) {
1955 printf("Leak of %d blocks found in htmlEntityValueLookup",
1956 xmlMemBlocks() - mem_base);
1957 test_ret++;
1958 printf(" %d", n_value);
1959 printf("\n");
1960 }
1961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001962 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001963#endif
1964
Daniel Veillard42595322004-11-08 10:52:06 +00001965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001966}
1967
1968
1969static int
1970test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001972
William M. Brack21e4ef22005-01-02 09:53:13 +00001973#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001974 int mem_base;
1975 int ret_val;
1976 int val; /* int 0 or 1 */
1977 int n_val;
1978
1979 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001981 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001982
1983 ret_val = htmlHandleOmittedElem(val);
1984 desret_int(ret_val);
1985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001986 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001987 xmlResetLastError();
1988 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001989 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001991 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001992 printf(" %d", n_val);
1993 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001994 }
1995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001996 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001997#endif
1998
Daniel Veillard42595322004-11-08 10:52:06 +00001999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002000}
2001
2002
2003static int
2004test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002006
William M. Brack21e4ef22005-01-02 09:53:13 +00002007#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002008 int mem_base;
2009 int ret_val;
2010 htmlDocPtr doc; /* the HTML document */
2011 int n_doc;
2012 htmlNodePtr elem; /* the HTML element */
2013 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002014
Daniel Veillarda521d282004-11-09 14:59:59 +00002015 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2016 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002017 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002018 doc = gen_htmlDocPtr(n_doc, 0);
2019 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002020
2021 ret_val = htmlIsAutoClosed(doc, elem);
2022 desret_int(ret_val);
2023 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002024 des_htmlDocPtr(n_doc, doc, 0);
2025 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002026 xmlResetLastError();
2027 if (mem_base != xmlMemBlocks()) {
2028 printf("Leak of %d blocks found in htmlIsAutoClosed",
2029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031 printf(" %d", n_doc);
2032 printf(" %d", n_elem);
2033 printf("\n");
2034 }
2035 }
2036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002037 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002038#endif
2039
Daniel Veillard42595322004-11-08 10:52:06 +00002040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002041}
2042
2043
2044static int
2045test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002047
William M. Brack21e4ef22005-01-02 09:53:13 +00002048#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002049 int mem_base;
2050 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002051 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002052 int n_name;
2053
2054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002056 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002057
William M. Brackf13f77f2004-11-12 16:03:48 +00002058 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002059 desret_int(ret_val);
2060 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002061 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002062 xmlResetLastError();
2063 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002064 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002066 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002067 printf(" %d", n_name);
2068 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002069 }
2070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002071 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002072#endif
2073
Daniel Veillard42595322004-11-08 10:52:06 +00002074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002075}
2076
2077
2078static int
2079test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002081
William M. Brack21e4ef22005-01-02 09:53:13 +00002082#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002083 int mem_base;
2084 htmlStatus ret_val;
2085 htmlNodePtr node; /* an htmlNodePtr in a tree */
2086 int n_node;
2087 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2088 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002089
Daniel Veillarda521d282004-11-09 14:59:59 +00002090 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002091 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2092 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002093 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002094 legacy = gen_int(n_legacy, 1);
2095
William M. Brackf13f77f2004-11-12 16:03:48 +00002096 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002097 desret_htmlStatus(ret_val);
2098 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002099 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002100 des_int(n_legacy, legacy, 1);
2101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlNodeStatus",
2104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002105 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002106 printf(" %d", n_node);
2107 printf(" %d", n_legacy);
2108 printf("\n");
2109 }
2110 }
2111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002112 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002113#endif
2114
Daniel Veillard42595322004-11-08 10:52:06 +00002115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002116}
2117
2118
2119static int
2120test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002122
William M. Brack21e4ef22005-01-02 09:53:13 +00002123#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002124 int mem_base;
2125 int ret_val;
2126 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2127 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002128
Daniel Veillarda521d282004-11-09 14:59:59 +00002129 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002130 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002131 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002132
2133 ret_val = htmlParseCharRef(ctxt);
2134 desret_int(ret_val);
2135 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002136 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002137 xmlResetLastError();
2138 if (mem_base != xmlMemBlocks()) {
2139 printf("Leak of %d blocks found in htmlParseCharRef",
2140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002141 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142 printf(" %d", n_ctxt);
2143 printf("\n");
2144 }
2145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002146 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002147#endif
2148
Daniel Veillard42595322004-11-08 10:52:06 +00002149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002150}
2151
2152
2153static int
2154test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002156
William M. Brack21e4ef22005-01-02 09:53:13 +00002157#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002158 int mem_base;
2159 int ret_val;
2160 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2161 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002162 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163 int n_chunk;
2164 int size; /* the size in byte of the chunk */
2165 int n_size;
2166 int terminate; /* last chunk indicator */
2167 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002168
Daniel Veillarda521d282004-11-09 14:59:59 +00002169 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002170 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2171 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2172 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2173 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002174 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002175 chunk = gen_const_char_ptr(n_chunk, 1);
2176 size = gen_int(n_size, 2);
2177 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002178
William M. Brackf13f77f2004-11-12 16:03:48 +00002179 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002180 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002181 desret_int(ret_val);
2182 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002183 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002184 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002185 des_int(n_size, size, 2);
2186 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002187 xmlResetLastError();
2188 if (mem_base != xmlMemBlocks()) {
2189 printf("Leak of %d blocks found in htmlParseChunk",
2190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002192 printf(" %d", n_ctxt);
2193 printf(" %d", n_chunk);
2194 printf(" %d", n_size);
2195 printf(" %d", n_terminate);
2196 printf("\n");
2197 }
2198 }
2199 }
2200 }
2201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002202 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002203#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002204
Daniel Veillard42595322004-11-08 10:52:06 +00002205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002206}
2207
2208
2209static int
2210test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002212
William M. Brack21e4ef22005-01-02 09:53:13 +00002213#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002214 int mem_base;
2215 htmlDocPtr ret_val;
2216 xmlChar * cur; /* a pointer to an array of xmlChar */
2217 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002218 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002219 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002221 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2222 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002224 cur = gen_xmlChar_ptr(n_cur, 0);
2225 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002226
William M. Brackf13f77f2004-11-12 16:03:48 +00002227 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002228 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002230 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002231 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002232 xmlResetLastError();
2233 if (mem_base != xmlMemBlocks()) {
2234 printf("Leak of %d blocks found in htmlParseDoc",
2235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002236 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002237 printf(" %d", n_cur);
2238 printf(" %d", n_encoding);
2239 printf("\n");
2240 }
2241 }
2242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002243 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002244#endif
2245
Daniel Veillard42595322004-11-08 10:52:06 +00002246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002247}
2248
2249
2250static int
2251test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002253
William M. Brack21e4ef22005-01-02 09:53:13 +00002254#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002255 int mem_base;
2256 int ret_val;
2257 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2258 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002259
Daniel Veillarda521d282004-11-09 14:59:59 +00002260 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002261 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002262 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002263
2264 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002265 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002266 desret_int(ret_val);
2267 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002268 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002269 xmlResetLastError();
2270 if (mem_base != xmlMemBlocks()) {
2271 printf("Leak of %d blocks found in htmlParseDocument",
2272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002274 printf(" %d", n_ctxt);
2275 printf("\n");
2276 }
2277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002278 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002279#endif
2280
Daniel Veillard42595322004-11-08 10:52:06 +00002281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002282}
2283
2284
2285static int
2286test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002288
William M. Brack21e4ef22005-01-02 09:53:13 +00002289#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002290 int mem_base;
2291 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2292 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002293
Daniel Veillarda521d282004-11-09 14:59:59 +00002294 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002295 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002296 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002297
2298 htmlParseElement(ctxt);
2299 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002300 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002301 xmlResetLastError();
2302 if (mem_base != xmlMemBlocks()) {
2303 printf("Leak of %d blocks found in htmlParseElement",
2304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002305 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002306 printf(" %d", n_ctxt);
2307 printf("\n");
2308 }
2309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002310 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002311#endif
2312
Daniel Veillard42595322004-11-08 10:52:06 +00002313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002314}
2315
2316
2317static int
2318test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002320
William M. Brack21e4ef22005-01-02 09:53:13 +00002321#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002322 int mem_base;
2323 const htmlEntityDesc * ret_val;
2324 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2325 int n_ctxt;
2326 xmlChar ** str; /* location to store the entity name */
2327 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002328
Daniel Veillarda521d282004-11-09 14:59:59 +00002329 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002330 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2331 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002332 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002333 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2334
William M. Brackf13f77f2004-11-12 16:03:48 +00002335 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002336 desret_const_htmlEntityDesc_ptr(ret_val);
2337 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002338 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002339 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002340 xmlResetLastError();
2341 if (mem_base != xmlMemBlocks()) {
2342 printf("Leak of %d blocks found in htmlParseEntityRef",
2343 xmlMemBlocks() - mem_base);
2344 test_ret++;
2345 printf(" %d", n_ctxt);
2346 printf(" %d", n_str);
2347 printf("\n");
2348 }
2349 }
2350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002351 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002352#endif
2353
Daniel Veillard42595322004-11-08 10:52:06 +00002354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002355}
2356
2357
2358static int
2359test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002361
William M. Brack21e4ef22005-01-02 09:53:13 +00002362#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002363 htmlDocPtr ret_val;
2364 const char * filename; /* the filename */
2365 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002366 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002367 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillarda03e3652004-11-02 18:45:30 +00002369 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2370 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 filename = gen_filepath(n_filename, 0);
2372 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002373
William M. Brackf13f77f2004-11-12 16:03:48 +00002374 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002375 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002377 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002378 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002379 xmlResetLastError();
2380 }
2381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002382 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002383#endif
2384
Daniel Veillard42595322004-11-08 10:52:06 +00002385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002386}
2387
2388
2389static int
2390test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002392
William M. Brack21e4ef22005-01-02 09:53:13 +00002393#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002394 int mem_base;
2395 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002396 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002397 int n_cur;
2398 const char * URL; /* the base URL to use for the document */
2399 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002400 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002401 int n_encoding;
2402 int options; /* a combination of htmlParserOption(s) */
2403 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002404
Daniel Veillarda03e3652004-11-02 18:45:30 +00002405 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2406 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2407 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2408 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002410 cur = gen_const_xmlChar_ptr(n_cur, 0);
2411 URL = gen_filepath(n_URL, 1);
2412 encoding = gen_const_char_ptr(n_encoding, 2);
2413 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002414
William M. Brackf13f77f2004-11-12 16:03:48 +00002415 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002416 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002417 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002418 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002419 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002420 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002421 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 xmlResetLastError();
2423 if (mem_base != xmlMemBlocks()) {
2424 printf("Leak of %d blocks found in htmlReadDoc",
2425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002426 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002427 printf(" %d", n_cur);
2428 printf(" %d", n_URL);
2429 printf(" %d", n_encoding);
2430 printf(" %d", n_options);
2431 printf("\n");
2432 }
2433 }
2434 }
2435 }
2436 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002437 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002438#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002439
Daniel Veillard42595322004-11-08 10:52:06 +00002440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002441}
2442
2443
2444static int
2445test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002447
William M. Brack21e4ef22005-01-02 09:53:13 +00002448#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002449 int mem_base;
2450 htmlDocPtr ret_val;
2451 const char * filename; /* a file or URL */
2452 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002453 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002454 int n_encoding;
2455 int options; /* a combination of htmlParserOption(s) */
2456 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457
Daniel Veillarda03e3652004-11-02 18:45:30 +00002458 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2459 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2460 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2461 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002462 filename = gen_filepath(n_filename, 0);
2463 encoding = gen_const_char_ptr(n_encoding, 1);
2464 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002465
William M. Brackf13f77f2004-11-12 16:03:48 +00002466 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002467 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002469 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002470 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002471 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002472 xmlResetLastError();
2473 if (mem_base != xmlMemBlocks()) {
2474 printf("Leak of %d blocks found in htmlReadFile",
2475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002477 printf(" %d", n_filename);
2478 printf(" %d", n_encoding);
2479 printf(" %d", n_options);
2480 printf("\n");
2481 }
2482 }
2483 }
2484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002485 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486#endif
2487
Daniel Veillard42595322004-11-08 10:52:06 +00002488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002489}
2490
2491
2492static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002493test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002495
William M. Brack21e4ef22005-01-02 09:53:13 +00002496#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002497 int mem_base;
2498 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002499 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002500 int n_buffer;
2501 int size; /* the size of the array */
2502 int n_size;
2503 const char * URL; /* the base URL to use for the document */
2504 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002505 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002506 int n_encoding;
2507 int options; /* a combination of htmlParserOption(s) */
2508 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002509
Daniel Veillarda03e3652004-11-02 18:45:30 +00002510 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2511 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2512 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2513 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2514 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002516 buffer = gen_const_char_ptr(n_buffer, 0);
2517 size = gen_int(n_size, 1);
2518 URL = gen_filepath(n_URL, 2);
2519 encoding = gen_const_char_ptr(n_encoding, 3);
2520 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002521
William M. Brackf13f77f2004-11-12 16:03:48 +00002522 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002523 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002524 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002525 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002526 des_int(n_size, size, 1);
2527 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002528 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002529 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002530 xmlResetLastError();
2531 if (mem_base != xmlMemBlocks()) {
2532 printf("Leak of %d blocks found in htmlReadMemory",
2533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002534 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002535 printf(" %d", n_buffer);
2536 printf(" %d", n_size);
2537 printf(" %d", n_URL);
2538 printf(" %d", n_encoding);
2539 printf(" %d", n_options);
2540 printf("\n");
2541 }
2542 }
2543 }
2544 }
2545 }
2546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002547 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002548#endif
2549
Daniel Veillard42595322004-11-08 10:52:06 +00002550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002551}
2552
2553
2554static int
2555test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002557
William M. Brack21e4ef22005-01-02 09:53:13 +00002558#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002559 int mem_base;
2560 htmlDocPtr ret_val;
2561 xmlChar * cur; /* a pointer to an array of xmlChar */
2562 int n_cur;
2563 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2564 int n_encoding;
2565 htmlSAXHandlerPtr sax; /* the SAX handler block */
2566 int n_sax;
2567 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2568 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002569
Daniel Veillardce682bc2004-11-05 17:22:25 +00002570 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2571 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2572 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2573 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2574 mem_base = xmlMemBlocks();
2575 cur = gen_xmlChar_ptr(n_cur, 0);
2576 encoding = gen_const_char_ptr(n_encoding, 1);
2577 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2578 userData = gen_userdata(n_userData, 3);
2579
William M. Brackf13f77f2004-11-12 16:03:48 +00002580 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002581 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002582 call_tests++;
2583 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002584 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002585 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2586 des_userdata(n_userData, userData, 3);
2587 xmlResetLastError();
2588 if (mem_base != xmlMemBlocks()) {
2589 printf("Leak of %d blocks found in htmlSAXParseDoc",
2590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002591 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002592 printf(" %d", n_cur);
2593 printf(" %d", n_encoding);
2594 printf(" %d", n_sax);
2595 printf(" %d", n_userData);
2596 printf("\n");
2597 }
2598 }
2599 }
2600 }
2601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002602 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002603#endif
2604
Daniel Veillard42595322004-11-08 10:52:06 +00002605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002606}
2607
2608
2609static int
2610test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002612
William M. Brack21e4ef22005-01-02 09:53:13 +00002613#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002614 int mem_base;
2615 htmlDocPtr ret_val;
2616 const char * filename; /* the filename */
2617 int n_filename;
2618 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2619 int n_encoding;
2620 htmlSAXHandlerPtr sax; /* the SAX handler block */
2621 int n_sax;
2622 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2623 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002624
Daniel Veillardce682bc2004-11-05 17:22:25 +00002625 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2626 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2627 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2628 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2629 mem_base = xmlMemBlocks();
2630 filename = gen_filepath(n_filename, 0);
2631 encoding = gen_const_char_ptr(n_encoding, 1);
2632 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2633 userData = gen_userdata(n_userData, 3);
2634
William M. Brackf13f77f2004-11-12 16:03:48 +00002635 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002636 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002637 call_tests++;
2638 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002639 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002640 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2641 des_userdata(n_userData, userData, 3);
2642 xmlResetLastError();
2643 if (mem_base != xmlMemBlocks()) {
2644 printf("Leak of %d blocks found in htmlSAXParseFile",
2645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002646 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002647 printf(" %d", n_filename);
2648 printf(" %d", n_encoding);
2649 printf(" %d", n_sax);
2650 printf(" %d", n_userData);
2651 printf("\n");
2652 }
2653 }
2654 }
2655 }
2656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002657 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002658#endif
2659
Daniel Veillard42595322004-11-08 10:52:06 +00002660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002661}
2662
2663
2664static int
2665test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002667
2668
2669 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002671}
2672
2673static int
2674test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002676
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002677 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002678 test_ret += test_UTF8ToHtml();
2679 test_ret += test_htmlAttrAllowed();
2680 test_ret += test_htmlAutoCloseTag();
2681 test_ret += test_htmlCreateMemoryParserCtxt();
2682 test_ret += test_htmlCreatePushParserCtxt();
2683 test_ret += test_htmlCtxtReadDoc();
2684 test_ret += test_htmlCtxtReadFile();
2685 test_ret += test_htmlCtxtReadMemory();
2686 test_ret += test_htmlCtxtReset();
2687 test_ret += test_htmlCtxtUseOptions();
2688 test_ret += test_htmlElementAllowedHere();
2689 test_ret += test_htmlElementStatusHere();
2690 test_ret += test_htmlEncodeEntities();
2691 test_ret += test_htmlEntityLookup();
2692 test_ret += test_htmlEntityValueLookup();
2693 test_ret += test_htmlHandleOmittedElem();
2694 test_ret += test_htmlIsAutoClosed();
2695 test_ret += test_htmlIsScriptAttribute();
2696 test_ret += test_htmlNodeStatus();
2697 test_ret += test_htmlParseCharRef();
2698 test_ret += test_htmlParseChunk();
2699 test_ret += test_htmlParseDoc();
2700 test_ret += test_htmlParseDocument();
2701 test_ret += test_htmlParseElement();
2702 test_ret += test_htmlParseEntityRef();
2703 test_ret += test_htmlParseFile();
2704 test_ret += test_htmlReadDoc();
2705 test_ret += test_htmlReadFile();
2706 test_ret += test_htmlReadMemory();
2707 test_ret += test_htmlSAXParseDoc();
2708 test_ret += test_htmlSAXParseFile();
2709 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002710
Daniel Veillard42595322004-11-08 10:52:06 +00002711 if (test_ret != 0)
2712 printf("Module HTMLparser: %d errors\n", test_ret);
2713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002714}
2715
2716static int
2717test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002719
William M. Brack21e4ef22005-01-02 09:53:13 +00002720#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002721 int mem_base;
2722 xmlOutputBufferPtr buf; /* the HTML buffer output */
2723 int n_buf;
2724 xmlDocPtr cur; /* the document */
2725 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002726 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727 int n_encoding;
2728 int format; /* should formatting spaces been added */
2729 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730
Daniel Veillard3d97e662004-11-04 10:49:00 +00002731 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2732 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2733 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2734 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2735 mem_base = xmlMemBlocks();
2736 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2737 cur = gen_xmlDocPtr(n_cur, 1);
2738 encoding = gen_const_char_ptr(n_encoding, 2);
2739 format = gen_int(n_format, 3);
2740
William M. Brackf13f77f2004-11-12 16:03:48 +00002741 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002742 call_tests++;
2743 des_xmlOutputBufferPtr(n_buf, buf, 0);
2744 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002745 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002746 des_int(n_format, format, 3);
2747 xmlResetLastError();
2748 if (mem_base != xmlMemBlocks()) {
2749 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002751 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002752 printf(" %d", n_buf);
2753 printf(" %d", n_cur);
2754 printf(" %d", n_encoding);
2755 printf(" %d", n_format);
2756 printf("\n");
2757 }
2758 }
2759 }
2760 }
2761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002762 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002763#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002764
Daniel Veillard42595322004-11-08 10:52:06 +00002765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002766}
2767
2768
2769static int
2770test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002772
William M. Brack21e4ef22005-01-02 09:53:13 +00002773#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774 int mem_base;
2775 xmlOutputBufferPtr buf; /* the HTML buffer output */
2776 int n_buf;
2777 xmlDocPtr cur; /* the document */
2778 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002779 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002780 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002781
Daniel Veillard3d97e662004-11-04 10:49:00 +00002782 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2783 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2784 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2785 mem_base = xmlMemBlocks();
2786 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2787 cur = gen_xmlDocPtr(n_cur, 1);
2788 encoding = gen_const_char_ptr(n_encoding, 2);
2789
William M. Brackf13f77f2004-11-12 16:03:48 +00002790 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002791 call_tests++;
2792 des_xmlOutputBufferPtr(n_buf, buf, 0);
2793 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002794 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002795 xmlResetLastError();
2796 if (mem_base != xmlMemBlocks()) {
2797 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002799 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002800 printf(" %d", n_buf);
2801 printf(" %d", n_cur);
2802 printf(" %d", n_encoding);
2803 printf("\n");
2804 }
2805 }
2806 }
2807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002808 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002809#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002810
Daniel Veillard42595322004-11-08 10:52:06 +00002811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002812}
2813
2814
2815static int
2816test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002818
William M. Brack21e4ef22005-01-02 09:53:13 +00002819#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002820 int mem_base;
2821 int ret_val;
2822 FILE * f; /* the FILE* */
2823 int n_f;
2824 xmlDocPtr cur; /* the document */
2825 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002826
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002827 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2828 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2829 mem_base = xmlMemBlocks();
2830 f = gen_FILE_ptr(n_f, 0);
2831 cur = gen_xmlDocPtr(n_cur, 1);
2832
2833 ret_val = htmlDocDump(f, cur);
2834 desret_int(ret_val);
2835 call_tests++;
2836 des_FILE_ptr(n_f, f, 0);
2837 des_xmlDocPtr(n_cur, cur, 1);
2838 xmlResetLastError();
2839 if (mem_base != xmlMemBlocks()) {
2840 printf("Leak of %d blocks found in htmlDocDump",
2841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002842 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002843 printf(" %d", n_f);
2844 printf(" %d", n_cur);
2845 printf("\n");
2846 }
2847 }
2848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002849 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002850#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002851
Daniel Veillard42595322004-11-08 10:52:06 +00002852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002853}
2854
2855
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002856#define gen_nb_xmlChar_ptr_ptr 1
2857static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2858 return(NULL);
2859}
2860static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2861}
2862
Daniel Veillardd93f6252004-11-02 15:53:51 +00002863static int
2864test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002866
William M. Brack21e4ef22005-01-02 09:53:13 +00002867#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002868 int mem_base;
2869 xmlDocPtr cur; /* the document */
2870 int n_cur;
2871 xmlChar ** mem; /* OUT: the memory pointer */
2872 int n_mem;
2873 int * size; /* OUT: the memory length */
2874 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002875
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002876 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2877 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2878 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2879 mem_base = xmlMemBlocks();
2880 cur = gen_xmlDocPtr(n_cur, 0);
2881 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2882 size = gen_int_ptr(n_size, 2);
2883
2884 htmlDocDumpMemory(cur, mem, size);
2885 call_tests++;
2886 des_xmlDocPtr(n_cur, cur, 0);
2887 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2888 des_int_ptr(n_size, size, 2);
2889 xmlResetLastError();
2890 if (mem_base != xmlMemBlocks()) {
2891 printf("Leak of %d blocks found in htmlDocDumpMemory",
2892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002893 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002894 printf(" %d", n_cur);
2895 printf(" %d", n_mem);
2896 printf(" %d", n_size);
2897 printf("\n");
2898 }
2899 }
2900 }
2901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002902 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002903#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002904
Daniel Veillard42595322004-11-08 10:52:06 +00002905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002906}
2907
2908
2909static int
2910test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912
William M. Brack21e4ef22005-01-02 09:53:13 +00002913#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002914 int mem_base;
2915 const xmlChar * ret_val;
2916 htmlDocPtr doc; /* the document */
2917 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002918
Daniel Veillarda521d282004-11-09 14:59:59 +00002919 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002920 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002921 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002922
2923 ret_val = htmlGetMetaEncoding(doc);
2924 desret_const_xmlChar_ptr(ret_val);
2925 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002926 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002927 xmlResetLastError();
2928 if (mem_base != xmlMemBlocks()) {
2929 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002931 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002932 printf(" %d", n_doc);
2933 printf("\n");
2934 }
2935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002936 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002937#endif
2938
Daniel Veillard42595322004-11-08 10:52:06 +00002939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002940}
2941
2942
2943static int
2944test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002946
William M. Brack21e4ef22005-01-02 09:53:13 +00002947#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002948 int mem_base;
2949 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002950 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002951 int n_name;
2952
2953 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002955 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002956
William M. Brackf13f77f2004-11-12 16:03:48 +00002957 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002958 desret_int(ret_val);
2959 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002960 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002961 xmlResetLastError();
2962 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002963 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002965 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002966 printf(" %d", n_name);
2967 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002968 }
2969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002970 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002971#endif
2972
Daniel Veillard42595322004-11-08 10:52:06 +00002973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002974}
2975
2976
2977static int
2978test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002980
William M. Brack21e4ef22005-01-02 09:53:13 +00002981#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002982 int mem_base;
2983 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002984 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002985 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002986 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002988
Daniel Veillarda03e3652004-11-02 18:45:30 +00002989 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2990 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002992 URI = gen_const_xmlChar_ptr(n_URI, 0);
2993 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002994
William M. Brackf13f77f2004-11-12 16:03:48 +00002995 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002996 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002997 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002998 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2999 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003000 xmlResetLastError();
3001 if (mem_base != xmlMemBlocks()) {
3002 printf("Leak of %d blocks found in htmlNewDoc",
3003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003004 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 printf(" %d", n_URI);
3006 printf(" %d", n_ExternalID);
3007 printf("\n");
3008 }
3009 }
3010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003011 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003012#endif
3013
Daniel Veillard42595322004-11-08 10:52:06 +00003014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003015}
3016
3017
3018static int
3019test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003021
William M. Brack21e4ef22005-01-02 09:53:13 +00003022#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003023 int mem_base;
3024 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003025 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003027 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003028 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003029
Daniel Veillarda03e3652004-11-02 18:45:30 +00003030 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3031 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003033 URI = gen_const_xmlChar_ptr(n_URI, 0);
3034 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003035
William M. Brackf13f77f2004-11-12 16:03:48 +00003036 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003037 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003038 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003039 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3040 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003041 xmlResetLastError();
3042 if (mem_base != xmlMemBlocks()) {
3043 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003045 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003046 printf(" %d", n_URI);
3047 printf(" %d", n_ExternalID);
3048 printf("\n");
3049 }
3050 }
3051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003052 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003053#endif
3054
Daniel Veillard42595322004-11-08 10:52:06 +00003055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003056}
3057
3058
3059static int
3060test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003062
William M. Brack21e4ef22005-01-02 09:53:13 +00003063#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003064 int mem_base;
3065 int ret_val;
3066 xmlBufferPtr buf; /* the HTML buffer output */
3067 int n_buf;
3068 xmlDocPtr doc; /* the document */
3069 int n_doc;
3070 xmlNodePtr cur; /* the current node */
3071 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003072
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003073 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3074 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3075 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003077 buf = gen_xmlBufferPtr(n_buf, 0);
3078 doc = gen_xmlDocPtr(n_doc, 1);
3079 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003080
3081 ret_val = htmlNodeDump(buf, doc, cur);
3082 desret_int(ret_val);
3083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003084 des_xmlBufferPtr(n_buf, buf, 0);
3085 des_xmlDocPtr(n_doc, doc, 1);
3086 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003087 xmlResetLastError();
3088 if (mem_base != xmlMemBlocks()) {
3089 printf("Leak of %d blocks found in htmlNodeDump",
3090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003091 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003092 printf(" %d", n_buf);
3093 printf(" %d", n_doc);
3094 printf(" %d", n_cur);
3095 printf("\n");
3096 }
3097 }
3098 }
3099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003100 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003101#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003102
Daniel Veillard42595322004-11-08 10:52:06 +00003103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003104}
3105
3106
3107static int
3108test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003110
William M. Brack21e4ef22005-01-02 09:53:13 +00003111#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003112 int mem_base;
3113 FILE * out; /* the FILE pointer */
3114 int n_out;
3115 xmlDocPtr doc; /* the document */
3116 int n_doc;
3117 xmlNodePtr cur; /* the current node */
3118 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003119
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003120 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3121 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3122 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3123 mem_base = xmlMemBlocks();
3124 out = gen_FILE_ptr(n_out, 0);
3125 doc = gen_xmlDocPtr(n_doc, 1);
3126 cur = gen_xmlNodePtr(n_cur, 2);
3127
3128 htmlNodeDumpFile(out, doc, cur);
3129 call_tests++;
3130 des_FILE_ptr(n_out, out, 0);
3131 des_xmlDocPtr(n_doc, doc, 1);
3132 des_xmlNodePtr(n_cur, cur, 2);
3133 xmlResetLastError();
3134 if (mem_base != xmlMemBlocks()) {
3135 printf("Leak of %d blocks found in htmlNodeDumpFile",
3136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003137 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003138 printf(" %d", n_out);
3139 printf(" %d", n_doc);
3140 printf(" %d", n_cur);
3141 printf("\n");
3142 }
3143 }
3144 }
3145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003146 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003147#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148
Daniel Veillard42595322004-11-08 10:52:06 +00003149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003150}
3151
3152
3153static int
3154test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003156
William M. Brack21e4ef22005-01-02 09:53:13 +00003157#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003158 int mem_base;
3159 int ret_val;
3160 FILE * out; /* the FILE pointer */
3161 int n_out;
3162 xmlDocPtr doc; /* the document */
3163 int n_doc;
3164 xmlNodePtr cur; /* the current node */
3165 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003166 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003167 int n_encoding;
3168 int format; /* should formatting spaces been added */
3169 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003170
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003171 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3173 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3174 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3175 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3176 mem_base = xmlMemBlocks();
3177 out = gen_FILE_ptr(n_out, 0);
3178 doc = gen_xmlDocPtr(n_doc, 1);
3179 cur = gen_xmlNodePtr(n_cur, 2);
3180 encoding = gen_const_char_ptr(n_encoding, 3);
3181 format = gen_int(n_format, 4);
3182
William M. Brackf13f77f2004-11-12 16:03:48 +00003183 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003184 desret_int(ret_val);
3185 call_tests++;
3186 des_FILE_ptr(n_out, out, 0);
3187 des_xmlDocPtr(n_doc, doc, 1);
3188 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003189 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003190 des_int(n_format, format, 4);
3191 xmlResetLastError();
3192 if (mem_base != xmlMemBlocks()) {
3193 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003195 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003196 printf(" %d", n_out);
3197 printf(" %d", n_doc);
3198 printf(" %d", n_cur);
3199 printf(" %d", n_encoding);
3200 printf(" %d", n_format);
3201 printf("\n");
3202 }
3203 }
3204 }
3205 }
3206 }
3207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003208 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003209#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003210
Daniel Veillard42595322004-11-08 10:52:06 +00003211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003212}
3213
3214
3215static int
3216test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003218
William M. Brack21e4ef22005-01-02 09:53:13 +00003219#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 int mem_base;
3221 xmlOutputBufferPtr buf; /* the HTML buffer output */
3222 int n_buf;
3223 xmlDocPtr doc; /* the document */
3224 int n_doc;
3225 xmlNodePtr cur; /* the current node */
3226 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003227 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003228 int n_encoding;
3229 int format; /* should formatting spaces been added */
3230 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003231
Daniel Veillard3d97e662004-11-04 10:49:00 +00003232 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3234 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3235 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3236 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3237 mem_base = xmlMemBlocks();
3238 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3239 doc = gen_xmlDocPtr(n_doc, 1);
3240 cur = gen_xmlNodePtr(n_cur, 2);
3241 encoding = gen_const_char_ptr(n_encoding, 3);
3242 format = gen_int(n_format, 4);
3243
William M. Brackf13f77f2004-11-12 16:03:48 +00003244 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003245 call_tests++;
3246 des_xmlOutputBufferPtr(n_buf, buf, 0);
3247 des_xmlDocPtr(n_doc, doc, 1);
3248 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003249 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003250 des_int(n_format, format, 4);
3251 xmlResetLastError();
3252 if (mem_base != xmlMemBlocks()) {
3253 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003255 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003256 printf(" %d", n_buf);
3257 printf(" %d", n_doc);
3258 printf(" %d", n_cur);
3259 printf(" %d", n_encoding);
3260 printf(" %d", n_format);
3261 printf("\n");
3262 }
3263 }
3264 }
3265 }
3266 }
3267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003268 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003269#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270
Daniel Veillard42595322004-11-08 10:52:06 +00003271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003272}
3273
3274
3275static int
3276test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003278
William M. Brack21e4ef22005-01-02 09:53:13 +00003279#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003280 int mem_base;
3281 xmlOutputBufferPtr buf; /* the HTML buffer output */
3282 int n_buf;
3283 xmlDocPtr doc; /* the document */
3284 int n_doc;
3285 xmlNodePtr cur; /* the current node */
3286 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003287 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003288 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003289
Daniel Veillard3d97e662004-11-04 10:49:00 +00003290 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3291 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3292 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3293 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3294 mem_base = xmlMemBlocks();
3295 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3296 doc = gen_xmlDocPtr(n_doc, 1);
3297 cur = gen_xmlNodePtr(n_cur, 2);
3298 encoding = gen_const_char_ptr(n_encoding, 3);
3299
William M. Brackf13f77f2004-11-12 16:03:48 +00003300 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003301 call_tests++;
3302 des_xmlOutputBufferPtr(n_buf, buf, 0);
3303 des_xmlDocPtr(n_doc, doc, 1);
3304 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003305 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003306 xmlResetLastError();
3307 if (mem_base != xmlMemBlocks()) {
3308 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003310 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003311 printf(" %d", n_buf);
3312 printf(" %d", n_doc);
3313 printf(" %d", n_cur);
3314 printf(" %d", n_encoding);
3315 printf("\n");
3316 }
3317 }
3318 }
3319 }
3320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003321 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003322#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003323
Daniel Veillard42595322004-11-08 10:52:06 +00003324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003325}
3326
3327
3328static int
3329test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003331
William M. Brack21e4ef22005-01-02 09:53:13 +00003332#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003333 int mem_base;
3334 int ret_val;
3335 const char * filename; /* the filename (or URL) */
3336 int n_filename;
3337 xmlDocPtr cur; /* the document */
3338 int n_cur;
3339
3340 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3341 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003343 filename = gen_fileoutput(n_filename, 0);
3344 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345
3346 ret_val = htmlSaveFile(filename, cur);
3347 desret_int(ret_val);
3348 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003349 des_fileoutput(n_filename, filename, 0);
3350 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351 xmlResetLastError();
3352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003353 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003356 printf(" %d", n_filename);
3357 printf(" %d", n_cur);
3358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003359 }
3360 }
3361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003362 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003363#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364
Daniel Veillard42595322004-11-08 10:52:06 +00003365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003366}
3367
3368
3369static int
3370test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003372
William M. Brack21e4ef22005-01-02 09:53:13 +00003373#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003374 int mem_base;
3375 int ret_val;
3376 const char * filename; /* the filename */
3377 int n_filename;
3378 xmlDocPtr cur; /* the document */
3379 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003380 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003381 int n_encoding;
3382
3383 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3384 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3385 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003387 filename = gen_fileoutput(n_filename, 0);
3388 cur = gen_xmlDocPtr(n_cur, 1);
3389 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003390
William M. Brackf13f77f2004-11-12 16:03:48 +00003391 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003392 desret_int(ret_val);
3393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003394 des_fileoutput(n_filename, filename, 0);
3395 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003396 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003397 xmlResetLastError();
3398 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003399 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003401 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003402 printf(" %d", n_filename);
3403 printf(" %d", n_cur);
3404 printf(" %d", n_encoding);
3405 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003406 }
3407 }
3408 }
3409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003410 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003411#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003412
Daniel Veillard42595322004-11-08 10:52:06 +00003413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414}
3415
3416
3417static int
3418test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420
William M. Brack21e4ef22005-01-02 09:53:13 +00003421#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003422 int mem_base;
3423 int ret_val;
3424 const char * filename; /* the filename */
3425 int n_filename;
3426 xmlDocPtr cur; /* the document */
3427 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003428 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003429 int n_encoding;
3430 int format; /* should formatting spaces been added */
3431 int n_format;
3432
3433 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3434 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3435 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3436 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003438 filename = gen_fileoutput(n_filename, 0);
3439 cur = gen_xmlDocPtr(n_cur, 1);
3440 encoding = gen_const_char_ptr(n_encoding, 2);
3441 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003442
William M. Brackf13f77f2004-11-12 16:03:48 +00003443 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003444 desret_int(ret_val);
3445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003446 des_fileoutput(n_filename, filename, 0);
3447 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003448 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003449 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003450 xmlResetLastError();
3451 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003452 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003454 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 printf(" %d", n_filename);
3456 printf(" %d", n_cur);
3457 printf(" %d", n_encoding);
3458 printf(" %d", n_format);
3459 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003460 }
3461 }
3462 }
3463 }
3464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003465 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003466#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003467
Daniel Veillard42595322004-11-08 10:52:06 +00003468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003469}
3470
3471
3472static int
3473test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003475
William M. Brack21e4ef22005-01-02 09:53:13 +00003476#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003477 int mem_base;
3478 int ret_val;
3479 htmlDocPtr doc; /* the document */
3480 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003481 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003482 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003483
Daniel Veillarda521d282004-11-09 14:59:59 +00003484 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003485 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3486 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003487 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003488 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003489
William M. Brackf13f77f2004-11-12 16:03:48 +00003490 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003491 desret_int(ret_val);
3492 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003493 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003494 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003495 xmlResetLastError();
3496 if (mem_base != xmlMemBlocks()) {
3497 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003500 printf(" %d", n_doc);
3501 printf(" %d", n_encoding);
3502 printf("\n");
3503 }
3504 }
3505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003506 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003507#endif
3508
Daniel Veillard42595322004-11-08 10:52:06 +00003509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003510}
3511
3512static int
3513test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003515
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003516 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003517 test_ret += test_htmlDocContentDumpFormatOutput();
3518 test_ret += test_htmlDocContentDumpOutput();
3519 test_ret += test_htmlDocDump();
3520 test_ret += test_htmlDocDumpMemory();
3521 test_ret += test_htmlGetMetaEncoding();
3522 test_ret += test_htmlIsBooleanAttr();
3523 test_ret += test_htmlNewDoc();
3524 test_ret += test_htmlNewDocNoDtD();
3525 test_ret += test_htmlNodeDump();
3526 test_ret += test_htmlNodeDumpFile();
3527 test_ret += test_htmlNodeDumpFileFormat();
3528 test_ret += test_htmlNodeDumpFormatOutput();
3529 test_ret += test_htmlNodeDumpOutput();
3530 test_ret += test_htmlSaveFile();
3531 test_ret += test_htmlSaveFileEnc();
3532 test_ret += test_htmlSaveFileFormat();
3533 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003534
Daniel Veillard42595322004-11-08 10:52:06 +00003535 if (test_ret != 0)
3536 printf("Module HTMLtree: %d errors\n", test_ret);
3537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003538}
3539
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003540static int
3541test_docbDefaultSAXHandlerInit(void) {
3542 int test_ret = 0;
3543
William M. Brack21e4ef22005-01-02 09:53:13 +00003544#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003545#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003546 int mem_base;
3547
3548 mem_base = xmlMemBlocks();
3549
3550 docbDefaultSAXHandlerInit();
3551 call_tests++;
3552 xmlResetLastError();
3553 if (mem_base != xmlMemBlocks()) {
3554 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3555 xmlMemBlocks() - mem_base);
3556 test_ret++;
3557 printf("\n");
3558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003559 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003560#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003561#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003562
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003563 return(test_ret);
3564}
3565
3566
3567static int
3568test_htmlDefaultSAXHandlerInit(void) {
3569 int test_ret = 0;
3570
William M. Brack21e4ef22005-01-02 09:53:13 +00003571#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003572#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003573 int mem_base;
3574
3575 mem_base = xmlMemBlocks();
3576
3577 htmlDefaultSAXHandlerInit();
3578 call_tests++;
3579 xmlResetLastError();
3580 if (mem_base != xmlMemBlocks()) {
3581 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3582 xmlMemBlocks() - mem_base);
3583 test_ret++;
3584 printf("\n");
3585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003586 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003587#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003588#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003589
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003590 return(test_ret);
3591}
3592
3593
3594static int
3595test_xmlDefaultSAXHandlerInit(void) {
3596 int test_ret = 0;
3597
3598 int mem_base;
3599
3600 mem_base = xmlMemBlocks();
3601
3602 xmlDefaultSAXHandlerInit();
3603 call_tests++;
3604 xmlResetLastError();
3605 if (mem_base != xmlMemBlocks()) {
3606 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3607 xmlMemBlocks() - mem_base);
3608 test_ret++;
3609 printf("\n");
3610 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003612
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003613 return(test_ret);
3614}
3615
3616
3617#define gen_nb_xmlEnumerationPtr 1
3618static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3619 return(NULL);
3620}
3621static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3622}
3623
3624static int
3625test_xmlSAX2AttributeDecl(void) {
3626 int test_ret = 0;
3627
3628 int mem_base;
3629 void * ctx; /* the user data (XML parser context) */
3630 int n_ctx;
3631 xmlChar * elem; /* the name of the element */
3632 int n_elem;
3633 xmlChar * fullname; /* the attribute name */
3634 int n_fullname;
3635 int type; /* the attribute type */
3636 int n_type;
3637 int def; /* the type of default value */
3638 int n_def;
3639 xmlChar * defaultValue; /* the attribute default value */
3640 int n_defaultValue;
3641 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3642 int n_tree;
3643
3644 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3645 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3646 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3647 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3648 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3649 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3650 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3651 mem_base = xmlMemBlocks();
3652 ctx = gen_void_ptr(n_ctx, 0);
3653 elem = gen_const_xmlChar_ptr(n_elem, 1);
3654 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3655 type = gen_int(n_type, 3);
3656 def = gen_int(n_def, 4);
3657 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3658 tree = gen_xmlEnumerationPtr(n_tree, 6);
3659
William M. Brackf13f77f2004-11-12 16:03:48 +00003660 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003661 call_tests++;
3662 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003663 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3664 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003665 des_int(n_type, type, 3);
3666 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003667 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003668 des_xmlEnumerationPtr(n_tree, tree, 6);
3669 xmlResetLastError();
3670 if (mem_base != xmlMemBlocks()) {
3671 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3672 xmlMemBlocks() - mem_base);
3673 test_ret++;
3674 printf(" %d", n_ctx);
3675 printf(" %d", n_elem);
3676 printf(" %d", n_fullname);
3677 printf(" %d", n_type);
3678 printf(" %d", n_def);
3679 printf(" %d", n_defaultValue);
3680 printf(" %d", n_tree);
3681 printf("\n");
3682 }
3683 }
3684 }
3685 }
3686 }
3687 }
3688 }
3689 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003691
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003692 return(test_ret);
3693}
3694
3695
3696static int
3697test_xmlSAX2CDataBlock(void) {
3698 int test_ret = 0;
3699
3700 int mem_base;
3701 void * ctx; /* the user data (XML parser context) */
3702 int n_ctx;
3703 xmlChar * value; /* The pcdata content */
3704 int n_value;
3705 int len; /* the block length */
3706 int n_len;
3707
3708 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3709 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3710 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3711 mem_base = xmlMemBlocks();
3712 ctx = gen_void_ptr(n_ctx, 0);
3713 value = gen_const_xmlChar_ptr(n_value, 1);
3714 len = gen_int(n_len, 2);
3715
William M. Brackf13f77f2004-11-12 16:03:48 +00003716 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003717 call_tests++;
3718 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003719 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003720 des_int(n_len, len, 2);
3721 xmlResetLastError();
3722 if (mem_base != xmlMemBlocks()) {
3723 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3724 xmlMemBlocks() - mem_base);
3725 test_ret++;
3726 printf(" %d", n_ctx);
3727 printf(" %d", n_value);
3728 printf(" %d", n_len);
3729 printf("\n");
3730 }
3731 }
3732 }
3733 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003735
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003736 return(test_ret);
3737}
3738
3739
3740static int
3741test_xmlSAX2Characters(void) {
3742 int test_ret = 0;
3743
3744 int mem_base;
3745 void * ctx; /* the user data (XML parser context) */
3746 int n_ctx;
3747 xmlChar * ch; /* a xmlChar string */
3748 int n_ch;
3749 int len; /* the number of xmlChar */
3750 int n_len;
3751
3752 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3753 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3754 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3755 mem_base = xmlMemBlocks();
3756 ctx = gen_void_ptr(n_ctx, 0);
3757 ch = gen_const_xmlChar_ptr(n_ch, 1);
3758 len = gen_int(n_len, 2);
3759
William M. Brackf13f77f2004-11-12 16:03:48 +00003760 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003761 call_tests++;
3762 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003763 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003764 des_int(n_len, len, 2);
3765 xmlResetLastError();
3766 if (mem_base != xmlMemBlocks()) {
3767 printf("Leak of %d blocks found in xmlSAX2Characters",
3768 xmlMemBlocks() - mem_base);
3769 test_ret++;
3770 printf(" %d", n_ctx);
3771 printf(" %d", n_ch);
3772 printf(" %d", n_len);
3773 printf("\n");
3774 }
3775 }
3776 }
3777 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003778 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003779
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003780 return(test_ret);
3781}
3782
3783
3784static int
3785test_xmlSAX2Comment(void) {
3786 int test_ret = 0;
3787
3788 int mem_base;
3789 void * ctx; /* the user data (XML parser context) */
3790 int n_ctx;
3791 xmlChar * value; /* the xmlSAX2Comment content */
3792 int n_value;
3793
3794 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3795 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3796 mem_base = xmlMemBlocks();
3797 ctx = gen_void_ptr(n_ctx, 0);
3798 value = gen_const_xmlChar_ptr(n_value, 1);
3799
William M. Brackf13f77f2004-11-12 16:03:48 +00003800 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003801 call_tests++;
3802 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003803 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003804 xmlResetLastError();
3805 if (mem_base != xmlMemBlocks()) {
3806 printf("Leak of %d blocks found in xmlSAX2Comment",
3807 xmlMemBlocks() - mem_base);
3808 test_ret++;
3809 printf(" %d", n_ctx);
3810 printf(" %d", n_value);
3811 printf("\n");
3812 }
3813 }
3814 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003815 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003816
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003817 return(test_ret);
3818}
3819
3820
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003821static int
3822test_xmlSAX2ElementDecl(void) {
3823 int test_ret = 0;
3824
3825 int mem_base;
3826 void * ctx; /* the user data (XML parser context) */
3827 int n_ctx;
3828 xmlChar * name; /* the element name */
3829 int n_name;
3830 int type; /* the element type */
3831 int n_type;
3832 xmlElementContentPtr content; /* the element value tree */
3833 int n_content;
3834
3835 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3836 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3837 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3838 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3839 mem_base = xmlMemBlocks();
3840 ctx = gen_void_ptr(n_ctx, 0);
3841 name = gen_const_xmlChar_ptr(n_name, 1);
3842 type = gen_int(n_type, 2);
3843 content = gen_xmlElementContentPtr(n_content, 3);
3844
William M. Brackf13f77f2004-11-12 16:03:48 +00003845 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003846 call_tests++;
3847 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003848 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003849 des_int(n_type, type, 2);
3850 des_xmlElementContentPtr(n_content, content, 3);
3851 xmlResetLastError();
3852 if (mem_base != xmlMemBlocks()) {
3853 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3854 xmlMemBlocks() - mem_base);
3855 test_ret++;
3856 printf(" %d", n_ctx);
3857 printf(" %d", n_name);
3858 printf(" %d", n_type);
3859 printf(" %d", n_content);
3860 printf("\n");
3861 }
3862 }
3863 }
3864 }
3865 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003867
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003868 return(test_ret);
3869}
3870
3871
3872static int
3873test_xmlSAX2EndDocument(void) {
3874 int test_ret = 0;
3875
3876 int mem_base;
3877 void * ctx; /* the user data (XML parser context) */
3878 int n_ctx;
3879
3880 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3881 mem_base = xmlMemBlocks();
3882 ctx = gen_void_ptr(n_ctx, 0);
3883
3884 xmlSAX2EndDocument(ctx);
3885 call_tests++;
3886 des_void_ptr(n_ctx, ctx, 0);
3887 xmlResetLastError();
3888 if (mem_base != xmlMemBlocks()) {
3889 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3890 xmlMemBlocks() - mem_base);
3891 test_ret++;
3892 printf(" %d", n_ctx);
3893 printf("\n");
3894 }
3895 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003897
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003898 return(test_ret);
3899}
3900
3901
3902static int
3903test_xmlSAX2EndElement(void) {
3904 int test_ret = 0;
3905
William M. Brack21e4ef22005-01-02 09:53:13 +00003906#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003907#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003908 int mem_base;
3909 void * ctx; /* the user data (XML parser context) */
3910 int n_ctx;
3911 xmlChar * name; /* The element name */
3912 int n_name;
3913
3914 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3915 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3916 mem_base = xmlMemBlocks();
3917 ctx = gen_void_ptr(n_ctx, 0);
3918 name = gen_const_xmlChar_ptr(n_name, 1);
3919
William M. Brackf13f77f2004-11-12 16:03:48 +00003920 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003921 call_tests++;
3922 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003923 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003924 xmlResetLastError();
3925 if (mem_base != xmlMemBlocks()) {
3926 printf("Leak of %d blocks found in xmlSAX2EndElement",
3927 xmlMemBlocks() - mem_base);
3928 test_ret++;
3929 printf(" %d", n_ctx);
3930 printf(" %d", n_name);
3931 printf("\n");
3932 }
3933 }
3934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003935 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003936#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003937#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003938
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003939 return(test_ret);
3940}
3941
3942
3943static int
3944test_xmlSAX2EndElementNs(void) {
3945 int test_ret = 0;
3946
3947 int mem_base;
3948 void * ctx; /* the user data (XML parser context) */
3949 int n_ctx;
3950 xmlChar * localname; /* the local name of the element */
3951 int n_localname;
3952 xmlChar * prefix; /* the element namespace prefix if available */
3953 int n_prefix;
3954 xmlChar * URI; /* the element namespace name if available */
3955 int n_URI;
3956
3957 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3958 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3959 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3960 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3961 mem_base = xmlMemBlocks();
3962 ctx = gen_void_ptr(n_ctx, 0);
3963 localname = gen_const_xmlChar_ptr(n_localname, 1);
3964 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3965 URI = gen_const_xmlChar_ptr(n_URI, 3);
3966
William M. Brackf13f77f2004-11-12 16:03:48 +00003967 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003968 call_tests++;
3969 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003970 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3971 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3972 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003973 xmlResetLastError();
3974 if (mem_base != xmlMemBlocks()) {
3975 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3976 xmlMemBlocks() - mem_base);
3977 test_ret++;
3978 printf(" %d", n_ctx);
3979 printf(" %d", n_localname);
3980 printf(" %d", n_prefix);
3981 printf(" %d", n_URI);
3982 printf("\n");
3983 }
3984 }
3985 }
3986 }
3987 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003989
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003990 return(test_ret);
3991}
3992
3993
3994static int
3995test_xmlSAX2EntityDecl(void) {
3996 int test_ret = 0;
3997
3998 int mem_base;
3999 void * ctx; /* the user data (XML parser context) */
4000 int n_ctx;
4001 xmlChar * name; /* the entity name */
4002 int n_name;
4003 int type; /* the entity type */
4004 int n_type;
4005 xmlChar * publicId; /* The public ID of the entity */
4006 int n_publicId;
4007 xmlChar * systemId; /* The system ID of the entity */
4008 int n_systemId;
4009 xmlChar * content; /* the entity value (without processing). */
4010 int n_content;
4011
4012 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4013 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4014 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4015 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4016 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4017 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4018 mem_base = xmlMemBlocks();
4019 ctx = gen_void_ptr(n_ctx, 0);
4020 name = gen_const_xmlChar_ptr(n_name, 1);
4021 type = gen_int(n_type, 2);
4022 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4023 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4024 content = gen_xmlChar_ptr(n_content, 5);
4025
William M. Brackf13f77f2004-11-12 16:03:48 +00004026 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004027 call_tests++;
4028 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004029 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004030 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004031 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4032 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004033 des_xmlChar_ptr(n_content, content, 5);
4034 xmlResetLastError();
4035 if (mem_base != xmlMemBlocks()) {
4036 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4037 xmlMemBlocks() - mem_base);
4038 test_ret++;
4039 printf(" %d", n_ctx);
4040 printf(" %d", n_name);
4041 printf(" %d", n_type);
4042 printf(" %d", n_publicId);
4043 printf(" %d", n_systemId);
4044 printf(" %d", n_content);
4045 printf("\n");
4046 }
4047 }
4048 }
4049 }
4050 }
4051 }
4052 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004055 return(test_ret);
4056}
4057
4058
4059static int
4060test_xmlSAX2ExternalSubset(void) {
4061 int test_ret = 0;
4062
4063 int mem_base;
4064 void * ctx; /* the user data (XML parser context) */
4065 int n_ctx;
4066 xmlChar * name; /* the root element name */
4067 int n_name;
4068 xmlChar * ExternalID; /* the external ID */
4069 int n_ExternalID;
4070 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4071 int n_SystemID;
4072
4073 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4074 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4075 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4076 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4077 mem_base = xmlMemBlocks();
4078 ctx = gen_void_ptr(n_ctx, 0);
4079 name = gen_const_xmlChar_ptr(n_name, 1);
4080 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4081 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4082
William M. Brackf13f77f2004-11-12 16:03:48 +00004083 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004084 call_tests++;
4085 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004086 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4087 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4088 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004089 xmlResetLastError();
4090 if (mem_base != xmlMemBlocks()) {
4091 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4092 xmlMemBlocks() - mem_base);
4093 test_ret++;
4094 printf(" %d", n_ctx);
4095 printf(" %d", n_name);
4096 printf(" %d", n_ExternalID);
4097 printf(" %d", n_SystemID);
4098 printf("\n");
4099 }
4100 }
4101 }
4102 }
4103 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004104 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004105
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004106 return(test_ret);
4107}
4108
4109
4110static int
4111test_xmlSAX2GetColumnNumber(void) {
4112 int test_ret = 0;
4113
4114 int mem_base;
4115 int ret_val;
4116 void * ctx; /* the user data (XML parser context) */
4117 int n_ctx;
4118
4119 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4120 mem_base = xmlMemBlocks();
4121 ctx = gen_void_ptr(n_ctx, 0);
4122
4123 ret_val = xmlSAX2GetColumnNumber(ctx);
4124 desret_int(ret_val);
4125 call_tests++;
4126 des_void_ptr(n_ctx, ctx, 0);
4127 xmlResetLastError();
4128 if (mem_base != xmlMemBlocks()) {
4129 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4130 xmlMemBlocks() - mem_base);
4131 test_ret++;
4132 printf(" %d", n_ctx);
4133 printf("\n");
4134 }
4135 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004136 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004137
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004138 return(test_ret);
4139}
4140
4141
4142static int
4143test_xmlSAX2GetEntity(void) {
4144 int test_ret = 0;
4145
4146 int mem_base;
4147 xmlEntityPtr ret_val;
4148 void * ctx; /* the user data (XML parser context) */
4149 int n_ctx;
4150 xmlChar * name; /* The entity name */
4151 int n_name;
4152
4153 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4154 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4155 mem_base = xmlMemBlocks();
4156 ctx = gen_void_ptr(n_ctx, 0);
4157 name = gen_const_xmlChar_ptr(n_name, 1);
4158
William M. Brackf13f77f2004-11-12 16:03:48 +00004159 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004160 desret_xmlEntityPtr(ret_val);
4161 call_tests++;
4162 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004163 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004164 xmlResetLastError();
4165 if (mem_base != xmlMemBlocks()) {
4166 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4167 xmlMemBlocks() - mem_base);
4168 test_ret++;
4169 printf(" %d", n_ctx);
4170 printf(" %d", n_name);
4171 printf("\n");
4172 }
4173 }
4174 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004176
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004177 return(test_ret);
4178}
4179
4180
4181static int
4182test_xmlSAX2GetLineNumber(void) {
4183 int test_ret = 0;
4184
4185 int mem_base;
4186 int ret_val;
4187 void * ctx; /* the user data (XML parser context) */
4188 int n_ctx;
4189
4190 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4191 mem_base = xmlMemBlocks();
4192 ctx = gen_void_ptr(n_ctx, 0);
4193
4194 ret_val = xmlSAX2GetLineNumber(ctx);
4195 desret_int(ret_val);
4196 call_tests++;
4197 des_void_ptr(n_ctx, ctx, 0);
4198 xmlResetLastError();
4199 if (mem_base != xmlMemBlocks()) {
4200 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4201 xmlMemBlocks() - mem_base);
4202 test_ret++;
4203 printf(" %d", n_ctx);
4204 printf("\n");
4205 }
4206 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004208
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004209 return(test_ret);
4210}
4211
4212
4213static int
4214test_xmlSAX2GetParameterEntity(void) {
4215 int test_ret = 0;
4216
4217 int mem_base;
4218 xmlEntityPtr ret_val;
4219 void * ctx; /* the user data (XML parser context) */
4220 int n_ctx;
4221 xmlChar * name; /* The entity name */
4222 int n_name;
4223
4224 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4225 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4226 mem_base = xmlMemBlocks();
4227 ctx = gen_void_ptr(n_ctx, 0);
4228 name = gen_const_xmlChar_ptr(n_name, 1);
4229
William M. Brackf13f77f2004-11-12 16:03:48 +00004230 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004231 desret_xmlEntityPtr(ret_val);
4232 call_tests++;
4233 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004234 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004235 xmlResetLastError();
4236 if (mem_base != xmlMemBlocks()) {
4237 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4238 xmlMemBlocks() - mem_base);
4239 test_ret++;
4240 printf(" %d", n_ctx);
4241 printf(" %d", n_name);
4242 printf("\n");
4243 }
4244 }
4245 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004247
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004248 return(test_ret);
4249}
4250
4251
4252static int
4253test_xmlSAX2GetPublicId(void) {
4254 int test_ret = 0;
4255
4256 int mem_base;
4257 const xmlChar * ret_val;
4258 void * ctx; /* the user data (XML parser context) */
4259 int n_ctx;
4260
4261 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4262 mem_base = xmlMemBlocks();
4263 ctx = gen_void_ptr(n_ctx, 0);
4264
4265 ret_val = xmlSAX2GetPublicId(ctx);
4266 desret_const_xmlChar_ptr(ret_val);
4267 call_tests++;
4268 des_void_ptr(n_ctx, ctx, 0);
4269 xmlResetLastError();
4270 if (mem_base != xmlMemBlocks()) {
4271 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4272 xmlMemBlocks() - mem_base);
4273 test_ret++;
4274 printf(" %d", n_ctx);
4275 printf("\n");
4276 }
4277 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004279
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004280 return(test_ret);
4281}
4282
4283
4284static int
4285test_xmlSAX2GetSystemId(void) {
4286 int test_ret = 0;
4287
4288 int mem_base;
4289 const xmlChar * ret_val;
4290 void * ctx; /* the user data (XML parser context) */
4291 int n_ctx;
4292
4293 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4294 mem_base = xmlMemBlocks();
4295 ctx = gen_void_ptr(n_ctx, 0);
4296
4297 ret_val = xmlSAX2GetSystemId(ctx);
4298 desret_const_xmlChar_ptr(ret_val);
4299 call_tests++;
4300 des_void_ptr(n_ctx, ctx, 0);
4301 xmlResetLastError();
4302 if (mem_base != xmlMemBlocks()) {
4303 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4304 xmlMemBlocks() - mem_base);
4305 test_ret++;
4306 printf(" %d", n_ctx);
4307 printf("\n");
4308 }
4309 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004311
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004312 return(test_ret);
4313}
4314
4315
4316static int
4317test_xmlSAX2HasExternalSubset(void) {
4318 int test_ret = 0;
4319
4320 int mem_base;
4321 int ret_val;
4322 void * ctx; /* the user data (XML parser context) */
4323 int n_ctx;
4324
4325 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4326 mem_base = xmlMemBlocks();
4327 ctx = gen_void_ptr(n_ctx, 0);
4328
4329 ret_val = xmlSAX2HasExternalSubset(ctx);
4330 desret_int(ret_val);
4331 call_tests++;
4332 des_void_ptr(n_ctx, ctx, 0);
4333 xmlResetLastError();
4334 if (mem_base != xmlMemBlocks()) {
4335 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4336 xmlMemBlocks() - mem_base);
4337 test_ret++;
4338 printf(" %d", n_ctx);
4339 printf("\n");
4340 }
4341 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004343
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004344 return(test_ret);
4345}
4346
4347
4348static int
4349test_xmlSAX2HasInternalSubset(void) {
4350 int test_ret = 0;
4351
4352 int mem_base;
4353 int ret_val;
4354 void * ctx; /* the user data (XML parser context) */
4355 int n_ctx;
4356
4357 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4358 mem_base = xmlMemBlocks();
4359 ctx = gen_void_ptr(n_ctx, 0);
4360
4361 ret_val = xmlSAX2HasInternalSubset(ctx);
4362 desret_int(ret_val);
4363 call_tests++;
4364 des_void_ptr(n_ctx, ctx, 0);
4365 xmlResetLastError();
4366 if (mem_base != xmlMemBlocks()) {
4367 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4368 xmlMemBlocks() - mem_base);
4369 test_ret++;
4370 printf(" %d", n_ctx);
4371 printf("\n");
4372 }
4373 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004375
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004376 return(test_ret);
4377}
4378
4379
4380static int
4381test_xmlSAX2IgnorableWhitespace(void) {
4382 int test_ret = 0;
4383
4384 int mem_base;
4385 void * ctx; /* the user data (XML parser context) */
4386 int n_ctx;
4387 xmlChar * ch; /* a xmlChar string */
4388 int n_ch;
4389 int len; /* the number of xmlChar */
4390 int n_len;
4391
4392 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4393 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4394 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4395 mem_base = xmlMemBlocks();
4396 ctx = gen_void_ptr(n_ctx, 0);
4397 ch = gen_const_xmlChar_ptr(n_ch, 1);
4398 len = gen_int(n_len, 2);
4399
William M. Brackf13f77f2004-11-12 16:03:48 +00004400 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004401 call_tests++;
4402 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004403 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004404 des_int(n_len, len, 2);
4405 xmlResetLastError();
4406 if (mem_base != xmlMemBlocks()) {
4407 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4408 xmlMemBlocks() - mem_base);
4409 test_ret++;
4410 printf(" %d", n_ctx);
4411 printf(" %d", n_ch);
4412 printf(" %d", n_len);
4413 printf("\n");
4414 }
4415 }
4416 }
4417 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004418 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004419
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004420 return(test_ret);
4421}
4422
4423
4424#define gen_nb_xmlSAXHandler_ptr 1
4425static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4426 return(NULL);
4427}
4428static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4429}
4430
4431static int
4432test_xmlSAX2InitDefaultSAXHandler(void) {
4433 int test_ret = 0;
4434
4435 int mem_base;
4436 xmlSAXHandler * hdlr; /* the SAX handler */
4437 int n_hdlr;
4438 int warning; /* flag if non-zero sets the handler warning procedure */
4439 int n_warning;
4440
4441 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4442 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4443 mem_base = xmlMemBlocks();
4444 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4445 warning = gen_int(n_warning, 1);
4446
4447 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4448 call_tests++;
4449 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4450 des_int(n_warning, warning, 1);
4451 xmlResetLastError();
4452 if (mem_base != xmlMemBlocks()) {
4453 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4454 xmlMemBlocks() - mem_base);
4455 test_ret++;
4456 printf(" %d", n_hdlr);
4457 printf(" %d", n_warning);
4458 printf("\n");
4459 }
4460 }
4461 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004463
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004464 return(test_ret);
4465}
4466
4467
4468static int
4469test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4470 int test_ret = 0;
4471
William M. Brack21e4ef22005-01-02 09:53:13 +00004472#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004473 int mem_base;
4474 xmlSAXHandler * hdlr; /* the SAX handler */
4475 int n_hdlr;
4476
4477 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4478 mem_base = xmlMemBlocks();
4479 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4480
4481 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4482 call_tests++;
4483 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4484 xmlResetLastError();
4485 if (mem_base != xmlMemBlocks()) {
4486 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4487 xmlMemBlocks() - mem_base);
4488 test_ret++;
4489 printf(" %d", n_hdlr);
4490 printf("\n");
4491 }
4492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004493 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004494#endif
4495
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004496 return(test_ret);
4497}
4498
4499
4500static int
4501test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4502 int test_ret = 0;
4503
William M. Brack21e4ef22005-01-02 09:53:13 +00004504#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004505 int mem_base;
4506 xmlSAXHandler * hdlr; /* the SAX handler */
4507 int n_hdlr;
4508
4509 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4510 mem_base = xmlMemBlocks();
4511 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4512
4513 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4514 call_tests++;
4515 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4516 xmlResetLastError();
4517 if (mem_base != xmlMemBlocks()) {
4518 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4519 xmlMemBlocks() - mem_base);
4520 test_ret++;
4521 printf(" %d", n_hdlr);
4522 printf("\n");
4523 }
4524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004525 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526#endif
4527
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004528 return(test_ret);
4529}
4530
4531
4532static int
4533test_xmlSAX2InternalSubset(void) {
4534 int test_ret = 0;
4535
4536 int mem_base;
4537 void * ctx; /* the user data (XML parser context) */
4538 int n_ctx;
4539 xmlChar * name; /* the root element name */
4540 int n_name;
4541 xmlChar * ExternalID; /* the external ID */
4542 int n_ExternalID;
4543 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4544 int n_SystemID;
4545
4546 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4548 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4549 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4550 mem_base = xmlMemBlocks();
4551 ctx = gen_void_ptr(n_ctx, 0);
4552 name = gen_const_xmlChar_ptr(n_name, 1);
4553 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4554 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4555
William M. Brackf13f77f2004-11-12 16:03:48 +00004556 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004557 call_tests++;
4558 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004559 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4560 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4561 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004562 xmlResetLastError();
4563 if (mem_base != xmlMemBlocks()) {
4564 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4565 xmlMemBlocks() - mem_base);
4566 test_ret++;
4567 printf(" %d", n_ctx);
4568 printf(" %d", n_name);
4569 printf(" %d", n_ExternalID);
4570 printf(" %d", n_SystemID);
4571 printf("\n");
4572 }
4573 }
4574 }
4575 }
4576 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004577 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004578
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004579 return(test_ret);
4580}
4581
4582
4583static int
4584test_xmlSAX2IsStandalone(void) {
4585 int test_ret = 0;
4586
4587 int mem_base;
4588 int ret_val;
4589 void * ctx; /* the user data (XML parser context) */
4590 int n_ctx;
4591
4592 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4593 mem_base = xmlMemBlocks();
4594 ctx = gen_void_ptr(n_ctx, 0);
4595
4596 ret_val = xmlSAX2IsStandalone(ctx);
4597 desret_int(ret_val);
4598 call_tests++;
4599 des_void_ptr(n_ctx, ctx, 0);
4600 xmlResetLastError();
4601 if (mem_base != xmlMemBlocks()) {
4602 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4603 xmlMemBlocks() - mem_base);
4604 test_ret++;
4605 printf(" %d", n_ctx);
4606 printf("\n");
4607 }
4608 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004610
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004611 return(test_ret);
4612}
4613
4614
4615static int
4616test_xmlSAX2NotationDecl(void) {
4617 int test_ret = 0;
4618
4619 int mem_base;
4620 void * ctx; /* the user data (XML parser context) */
4621 int n_ctx;
4622 xmlChar * name; /* The name of the notation */
4623 int n_name;
4624 xmlChar * publicId; /* The public ID of the entity */
4625 int n_publicId;
4626 xmlChar * systemId; /* The system ID of the entity */
4627 int n_systemId;
4628
4629 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4630 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4631 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4632 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4633 mem_base = xmlMemBlocks();
4634 ctx = gen_void_ptr(n_ctx, 0);
4635 name = gen_const_xmlChar_ptr(n_name, 1);
4636 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4637 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4638
William M. Brackf13f77f2004-11-12 16:03:48 +00004639 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004640 call_tests++;
4641 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004642 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4643 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4644 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004645 xmlResetLastError();
4646 if (mem_base != xmlMemBlocks()) {
4647 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4648 xmlMemBlocks() - mem_base);
4649 test_ret++;
4650 printf(" %d", n_ctx);
4651 printf(" %d", n_name);
4652 printf(" %d", n_publicId);
4653 printf(" %d", n_systemId);
4654 printf("\n");
4655 }
4656 }
4657 }
4658 }
4659 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004660 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004661
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004662 return(test_ret);
4663}
4664
4665
4666static int
4667test_xmlSAX2ProcessingInstruction(void) {
4668 int test_ret = 0;
4669
4670 int mem_base;
4671 void * ctx; /* the user data (XML parser context) */
4672 int n_ctx;
4673 xmlChar * target; /* the target name */
4674 int n_target;
4675 xmlChar * data; /* the PI data's */
4676 int n_data;
4677
4678 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4679 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4680 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4681 mem_base = xmlMemBlocks();
4682 ctx = gen_void_ptr(n_ctx, 0);
4683 target = gen_const_xmlChar_ptr(n_target, 1);
4684 data = gen_const_xmlChar_ptr(n_data, 2);
4685
William M. Brackf13f77f2004-11-12 16:03:48 +00004686 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004687 call_tests++;
4688 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004689 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4690 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 xmlResetLastError();
4692 if (mem_base != xmlMemBlocks()) {
4693 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4694 xmlMemBlocks() - mem_base);
4695 test_ret++;
4696 printf(" %d", n_ctx);
4697 printf(" %d", n_target);
4698 printf(" %d", n_data);
4699 printf("\n");
4700 }
4701 }
4702 }
4703 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004704 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004705
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004706 return(test_ret);
4707}
4708
4709
4710static int
4711test_xmlSAX2Reference(void) {
4712 int test_ret = 0;
4713
4714 int mem_base;
4715 void * ctx; /* the user data (XML parser context) */
4716 int n_ctx;
4717 xmlChar * name; /* The entity name */
4718 int n_name;
4719
4720 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4721 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4722 mem_base = xmlMemBlocks();
4723 ctx = gen_void_ptr(n_ctx, 0);
4724 name = gen_const_xmlChar_ptr(n_name, 1);
4725
William M. Brackf13f77f2004-11-12 16:03:48 +00004726 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004727 call_tests++;
4728 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004729 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004730 xmlResetLastError();
4731 if (mem_base != xmlMemBlocks()) {
4732 printf("Leak of %d blocks found in xmlSAX2Reference",
4733 xmlMemBlocks() - mem_base);
4734 test_ret++;
4735 printf(" %d", n_ctx);
4736 printf(" %d", n_name);
4737 printf("\n");
4738 }
4739 }
4740 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004742
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004743 return(test_ret);
4744}
4745
4746
4747static int
4748test_xmlSAX2ResolveEntity(void) {
4749 int test_ret = 0;
4750
4751 int mem_base;
4752 xmlParserInputPtr ret_val;
4753 void * ctx; /* the user data (XML parser context) */
4754 int n_ctx;
4755 xmlChar * publicId; /* The public ID of the entity */
4756 int n_publicId;
4757 xmlChar * systemId; /* The system ID of the entity */
4758 int n_systemId;
4759
4760 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4761 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4762 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4763 mem_base = xmlMemBlocks();
4764 ctx = gen_void_ptr(n_ctx, 0);
4765 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4766 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4767
William M. Brackf13f77f2004-11-12 16:03:48 +00004768 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004769 desret_xmlParserInputPtr(ret_val);
4770 call_tests++;
4771 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004772 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4773 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004774 xmlResetLastError();
4775 if (mem_base != xmlMemBlocks()) {
4776 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4777 xmlMemBlocks() - mem_base);
4778 test_ret++;
4779 printf(" %d", n_ctx);
4780 printf(" %d", n_publicId);
4781 printf(" %d", n_systemId);
4782 printf("\n");
4783 }
4784 }
4785 }
4786 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004787 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004788
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004789 return(test_ret);
4790}
4791
4792
4793#define gen_nb_xmlSAXLocatorPtr 1
4794static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4795 return(NULL);
4796}
4797static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4798}
4799
4800static int
4801test_xmlSAX2SetDocumentLocator(void) {
4802 int test_ret = 0;
4803
4804 int mem_base;
4805 void * ctx; /* the user data (XML parser context) */
4806 int n_ctx;
4807 xmlSAXLocatorPtr loc; /* A SAX Locator */
4808 int n_loc;
4809
4810 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4811 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4812 mem_base = xmlMemBlocks();
4813 ctx = gen_void_ptr(n_ctx, 0);
4814 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4815
4816 xmlSAX2SetDocumentLocator(ctx, loc);
4817 call_tests++;
4818 des_void_ptr(n_ctx, ctx, 0);
4819 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4820 xmlResetLastError();
4821 if (mem_base != xmlMemBlocks()) {
4822 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4823 xmlMemBlocks() - mem_base);
4824 test_ret++;
4825 printf(" %d", n_ctx);
4826 printf(" %d", n_loc);
4827 printf("\n");
4828 }
4829 }
4830 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004832
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004833 return(test_ret);
4834}
4835
4836
4837static int
4838test_xmlSAX2StartDocument(void) {
4839 int test_ret = 0;
4840
4841 int mem_base;
4842 void * ctx; /* the user data (XML parser context) */
4843 int n_ctx;
4844
4845 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4846 mem_base = xmlMemBlocks();
4847 ctx = gen_void_ptr(n_ctx, 0);
4848
4849 xmlSAX2StartDocument(ctx);
4850 call_tests++;
4851 des_void_ptr(n_ctx, ctx, 0);
4852 xmlResetLastError();
4853 if (mem_base != xmlMemBlocks()) {
4854 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4855 xmlMemBlocks() - mem_base);
4856 test_ret++;
4857 printf(" %d", n_ctx);
4858 printf("\n");
4859 }
4860 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004861 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004862
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004863 return(test_ret);
4864}
4865
4866
4867static int
4868test_xmlSAX2StartElement(void) {
4869 int test_ret = 0;
4870
William M. Brack21e4ef22005-01-02 09:53:13 +00004871#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004872#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004873 int mem_base;
4874 void * ctx; /* the user data (XML parser context) */
4875 int n_ctx;
4876 xmlChar * fullname; /* The element name, including namespace prefix */
4877 int n_fullname;
4878 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4879 int n_atts;
4880
4881 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4882 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4883 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4884 mem_base = xmlMemBlocks();
4885 ctx = gen_void_ptr(n_ctx, 0);
4886 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4887 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4888
William M. Brackf13f77f2004-11-12 16:03:48 +00004889 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004890 call_tests++;
4891 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004892 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4893 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004894 xmlResetLastError();
4895 if (mem_base != xmlMemBlocks()) {
4896 printf("Leak of %d blocks found in xmlSAX2StartElement",
4897 xmlMemBlocks() - mem_base);
4898 test_ret++;
4899 printf(" %d", n_ctx);
4900 printf(" %d", n_fullname);
4901 printf(" %d", n_atts);
4902 printf("\n");
4903 }
4904 }
4905 }
4906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004907 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004908#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004909#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004910
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004911 return(test_ret);
4912}
4913
4914
4915static int
4916test_xmlSAX2StartElementNs(void) {
4917 int test_ret = 0;
4918
4919 int mem_base;
4920 void * ctx; /* the user data (XML parser context) */
4921 int n_ctx;
4922 xmlChar * localname; /* the local name of the element */
4923 int n_localname;
4924 xmlChar * prefix; /* the element namespace prefix if available */
4925 int n_prefix;
4926 xmlChar * URI; /* the element namespace name if available */
4927 int n_URI;
4928 int nb_namespaces; /* number of namespace definitions on that node */
4929 int n_nb_namespaces;
4930 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4931 int n_namespaces;
4932 int nb_attributes; /* the number of attributes on that node */
4933 int n_nb_attributes;
4934 int nb_defaulted; /* the number of defaulted attributes. */
4935 int n_nb_defaulted;
4936 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4937 int n_attributes;
4938
4939 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4940 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4941 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4942 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4943 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4944 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4945 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4946 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4947 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4948 mem_base = xmlMemBlocks();
4949 ctx = gen_void_ptr(n_ctx, 0);
4950 localname = gen_const_xmlChar_ptr(n_localname, 1);
4951 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4952 URI = gen_const_xmlChar_ptr(n_URI, 3);
4953 nb_namespaces = gen_int(n_nb_namespaces, 4);
4954 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4955 nb_attributes = gen_int(n_nb_attributes, 6);
4956 nb_defaulted = gen_int(n_nb_defaulted, 7);
4957 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4958
William M. Brackf13f77f2004-11-12 16:03:48 +00004959 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004960 call_tests++;
4961 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004962 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4963 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4964 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004965 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004966 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004967 des_int(n_nb_attributes, nb_attributes, 6);
4968 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004969 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004970 xmlResetLastError();
4971 if (mem_base != xmlMemBlocks()) {
4972 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4973 xmlMemBlocks() - mem_base);
4974 test_ret++;
4975 printf(" %d", n_ctx);
4976 printf(" %d", n_localname);
4977 printf(" %d", n_prefix);
4978 printf(" %d", n_URI);
4979 printf(" %d", n_nb_namespaces);
4980 printf(" %d", n_namespaces);
4981 printf(" %d", n_nb_attributes);
4982 printf(" %d", n_nb_defaulted);
4983 printf(" %d", n_attributes);
4984 printf("\n");
4985 }
4986 }
4987 }
4988 }
4989 }
4990 }
4991 }
4992 }
4993 }
4994 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004996
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004997 return(test_ret);
4998}
4999
5000
5001static int
5002test_xmlSAX2UnparsedEntityDecl(void) {
5003 int test_ret = 0;
5004
5005 int mem_base;
5006 void * ctx; /* the user data (XML parser context) */
5007 int n_ctx;
5008 xmlChar * name; /* The name of the entity */
5009 int n_name;
5010 xmlChar * publicId; /* The public ID of the entity */
5011 int n_publicId;
5012 xmlChar * systemId; /* The system ID of the entity */
5013 int n_systemId;
5014 xmlChar * notationName; /* the name of the notation */
5015 int n_notationName;
5016
5017 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5019 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5020 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5021 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5022 mem_base = xmlMemBlocks();
5023 ctx = gen_void_ptr(n_ctx, 0);
5024 name = gen_const_xmlChar_ptr(n_name, 1);
5025 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5026 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5027 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5028
William M. Brackf13f77f2004-11-12 16:03:48 +00005029 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005030 call_tests++;
5031 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5033 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5034 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5035 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005036 xmlResetLastError();
5037 if (mem_base != xmlMemBlocks()) {
5038 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5039 xmlMemBlocks() - mem_base);
5040 test_ret++;
5041 printf(" %d", n_ctx);
5042 printf(" %d", n_name);
5043 printf(" %d", n_publicId);
5044 printf(" %d", n_systemId);
5045 printf(" %d", n_notationName);
5046 printf("\n");
5047 }
5048 }
5049 }
5050 }
5051 }
5052 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005055 return(test_ret);
5056}
5057
5058
5059static int
5060test_xmlSAXDefaultVersion(void) {
5061 int test_ret = 0;
5062
William M. Brack21e4ef22005-01-02 09:53:13 +00005063#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005064#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005065 int mem_base;
5066 int ret_val;
5067 int version; /* the version, 1 or 2 */
5068 int n_version;
5069
5070 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5071 mem_base = xmlMemBlocks();
5072 version = gen_int(n_version, 0);
5073
5074 ret_val = xmlSAXDefaultVersion(version);
5075 desret_int(ret_val);
5076 call_tests++;
5077 des_int(n_version, version, 0);
5078 xmlResetLastError();
5079 if (mem_base != xmlMemBlocks()) {
5080 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5081 xmlMemBlocks() - mem_base);
5082 test_ret++;
5083 printf(" %d", n_version);
5084 printf("\n");
5085 }
5086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005087 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005088#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005089#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005090
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005091 return(test_ret);
5092}
5093
5094
5095static int
5096test_xmlSAXVersion(void) {
5097 int test_ret = 0;
5098
5099 int mem_base;
5100 int ret_val;
5101 xmlSAXHandler * hdlr; /* the SAX handler */
5102 int n_hdlr;
5103 int version; /* the version, 1 or 2 */
5104 int n_version;
5105
5106 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5107 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5108 mem_base = xmlMemBlocks();
5109 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5110 version = gen_int(n_version, 1);
5111
5112 ret_val = xmlSAXVersion(hdlr, version);
5113 desret_int(ret_val);
5114 call_tests++;
5115 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5116 des_int(n_version, version, 1);
5117 xmlResetLastError();
5118 if (mem_base != xmlMemBlocks()) {
5119 printf("Leak of %d blocks found in xmlSAXVersion",
5120 xmlMemBlocks() - mem_base);
5121 test_ret++;
5122 printf(" %d", n_hdlr);
5123 printf(" %d", n_version);
5124 printf("\n");
5125 }
5126 }
5127 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005129
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005130 return(test_ret);
5131}
5132
5133static int
5134test_SAX2(void) {
5135 int test_ret = 0;
5136
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005137 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005138 test_ret += test_docbDefaultSAXHandlerInit();
5139 test_ret += test_htmlDefaultSAXHandlerInit();
5140 test_ret += test_xmlDefaultSAXHandlerInit();
5141 test_ret += test_xmlSAX2AttributeDecl();
5142 test_ret += test_xmlSAX2CDataBlock();
5143 test_ret += test_xmlSAX2Characters();
5144 test_ret += test_xmlSAX2Comment();
5145 test_ret += test_xmlSAX2ElementDecl();
5146 test_ret += test_xmlSAX2EndDocument();
5147 test_ret += test_xmlSAX2EndElement();
5148 test_ret += test_xmlSAX2EndElementNs();
5149 test_ret += test_xmlSAX2EntityDecl();
5150 test_ret += test_xmlSAX2ExternalSubset();
5151 test_ret += test_xmlSAX2GetColumnNumber();
5152 test_ret += test_xmlSAX2GetEntity();
5153 test_ret += test_xmlSAX2GetLineNumber();
5154 test_ret += test_xmlSAX2GetParameterEntity();
5155 test_ret += test_xmlSAX2GetPublicId();
5156 test_ret += test_xmlSAX2GetSystemId();
5157 test_ret += test_xmlSAX2HasExternalSubset();
5158 test_ret += test_xmlSAX2HasInternalSubset();
5159 test_ret += test_xmlSAX2IgnorableWhitespace();
5160 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5161 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5162 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5163 test_ret += test_xmlSAX2InternalSubset();
5164 test_ret += test_xmlSAX2IsStandalone();
5165 test_ret += test_xmlSAX2NotationDecl();
5166 test_ret += test_xmlSAX2ProcessingInstruction();
5167 test_ret += test_xmlSAX2Reference();
5168 test_ret += test_xmlSAX2ResolveEntity();
5169 test_ret += test_xmlSAX2SetDocumentLocator();
5170 test_ret += test_xmlSAX2StartDocument();
5171 test_ret += test_xmlSAX2StartElement();
5172 test_ret += test_xmlSAX2StartElementNs();
5173 test_ret += test_xmlSAX2UnparsedEntityDecl();
5174 test_ret += test_xmlSAXDefaultVersion();
5175 test_ret += test_xmlSAXVersion();
5176
5177 if (test_ret != 0)
5178 printf("Module SAX2: %d errors\n", test_ret);
5179 return(test_ret);
5180}
5181
Daniel Veillarda82b1822004-11-08 16:24:57 +00005182static int
5183test_xmlC14NDocDumpMemory(void) {
5184 int test_ret = 0;
5185
William M. Brack21e4ef22005-01-02 09:53:13 +00005186#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005187 int mem_base;
5188 int ret_val;
5189 xmlDocPtr doc; /* the XML document for canonization */
5190 int n_doc;
5191 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5192 int n_nodes;
5193 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5194 int n_exclusive;
5195 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5196 int n_inclusive_ns_prefixes;
5197 int with_comments; /* include comments in the result (!=0) or not (==0) */
5198 int n_with_comments;
5199 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */
5200 int n_doc_txt_ptr;
5201
5202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5203 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5204 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5205 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5206 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5207 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5208 mem_base = xmlMemBlocks();
5209 doc = gen_xmlDocPtr(n_doc, 0);
5210 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5211 exclusive = gen_int(n_exclusive, 2);
5212 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5213 with_comments = gen_int(n_with_comments, 4);
5214 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5215
5216 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5217 desret_int(ret_val);
5218 call_tests++;
5219 des_xmlDocPtr(n_doc, doc, 0);
5220 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5221 des_int(n_exclusive, exclusive, 2);
5222 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5223 des_int(n_with_comments, with_comments, 4);
5224 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5225 xmlResetLastError();
5226 if (mem_base != xmlMemBlocks()) {
5227 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5228 xmlMemBlocks() - mem_base);
5229 test_ret++;
5230 printf(" %d", n_doc);
5231 printf(" %d", n_nodes);
5232 printf(" %d", n_exclusive);
5233 printf(" %d", n_inclusive_ns_prefixes);
5234 printf(" %d", n_with_comments);
5235 printf(" %d", n_doc_txt_ptr);
5236 printf("\n");
5237 }
5238 }
5239 }
5240 }
5241 }
5242 }
5243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005244 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005245#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005246
Daniel Veillarda82b1822004-11-08 16:24:57 +00005247 return(test_ret);
5248}
5249
5250
5251static int
5252test_xmlC14NDocSave(void) {
5253 int test_ret = 0;
5254
William M. Brack21e4ef22005-01-02 09:53:13 +00005255#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005256 int mem_base;
5257 int ret_val;
5258 xmlDocPtr doc; /* the XML document for canonization */
5259 int n_doc;
5260 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5261 int n_nodes;
5262 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5263 int n_exclusive;
5264 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5265 int n_inclusive_ns_prefixes;
5266 int with_comments; /* include comments in the result (!=0) or not (==0) */
5267 int n_with_comments;
5268 const char * filename; /* the filename to store canonical XML image */
5269 int n_filename;
5270 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5271 int n_compression;
5272
5273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5274 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5275 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5276 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5277 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5278 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5279 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5280 mem_base = xmlMemBlocks();
5281 doc = gen_xmlDocPtr(n_doc, 0);
5282 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5283 exclusive = gen_int(n_exclusive, 2);
5284 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5285 with_comments = gen_int(n_with_comments, 4);
5286 filename = gen_fileoutput(n_filename, 5);
5287 compression = gen_int(n_compression, 6);
5288
5289 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5290 desret_int(ret_val);
5291 call_tests++;
5292 des_xmlDocPtr(n_doc, doc, 0);
5293 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5294 des_int(n_exclusive, exclusive, 2);
5295 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5296 des_int(n_with_comments, with_comments, 4);
5297 des_fileoutput(n_filename, filename, 5);
5298 des_int(n_compression, compression, 6);
5299 xmlResetLastError();
5300 if (mem_base != xmlMemBlocks()) {
5301 printf("Leak of %d blocks found in xmlC14NDocSave",
5302 xmlMemBlocks() - mem_base);
5303 test_ret++;
5304 printf(" %d", n_doc);
5305 printf(" %d", n_nodes);
5306 printf(" %d", n_exclusive);
5307 printf(" %d", n_inclusive_ns_prefixes);
5308 printf(" %d", n_with_comments);
5309 printf(" %d", n_filename);
5310 printf(" %d", n_compression);
5311 printf("\n");
5312 }
5313 }
5314 }
5315 }
5316 }
5317 }
5318 }
5319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005320 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005321#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005322
Daniel Veillarda82b1822004-11-08 16:24:57 +00005323 return(test_ret);
5324}
5325
5326
5327static int
5328test_xmlC14NDocSaveTo(void) {
5329 int test_ret = 0;
5330
William M. Brack21e4ef22005-01-02 09:53:13 +00005331#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005332 int mem_base;
5333 int ret_val;
5334 xmlDocPtr doc; /* the XML document for canonization */
5335 int n_doc;
5336 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5337 int n_nodes;
5338 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5339 int n_exclusive;
5340 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5341 int n_inclusive_ns_prefixes;
5342 int with_comments; /* include comments in the result (!=0) or not (==0) */
5343 int n_with_comments;
5344 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5345 int n_buf;
5346
5347 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5348 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5349 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5350 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5351 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5352 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5353 mem_base = xmlMemBlocks();
5354 doc = gen_xmlDocPtr(n_doc, 0);
5355 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5356 exclusive = gen_int(n_exclusive, 2);
5357 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5358 with_comments = gen_int(n_with_comments, 4);
5359 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5360
5361 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5362 desret_int(ret_val);
5363 call_tests++;
5364 des_xmlDocPtr(n_doc, doc, 0);
5365 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5366 des_int(n_exclusive, exclusive, 2);
5367 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5368 des_int(n_with_comments, with_comments, 4);
5369 des_xmlOutputBufferPtr(n_buf, buf, 5);
5370 xmlResetLastError();
5371 if (mem_base != xmlMemBlocks()) {
5372 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5373 xmlMemBlocks() - mem_base);
5374 test_ret++;
5375 printf(" %d", n_doc);
5376 printf(" %d", n_nodes);
5377 printf(" %d", n_exclusive);
5378 printf(" %d", n_inclusive_ns_prefixes);
5379 printf(" %d", n_with_comments);
5380 printf(" %d", n_buf);
5381 printf("\n");
5382 }
5383 }
5384 }
5385 }
5386 }
5387 }
5388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005389 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005390#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005391
Daniel Veillarda82b1822004-11-08 16:24:57 +00005392 return(test_ret);
5393}
5394
5395
5396static int
5397test_xmlC14NExecute(void) {
5398 int test_ret = 0;
5399
5400
5401 /* missing type support */
5402 return(test_ret);
5403}
5404
5405static int
5406test_c14n(void) {
5407 int test_ret = 0;
5408
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005409 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005410 test_ret += test_xmlC14NDocDumpMemory();
5411 test_ret += test_xmlC14NDocSave();
5412 test_ret += test_xmlC14NDocSaveTo();
5413 test_ret += test_xmlC14NExecute();
5414
5415 if (test_ret != 0)
5416 printf("Module c14n: %d errors\n", test_ret);
5417 return(test_ret);
5418}
Daniel Veillarda521d282004-11-09 14:59:59 +00005419#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005420
Daniel Veillardce682bc2004-11-05 17:22:25 +00005421#define gen_nb_xmlCatalogPtr 1
5422static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5423 return(NULL);
5424}
5425static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5426}
Daniel Veillarda521d282004-11-09 14:59:59 +00005427#endif
5428
Daniel Veillardce682bc2004-11-05 17:22:25 +00005429
Daniel Veillardd93f6252004-11-02 15:53:51 +00005430static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005431test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005433
William M. Brack21e4ef22005-01-02 09:53:13 +00005434#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005435 int mem_base;
5436 int ret_val;
5437 xmlCatalogPtr catal; /* a Catalog */
5438 int n_catal;
5439 xmlChar * type; /* the type of record to add to the catalog */
5440 int n_type;
5441 xmlChar * orig; /* the system, public or prefix to match */
5442 int n_orig;
5443 xmlChar * replace; /* the replacement value for the match */
5444 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005445
Daniel Veillardce682bc2004-11-05 17:22:25 +00005446 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5447 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5448 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5449 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5450 mem_base = xmlMemBlocks();
5451 catal = gen_xmlCatalogPtr(n_catal, 0);
5452 type = gen_const_xmlChar_ptr(n_type, 1);
5453 orig = gen_const_xmlChar_ptr(n_orig, 2);
5454 replace = gen_const_xmlChar_ptr(n_replace, 3);
5455
William M. Brackf13f77f2004-11-12 16:03:48 +00005456 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005457 desret_int(ret_val);
5458 call_tests++;
5459 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005460 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5461 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5462 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005463 xmlResetLastError();
5464 if (mem_base != xmlMemBlocks()) {
5465 printf("Leak of %d blocks found in xmlACatalogAdd",
5466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005467 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005468 printf(" %d", n_catal);
5469 printf(" %d", n_type);
5470 printf(" %d", n_orig);
5471 printf(" %d", n_replace);
5472 printf("\n");
5473 }
5474 }
5475 }
5476 }
5477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005478 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005479#endif
5480
Daniel Veillard42595322004-11-08 10:52:06 +00005481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005482}
5483
5484
5485static int
5486test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005488
William M. Brack21e4ef22005-01-02 09:53:13 +00005489#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005490 int mem_base;
5491 xmlCatalogPtr catal; /* a Catalog */
5492 int n_catal;
5493 FILE * out; /* the file. */
5494 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005495
Daniel Veillardce682bc2004-11-05 17:22:25 +00005496 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5497 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5498 mem_base = xmlMemBlocks();
5499 catal = gen_xmlCatalogPtr(n_catal, 0);
5500 out = gen_FILE_ptr(n_out, 1);
5501
5502 xmlACatalogDump(catal, out);
5503 call_tests++;
5504 des_xmlCatalogPtr(n_catal, catal, 0);
5505 des_FILE_ptr(n_out, out, 1);
5506 xmlResetLastError();
5507 if (mem_base != xmlMemBlocks()) {
5508 printf("Leak of %d blocks found in xmlACatalogDump",
5509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 printf(" %d", n_catal);
5512 printf(" %d", n_out);
5513 printf("\n");
5514 }
5515 }
5516 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005517 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005518#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005519
Daniel Veillard42595322004-11-08 10:52:06 +00005520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005521}
5522
5523
5524static int
5525test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005527
William M. Brack21e4ef22005-01-02 09:53:13 +00005528#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005529 int mem_base;
5530 int ret_val;
5531 xmlCatalogPtr catal; /* a Catalog */
5532 int n_catal;
5533 xmlChar * value; /* the value to remove */
5534 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005535
Daniel Veillardce682bc2004-11-05 17:22:25 +00005536 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5537 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5538 mem_base = xmlMemBlocks();
5539 catal = gen_xmlCatalogPtr(n_catal, 0);
5540 value = gen_const_xmlChar_ptr(n_value, 1);
5541
William M. Brackf13f77f2004-11-12 16:03:48 +00005542 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005543 desret_int(ret_val);
5544 call_tests++;
5545 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005546 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005547 xmlResetLastError();
5548 if (mem_base != xmlMemBlocks()) {
5549 printf("Leak of %d blocks found in xmlACatalogRemove",
5550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 printf(" %d", n_catal);
5553 printf(" %d", n_value);
5554 printf("\n");
5555 }
5556 }
5557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005558 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005559#endif
5560
Daniel Veillard42595322004-11-08 10:52:06 +00005561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005562}
5563
5564
5565static int
5566test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005568
William M. Brack21e4ef22005-01-02 09:53:13 +00005569#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005570 int mem_base;
5571 xmlChar * ret_val;
5572 xmlCatalogPtr catal; /* a Catalog */
5573 int n_catal;
5574 xmlChar * pubID; /* the public ID string */
5575 int n_pubID;
5576 xmlChar * sysID; /* the system ID string */
5577 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005578
Daniel Veillardce682bc2004-11-05 17:22:25 +00005579 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5580 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5581 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5582 mem_base = xmlMemBlocks();
5583 catal = gen_xmlCatalogPtr(n_catal, 0);
5584 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5585 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5586
William M. Brackf13f77f2004-11-12 16:03:48 +00005587 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005588 desret_xmlChar_ptr(ret_val);
5589 call_tests++;
5590 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005591 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5592 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005593 xmlResetLastError();
5594 if (mem_base != xmlMemBlocks()) {
5595 printf("Leak of %d blocks found in xmlACatalogResolve",
5596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005597 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005598 printf(" %d", n_catal);
5599 printf(" %d", n_pubID);
5600 printf(" %d", n_sysID);
5601 printf("\n");
5602 }
5603 }
5604 }
5605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005606 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005607#endif
5608
Daniel Veillard42595322004-11-08 10:52:06 +00005609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005610}
5611
5612
5613static int
5614test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005616
William M. Brack21e4ef22005-01-02 09:53:13 +00005617#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005618 int mem_base;
5619 xmlChar * ret_val;
5620 xmlCatalogPtr catal; /* a Catalog */
5621 int n_catal;
5622 xmlChar * pubID; /* the public ID string */
5623 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005624
Daniel Veillardce682bc2004-11-05 17:22:25 +00005625 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5626 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5627 mem_base = xmlMemBlocks();
5628 catal = gen_xmlCatalogPtr(n_catal, 0);
5629 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5630
William M. Brackf13f77f2004-11-12 16:03:48 +00005631 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005632 desret_xmlChar_ptr(ret_val);
5633 call_tests++;
5634 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005635 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005636 xmlResetLastError();
5637 if (mem_base != xmlMemBlocks()) {
5638 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005640 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005641 printf(" %d", n_catal);
5642 printf(" %d", n_pubID);
5643 printf("\n");
5644 }
5645 }
5646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005647 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005648#endif
5649
Daniel Veillard42595322004-11-08 10:52:06 +00005650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005651}
5652
5653
5654static int
5655test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005657
William M. Brack21e4ef22005-01-02 09:53:13 +00005658#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005659 int mem_base;
5660 xmlChar * ret_val;
5661 xmlCatalogPtr catal; /* a Catalog */
5662 int n_catal;
5663 xmlChar * sysID; /* the system ID string */
5664 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005665
Daniel Veillardce682bc2004-11-05 17:22:25 +00005666 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5667 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5668 mem_base = xmlMemBlocks();
5669 catal = gen_xmlCatalogPtr(n_catal, 0);
5670 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5671
William M. Brackf13f77f2004-11-12 16:03:48 +00005672 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005673 desret_xmlChar_ptr(ret_val);
5674 call_tests++;
5675 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005676 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005677 xmlResetLastError();
5678 if (mem_base != xmlMemBlocks()) {
5679 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005681 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005682 printf(" %d", n_catal);
5683 printf(" %d", n_sysID);
5684 printf("\n");
5685 }
5686 }
5687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005688 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005689#endif
5690
Daniel Veillard42595322004-11-08 10:52:06 +00005691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005692}
5693
5694
5695static int
5696test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005698
William M. Brack21e4ef22005-01-02 09:53:13 +00005699#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005700 int mem_base;
5701 xmlChar * ret_val;
5702 xmlCatalogPtr catal; /* a Catalog */
5703 int n_catal;
5704 xmlChar * URI; /* the URI */
5705 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005706
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5708 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5709 mem_base = xmlMemBlocks();
5710 catal = gen_xmlCatalogPtr(n_catal, 0);
5711 URI = gen_const_xmlChar_ptr(n_URI, 1);
5712
William M. Brackf13f77f2004-11-12 16:03:48 +00005713 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005714 desret_xmlChar_ptr(ret_val);
5715 call_tests++;
5716 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005717 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005718 xmlResetLastError();
5719 if (mem_base != xmlMemBlocks()) {
5720 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005722 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005723 printf(" %d", n_catal);
5724 printf(" %d", n_URI);
5725 printf("\n");
5726 }
5727 }
5728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005729 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005730#endif
5731
Daniel Veillard42595322004-11-08 10:52:06 +00005732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005733}
5734
5735
5736static int
5737test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005739
William M. Brack21e4ef22005-01-02 09:53:13 +00005740#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005741 int mem_base;
5742 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005743 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005744 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005745 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005746 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005747 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005748 int n_replace;
5749
5750 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5751 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5752 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005754 type = gen_const_xmlChar_ptr(n_type, 0);
5755 orig = gen_const_xmlChar_ptr(n_orig, 1);
5756 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005757
William M. Brackf13f77f2004-11-12 16:03:48 +00005758 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759 desret_int(ret_val);
5760 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005761 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5762 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5763 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005764 xmlResetLastError();
5765 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005766 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005768 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005769 printf(" %d", n_type);
5770 printf(" %d", n_orig);
5771 printf(" %d", n_replace);
5772 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005773 }
5774 }
5775 }
5776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005777 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778#endif
5779
Daniel Veillard42595322004-11-08 10:52:06 +00005780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005781}
5782
5783
5784static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005785test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787
William M. Brack21e4ef22005-01-02 09:53:13 +00005788#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005789
Daniel Veillardd93f6252004-11-02 15:53:51 +00005790
5791 xmlCatalogCleanup();
5792 call_tests++;
5793 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005794 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005795#endif
5796
Daniel Veillard42595322004-11-08 10:52:06 +00005797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005798}
5799
5800
5801static int
5802test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005804
William M. Brack21e4ef22005-01-02 09:53:13 +00005805#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005806 int ret_val;
5807
5808
5809 ret_val = xmlCatalogConvert();
5810 desret_int(ret_val);
5811 call_tests++;
5812 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005813 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005814#endif
5815
Daniel Veillard42595322004-11-08 10:52:06 +00005816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005817}
5818
5819
5820static int
5821test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
William M. Brack21e4ef22005-01-02 09:53:13 +00005824#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005825 int mem_base;
5826 FILE * out; /* the file. */
5827 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005828
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005829 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5830 mem_base = xmlMemBlocks();
5831 out = gen_FILE_ptr(n_out, 0);
5832
5833 xmlCatalogDump(out);
5834 call_tests++;
5835 des_FILE_ptr(n_out, out, 0);
5836 xmlResetLastError();
5837 if (mem_base != xmlMemBlocks()) {
5838 printf("Leak of %d blocks found in xmlCatalogDump",
5839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005840 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005841 printf(" %d", n_out);
5842 printf("\n");
5843 }
5844 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005845 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005846#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005847
Daniel Veillard42595322004-11-08 10:52:06 +00005848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005849}
5850
5851
5852static int
5853test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005855
William M. Brack21e4ef22005-01-02 09:53:13 +00005856#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005857 int mem_base;
5858 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005859
Daniel Veillard57b25162004-11-06 14:50:18 +00005860 mem_base = xmlMemBlocks();
5861
5862 ret_val = xmlCatalogGetDefaults();
5863 desret_xmlCatalogAllow(ret_val);
5864 call_tests++;
5865 xmlResetLastError();
5866 if (mem_base != xmlMemBlocks()) {
5867 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005869 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005870 printf("\n");
5871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005872 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005873#endif
5874
Daniel Veillard42595322004-11-08 10:52:06 +00005875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005876}
5877
5878
5879static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005882
William M. Brack21e4ef22005-01-02 09:53:13 +00005883#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005884 int mem_base;
5885 int ret_val;
5886 xmlCatalogPtr catal; /* should this create an SGML catalog */
5887 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005888
Daniel Veillardce682bc2004-11-05 17:22:25 +00005889 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5890 mem_base = xmlMemBlocks();
5891 catal = gen_xmlCatalogPtr(n_catal, 0);
5892
5893 ret_val = xmlCatalogIsEmpty(catal);
5894 desret_int(ret_val);
5895 call_tests++;
5896 des_xmlCatalogPtr(n_catal, catal, 0);
5897 xmlResetLastError();
5898 if (mem_base != xmlMemBlocks()) {
5899 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005901 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005902 printf(" %d", n_catal);
5903 printf("\n");
5904 }
5905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005906 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005907#endif
5908
Daniel Veillard42595322004-11-08 10:52:06 +00005909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005910}
5911
5912
5913static int
5914test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005916
William M. Brack21e4ef22005-01-02 09:53:13 +00005917#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005918 int mem_base;
5919 xmlChar * ret_val;
5920 void * catalogs; /* a document's list of catalogs */
5921 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005922 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005923 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005924 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005925 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005926
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005927 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5928 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5929 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005931 catalogs = gen_void_ptr(n_catalogs, 0);
5932 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5933 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005934
William M. Brackf13f77f2004-11-12 16:03:48 +00005935 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005936 desret_xmlChar_ptr(ret_val);
5937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005938 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005939 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5940 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005941 xmlResetLastError();
5942 if (mem_base != xmlMemBlocks()) {
5943 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005945 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005946 printf(" %d", n_catalogs);
5947 printf(" %d", n_pubID);
5948 printf(" %d", n_sysID);
5949 printf("\n");
5950 }
5951 }
5952 }
5953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005954 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005955#endif
5956
Daniel Veillard42595322004-11-08 10:52:06 +00005957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005958}
5959
5960
5961static int
5962test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005964
William M. Brack21e4ef22005-01-02 09:53:13 +00005965#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005966 int mem_base;
5967 xmlChar * ret_val;
5968 void * catalogs; /* a document's list of catalogs */
5969 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005970 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005971 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005972
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005973 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5974 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005976 catalogs = gen_void_ptr(n_catalogs, 0);
5977 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005978
William M. Brackf13f77f2004-11-12 16:03:48 +00005979 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005980 desret_xmlChar_ptr(ret_val);
5981 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005982 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005983 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005984 xmlResetLastError();
5985 if (mem_base != xmlMemBlocks()) {
5986 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005988 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005989 printf(" %d", n_catalogs);
5990 printf(" %d", n_URI);
5991 printf("\n");
5992 }
5993 }
5994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005995 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005996#endif
5997
Daniel Veillard42595322004-11-08 10:52:06 +00005998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005999}
6000
6001
6002static int
6003test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006005
William M. Brack21e4ef22005-01-02 09:53:13 +00006006#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006007 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006008 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006009 int n_value;
6010
6011 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006012 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006013
William M. Brackf13f77f2004-11-12 16:03:48 +00006014 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006015 desret_int(ret_val);
6016 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006017 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006018 xmlResetLastError();
6019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006020 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006021#endif
6022
Daniel Veillard42595322004-11-08 10:52:06 +00006023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006024}
6025
6026
6027static int
6028test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006030
William M. Brack21e4ef22005-01-02 09:53:13 +00006031#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006032 int mem_base;
6033 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006034 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006035 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006036 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006038
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006039 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6040 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006042 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6043 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006044
William M. Brackf13f77f2004-11-12 16:03:48 +00006045 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006046 desret_xmlChar_ptr(ret_val);
6047 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006048 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6049 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006050 xmlResetLastError();
6051 if (mem_base != xmlMemBlocks()) {
6052 printf("Leak of %d blocks found in xmlCatalogResolve",
6053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006054 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006055 printf(" %d", n_pubID);
6056 printf(" %d", n_sysID);
6057 printf("\n");
6058 }
6059 }
6060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006061 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006062#endif
6063
Daniel Veillard42595322004-11-08 10:52:06 +00006064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006065}
6066
6067
6068static int
6069test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006071
William M. Brack21e4ef22005-01-02 09:53:13 +00006072#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006073 int mem_base;
6074 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006075 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006077
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006078 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006080 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081
William M. Brackf13f77f2004-11-12 16:03:48 +00006082 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006083 desret_xmlChar_ptr(ret_val);
6084 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006085 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006086 xmlResetLastError();
6087 if (mem_base != xmlMemBlocks()) {
6088 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006090 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006091 printf(" %d", n_pubID);
6092 printf("\n");
6093 }
6094 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006095 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006096#endif
6097
Daniel Veillard42595322004-11-08 10:52:06 +00006098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006099}
6100
6101
6102static int
6103test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006105
William M. Brack21e4ef22005-01-02 09:53:13 +00006106#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006107 int mem_base;
6108 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006109 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006111
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006112 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006114 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115
William M. Brackf13f77f2004-11-12 16:03:48 +00006116 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006117 desret_xmlChar_ptr(ret_val);
6118 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006119 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006120 xmlResetLastError();
6121 if (mem_base != xmlMemBlocks()) {
6122 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006124 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006125 printf(" %d", n_sysID);
6126 printf("\n");
6127 }
6128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006129 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006130#endif
6131
Daniel Veillard42595322004-11-08 10:52:06 +00006132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006133}
6134
6135
6136static int
6137test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006139
William M. Brack21e4ef22005-01-02 09:53:13 +00006140#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006141 int mem_base;
6142 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006143 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006144 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006145
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006146 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006148 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006149
William M. Brackf13f77f2004-11-12 16:03:48 +00006150 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006151 desret_xmlChar_ptr(ret_val);
6152 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006153 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006154 xmlResetLastError();
6155 if (mem_base != xmlMemBlocks()) {
6156 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006158 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006159 printf(" %d", n_URI);
6160 printf("\n");
6161 }
6162 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006163 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006164#endif
6165
Daniel Veillard42595322004-11-08 10:52:06 +00006166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006167}
6168
6169
6170static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006171test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006173
William M. Brack21e4ef22005-01-02 09:53:13 +00006174#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006175 int mem_base;
6176 xmlCatalogPrefer ret_val;
6177 xmlCatalogPrefer prefer; /* the default preference for delegation */
6178 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006179
Daniel Veillard57b25162004-11-06 14:50:18 +00006180 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6181 mem_base = xmlMemBlocks();
6182 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6183
6184 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6185 desret_xmlCatalogPrefer(ret_val);
6186 call_tests++;
6187 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6188 xmlResetLastError();
6189 if (mem_base != xmlMemBlocks()) {
6190 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006192 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006193 printf(" %d", n_prefer);
6194 printf("\n");
6195 }
6196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006197 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006198#endif
6199
Daniel Veillard42595322004-11-08 10:52:06 +00006200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006201}
6202
6203
6204static int
6205test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006207
William M. Brack21e4ef22005-01-02 09:53:13 +00006208#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006209 int mem_base;
6210 xmlCatalogAllow allow; /* what catalogs should be accepted */
6211 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006212
Daniel Veillard57b25162004-11-06 14:50:18 +00006213 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6214 mem_base = xmlMemBlocks();
6215 allow = gen_xmlCatalogAllow(n_allow, 0);
6216
6217 xmlCatalogSetDefaults(allow);
6218 call_tests++;
6219 des_xmlCatalogAllow(n_allow, allow, 0);
6220 xmlResetLastError();
6221 if (mem_base != xmlMemBlocks()) {
6222 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006224 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006225 printf(" %d", n_allow);
6226 printf("\n");
6227 }
6228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006229 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006230#endif
6231
Daniel Veillard42595322004-11-08 10:52:06 +00006232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006233}
6234
6235
6236static int
6237test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239
William M. Brack21e4ef22005-01-02 09:53:13 +00006240#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006241 int mem_base;
6242 int ret_val;
6243 xmlCatalogPtr catal; /* the catalog */
6244 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006245
Daniel Veillardce682bc2004-11-05 17:22:25 +00006246 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6247 mem_base = xmlMemBlocks();
6248 catal = gen_xmlCatalogPtr(n_catal, 0);
6249
6250 ret_val = xmlConvertSGMLCatalog(catal);
6251 desret_int(ret_val);
6252 call_tests++;
6253 des_xmlCatalogPtr(n_catal, catal, 0);
6254 xmlResetLastError();
6255 if (mem_base != xmlMemBlocks()) {
6256 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006258 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006259 printf(" %d", n_catal);
6260 printf("\n");
6261 }
6262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006263 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006264#endif
6265
Daniel Veillard42595322004-11-08 10:52:06 +00006266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006267}
6268
6269
6270static int
6271test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006273
William M. Brack21e4ef22005-01-02 09:53:13 +00006274#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006275 int mem_base;
6276
6277 mem_base = xmlMemBlocks();
6278
6279 xmlInitializeCatalog();
6280 call_tests++;
6281 xmlResetLastError();
6282 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006283 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006285 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006286 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006288 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006289#endif
6290
Daniel Veillard42595322004-11-08 10:52:06 +00006291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006292}
6293
6294
6295static int
6296test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006298
6299
6300 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006302}
6303
6304
6305static int
6306test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308
William M. Brack21e4ef22005-01-02 09:53:13 +00006309#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006310 int ret_val;
6311 const char * filename; /* a file path */
6312 int n_filename;
6313
6314 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006315 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006316
6317 ret_val = xmlLoadCatalog(filename);
6318 desret_int(ret_val);
6319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006320 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006321 xmlResetLastError();
6322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006323 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324#endif
6325
Daniel Veillard42595322004-11-08 10:52:06 +00006326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006327}
6328
6329
6330static int
6331test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006333
William M. Brack21e4ef22005-01-02 09:53:13 +00006334#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006335 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336 int n_pathss;
6337
6338 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006339 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340
William M. Brackf13f77f2004-11-12 16:03:48 +00006341 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006343 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006344 xmlResetLastError();
6345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006346 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006347#endif
6348
Daniel Veillard42595322004-11-08 10:52:06 +00006349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006350}
6351
6352
6353static int
6354test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006356
6357
6358 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006360}
6361
6362
6363static int
6364test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006366
6367
6368 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006370}
6371
6372
6373static int
6374test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006376
William M. Brack21e4ef22005-01-02 09:53:13 +00006377#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006378 int mem_base;
6379 xmlDocPtr ret_val;
6380 const char * filename; /* the filename */
6381 int n_filename;
6382
6383 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6384 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006385 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006386
6387 ret_val = xmlParseCatalogFile(filename);
6388 desret_xmlDocPtr(ret_val);
6389 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006390 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006391 xmlResetLastError();
6392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006393 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006396 printf(" %d", n_filename);
6397 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006398 }
6399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006400 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006401#endif
6402
Daniel Veillard42595322004-11-08 10:52:06 +00006403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006404}
6405
6406static int
6407test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006409
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006410 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006411 test_ret += test_xmlACatalogAdd();
6412 test_ret += test_xmlACatalogDump();
6413 test_ret += test_xmlACatalogRemove();
6414 test_ret += test_xmlACatalogResolve();
6415 test_ret += test_xmlACatalogResolvePublic();
6416 test_ret += test_xmlACatalogResolveSystem();
6417 test_ret += test_xmlACatalogResolveURI();
6418 test_ret += test_xmlCatalogAdd();
6419 test_ret += test_xmlCatalogCleanup();
6420 test_ret += test_xmlCatalogConvert();
6421 test_ret += test_xmlCatalogDump();
6422 test_ret += test_xmlCatalogGetDefaults();
6423 test_ret += test_xmlCatalogIsEmpty();
6424 test_ret += test_xmlCatalogLocalResolve();
6425 test_ret += test_xmlCatalogLocalResolveURI();
6426 test_ret += test_xmlCatalogRemove();
6427 test_ret += test_xmlCatalogResolve();
6428 test_ret += test_xmlCatalogResolvePublic();
6429 test_ret += test_xmlCatalogResolveSystem();
6430 test_ret += test_xmlCatalogResolveURI();
6431 test_ret += test_xmlCatalogSetDefaultPrefer();
6432 test_ret += test_xmlCatalogSetDefaults();
6433 test_ret += test_xmlConvertSGMLCatalog();
6434 test_ret += test_xmlInitializeCatalog();
6435 test_ret += test_xmlLoadACatalog();
6436 test_ret += test_xmlLoadCatalog();
6437 test_ret += test_xmlLoadCatalogs();
6438 test_ret += test_xmlLoadSGMLSuperCatalog();
6439 test_ret += test_xmlNewCatalog();
6440 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006441
Daniel Veillard42595322004-11-08 10:52:06 +00006442 if (test_ret != 0)
6443 printf("Module catalog: %d errors\n", test_ret);
6444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006445}
6446
Daniel Veillardce682bc2004-11-05 17:22:25 +00006447#define gen_nb_const_xmlChRangeGroupPtr 1
6448static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6449 return(NULL);
6450}
6451static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6452}
6453
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454static int
6455test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006457
Daniel Veillardce682bc2004-11-05 17:22:25 +00006458 int mem_base;
6459 int ret_val;
6460 unsigned int val; /* character to be validated */
6461 int n_val;
6462 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6463 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006464
Daniel Veillardce682bc2004-11-05 17:22:25 +00006465 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6466 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6467 mem_base = xmlMemBlocks();
6468 val = gen_unsigned_int(n_val, 0);
6469 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6470
William M. Brackf13f77f2004-11-12 16:03:48 +00006471 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006472 desret_int(ret_val);
6473 call_tests++;
6474 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006475 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006476 xmlResetLastError();
6477 if (mem_base != xmlMemBlocks()) {
6478 printf("Leak of %d blocks found in xmlCharInRange",
6479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006481 printf(" %d", n_val);
6482 printf(" %d", n_rptr);
6483 printf("\n");
6484 }
6485 }
6486 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006488
Daniel Veillard42595322004-11-08 10:52:06 +00006489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006490}
6491
6492
6493static int
6494test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006496
Daniel Veillard3d97e662004-11-04 10:49:00 +00006497 int mem_base;
6498 int ret_val;
6499 unsigned int ch; /* character to validate */
6500 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006501
Daniel Veillard3d97e662004-11-04 10:49:00 +00006502 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6503 mem_base = xmlMemBlocks();
6504 ch = gen_unsigned_int(n_ch, 0);
6505
6506 ret_val = xmlIsBaseChar(ch);
6507 desret_int(ret_val);
6508 call_tests++;
6509 des_unsigned_int(n_ch, ch, 0);
6510 xmlResetLastError();
6511 if (mem_base != xmlMemBlocks()) {
6512 printf("Leak of %d blocks found in xmlIsBaseChar",
6513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006514 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006515 printf(" %d", n_ch);
6516 printf("\n");
6517 }
6518 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006520
Daniel Veillard42595322004-11-08 10:52:06 +00006521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522}
6523
6524
6525static int
6526test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006528
Daniel Veillard3d97e662004-11-04 10:49:00 +00006529 int mem_base;
6530 int ret_val;
6531 unsigned int ch; /* character to validate */
6532 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006533
Daniel Veillard3d97e662004-11-04 10:49:00 +00006534 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6535 mem_base = xmlMemBlocks();
6536 ch = gen_unsigned_int(n_ch, 0);
6537
6538 ret_val = xmlIsBlank(ch);
6539 desret_int(ret_val);
6540 call_tests++;
6541 des_unsigned_int(n_ch, ch, 0);
6542 xmlResetLastError();
6543 if (mem_base != xmlMemBlocks()) {
6544 printf("Leak of %d blocks found in xmlIsBlank",
6545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006546 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 printf(" %d", n_ch);
6548 printf("\n");
6549 }
6550 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006551 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006552
Daniel Veillard42595322004-11-08 10:52:06 +00006553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006554}
6555
6556
6557static int
6558test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006560
Daniel Veillard3d97e662004-11-04 10:49:00 +00006561 int mem_base;
6562 int ret_val;
6563 unsigned int ch; /* character to validate */
6564 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006565
Daniel Veillard3d97e662004-11-04 10:49:00 +00006566 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6567 mem_base = xmlMemBlocks();
6568 ch = gen_unsigned_int(n_ch, 0);
6569
6570 ret_val = xmlIsChar(ch);
6571 desret_int(ret_val);
6572 call_tests++;
6573 des_unsigned_int(n_ch, ch, 0);
6574 xmlResetLastError();
6575 if (mem_base != xmlMemBlocks()) {
6576 printf("Leak of %d blocks found in xmlIsChar",
6577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006578 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 printf(" %d", n_ch);
6580 printf("\n");
6581 }
6582 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006584
Daniel Veillard42595322004-11-08 10:52:06 +00006585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006586}
6587
6588
6589static int
6590test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006592
Daniel Veillard3d97e662004-11-04 10:49:00 +00006593 int mem_base;
6594 int ret_val;
6595 unsigned int ch; /* character to validate */
6596 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006597
Daniel Veillard3d97e662004-11-04 10:49:00 +00006598 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6599 mem_base = xmlMemBlocks();
6600 ch = gen_unsigned_int(n_ch, 0);
6601
6602 ret_val = xmlIsCombining(ch);
6603 desret_int(ret_val);
6604 call_tests++;
6605 des_unsigned_int(n_ch, ch, 0);
6606 xmlResetLastError();
6607 if (mem_base != xmlMemBlocks()) {
6608 printf("Leak of %d blocks found in xmlIsCombining",
6609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006610 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006611 printf(" %d", n_ch);
6612 printf("\n");
6613 }
6614 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006616
Daniel Veillard42595322004-11-08 10:52:06 +00006617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006618}
6619
6620
6621static int
6622test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006624
Daniel Veillard3d97e662004-11-04 10:49:00 +00006625 int mem_base;
6626 int ret_val;
6627 unsigned int ch; /* character to validate */
6628 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006629
Daniel Veillard3d97e662004-11-04 10:49:00 +00006630 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6631 mem_base = xmlMemBlocks();
6632 ch = gen_unsigned_int(n_ch, 0);
6633
6634 ret_val = xmlIsDigit(ch);
6635 desret_int(ret_val);
6636 call_tests++;
6637 des_unsigned_int(n_ch, ch, 0);
6638 xmlResetLastError();
6639 if (mem_base != xmlMemBlocks()) {
6640 printf("Leak of %d blocks found in xmlIsDigit",
6641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006642 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006643 printf(" %d", n_ch);
6644 printf("\n");
6645 }
6646 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006648
Daniel Veillard42595322004-11-08 10:52:06 +00006649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006650}
6651
6652
6653static int
6654test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006656
Daniel Veillard3d97e662004-11-04 10:49:00 +00006657 int mem_base;
6658 int ret_val;
6659 unsigned int ch; /* character to validate */
6660 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006661
Daniel Veillard3d97e662004-11-04 10:49:00 +00006662 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6663 mem_base = xmlMemBlocks();
6664 ch = gen_unsigned_int(n_ch, 0);
6665
6666 ret_val = xmlIsExtender(ch);
6667 desret_int(ret_val);
6668 call_tests++;
6669 des_unsigned_int(n_ch, ch, 0);
6670 xmlResetLastError();
6671 if (mem_base != xmlMemBlocks()) {
6672 printf("Leak of %d blocks found in xmlIsExtender",
6673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006674 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006675 printf(" %d", n_ch);
6676 printf("\n");
6677 }
6678 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006680
Daniel Veillard42595322004-11-08 10:52:06 +00006681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006682}
6683
6684
6685static int
6686test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006688
Daniel Veillard3d97e662004-11-04 10:49:00 +00006689 int mem_base;
6690 int ret_val;
6691 unsigned int ch; /* character to validate */
6692 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006693
Daniel Veillard3d97e662004-11-04 10:49:00 +00006694 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6695 mem_base = xmlMemBlocks();
6696 ch = gen_unsigned_int(n_ch, 0);
6697
6698 ret_val = xmlIsIdeographic(ch);
6699 desret_int(ret_val);
6700 call_tests++;
6701 des_unsigned_int(n_ch, ch, 0);
6702 xmlResetLastError();
6703 if (mem_base != xmlMemBlocks()) {
6704 printf("Leak of %d blocks found in xmlIsIdeographic",
6705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006706 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006707 printf(" %d", n_ch);
6708 printf("\n");
6709 }
6710 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006712
Daniel Veillard42595322004-11-08 10:52:06 +00006713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006714}
6715
6716
6717static int
6718test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006720
Daniel Veillard3d97e662004-11-04 10:49:00 +00006721 int mem_base;
6722 int ret_val;
6723 unsigned int ch; /* character to validate */
6724 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006725
Daniel Veillard3d97e662004-11-04 10:49:00 +00006726 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6727 mem_base = xmlMemBlocks();
6728 ch = gen_unsigned_int(n_ch, 0);
6729
6730 ret_val = xmlIsPubidChar(ch);
6731 desret_int(ret_val);
6732 call_tests++;
6733 des_unsigned_int(n_ch, ch, 0);
6734 xmlResetLastError();
6735 if (mem_base != xmlMemBlocks()) {
6736 printf("Leak of %d blocks found in xmlIsPubidChar",
6737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006738 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006739 printf(" %d", n_ch);
6740 printf("\n");
6741 }
6742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006744
Daniel Veillard42595322004-11-08 10:52:06 +00006745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006746}
6747
6748static int
6749test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006751
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006752 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006753 test_ret += test_xmlCharInRange();
6754 test_ret += test_xmlIsBaseChar();
6755 test_ret += test_xmlIsBlank();
6756 test_ret += test_xmlIsChar();
6757 test_ret += test_xmlIsCombining();
6758 test_ret += test_xmlIsDigit();
6759 test_ret += test_xmlIsExtender();
6760 test_ret += test_xmlIsIdeographic();
6761 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006762
Daniel Veillard42595322004-11-08 10:52:06 +00006763 if (test_ret != 0)
6764 printf("Module chvalid: %d errors\n", test_ret);
6765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006766}
6767
6768static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006769test_xmlBoolToText(void) {
6770 int test_ret = 0;
6771
William M. Brack21e4ef22005-01-02 09:53:13 +00006772#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006773 int mem_base;
6774 const char * ret_val;
6775 int boolval; /* a bool to turn into text */
6776 int n_boolval;
6777
6778 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6779 mem_base = xmlMemBlocks();
6780 boolval = gen_int(n_boolval, 0);
6781
6782 ret_val = xmlBoolToText(boolval);
6783 desret_const_char_ptr(ret_val);
6784 call_tests++;
6785 des_int(n_boolval, boolval, 0);
6786 xmlResetLastError();
6787 if (mem_base != xmlMemBlocks()) {
6788 printf("Leak of %d blocks found in xmlBoolToText",
6789 xmlMemBlocks() - mem_base);
6790 test_ret++;
6791 printf(" %d", n_boolval);
6792 printf("\n");
6793 }
6794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006795 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006796#endif
6797
Daniel Veillarda82b1822004-11-08 16:24:57 +00006798 return(test_ret);
6799}
6800
6801
6802static int
6803test_xmlDebugCheckDocument(void) {
6804 int test_ret = 0;
6805
William M. Brack21e4ef22005-01-02 09:53:13 +00006806#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006807 int mem_base;
6808 int ret_val;
6809 FILE * output; /* the FILE * for the output */
6810 int n_output;
6811 xmlDocPtr doc; /* the document */
6812 int n_doc;
6813
6814 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6815 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6816 mem_base = xmlMemBlocks();
6817 output = gen_debug_FILE_ptr(n_output, 0);
6818 doc = gen_xmlDocPtr(n_doc, 1);
6819
6820 ret_val = xmlDebugCheckDocument(output, doc);
6821 desret_int(ret_val);
6822 call_tests++;
6823 des_debug_FILE_ptr(n_output, output, 0);
6824 des_xmlDocPtr(n_doc, doc, 1);
6825 xmlResetLastError();
6826 if (mem_base != xmlMemBlocks()) {
6827 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6828 xmlMemBlocks() - mem_base);
6829 test_ret++;
6830 printf(" %d", n_output);
6831 printf(" %d", n_doc);
6832 printf("\n");
6833 }
6834 }
6835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006836 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006837#endif
6838
Daniel Veillarda82b1822004-11-08 16:24:57 +00006839 return(test_ret);
6840}
6841
6842
6843static int
6844test_xmlDebugDumpAttr(void) {
6845 int test_ret = 0;
6846
William M. Brack21e4ef22005-01-02 09:53:13 +00006847#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006848 int mem_base;
6849 FILE * output; /* the FILE * for the output */
6850 int n_output;
6851 xmlAttrPtr attr; /* the attribute */
6852 int n_attr;
6853 int depth; /* the indentation level. */
6854 int n_depth;
6855
6856 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6857 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6858 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6859 mem_base = xmlMemBlocks();
6860 output = gen_debug_FILE_ptr(n_output, 0);
6861 attr = gen_xmlAttrPtr(n_attr, 1);
6862 depth = gen_int(n_depth, 2);
6863
6864 xmlDebugDumpAttr(output, attr, depth);
6865 call_tests++;
6866 des_debug_FILE_ptr(n_output, output, 0);
6867 des_xmlAttrPtr(n_attr, attr, 1);
6868 des_int(n_depth, depth, 2);
6869 xmlResetLastError();
6870 if (mem_base != xmlMemBlocks()) {
6871 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6872 xmlMemBlocks() - mem_base);
6873 test_ret++;
6874 printf(" %d", n_output);
6875 printf(" %d", n_attr);
6876 printf(" %d", n_depth);
6877 printf("\n");
6878 }
6879 }
6880 }
6881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006882 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006883#endif
6884
Daniel Veillarda82b1822004-11-08 16:24:57 +00006885 return(test_ret);
6886}
6887
6888
6889static int
6890test_xmlDebugDumpAttrList(void) {
6891 int test_ret = 0;
6892
William M. Brack21e4ef22005-01-02 09:53:13 +00006893#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006894 int mem_base;
6895 FILE * output; /* the FILE * for the output */
6896 int n_output;
6897 xmlAttrPtr attr; /* the attribute list */
6898 int n_attr;
6899 int depth; /* the indentation level. */
6900 int n_depth;
6901
6902 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6903 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6904 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6905 mem_base = xmlMemBlocks();
6906 output = gen_debug_FILE_ptr(n_output, 0);
6907 attr = gen_xmlAttrPtr(n_attr, 1);
6908 depth = gen_int(n_depth, 2);
6909
6910 xmlDebugDumpAttrList(output, attr, depth);
6911 call_tests++;
6912 des_debug_FILE_ptr(n_output, output, 0);
6913 des_xmlAttrPtr(n_attr, attr, 1);
6914 des_int(n_depth, depth, 2);
6915 xmlResetLastError();
6916 if (mem_base != xmlMemBlocks()) {
6917 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6918 xmlMemBlocks() - mem_base);
6919 test_ret++;
6920 printf(" %d", n_output);
6921 printf(" %d", n_attr);
6922 printf(" %d", n_depth);
6923 printf("\n");
6924 }
6925 }
6926 }
6927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006928 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006929#endif
6930
Daniel Veillarda82b1822004-11-08 16:24:57 +00006931 return(test_ret);
6932}
6933
6934
6935static int
6936test_xmlDebugDumpDTD(void) {
6937 int test_ret = 0;
6938
William M. Brack21e4ef22005-01-02 09:53:13 +00006939#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006940 int mem_base;
6941 FILE * output; /* the FILE * for the output */
6942 int n_output;
6943 xmlDtdPtr dtd; /* the DTD */
6944 int n_dtd;
6945
6946 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6947 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6948 mem_base = xmlMemBlocks();
6949 output = gen_debug_FILE_ptr(n_output, 0);
6950 dtd = gen_xmlDtdPtr(n_dtd, 1);
6951
6952 xmlDebugDumpDTD(output, dtd);
6953 call_tests++;
6954 des_debug_FILE_ptr(n_output, output, 0);
6955 des_xmlDtdPtr(n_dtd, dtd, 1);
6956 xmlResetLastError();
6957 if (mem_base != xmlMemBlocks()) {
6958 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6959 xmlMemBlocks() - mem_base);
6960 test_ret++;
6961 printf(" %d", n_output);
6962 printf(" %d", n_dtd);
6963 printf("\n");
6964 }
6965 }
6966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006967 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006968#endif
6969
Daniel Veillarda82b1822004-11-08 16:24:57 +00006970 return(test_ret);
6971}
6972
6973
6974static int
6975test_xmlDebugDumpDocument(void) {
6976 int test_ret = 0;
6977
William M. Brack21e4ef22005-01-02 09:53:13 +00006978#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006979 int mem_base;
6980 FILE * output; /* the FILE * for the output */
6981 int n_output;
6982 xmlDocPtr doc; /* the document */
6983 int n_doc;
6984
6985 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6986 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6987 mem_base = xmlMemBlocks();
6988 output = gen_debug_FILE_ptr(n_output, 0);
6989 doc = gen_xmlDocPtr(n_doc, 1);
6990
6991 xmlDebugDumpDocument(output, doc);
6992 call_tests++;
6993 des_debug_FILE_ptr(n_output, output, 0);
6994 des_xmlDocPtr(n_doc, doc, 1);
6995 xmlResetLastError();
6996 if (mem_base != xmlMemBlocks()) {
6997 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6998 xmlMemBlocks() - mem_base);
6999 test_ret++;
7000 printf(" %d", n_output);
7001 printf(" %d", n_doc);
7002 printf("\n");
7003 }
7004 }
7005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007006 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007007#endif
7008
Daniel Veillarda82b1822004-11-08 16:24:57 +00007009 return(test_ret);
7010}
7011
7012
7013static int
7014test_xmlDebugDumpDocumentHead(void) {
7015 int test_ret = 0;
7016
William M. Brack21e4ef22005-01-02 09:53:13 +00007017#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007018 int mem_base;
7019 FILE * output; /* the FILE * for the output */
7020 int n_output;
7021 xmlDocPtr doc; /* the document */
7022 int n_doc;
7023
7024 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7025 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7026 mem_base = xmlMemBlocks();
7027 output = gen_debug_FILE_ptr(n_output, 0);
7028 doc = gen_xmlDocPtr(n_doc, 1);
7029
7030 xmlDebugDumpDocumentHead(output, doc);
7031 call_tests++;
7032 des_debug_FILE_ptr(n_output, output, 0);
7033 des_xmlDocPtr(n_doc, doc, 1);
7034 xmlResetLastError();
7035 if (mem_base != xmlMemBlocks()) {
7036 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7037 xmlMemBlocks() - mem_base);
7038 test_ret++;
7039 printf(" %d", n_output);
7040 printf(" %d", n_doc);
7041 printf("\n");
7042 }
7043 }
7044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007045 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007046#endif
7047
Daniel Veillarda82b1822004-11-08 16:24:57 +00007048 return(test_ret);
7049}
7050
7051
7052static int
7053test_xmlDebugDumpEntities(void) {
7054 int test_ret = 0;
7055
William M. Brack21e4ef22005-01-02 09:53:13 +00007056#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007057 int mem_base;
7058 FILE * output; /* the FILE * for the output */
7059 int n_output;
7060 xmlDocPtr doc; /* the document */
7061 int n_doc;
7062
7063 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7064 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7065 mem_base = xmlMemBlocks();
7066 output = gen_debug_FILE_ptr(n_output, 0);
7067 doc = gen_xmlDocPtr(n_doc, 1);
7068
7069 xmlDebugDumpEntities(output, doc);
7070 call_tests++;
7071 des_debug_FILE_ptr(n_output, output, 0);
7072 des_xmlDocPtr(n_doc, doc, 1);
7073 xmlResetLastError();
7074 if (mem_base != xmlMemBlocks()) {
7075 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7076 xmlMemBlocks() - mem_base);
7077 test_ret++;
7078 printf(" %d", n_output);
7079 printf(" %d", n_doc);
7080 printf("\n");
7081 }
7082 }
7083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007084 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007085#endif
7086
Daniel Veillarda82b1822004-11-08 16:24:57 +00007087 return(test_ret);
7088}
7089
7090
7091static int
7092test_xmlDebugDumpNode(void) {
7093 int test_ret = 0;
7094
William M. Brack21e4ef22005-01-02 09:53:13 +00007095#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007096 int mem_base;
7097 FILE * output; /* the FILE * for the output */
7098 int n_output;
7099 xmlNodePtr node; /* the node */
7100 int n_node;
7101 int depth; /* the indentation level. */
7102 int n_depth;
7103
7104 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7105 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7106 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7107 mem_base = xmlMemBlocks();
7108 output = gen_debug_FILE_ptr(n_output, 0);
7109 node = gen_xmlNodePtr(n_node, 1);
7110 depth = gen_int(n_depth, 2);
7111
7112 xmlDebugDumpNode(output, node, depth);
7113 call_tests++;
7114 des_debug_FILE_ptr(n_output, output, 0);
7115 des_xmlNodePtr(n_node, node, 1);
7116 des_int(n_depth, depth, 2);
7117 xmlResetLastError();
7118 if (mem_base != xmlMemBlocks()) {
7119 printf("Leak of %d blocks found in xmlDebugDumpNode",
7120 xmlMemBlocks() - mem_base);
7121 test_ret++;
7122 printf(" %d", n_output);
7123 printf(" %d", n_node);
7124 printf(" %d", n_depth);
7125 printf("\n");
7126 }
7127 }
7128 }
7129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007130 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007131#endif
7132
Daniel Veillarda82b1822004-11-08 16:24:57 +00007133 return(test_ret);
7134}
7135
7136
7137static int
7138test_xmlDebugDumpNodeList(void) {
7139 int test_ret = 0;
7140
William M. Brack21e4ef22005-01-02 09:53:13 +00007141#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007142 int mem_base;
7143 FILE * output; /* the FILE * for the output */
7144 int n_output;
7145 xmlNodePtr node; /* the node list */
7146 int n_node;
7147 int depth; /* the indentation level. */
7148 int n_depth;
7149
7150 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7151 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7152 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7153 mem_base = xmlMemBlocks();
7154 output = gen_debug_FILE_ptr(n_output, 0);
7155 node = gen_xmlNodePtr(n_node, 1);
7156 depth = gen_int(n_depth, 2);
7157
7158 xmlDebugDumpNodeList(output, node, depth);
7159 call_tests++;
7160 des_debug_FILE_ptr(n_output, output, 0);
7161 des_xmlNodePtr(n_node, node, 1);
7162 des_int(n_depth, depth, 2);
7163 xmlResetLastError();
7164 if (mem_base != xmlMemBlocks()) {
7165 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7166 xmlMemBlocks() - mem_base);
7167 test_ret++;
7168 printf(" %d", n_output);
7169 printf(" %d", n_node);
7170 printf(" %d", n_depth);
7171 printf("\n");
7172 }
7173 }
7174 }
7175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007176 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007177#endif
7178
Daniel Veillarda82b1822004-11-08 16:24:57 +00007179 return(test_ret);
7180}
7181
7182
7183static int
7184test_xmlDebugDumpOneNode(void) {
7185 int test_ret = 0;
7186
William M. Brack21e4ef22005-01-02 09:53:13 +00007187#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007188 int mem_base;
7189 FILE * output; /* the FILE * for the output */
7190 int n_output;
7191 xmlNodePtr node; /* the node */
7192 int n_node;
7193 int depth; /* the indentation level. */
7194 int n_depth;
7195
7196 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7197 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7198 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7199 mem_base = xmlMemBlocks();
7200 output = gen_debug_FILE_ptr(n_output, 0);
7201 node = gen_xmlNodePtr(n_node, 1);
7202 depth = gen_int(n_depth, 2);
7203
7204 xmlDebugDumpOneNode(output, node, depth);
7205 call_tests++;
7206 des_debug_FILE_ptr(n_output, output, 0);
7207 des_xmlNodePtr(n_node, node, 1);
7208 des_int(n_depth, depth, 2);
7209 xmlResetLastError();
7210 if (mem_base != xmlMemBlocks()) {
7211 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7212 xmlMemBlocks() - mem_base);
7213 test_ret++;
7214 printf(" %d", n_output);
7215 printf(" %d", n_node);
7216 printf(" %d", n_depth);
7217 printf("\n");
7218 }
7219 }
7220 }
7221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007222 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007223#endif
7224
Daniel Veillarda82b1822004-11-08 16:24:57 +00007225 return(test_ret);
7226}
7227
7228
7229static int
7230test_xmlDebugDumpString(void) {
7231 int test_ret = 0;
7232
William M. Brack21e4ef22005-01-02 09:53:13 +00007233#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007234 int mem_base;
7235 FILE * output; /* the FILE * for the output */
7236 int n_output;
7237 xmlChar * str; /* the string */
7238 int n_str;
7239
7240 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7241 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7242 mem_base = xmlMemBlocks();
7243 output = gen_debug_FILE_ptr(n_output, 0);
7244 str = gen_const_xmlChar_ptr(n_str, 1);
7245
William M. Brackf13f77f2004-11-12 16:03:48 +00007246 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007247 call_tests++;
7248 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007249 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007250 xmlResetLastError();
7251 if (mem_base != xmlMemBlocks()) {
7252 printf("Leak of %d blocks found in xmlDebugDumpString",
7253 xmlMemBlocks() - mem_base);
7254 test_ret++;
7255 printf(" %d", n_output);
7256 printf(" %d", n_str);
7257 printf("\n");
7258 }
7259 }
7260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007261 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007262#endif
7263
Daniel Veillarda82b1822004-11-08 16:24:57 +00007264 return(test_ret);
7265}
7266
7267
7268static int
7269test_xmlLsCountNode(void) {
7270 int test_ret = 0;
7271
William M. Brack21e4ef22005-01-02 09:53:13 +00007272#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007273 int mem_base;
7274 int ret_val;
7275 xmlNodePtr node; /* the node to count */
7276 int n_node;
7277
7278 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7279 mem_base = xmlMemBlocks();
7280 node = gen_xmlNodePtr(n_node, 0);
7281
7282 ret_val = xmlLsCountNode(node);
7283 desret_int(ret_val);
7284 call_tests++;
7285 des_xmlNodePtr(n_node, node, 0);
7286 xmlResetLastError();
7287 if (mem_base != xmlMemBlocks()) {
7288 printf("Leak of %d blocks found in xmlLsCountNode",
7289 xmlMemBlocks() - mem_base);
7290 test_ret++;
7291 printf(" %d", n_node);
7292 printf("\n");
7293 }
7294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007295 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007296#endif
7297
Daniel Veillarda82b1822004-11-08 16:24:57 +00007298 return(test_ret);
7299}
7300
7301
7302static int
7303test_xmlLsOneNode(void) {
7304 int test_ret = 0;
7305
William M. Brack21e4ef22005-01-02 09:53:13 +00007306#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007307 int mem_base;
7308 FILE * output; /* the FILE * for the output */
7309 int n_output;
7310 xmlNodePtr node; /* the node to dump */
7311 int n_node;
7312
7313 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7314 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7315 mem_base = xmlMemBlocks();
7316 output = gen_debug_FILE_ptr(n_output, 0);
7317 node = gen_xmlNodePtr(n_node, 1);
7318
7319 xmlLsOneNode(output, node);
7320 call_tests++;
7321 des_debug_FILE_ptr(n_output, output, 0);
7322 des_xmlNodePtr(n_node, node, 1);
7323 xmlResetLastError();
7324 if (mem_base != xmlMemBlocks()) {
7325 printf("Leak of %d blocks found in xmlLsOneNode",
7326 xmlMemBlocks() - mem_base);
7327 test_ret++;
7328 printf(" %d", n_output);
7329 printf(" %d", n_node);
7330 printf("\n");
7331 }
7332 }
7333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007335#endif
7336
Daniel Veillarda82b1822004-11-08 16:24:57 +00007337 return(test_ret);
7338}
7339
7340
7341#define gen_nb_char_ptr 1
7342static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7343 return(NULL);
7344}
7345static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7346}
7347
7348static int
7349test_xmlShell(void) {
7350 int test_ret = 0;
7351
7352
7353 /* missing type support */
7354 return(test_ret);
7355}
7356
7357
Daniel Veillarda82b1822004-11-08 16:24:57 +00007358static int
7359test_xmlShellBase(void) {
7360 int test_ret = 0;
7361
William M. Brack21e4ef22005-01-02 09:53:13 +00007362#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007363 int mem_base;
7364 int ret_val;
7365 xmlShellCtxtPtr ctxt; /* the shell context */
7366 int n_ctxt;
7367 char * arg; /* unused */
7368 int n_arg;
7369 xmlNodePtr node; /* a node */
7370 int n_node;
7371 xmlNodePtr node2; /* unused */
7372 int n_node2;
7373
7374 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7375 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7376 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7377 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7378 mem_base = xmlMemBlocks();
7379 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7380 arg = gen_char_ptr(n_arg, 1);
7381 node = gen_xmlNodePtr(n_node, 2);
7382 node2 = gen_xmlNodePtr(n_node2, 3);
7383
7384 ret_val = xmlShellBase(ctxt, arg, node, node2);
7385 desret_int(ret_val);
7386 call_tests++;
7387 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7388 des_char_ptr(n_arg, arg, 1);
7389 des_xmlNodePtr(n_node, node, 2);
7390 des_xmlNodePtr(n_node2, node2, 3);
7391 xmlResetLastError();
7392 if (mem_base != xmlMemBlocks()) {
7393 printf("Leak of %d blocks found in xmlShellBase",
7394 xmlMemBlocks() - mem_base);
7395 test_ret++;
7396 printf(" %d", n_ctxt);
7397 printf(" %d", n_arg);
7398 printf(" %d", n_node);
7399 printf(" %d", n_node2);
7400 printf("\n");
7401 }
7402 }
7403 }
7404 }
7405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007406 function_tests++;
7407#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007408
Daniel Veillarda82b1822004-11-08 16:24:57 +00007409 return(test_ret);
7410}
7411
7412
7413static int
7414test_xmlShellCat(void) {
7415 int test_ret = 0;
7416
William M. Brack21e4ef22005-01-02 09:53:13 +00007417#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007418 int mem_base;
7419 int ret_val;
7420 xmlShellCtxtPtr ctxt; /* the shell context */
7421 int n_ctxt;
7422 char * arg; /* unused */
7423 int n_arg;
7424 xmlNodePtr node; /* a node */
7425 int n_node;
7426 xmlNodePtr node2; /* unused */
7427 int n_node2;
7428
7429 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7430 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7431 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7432 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7433 mem_base = xmlMemBlocks();
7434 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7435 arg = gen_char_ptr(n_arg, 1);
7436 node = gen_xmlNodePtr(n_node, 2);
7437 node2 = gen_xmlNodePtr(n_node2, 3);
7438
7439 ret_val = xmlShellCat(ctxt, arg, node, node2);
7440 desret_int(ret_val);
7441 call_tests++;
7442 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7443 des_char_ptr(n_arg, arg, 1);
7444 des_xmlNodePtr(n_node, node, 2);
7445 des_xmlNodePtr(n_node2, node2, 3);
7446 xmlResetLastError();
7447 if (mem_base != xmlMemBlocks()) {
7448 printf("Leak of %d blocks found in xmlShellCat",
7449 xmlMemBlocks() - mem_base);
7450 test_ret++;
7451 printf(" %d", n_ctxt);
7452 printf(" %d", n_arg);
7453 printf(" %d", n_node);
7454 printf(" %d", n_node2);
7455 printf("\n");
7456 }
7457 }
7458 }
7459 }
7460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007461 function_tests++;
7462#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007463
Daniel Veillarda82b1822004-11-08 16:24:57 +00007464 return(test_ret);
7465}
7466
7467
7468static int
7469test_xmlShellDir(void) {
7470 int test_ret = 0;
7471
William M. Brack21e4ef22005-01-02 09:53:13 +00007472#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007473 int mem_base;
7474 int ret_val;
7475 xmlShellCtxtPtr ctxt; /* the shell context */
7476 int n_ctxt;
7477 char * arg; /* unused */
7478 int n_arg;
7479 xmlNodePtr node; /* a node */
7480 int n_node;
7481 xmlNodePtr node2; /* unused */
7482 int n_node2;
7483
7484 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7485 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7486 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7487 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7488 mem_base = xmlMemBlocks();
7489 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7490 arg = gen_char_ptr(n_arg, 1);
7491 node = gen_xmlNodePtr(n_node, 2);
7492 node2 = gen_xmlNodePtr(n_node2, 3);
7493
7494 ret_val = xmlShellDir(ctxt, arg, node, node2);
7495 desret_int(ret_val);
7496 call_tests++;
7497 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7498 des_char_ptr(n_arg, arg, 1);
7499 des_xmlNodePtr(n_node, node, 2);
7500 des_xmlNodePtr(n_node2, node2, 3);
7501 xmlResetLastError();
7502 if (mem_base != xmlMemBlocks()) {
7503 printf("Leak of %d blocks found in xmlShellDir",
7504 xmlMemBlocks() - mem_base);
7505 test_ret++;
7506 printf(" %d", n_ctxt);
7507 printf(" %d", n_arg);
7508 printf(" %d", n_node);
7509 printf(" %d", n_node2);
7510 printf("\n");
7511 }
7512 }
7513 }
7514 }
7515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007516 function_tests++;
7517#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007518
Daniel Veillarda82b1822004-11-08 16:24:57 +00007519 return(test_ret);
7520}
7521
7522
7523static int
7524test_xmlShellDu(void) {
7525 int test_ret = 0;
7526
William M. Brack21e4ef22005-01-02 09:53:13 +00007527#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007528 int mem_base;
7529 int ret_val;
7530 xmlShellCtxtPtr ctxt; /* the shell context */
7531 int n_ctxt;
7532 char * arg; /* unused */
7533 int n_arg;
7534 xmlNodePtr tree; /* a node defining a subtree */
7535 int n_tree;
7536 xmlNodePtr node2; /* unused */
7537 int n_node2;
7538
7539 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7540 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7541 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7542 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7543 mem_base = xmlMemBlocks();
7544 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7545 arg = gen_char_ptr(n_arg, 1);
7546 tree = gen_xmlNodePtr(n_tree, 2);
7547 node2 = gen_xmlNodePtr(n_node2, 3);
7548
7549 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7550 desret_int(ret_val);
7551 call_tests++;
7552 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7553 des_char_ptr(n_arg, arg, 1);
7554 des_xmlNodePtr(n_tree, tree, 2);
7555 des_xmlNodePtr(n_node2, node2, 3);
7556 xmlResetLastError();
7557 if (mem_base != xmlMemBlocks()) {
7558 printf("Leak of %d blocks found in xmlShellDu",
7559 xmlMemBlocks() - mem_base);
7560 test_ret++;
7561 printf(" %d", n_ctxt);
7562 printf(" %d", n_arg);
7563 printf(" %d", n_tree);
7564 printf(" %d", n_node2);
7565 printf("\n");
7566 }
7567 }
7568 }
7569 }
7570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007571 function_tests++;
7572#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007573
Daniel Veillarda82b1822004-11-08 16:24:57 +00007574 return(test_ret);
7575}
7576
7577
7578static int
7579test_xmlShellList(void) {
7580 int test_ret = 0;
7581
William M. Brack21e4ef22005-01-02 09:53:13 +00007582#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007583 int mem_base;
7584 int ret_val;
7585 xmlShellCtxtPtr ctxt; /* the shell context */
7586 int n_ctxt;
7587 char * arg; /* unused */
7588 int n_arg;
7589 xmlNodePtr node; /* a node */
7590 int n_node;
7591 xmlNodePtr node2; /* unused */
7592 int n_node2;
7593
7594 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7595 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7596 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7597 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7598 mem_base = xmlMemBlocks();
7599 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7600 arg = gen_char_ptr(n_arg, 1);
7601 node = gen_xmlNodePtr(n_node, 2);
7602 node2 = gen_xmlNodePtr(n_node2, 3);
7603
7604 ret_val = xmlShellList(ctxt, arg, node, node2);
7605 desret_int(ret_val);
7606 call_tests++;
7607 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7608 des_char_ptr(n_arg, arg, 1);
7609 des_xmlNodePtr(n_node, node, 2);
7610 des_xmlNodePtr(n_node2, node2, 3);
7611 xmlResetLastError();
7612 if (mem_base != xmlMemBlocks()) {
7613 printf("Leak of %d blocks found in xmlShellList",
7614 xmlMemBlocks() - mem_base);
7615 test_ret++;
7616 printf(" %d", n_ctxt);
7617 printf(" %d", n_arg);
7618 printf(" %d", n_node);
7619 printf(" %d", n_node2);
7620 printf("\n");
7621 }
7622 }
7623 }
7624 }
7625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007626 function_tests++;
7627#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007628
Daniel Veillarda82b1822004-11-08 16:24:57 +00007629 return(test_ret);
7630}
7631
7632
7633static int
7634test_xmlShellLoad(void) {
7635 int test_ret = 0;
7636
William M. Brack21e4ef22005-01-02 09:53:13 +00007637#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007638 int mem_base;
7639 int ret_val;
7640 xmlShellCtxtPtr ctxt; /* the shell context */
7641 int n_ctxt;
7642 char * filename; /* the file name */
7643 int n_filename;
7644 xmlNodePtr node; /* unused */
7645 int n_node;
7646 xmlNodePtr node2; /* unused */
7647 int n_node2;
7648
7649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7650 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7651 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7652 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7653 mem_base = xmlMemBlocks();
7654 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7655 filename = gen_char_ptr(n_filename, 1);
7656 node = gen_xmlNodePtr(n_node, 2);
7657 node2 = gen_xmlNodePtr(n_node2, 3);
7658
7659 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7660 desret_int(ret_val);
7661 call_tests++;
7662 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7663 des_char_ptr(n_filename, filename, 1);
7664 des_xmlNodePtr(n_node, node, 2);
7665 des_xmlNodePtr(n_node2, node2, 3);
7666 xmlResetLastError();
7667 if (mem_base != xmlMemBlocks()) {
7668 printf("Leak of %d blocks found in xmlShellLoad",
7669 xmlMemBlocks() - mem_base);
7670 test_ret++;
7671 printf(" %d", n_ctxt);
7672 printf(" %d", n_filename);
7673 printf(" %d", n_node);
7674 printf(" %d", n_node2);
7675 printf("\n");
7676 }
7677 }
7678 }
7679 }
7680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007681 function_tests++;
7682#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007683
Daniel Veillarda82b1822004-11-08 16:24:57 +00007684 return(test_ret);
7685}
7686
7687
7688static int
7689test_xmlShellPrintXPathResult(void) {
7690 int test_ret = 0;
7691
William M. Brack21e4ef22005-01-02 09:53:13 +00007692#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007693 int mem_base;
7694 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7695 int n_list;
7696
7697 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7698 mem_base = xmlMemBlocks();
7699 list = gen_xmlXPathObjectPtr(n_list, 0);
7700
7701 xmlShellPrintXPathResult(list);
7702 call_tests++;
7703 des_xmlXPathObjectPtr(n_list, list, 0);
7704 xmlResetLastError();
7705 if (mem_base != xmlMemBlocks()) {
7706 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7707 xmlMemBlocks() - mem_base);
7708 test_ret++;
7709 printf(" %d", n_list);
7710 printf("\n");
7711 }
7712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007713 function_tests++;
7714#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007715
Daniel Veillarda82b1822004-11-08 16:24:57 +00007716 return(test_ret);
7717}
7718
7719
7720static int
7721test_xmlShellPwd(void) {
7722 int test_ret = 0;
7723
William M. Brack21e4ef22005-01-02 09:53:13 +00007724#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007725 int mem_base;
7726 int ret_val;
7727 xmlShellCtxtPtr ctxt; /* the shell context */
7728 int n_ctxt;
7729 char * buffer; /* the output buffer */
7730 int n_buffer;
7731 xmlNodePtr node; /* a node */
7732 int n_node;
7733 xmlNodePtr node2; /* unused */
7734 int n_node2;
7735
7736 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7737 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7738 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7739 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7740 mem_base = xmlMemBlocks();
7741 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7742 buffer = gen_char_ptr(n_buffer, 1);
7743 node = gen_xmlNodePtr(n_node, 2);
7744 node2 = gen_xmlNodePtr(n_node2, 3);
7745
7746 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7747 desret_int(ret_val);
7748 call_tests++;
7749 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7750 des_char_ptr(n_buffer, buffer, 1);
7751 des_xmlNodePtr(n_node, node, 2);
7752 des_xmlNodePtr(n_node2, node2, 3);
7753 xmlResetLastError();
7754 if (mem_base != xmlMemBlocks()) {
7755 printf("Leak of %d blocks found in xmlShellPwd",
7756 xmlMemBlocks() - mem_base);
7757 test_ret++;
7758 printf(" %d", n_ctxt);
7759 printf(" %d", n_buffer);
7760 printf(" %d", n_node);
7761 printf(" %d", n_node2);
7762 printf("\n");
7763 }
7764 }
7765 }
7766 }
7767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007768 function_tests++;
7769#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007770
Daniel Veillarda82b1822004-11-08 16:24:57 +00007771 return(test_ret);
7772}
7773
7774
7775static int
7776test_xmlShellSave(void) {
7777 int test_ret = 0;
7778
William M. Brack21e4ef22005-01-02 09:53:13 +00007779#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007780 int mem_base;
7781 int ret_val;
7782 xmlShellCtxtPtr ctxt; /* the shell context */
7783 int n_ctxt;
7784 char * filename; /* the file name (optional) */
7785 int n_filename;
7786 xmlNodePtr node; /* unused */
7787 int n_node;
7788 xmlNodePtr node2; /* unused */
7789 int n_node2;
7790
7791 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7792 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7793 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7794 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7795 mem_base = xmlMemBlocks();
7796 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7797 filename = gen_char_ptr(n_filename, 1);
7798 node = gen_xmlNodePtr(n_node, 2);
7799 node2 = gen_xmlNodePtr(n_node2, 3);
7800
7801 ret_val = xmlShellSave(ctxt, filename, node, node2);
7802 desret_int(ret_val);
7803 call_tests++;
7804 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7805 des_char_ptr(n_filename, filename, 1);
7806 des_xmlNodePtr(n_node, node, 2);
7807 des_xmlNodePtr(n_node2, node2, 3);
7808 xmlResetLastError();
7809 if (mem_base != xmlMemBlocks()) {
7810 printf("Leak of %d blocks found in xmlShellSave",
7811 xmlMemBlocks() - mem_base);
7812 test_ret++;
7813 printf(" %d", n_ctxt);
7814 printf(" %d", n_filename);
7815 printf(" %d", n_node);
7816 printf(" %d", n_node2);
7817 printf("\n");
7818 }
7819 }
7820 }
7821 }
7822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007823 function_tests++;
7824#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007825
Daniel Veillarda82b1822004-11-08 16:24:57 +00007826 return(test_ret);
7827}
7828
7829
7830static int
7831test_xmlShellValidate(void) {
7832 int test_ret = 0;
7833
William M. Brack21e4ef22005-01-02 09:53:13 +00007834#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007835 int mem_base;
7836 int ret_val;
7837 xmlShellCtxtPtr ctxt; /* the shell context */
7838 int n_ctxt;
7839 char * dtd; /* the DTD URI (optional) */
7840 int n_dtd;
7841 xmlNodePtr node; /* unused */
7842 int n_node;
7843 xmlNodePtr node2; /* unused */
7844 int n_node2;
7845
7846 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7847 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7848 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7849 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7850 mem_base = xmlMemBlocks();
7851 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7852 dtd = gen_char_ptr(n_dtd, 1);
7853 node = gen_xmlNodePtr(n_node, 2);
7854 node2 = gen_xmlNodePtr(n_node2, 3);
7855
7856 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7857 desret_int(ret_val);
7858 call_tests++;
7859 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7860 des_char_ptr(n_dtd, dtd, 1);
7861 des_xmlNodePtr(n_node, node, 2);
7862 des_xmlNodePtr(n_node2, node2, 3);
7863 xmlResetLastError();
7864 if (mem_base != xmlMemBlocks()) {
7865 printf("Leak of %d blocks found in xmlShellValidate",
7866 xmlMemBlocks() - mem_base);
7867 test_ret++;
7868 printf(" %d", n_ctxt);
7869 printf(" %d", n_dtd);
7870 printf(" %d", n_node);
7871 printf(" %d", n_node2);
7872 printf("\n");
7873 }
7874 }
7875 }
7876 }
7877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007878 function_tests++;
7879#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007880
Daniel Veillarda82b1822004-11-08 16:24:57 +00007881 return(test_ret);
7882}
7883
7884
7885static int
7886test_xmlShellWrite(void) {
7887 int test_ret = 0;
7888
William M. Brack21e4ef22005-01-02 09:53:13 +00007889#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007890 int mem_base;
7891 int ret_val;
7892 xmlShellCtxtPtr ctxt; /* the shell context */
7893 int n_ctxt;
7894 char * filename; /* the file name */
7895 int n_filename;
7896 xmlNodePtr node; /* a node in the tree */
7897 int n_node;
7898 xmlNodePtr node2; /* unused */
7899 int n_node2;
7900
7901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7902 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7903 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7904 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7905 mem_base = xmlMemBlocks();
7906 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7907 filename = gen_char_ptr(n_filename, 1);
7908 node = gen_xmlNodePtr(n_node, 2);
7909 node2 = gen_xmlNodePtr(n_node2, 3);
7910
7911 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7912 desret_int(ret_val);
7913 call_tests++;
7914 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7915 des_char_ptr(n_filename, filename, 1);
7916 des_xmlNodePtr(n_node, node, 2);
7917 des_xmlNodePtr(n_node2, node2, 3);
7918 xmlResetLastError();
7919 if (mem_base != xmlMemBlocks()) {
7920 printf("Leak of %d blocks found in xmlShellWrite",
7921 xmlMemBlocks() - mem_base);
7922 test_ret++;
7923 printf(" %d", n_ctxt);
7924 printf(" %d", n_filename);
7925 printf(" %d", n_node);
7926 printf(" %d", n_node2);
7927 printf("\n");
7928 }
7929 }
7930 }
7931 }
7932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007933 function_tests++;
7934#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007935
Daniel Veillarda82b1822004-11-08 16:24:57 +00007936 return(test_ret);
7937}
7938
7939static int
7940test_debugXML(void) {
7941 int test_ret = 0;
7942
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007943 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007944 test_ret += test_xmlBoolToText();
7945 test_ret += test_xmlDebugCheckDocument();
7946 test_ret += test_xmlDebugDumpAttr();
7947 test_ret += test_xmlDebugDumpAttrList();
7948 test_ret += test_xmlDebugDumpDTD();
7949 test_ret += test_xmlDebugDumpDocument();
7950 test_ret += test_xmlDebugDumpDocumentHead();
7951 test_ret += test_xmlDebugDumpEntities();
7952 test_ret += test_xmlDebugDumpNode();
7953 test_ret += test_xmlDebugDumpNodeList();
7954 test_ret += test_xmlDebugDumpOneNode();
7955 test_ret += test_xmlDebugDumpString();
7956 test_ret += test_xmlLsCountNode();
7957 test_ret += test_xmlLsOneNode();
7958 test_ret += test_xmlShell();
7959 test_ret += test_xmlShellBase();
7960 test_ret += test_xmlShellCat();
7961 test_ret += test_xmlShellDir();
7962 test_ret += test_xmlShellDu();
7963 test_ret += test_xmlShellList();
7964 test_ret += test_xmlShellLoad();
7965 test_ret += test_xmlShellPrintXPathResult();
7966 test_ret += test_xmlShellPwd();
7967 test_ret += test_xmlShellSave();
7968 test_ret += test_xmlShellValidate();
7969 test_ret += test_xmlShellWrite();
7970
7971 if (test_ret != 0)
7972 printf("Module debugXML: %d errors\n", test_ret);
7973 return(test_ret);
7974}
7975
7976static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007977test_xmlDictCleanup(void) {
7978 int test_ret = 0;
7979
7980 int mem_base;
7981
7982 mem_base = xmlMemBlocks();
7983
7984 xmlDictCleanup();
7985 call_tests++;
7986 xmlResetLastError();
7987 if (mem_base != xmlMemBlocks()) {
7988 printf("Leak of %d blocks found in xmlDictCleanup",
7989 xmlMemBlocks() - mem_base);
7990 test_ret++;
7991 printf("\n");
7992 }
7993 function_tests++;
7994
7995 return(test_ret);
7996}
7997
7998
7999static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008000test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008002
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008003 int mem_base;
8004 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008005
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008006 mem_base = xmlMemBlocks();
8007
8008 ret_val = xmlDictCreate();
8009 desret_xmlDictPtr(ret_val);
8010 call_tests++;
8011 xmlResetLastError();
8012 if (mem_base != xmlMemBlocks()) {
8013 printf("Leak of %d blocks found in xmlDictCreate",
8014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008015 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008016 printf("\n");
8017 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008018 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008019
Daniel Veillard42595322004-11-08 10:52:06 +00008020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008021}
8022
8023
8024static int
8025test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008027
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008028 int mem_base;
8029 xmlDictPtr ret_val;
8030 xmlDictPtr sub; /* an existing dictionnary */
8031 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008032
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008033 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8034 mem_base = xmlMemBlocks();
8035 sub = gen_xmlDictPtr(n_sub, 0);
8036
8037 ret_val = xmlDictCreateSub(sub);
8038 desret_xmlDictPtr(ret_val);
8039 call_tests++;
8040 des_xmlDictPtr(n_sub, sub, 0);
8041 xmlResetLastError();
8042 if (mem_base != xmlMemBlocks()) {
8043 printf("Leak of %d blocks found in xmlDictCreateSub",
8044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008045 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008046 printf(" %d", n_sub);
8047 printf("\n");
8048 }
8049 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008050 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008051
Daniel Veillard42595322004-11-08 10:52:06 +00008052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008053}
8054
8055
8056static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008057test_xmlDictExists(void) {
8058 int test_ret = 0;
8059
8060 int mem_base;
8061 const xmlChar * ret_val;
8062 xmlDictPtr dict; /* the dictionnary */
8063 int n_dict;
8064 xmlChar * name; /* the name of the userdata */
8065 int n_name;
8066 int len; /* the length of the name, if -1 it is recomputed */
8067 int n_len;
8068
8069 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8070 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8071 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8072 mem_base = xmlMemBlocks();
8073 dict = gen_xmlDictPtr(n_dict, 0);
8074 name = gen_const_xmlChar_ptr(n_name, 1);
8075 len = gen_int(n_len, 2);
8076
8077 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8078 desret_const_xmlChar_ptr(ret_val);
8079 call_tests++;
8080 des_xmlDictPtr(n_dict, dict, 0);
8081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8082 des_int(n_len, len, 2);
8083 xmlResetLastError();
8084 if (mem_base != xmlMemBlocks()) {
8085 printf("Leak of %d blocks found in xmlDictExists",
8086 xmlMemBlocks() - mem_base);
8087 test_ret++;
8088 printf(" %d", n_dict);
8089 printf(" %d", n_name);
8090 printf(" %d", n_len);
8091 printf("\n");
8092 }
8093 }
8094 }
8095 }
8096 function_tests++;
8097
8098 return(test_ret);
8099}
8100
8101
8102static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008103test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008105
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008106 int mem_base;
8107 const xmlChar * ret_val;
8108 xmlDictPtr dict; /* the dictionnary */
8109 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008110 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008111 int n_name;
8112 int len; /* the length of the name, if -1 it is recomputed */
8113 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008114
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008115 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8116 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8117 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8118 mem_base = xmlMemBlocks();
8119 dict = gen_xmlDictPtr(n_dict, 0);
8120 name = gen_const_xmlChar_ptr(n_name, 1);
8121 len = gen_int(n_len, 2);
8122
William M. Brackf13f77f2004-11-12 16:03:48 +00008123 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008124 desret_const_xmlChar_ptr(ret_val);
8125 call_tests++;
8126 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008128 des_int(n_len, len, 2);
8129 xmlResetLastError();
8130 if (mem_base != xmlMemBlocks()) {
8131 printf("Leak of %d blocks found in xmlDictLookup",
8132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008133 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 printf(" %d", n_dict);
8135 printf(" %d", n_name);
8136 printf(" %d", n_len);
8137 printf("\n");
8138 }
8139 }
8140 }
8141 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008142 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008143
Daniel Veillard42595322004-11-08 10:52:06 +00008144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008145}
8146
8147
8148static int
8149test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008151
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008152 int mem_base;
8153 int ret_val;
8154 xmlDictPtr dict; /* the dictionnary */
8155 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008156 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008157 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008158
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008159 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8160 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8161 mem_base = xmlMemBlocks();
8162 dict = gen_xmlDictPtr(n_dict, 0);
8163 str = gen_const_xmlChar_ptr(n_str, 1);
8164
William M. Brackf13f77f2004-11-12 16:03:48 +00008165 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008166 desret_int(ret_val);
8167 call_tests++;
8168 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008169 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008170 xmlResetLastError();
8171 if (mem_base != xmlMemBlocks()) {
8172 printf("Leak of %d blocks found in xmlDictOwns",
8173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008174 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008175 printf(" %d", n_dict);
8176 printf(" %d", n_str);
8177 printf("\n");
8178 }
8179 }
8180 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008182
Daniel Veillard42595322004-11-08 10:52:06 +00008183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008184}
8185
8186
8187static int
8188test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008190
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 int mem_base;
8192 const xmlChar * ret_val;
8193 xmlDictPtr dict; /* the dictionnary */
8194 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008195 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008196 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008197 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008198 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008199
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008200 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8201 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8203 mem_base = xmlMemBlocks();
8204 dict = gen_xmlDictPtr(n_dict, 0);
8205 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8206 name = gen_const_xmlChar_ptr(n_name, 2);
8207
William M. Brackf13f77f2004-11-12 16:03:48 +00008208 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008209 desret_const_xmlChar_ptr(ret_val);
8210 call_tests++;
8211 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008212 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8213 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008214 xmlResetLastError();
8215 if (mem_base != xmlMemBlocks()) {
8216 printf("Leak of %d blocks found in xmlDictQLookup",
8217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008218 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008219 printf(" %d", n_dict);
8220 printf(" %d", n_prefix);
8221 printf(" %d", n_name);
8222 printf("\n");
8223 }
8224 }
8225 }
8226 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008228
Daniel Veillard42595322004-11-08 10:52:06 +00008229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008230}
8231
8232
8233static int
8234test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008236
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008237 int mem_base;
8238 int ret_val;
8239 xmlDictPtr dict; /* the dictionnary */
8240 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008241
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008242 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8243 mem_base = xmlMemBlocks();
8244 dict = gen_xmlDictPtr(n_dict, 0);
8245
8246 ret_val = xmlDictReference(dict);
8247 xmlDictFree(dict);
8248 desret_int(ret_val);
8249 call_tests++;
8250 des_xmlDictPtr(n_dict, dict, 0);
8251 xmlResetLastError();
8252 if (mem_base != xmlMemBlocks()) {
8253 printf("Leak of %d blocks found in xmlDictReference",
8254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008255 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008256 printf(" %d", n_dict);
8257 printf("\n");
8258 }
8259 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008261
Daniel Veillard42595322004-11-08 10:52:06 +00008262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008263}
8264
8265
8266static int
8267test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008269
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008270 int mem_base;
8271 int ret_val;
8272 xmlDictPtr dict; /* the dictionnary */
8273 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008274
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008275 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8276 mem_base = xmlMemBlocks();
8277 dict = gen_xmlDictPtr(n_dict, 0);
8278
8279 ret_val = xmlDictSize(dict);
8280 desret_int(ret_val);
8281 call_tests++;
8282 des_xmlDictPtr(n_dict, dict, 0);
8283 xmlResetLastError();
8284 if (mem_base != xmlMemBlocks()) {
8285 printf("Leak of %d blocks found in xmlDictSize",
8286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008287 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008288 printf(" %d", n_dict);
8289 printf("\n");
8290 }
8291 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008293
Daniel Veillard42595322004-11-08 10:52:06 +00008294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008295}
8296
8297static int
8298test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008300
Daniel Veillard2ae13382005-01-25 23:45:06 +00008301 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8302 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008303 test_ret += test_xmlDictCreate();
8304 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008305 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008306 test_ret += test_xmlDictLookup();
8307 test_ret += test_xmlDictOwns();
8308 test_ret += test_xmlDictQLookup();
8309 test_ret += test_xmlDictReference();
8310 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008311
Daniel Veillard42595322004-11-08 10:52:06 +00008312 if (test_ret != 0)
8313 printf("Module dict: %d errors\n", test_ret);
8314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008315}
8316
8317static int
8318test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008320
William M. Brack21e4ef22005-01-02 09:53:13 +00008321#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008322#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008323 int mem_base;
8324 int ret_val;
8325 unsigned char * out; /* a pointer to an array of bytes to store the result */
8326 int n_out;
8327 int * outlen; /* the length of @out */
8328 int n_outlen;
8329 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8330 int n_in;
8331 int * inlen; /* the length of @in */
8332 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008333
Daniel Veillardce682bc2004-11-05 17:22:25 +00008334 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8335 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8336 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8337 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8338 mem_base = xmlMemBlocks();
8339 out = gen_unsigned_char_ptr(n_out, 0);
8340 outlen = gen_int_ptr(n_outlen, 1);
8341 in = gen_const_unsigned_char_ptr(n_in, 2);
8342 inlen = gen_int_ptr(n_inlen, 3);
8343
William M. Brackf13f77f2004-11-12 16:03:48 +00008344 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008345 desret_int(ret_val);
8346 call_tests++;
8347 des_unsigned_char_ptr(n_out, out, 0);
8348 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008349 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008350 des_int_ptr(n_inlen, inlen, 3);
8351 xmlResetLastError();
8352 if (mem_base != xmlMemBlocks()) {
8353 printf("Leak of %d blocks found in UTF8Toisolat1",
8354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008355 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008356 printf(" %d", n_out);
8357 printf(" %d", n_outlen);
8358 printf(" %d", n_in);
8359 printf(" %d", n_inlen);
8360 printf("\n");
8361 }
8362 }
8363 }
8364 }
8365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008366 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008367#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008368#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008369
Daniel Veillard42595322004-11-08 10:52:06 +00008370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008371}
8372
8373
8374static int
8375test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008377
Daniel Veillardce682bc2004-11-05 17:22:25 +00008378 int mem_base;
8379 int ret_val;
8380 unsigned char * out; /* a pointer to an array of bytes to store the result */
8381 int n_out;
8382 int * outlen; /* the length of @out */
8383 int n_outlen;
8384 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8385 int n_in;
8386 int * inlen; /* the length of @in */
8387 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008388
Daniel Veillardce682bc2004-11-05 17:22:25 +00008389 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8390 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8391 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8392 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8393 mem_base = xmlMemBlocks();
8394 out = gen_unsigned_char_ptr(n_out, 0);
8395 outlen = gen_int_ptr(n_outlen, 1);
8396 in = gen_const_unsigned_char_ptr(n_in, 2);
8397 inlen = gen_int_ptr(n_inlen, 3);
8398
William M. Brackf13f77f2004-11-12 16:03:48 +00008399 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008400 desret_int(ret_val);
8401 call_tests++;
8402 des_unsigned_char_ptr(n_out, out, 0);
8403 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008404 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008405 des_int_ptr(n_inlen, inlen, 3);
8406 xmlResetLastError();
8407 if (mem_base != xmlMemBlocks()) {
8408 printf("Leak of %d blocks found in isolat1ToUTF8",
8409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008411 printf(" %d", n_out);
8412 printf(" %d", n_outlen);
8413 printf(" %d", n_in);
8414 printf(" %d", n_inlen);
8415 printf("\n");
8416 }
8417 }
8418 }
8419 }
8420 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008421 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008422
Daniel Veillard42595322004-11-08 10:52:06 +00008423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008424}
8425
8426
8427static int
8428test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008430
8431 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008432 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008433 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008434 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008435 int n_alias;
8436
8437 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8438 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008439 name = gen_const_char_ptr(n_name, 0);
8440 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008441
William M. Brackf13f77f2004-11-12 16:03:48 +00008442 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008443 desret_int(ret_val);
8444 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008445 des_const_char_ptr(n_name, (const char *)name, 0);
8446 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008447 xmlResetLastError();
8448 }
8449 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008451
Daniel Veillard42595322004-11-08 10:52:06 +00008452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008453}
8454
8455
Daniel Veillardce682bc2004-11-05 17:22:25 +00008456#define gen_nb_xmlCharEncodingHandler_ptr 1
8457static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8458 return(NULL);
8459}
8460static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8461}
8462
Daniel Veillardd93f6252004-11-02 15:53:51 +00008463static int
8464test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008466
Daniel Veillardce682bc2004-11-05 17:22:25 +00008467 int mem_base;
8468 int ret_val;
8469 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8470 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008471
Daniel Veillardce682bc2004-11-05 17:22:25 +00008472 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8473 mem_base = xmlMemBlocks();
8474 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8475
8476 ret_val = xmlCharEncCloseFunc(handler);
8477 desret_int(ret_val);
8478 call_tests++;
8479 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8480 xmlResetLastError();
8481 if (mem_base != xmlMemBlocks()) {
8482 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008484 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008485 printf(" %d", n_handler);
8486 printf("\n");
8487 }
8488 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008490
Daniel Veillard42595322004-11-08 10:52:06 +00008491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008492}
8493
8494
8495static int
8496test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008498
Daniel Veillardce682bc2004-11-05 17:22:25 +00008499 int mem_base;
8500 int ret_val;
8501 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8502 int n_handler;
8503 xmlBufferPtr out; /* an xmlBuffer for the output. */
8504 int n_out;
8505 xmlBufferPtr in; /* an xmlBuffer for the input */
8506 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008507
Daniel Veillardce682bc2004-11-05 17:22:25 +00008508 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8509 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8510 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8511 mem_base = xmlMemBlocks();
8512 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8513 out = gen_xmlBufferPtr(n_out, 1);
8514 in = gen_xmlBufferPtr(n_in, 2);
8515
8516 ret_val = xmlCharEncFirstLine(handler, out, in);
8517 desret_int(ret_val);
8518 call_tests++;
8519 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8520 des_xmlBufferPtr(n_out, out, 1);
8521 des_xmlBufferPtr(n_in, in, 2);
8522 xmlResetLastError();
8523 if (mem_base != xmlMemBlocks()) {
8524 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008526 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008527 printf(" %d", n_handler);
8528 printf(" %d", n_out);
8529 printf(" %d", n_in);
8530 printf("\n");
8531 }
8532 }
8533 }
8534 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008536
Daniel Veillard42595322004-11-08 10:52:06 +00008537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008538}
8539
8540
8541static int
8542test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008544
Daniel Veillardce682bc2004-11-05 17:22:25 +00008545 int mem_base;
8546 int ret_val;
8547 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8548 int n_handler;
8549 xmlBufferPtr out; /* an xmlBuffer for the output. */
8550 int n_out;
8551 xmlBufferPtr in; /* an xmlBuffer for the input */
8552 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008553
Daniel Veillardce682bc2004-11-05 17:22:25 +00008554 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8555 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8556 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8557 mem_base = xmlMemBlocks();
8558 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8559 out = gen_xmlBufferPtr(n_out, 1);
8560 in = gen_xmlBufferPtr(n_in, 2);
8561
8562 ret_val = xmlCharEncInFunc(handler, out, in);
8563 desret_int(ret_val);
8564 call_tests++;
8565 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8566 des_xmlBufferPtr(n_out, out, 1);
8567 des_xmlBufferPtr(n_in, in, 2);
8568 xmlResetLastError();
8569 if (mem_base != xmlMemBlocks()) {
8570 printf("Leak of %d blocks found in xmlCharEncInFunc",
8571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008572 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008573 printf(" %d", n_handler);
8574 printf(" %d", n_out);
8575 printf(" %d", n_in);
8576 printf("\n");
8577 }
8578 }
8579 }
8580 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008582
Daniel Veillard42595322004-11-08 10:52:06 +00008583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008584}
8585
8586
8587static int
8588test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008590
Daniel Veillardce682bc2004-11-05 17:22:25 +00008591 int mem_base;
8592 int ret_val;
8593 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8594 int n_handler;
8595 xmlBufferPtr out; /* an xmlBuffer for the output. */
8596 int n_out;
8597 xmlBufferPtr in; /* an xmlBuffer for the input */
8598 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008599
Daniel Veillardce682bc2004-11-05 17:22:25 +00008600 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8601 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8602 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8603 mem_base = xmlMemBlocks();
8604 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8605 out = gen_xmlBufferPtr(n_out, 1);
8606 in = gen_xmlBufferPtr(n_in, 2);
8607
8608 ret_val = xmlCharEncOutFunc(handler, out, in);
8609 desret_int(ret_val);
8610 call_tests++;
8611 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8612 des_xmlBufferPtr(n_out, out, 1);
8613 des_xmlBufferPtr(n_in, in, 2);
8614 xmlResetLastError();
8615 if (mem_base != xmlMemBlocks()) {
8616 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008619 printf(" %d", n_handler);
8620 printf(" %d", n_out);
8621 printf(" %d", n_in);
8622 printf("\n");
8623 }
8624 }
8625 }
8626 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008628
Daniel Veillard42595322004-11-08 10:52:06 +00008629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008630}
8631
8632
8633static int
8634test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008636
8637
8638
8639 xmlCleanupCharEncodingHandlers();
8640 call_tests++;
8641 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008643
Daniel Veillard42595322004-11-08 10:52:06 +00008644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008645}
8646
8647
8648static int
8649test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008651
8652 int mem_base;
8653
8654 mem_base = xmlMemBlocks();
8655
8656 xmlCleanupEncodingAliases();
8657 call_tests++;
8658 xmlResetLastError();
8659 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008660 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008663 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008666
Daniel Veillard42595322004-11-08 10:52:06 +00008667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008668}
8669
8670
8671static int
8672test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008674
8675 int mem_base;
8676 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008677 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008678 int n_alias;
8679
8680 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008682 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008683
William M. Brackf13f77f2004-11-12 16:03:48 +00008684 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685 desret_int(ret_val);
8686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008687 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008688 xmlResetLastError();
8689 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008690 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008692 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008693 printf(" %d", n_alias);
8694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695 }
8696 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008698
Daniel Veillard42595322004-11-08 10:52:06 +00008699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008700}
8701
8702
8703static int
8704test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008706
Daniel Veillardce682bc2004-11-05 17:22:25 +00008707 int mem_base;
8708 xmlCharEncoding ret_val;
8709 unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */
8710 int n_in;
8711 int len; /* pointer to the length of the buffer */
8712 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008713
Daniel Veillardce682bc2004-11-05 17:22:25 +00008714 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8715 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8716 mem_base = xmlMemBlocks();
8717 in = gen_const_unsigned_char_ptr(n_in, 0);
8718 len = gen_int(n_len, 1);
8719
William M. Brackf13f77f2004-11-12 16:03:48 +00008720 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008721 desret_xmlCharEncoding(ret_val);
8722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008723 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008724 des_int(n_len, len, 1);
8725 xmlResetLastError();
8726 if (mem_base != xmlMemBlocks()) {
8727 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008730 printf(" %d", n_in);
8731 printf(" %d", n_len);
8732 printf("\n");
8733 }
8734 }
8735 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008737
Daniel Veillard42595322004-11-08 10:52:06 +00008738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008739}
8740
8741
8742static int
8743test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008745
8746
8747 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008749}
8750
8751
8752static int
8753test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755
8756
8757 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759}
8760
8761
8762static int
8763test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765
Daniel Veillard3d97e662004-11-04 10:49:00 +00008766 int mem_base;
8767 const char * ret_val;
8768 xmlCharEncoding enc; /* the encoding */
8769 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008770
Daniel Veillard3d97e662004-11-04 10:49:00 +00008771 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8772 mem_base = xmlMemBlocks();
8773 enc = gen_xmlCharEncoding(n_enc, 0);
8774
8775 ret_val = xmlGetCharEncodingName(enc);
8776 desret_const_char_ptr(ret_val);
8777 call_tests++;
8778 des_xmlCharEncoding(n_enc, enc, 0);
8779 xmlResetLastError();
8780 if (mem_base != xmlMemBlocks()) {
8781 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008783 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008784 printf(" %d", n_enc);
8785 printf("\n");
8786 }
8787 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008788 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008789
Daniel Veillard42595322004-11-08 10:52:06 +00008790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791}
8792
8793
8794static int
8795test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008797
8798 int mem_base;
8799 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008800 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008801 int n_alias;
8802
8803 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008806
William M. Brackf13f77f2004-11-12 16:03:48 +00008807 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808 desret_const_char_ptr(ret_val);
8809 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008810 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008811 xmlResetLastError();
8812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008813 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008816 printf(" %d", n_alias);
8817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818 }
8819 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008820 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008821
Daniel Veillard42595322004-11-08 10:52:06 +00008822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008823}
8824
8825
8826static int
8827test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829
8830
8831
8832 xmlInitCharEncodingHandlers();
8833 call_tests++;
8834 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008836
Daniel Veillard42595322004-11-08 10:52:06 +00008837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008838}
8839
8840
8841static int
8842test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844
8845
8846 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008848}
8849
8850
8851static int
8852test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008854
Daniel Veillard3d97e662004-11-04 10:49:00 +00008855 int mem_base;
8856 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008857 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008858 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008859
Daniel Veillard3d97e662004-11-04 10:49:00 +00008860 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8861 mem_base = xmlMemBlocks();
8862 name = gen_const_char_ptr(n_name, 0);
8863
William M. Brackf13f77f2004-11-12 16:03:48 +00008864 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008865 desret_xmlCharEncoding(ret_val);
8866 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008867 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008868 xmlResetLastError();
8869 if (mem_base != xmlMemBlocks()) {
8870 printf("Leak of %d blocks found in xmlParseCharEncoding",
8871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008872 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008873 printf(" %d", n_name);
8874 printf("\n");
8875 }
8876 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008877 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008878
Daniel Veillard42595322004-11-08 10:52:06 +00008879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008880}
8881
8882
Daniel Veillardce682bc2004-11-05 17:22:25 +00008883#define gen_nb_xmlCharEncodingHandlerPtr 1
8884static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8885 return(NULL);
8886}
8887static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8888}
8889
Daniel Veillardd93f6252004-11-02 15:53:51 +00008890static int
8891test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008893
Daniel Veillardce682bc2004-11-05 17:22:25 +00008894 int mem_base;
8895 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8896 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008897
Daniel Veillardce682bc2004-11-05 17:22:25 +00008898 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8899 mem_base = xmlMemBlocks();
8900 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8901
8902 xmlRegisterCharEncodingHandler(handler);
8903 call_tests++;
8904 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8905 xmlResetLastError();
8906 if (mem_base != xmlMemBlocks()) {
8907 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008910 printf(" %d", n_handler);
8911 printf("\n");
8912 }
8913 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008914 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008915
Daniel Veillard42595322004-11-08 10:52:06 +00008916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008917}
8918
8919static int
8920test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008922
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008923 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008924 test_ret += test_UTF8Toisolat1();
8925 test_ret += test_isolat1ToUTF8();
8926 test_ret += test_xmlAddEncodingAlias();
8927 test_ret += test_xmlCharEncCloseFunc();
8928 test_ret += test_xmlCharEncFirstLine();
8929 test_ret += test_xmlCharEncInFunc();
8930 test_ret += test_xmlCharEncOutFunc();
8931 test_ret += test_xmlCleanupCharEncodingHandlers();
8932 test_ret += test_xmlCleanupEncodingAliases();
8933 test_ret += test_xmlDelEncodingAlias();
8934 test_ret += test_xmlDetectCharEncoding();
8935 test_ret += test_xmlFindCharEncodingHandler();
8936 test_ret += test_xmlGetCharEncodingHandler();
8937 test_ret += test_xmlGetCharEncodingName();
8938 test_ret += test_xmlGetEncodingAlias();
8939 test_ret += test_xmlInitCharEncodingHandlers();
8940 test_ret += test_xmlNewCharEncodingHandler();
8941 test_ret += test_xmlParseCharEncoding();
8942 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008943
Daniel Veillard42595322004-11-08 10:52:06 +00008944 if (test_ret != 0)
8945 printf("Module encoding: %d errors\n", test_ret);
8946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008947}
8948
8949static int
8950test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008953 int mem_base;
8954 xmlEntityPtr ret_val;
8955 xmlDocPtr doc; /* the document */
8956 int n_doc;
8957 xmlChar * name; /* the entity name */
8958 int n_name;
8959 int type; /* the entity type XML_xxx_yyy_ENTITY */
8960 int n_type;
8961 xmlChar * ExternalID; /* the entity external ID if available */
8962 int n_ExternalID;
8963 xmlChar * SystemID; /* the entity system ID if available */
8964 int n_SystemID;
8965 xmlChar * content; /* the entity content */
8966 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008967
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008968 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8969 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8970 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8971 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8972 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8973 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8974 mem_base = xmlMemBlocks();
8975 doc = gen_xmlDocPtr(n_doc, 0);
8976 name = gen_const_xmlChar_ptr(n_name, 1);
8977 type = gen_int(n_type, 2);
8978 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8979 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8980 content = gen_const_xmlChar_ptr(n_content, 5);
8981
William M. Brackf13f77f2004-11-12 16:03:48 +00008982 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008983 desret_xmlEntityPtr(ret_val);
8984 call_tests++;
8985 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008986 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008987 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008988 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8989 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8990 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008991 xmlResetLastError();
8992 if (mem_base != xmlMemBlocks()) {
8993 printf("Leak of %d blocks found in xmlAddDocEntity",
8994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008995 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008996 printf(" %d", n_doc);
8997 printf(" %d", n_name);
8998 printf(" %d", n_type);
8999 printf(" %d", n_ExternalID);
9000 printf(" %d", n_SystemID);
9001 printf(" %d", n_content);
9002 printf("\n");
9003 }
9004 }
9005 }
9006 }
9007 }
9008 }
9009 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009011
Daniel Veillard42595322004-11-08 10:52:06 +00009012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009013}
9014
9015
9016static int
9017test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009020 int mem_base;
9021 xmlEntityPtr ret_val;
9022 xmlDocPtr doc; /* the document */
9023 int n_doc;
9024 xmlChar * name; /* the entity name */
9025 int n_name;
9026 int type; /* the entity type XML_xxx_yyy_ENTITY */
9027 int n_type;
9028 xmlChar * ExternalID; /* the entity external ID if available */
9029 int n_ExternalID;
9030 xmlChar * SystemID; /* the entity system ID if available */
9031 int n_SystemID;
9032 xmlChar * content; /* the entity content */
9033 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009035 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9036 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9037 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9038 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9039 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9040 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9041 mem_base = xmlMemBlocks();
9042 doc = gen_xmlDocPtr(n_doc, 0);
9043 name = gen_const_xmlChar_ptr(n_name, 1);
9044 type = gen_int(n_type, 2);
9045 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9046 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9047 content = gen_const_xmlChar_ptr(n_content, 5);
9048
William M. Brackf13f77f2004-11-12 16:03:48 +00009049 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009050 desret_xmlEntityPtr(ret_val);
9051 call_tests++;
9052 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009053 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009054 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009055 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9056 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9057 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009058 xmlResetLastError();
9059 if (mem_base != xmlMemBlocks()) {
9060 printf("Leak of %d blocks found in xmlAddDtdEntity",
9061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009062 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009063 printf(" %d", n_doc);
9064 printf(" %d", n_name);
9065 printf(" %d", n_type);
9066 printf(" %d", n_ExternalID);
9067 printf(" %d", n_SystemID);
9068 printf(" %d", n_content);
9069 printf("\n");
9070 }
9071 }
9072 }
9073 }
9074 }
9075 }
9076 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009078
Daniel Veillard42595322004-11-08 10:52:06 +00009079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009080}
9081
9082
9083static int
9084test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009086
William M. Brack21e4ef22005-01-02 09:53:13 +00009087#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009088#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009089 int mem_base;
9090
9091 mem_base = xmlMemBlocks();
9092
9093 xmlCleanupPredefinedEntities();
9094 call_tests++;
9095 xmlResetLastError();
9096 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009097 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009099 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009102 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009103#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009104#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009105
Daniel Veillard42595322004-11-08 10:52:06 +00009106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009107}
9108
9109
Daniel Veillardce682bc2004-11-05 17:22:25 +00009110#define gen_nb_xmlEntitiesTablePtr 1
9111static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9112 return(NULL);
9113}
9114static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9115}
9116
Daniel Veillardd93f6252004-11-02 15:53:51 +00009117static int
9118test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009120
9121
9122 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009124}
9125
9126
9127static int
9128test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009130
9131
9132 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009134}
9135
9136
9137static int
9138test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009140
William M. Brack21e4ef22005-01-02 09:53:13 +00009141#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009142 int mem_base;
9143 xmlBufferPtr buf; /* An XML buffer. */
9144 int n_buf;
9145 xmlEntitiesTablePtr table; /* An entity table */
9146 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009147
Daniel Veillardce682bc2004-11-05 17:22:25 +00009148 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9149 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9150 mem_base = xmlMemBlocks();
9151 buf = gen_xmlBufferPtr(n_buf, 0);
9152 table = gen_xmlEntitiesTablePtr(n_table, 1);
9153
9154 xmlDumpEntitiesTable(buf, table);
9155 call_tests++;
9156 des_xmlBufferPtr(n_buf, buf, 0);
9157 des_xmlEntitiesTablePtr(n_table, table, 1);
9158 xmlResetLastError();
9159 if (mem_base != xmlMemBlocks()) {
9160 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009163 printf(" %d", n_buf);
9164 printf(" %d", n_table);
9165 printf("\n");
9166 }
9167 }
9168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009169 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009170#endif
9171
Daniel Veillard42595322004-11-08 10:52:06 +00009172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009173}
9174
9175
Daniel Veillardce682bc2004-11-05 17:22:25 +00009176#define gen_nb_xmlEntityPtr 1
9177static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9178 return(NULL);
9179}
9180static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9181}
9182
Daniel Veillardd93f6252004-11-02 15:53:51 +00009183static int
9184test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009186
William M. Brack21e4ef22005-01-02 09:53:13 +00009187#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009188 int mem_base;
9189 xmlBufferPtr buf; /* An XML buffer. */
9190 int n_buf;
9191 xmlEntityPtr ent; /* An entity table */
9192 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009193
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9195 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9196 mem_base = xmlMemBlocks();
9197 buf = gen_xmlBufferPtr(n_buf, 0);
9198 ent = gen_xmlEntityPtr(n_ent, 1);
9199
9200 xmlDumpEntityDecl(buf, ent);
9201 call_tests++;
9202 des_xmlBufferPtr(n_buf, buf, 0);
9203 des_xmlEntityPtr(n_ent, ent, 1);
9204 xmlResetLastError();
9205 if (mem_base != xmlMemBlocks()) {
9206 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009208 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009209 printf(" %d", n_buf);
9210 printf(" %d", n_ent);
9211 printf("\n");
9212 }
9213 }
9214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009215 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009216#endif
9217
Daniel Veillard42595322004-11-08 10:52:06 +00009218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219}
9220
9221
9222static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009223test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009225
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009226 int mem_base;
9227 xmlChar * ret_val;
9228 xmlDocPtr doc; /* the document containing the string */
9229 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009230 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009231 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009232
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9234 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9235 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009236 doc = gen_xmlDocPtr(n_doc, 0);
9237 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009238
William M. Brackf13f77f2004-11-12 16:03:48 +00009239 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009240 desret_xmlChar_ptr(ret_val);
9241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009242 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009243 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009244 xmlResetLastError();
9245 if (mem_base != xmlMemBlocks()) {
9246 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009248 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009249 printf(" %d", n_doc);
9250 printf(" %d", n_input);
9251 printf("\n");
9252 }
9253 }
9254 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009256
Daniel Veillard42595322004-11-08 10:52:06 +00009257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009258}
9259
9260
9261static int
9262test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009264
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009265 int mem_base;
9266 xmlChar * ret_val;
9267 xmlDocPtr doc; /* the document containing the string */
9268 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009269 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009270 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009271
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9273 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009275 doc = gen_xmlDocPtr(n_doc, 0);
9276 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009277
William M. Brackf13f77f2004-11-12 16:03:48 +00009278 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009279 desret_xmlChar_ptr(ret_val);
9280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009281 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009282 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009283 xmlResetLastError();
9284 if (mem_base != xmlMemBlocks()) {
9285 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009287 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009288 printf(" %d", n_doc);
9289 printf(" %d", n_input);
9290 printf("\n");
9291 }
9292 }
9293 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009294 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009295
Daniel Veillard42595322004-11-08 10:52:06 +00009296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009297}
9298
9299
9300static int
9301test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009303
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009304 int mem_base;
9305 xmlEntityPtr ret_val;
9306 xmlDocPtr doc; /* the document referencing the entity */
9307 int n_doc;
9308 xmlChar * name; /* the entity name */
9309 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009310
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9312 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9313 mem_base = xmlMemBlocks();
9314 doc = gen_xmlDocPtr(n_doc, 0);
9315 name = gen_const_xmlChar_ptr(n_name, 1);
9316
William M. Brackf13f77f2004-11-12 16:03:48 +00009317 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009318 desret_xmlEntityPtr(ret_val);
9319 call_tests++;
9320 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009321 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009322 xmlResetLastError();
9323 if (mem_base != xmlMemBlocks()) {
9324 printf("Leak of %d blocks found in xmlGetDocEntity",
9325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009326 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009327 printf(" %d", n_doc);
9328 printf(" %d", n_name);
9329 printf("\n");
9330 }
9331 }
9332 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009334
Daniel Veillard42595322004-11-08 10:52:06 +00009335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009336}
9337
9338
9339static int
9340test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009342
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009343 int mem_base;
9344 xmlEntityPtr ret_val;
9345 xmlDocPtr doc; /* the document referencing the entity */
9346 int n_doc;
9347 xmlChar * name; /* the entity name */
9348 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009349
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009350 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9351 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9352 mem_base = xmlMemBlocks();
9353 doc = gen_xmlDocPtr(n_doc, 0);
9354 name = gen_const_xmlChar_ptr(n_name, 1);
9355
William M. Brackf13f77f2004-11-12 16:03:48 +00009356 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009357 desret_xmlEntityPtr(ret_val);
9358 call_tests++;
9359 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009360 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009361 xmlResetLastError();
9362 if (mem_base != xmlMemBlocks()) {
9363 printf("Leak of %d blocks found in xmlGetDtdEntity",
9364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009365 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009366 printf(" %d", n_doc);
9367 printf(" %d", n_name);
9368 printf("\n");
9369 }
9370 }
9371 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009372 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009373
Daniel Veillard42595322004-11-08 10:52:06 +00009374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009375}
9376
9377
9378static int
9379test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009381
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009382 int mem_base;
9383 xmlEntityPtr ret_val;
9384 xmlDocPtr doc; /* the document referencing the entity */
9385 int n_doc;
9386 xmlChar * name; /* the entity name */
9387 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009388
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009389 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9391 mem_base = xmlMemBlocks();
9392 doc = gen_xmlDocPtr(n_doc, 0);
9393 name = gen_const_xmlChar_ptr(n_name, 1);
9394
William M. Brackf13f77f2004-11-12 16:03:48 +00009395 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009396 desret_xmlEntityPtr(ret_val);
9397 call_tests++;
9398 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009400 xmlResetLastError();
9401 if (mem_base != xmlMemBlocks()) {
9402 printf("Leak of %d blocks found in xmlGetParameterEntity",
9403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009404 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009405 printf(" %d", n_doc);
9406 printf(" %d", n_name);
9407 printf("\n");
9408 }
9409 }
9410 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009412
Daniel Veillard42595322004-11-08 10:52:06 +00009413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009414}
9415
9416
9417static int
9418test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009420
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009421 int mem_base;
9422 xmlEntityPtr ret_val;
9423 xmlChar * name; /* the entity name */
9424 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009425
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009426 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9427 mem_base = xmlMemBlocks();
9428 name = gen_const_xmlChar_ptr(n_name, 0);
9429
William M. Brackf13f77f2004-11-12 16:03:48 +00009430 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009431 desret_xmlEntityPtr(ret_val);
9432 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009433 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009434 xmlResetLastError();
9435 if (mem_base != xmlMemBlocks()) {
9436 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009438 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009439 printf(" %d", n_name);
9440 printf("\n");
9441 }
9442 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009444
Daniel Veillard42595322004-11-08 10:52:06 +00009445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009446}
9447
9448
9449static int
9450test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009452
William M. Brack21e4ef22005-01-02 09:53:13 +00009453#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009454#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009455 int mem_base;
9456
9457 mem_base = xmlMemBlocks();
9458
9459 xmlInitializePredefinedEntities();
9460 call_tests++;
9461 xmlResetLastError();
9462 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009463 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009465 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009466 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009468 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009469#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009470#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009471
Daniel Veillard42595322004-11-08 10:52:06 +00009472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009473}
9474
9475static int
9476test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009478
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009479 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009480 test_ret += test_xmlAddDocEntity();
9481 test_ret += test_xmlAddDtdEntity();
9482 test_ret += test_xmlCleanupPredefinedEntities();
9483 test_ret += test_xmlCopyEntitiesTable();
9484 test_ret += test_xmlCreateEntitiesTable();
9485 test_ret += test_xmlDumpEntitiesTable();
9486 test_ret += test_xmlDumpEntityDecl();
9487 test_ret += test_xmlEncodeEntitiesReentrant();
9488 test_ret += test_xmlEncodeSpecialChars();
9489 test_ret += test_xmlGetDocEntity();
9490 test_ret += test_xmlGetDtdEntity();
9491 test_ret += test_xmlGetParameterEntity();
9492 test_ret += test_xmlGetPredefinedEntity();
9493 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009494
Daniel Veillard42595322004-11-08 10:52:06 +00009495 if (test_ret != 0)
9496 printf("Module entities: %d errors\n", test_ret);
9497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009498}
9499
9500static int
9501test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009503
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009504 int mem_base;
9505 int ret_val;
9506 xmlHashTablePtr table; /* the hash table */
9507 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009508 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009509 int n_name;
9510 void * userdata; /* a pointer to the userdata */
9511 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009512
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009513 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9514 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9515 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009517 table = gen_xmlHashTablePtr(n_table, 0);
9518 name = gen_const_xmlChar_ptr(n_name, 1);
9519 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009520
William M. Brackf13f77f2004-11-12 16:03:48 +00009521 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009522 desret_int(ret_val);
9523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009524 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009525 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009526 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009527 xmlResetLastError();
9528 if (mem_base != xmlMemBlocks()) {
9529 printf("Leak of %d blocks found in xmlHashAddEntry",
9530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009531 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009532 printf(" %d", n_table);
9533 printf(" %d", n_name);
9534 printf(" %d", n_userdata);
9535 printf("\n");
9536 }
9537 }
9538 }
9539 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009541
Daniel Veillard42595322004-11-08 10:52:06 +00009542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009543}
9544
9545
9546static int
9547test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009549
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009550 int mem_base;
9551 int ret_val;
9552 xmlHashTablePtr table; /* the hash table */
9553 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009554 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009555 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009556 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009557 int n_name2;
9558 void * userdata; /* a pointer to the userdata */
9559 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009560
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009561 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9563 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9564 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009566 table = gen_xmlHashTablePtr(n_table, 0);
9567 name = gen_const_xmlChar_ptr(n_name, 1);
9568 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9569 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009570
William M. Brackf13f77f2004-11-12 16:03:48 +00009571 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009572 desret_int(ret_val);
9573 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009574 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009575 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9576 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009577 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009578 xmlResetLastError();
9579 if (mem_base != xmlMemBlocks()) {
9580 printf("Leak of %d blocks found in xmlHashAddEntry2",
9581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009582 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009583 printf(" %d", n_table);
9584 printf(" %d", n_name);
9585 printf(" %d", n_name2);
9586 printf(" %d", n_userdata);
9587 printf("\n");
9588 }
9589 }
9590 }
9591 }
9592 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009593 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009594
Daniel Veillard42595322004-11-08 10:52:06 +00009595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009596}
9597
9598
9599static int
9600test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009602
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009603 int mem_base;
9604 int ret_val;
9605 xmlHashTablePtr table; /* the hash table */
9606 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009607 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009608 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009609 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009610 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009611 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009612 int n_name3;
9613 void * userdata; /* a pointer to the userdata */
9614 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009615
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009616 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9617 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9618 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9619 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9620 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009622 table = gen_xmlHashTablePtr(n_table, 0);
9623 name = gen_const_xmlChar_ptr(n_name, 1);
9624 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9625 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9626 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009627
William M. Brackf13f77f2004-11-12 16:03:48 +00009628 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009629 desret_int(ret_val);
9630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009631 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009632 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9633 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9634 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009635 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009636 xmlResetLastError();
9637 if (mem_base != xmlMemBlocks()) {
9638 printf("Leak of %d blocks found in xmlHashAddEntry3",
9639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009640 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009641 printf(" %d", n_table);
9642 printf(" %d", n_name);
9643 printf(" %d", n_name2);
9644 printf(" %d", n_name3);
9645 printf(" %d", n_userdata);
9646 printf("\n");
9647 }
9648 }
9649 }
9650 }
9651 }
9652 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009653 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009654
Daniel Veillard42595322004-11-08 10:52:06 +00009655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009656}
9657
9658
9659static int
9660test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009662
9663
9664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009666}
9667
9668
9669static int
9670test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009672
9673
9674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009676}
9677
9678
9679static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009680test_xmlHashCreateDict(void) {
9681 int test_ret = 0;
9682
9683
9684 /* missing type support */
9685 return(test_ret);
9686}
9687
9688
9689static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009690test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009692
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009693 int mem_base;
9694 void * ret_val;
9695 xmlHashTablePtr table; /* the hash table */
9696 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009697 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009698 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009699
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009700 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9701 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009703 table = gen_xmlHashTablePtr(n_table, 0);
9704 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009705
William M. Brackf13f77f2004-11-12 16:03:48 +00009706 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009707 desret_void_ptr(ret_val);
9708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009709 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009710 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009711 xmlResetLastError();
9712 if (mem_base != xmlMemBlocks()) {
9713 printf("Leak of %d blocks found in xmlHashLookup",
9714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009715 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009716 printf(" %d", n_table);
9717 printf(" %d", n_name);
9718 printf("\n");
9719 }
9720 }
9721 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009722 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009723
Daniel Veillard42595322004-11-08 10:52:06 +00009724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009725}
9726
9727
9728static int
9729test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009731
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009732 int mem_base;
9733 void * ret_val;
9734 xmlHashTablePtr table; /* the hash table */
9735 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009736 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009737 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009738 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009739 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009740
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009741 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9742 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9743 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009745 table = gen_xmlHashTablePtr(n_table, 0);
9746 name = gen_const_xmlChar_ptr(n_name, 1);
9747 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009748
William M. Brackf13f77f2004-11-12 16:03:48 +00009749 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009750 desret_void_ptr(ret_val);
9751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009752 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009753 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9754 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009755 xmlResetLastError();
9756 if (mem_base != xmlMemBlocks()) {
9757 printf("Leak of %d blocks found in xmlHashLookup2",
9758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009759 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009760 printf(" %d", n_table);
9761 printf(" %d", n_name);
9762 printf(" %d", n_name2);
9763 printf("\n");
9764 }
9765 }
9766 }
9767 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009768 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009769
Daniel Veillard42595322004-11-08 10:52:06 +00009770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009771}
9772
9773
9774static int
9775test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009777
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009778 int mem_base;
9779 void * ret_val;
9780 xmlHashTablePtr table; /* the hash table */
9781 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009782 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009783 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009784 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009785 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009786 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009787 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009788
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009789 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9790 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9791 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9792 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009794 table = gen_xmlHashTablePtr(n_table, 0);
9795 name = gen_const_xmlChar_ptr(n_name, 1);
9796 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9797 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009798
William M. Brackf13f77f2004-11-12 16:03:48 +00009799 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009800 desret_void_ptr(ret_val);
9801 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009802 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009803 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9804 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9805 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009806 xmlResetLastError();
9807 if (mem_base != xmlMemBlocks()) {
9808 printf("Leak of %d blocks found in xmlHashLookup3",
9809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009810 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811 printf(" %d", n_table);
9812 printf(" %d", n_name);
9813 printf(" %d", n_name2);
9814 printf(" %d", n_name3);
9815 printf("\n");
9816 }
9817 }
9818 }
9819 }
9820 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009822
Daniel Veillard42595322004-11-08 10:52:06 +00009823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009824}
9825
9826
9827static int
9828test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009830
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009831 int mem_base;
9832 void * ret_val;
9833 xmlHashTablePtr table; /* the hash table */
9834 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009835 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009836 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009837 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009838 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009839
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009840 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9841 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9842 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009844 table = gen_xmlHashTablePtr(n_table, 0);
9845 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9846 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009847
William M. Brackf13f77f2004-11-12 16:03:48 +00009848 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009849 desret_void_ptr(ret_val);
9850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009851 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009852 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9853 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009854 xmlResetLastError();
9855 if (mem_base != xmlMemBlocks()) {
9856 printf("Leak of %d blocks found in xmlHashQLookup",
9857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009858 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009859 printf(" %d", n_table);
9860 printf(" %d", n_prefix);
9861 printf(" %d", n_name);
9862 printf("\n");
9863 }
9864 }
9865 }
9866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009868
Daniel Veillard42595322004-11-08 10:52:06 +00009869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009870}
9871
9872
9873static int
9874test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009876
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009877 int mem_base;
9878 void * ret_val;
9879 xmlHashTablePtr table; /* the hash table */
9880 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009881 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009882 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009883 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009884 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009885 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009886 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009887 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009888 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009889
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009890 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9891 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9892 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9893 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9894 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009896 table = gen_xmlHashTablePtr(n_table, 0);
9897 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9898 name = gen_const_xmlChar_ptr(n_name, 2);
9899 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9900 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009901
William M. Brackf13f77f2004-11-12 16:03:48 +00009902 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009903 desret_void_ptr(ret_val);
9904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009905 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009906 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9907 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9908 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9909 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 xmlResetLastError();
9911 if (mem_base != xmlMemBlocks()) {
9912 printf("Leak of %d blocks found in xmlHashQLookup2",
9913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009914 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009915 printf(" %d", n_table);
9916 printf(" %d", n_prefix);
9917 printf(" %d", n_name);
9918 printf(" %d", n_prefix2);
9919 printf(" %d", n_name2);
9920 printf("\n");
9921 }
9922 }
9923 }
9924 }
9925 }
9926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009928
Daniel Veillard42595322004-11-08 10:52:06 +00009929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009930}
9931
9932
9933static int
9934test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009937 int mem_base;
9938 void * ret_val;
9939 xmlHashTablePtr table; /* the hash table */
9940 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009941 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009942 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009943 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009944 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009945 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009946 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009947 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009948 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009949 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009950 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009951 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009952 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009953
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009954 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9955 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9956 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9957 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9958 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9959 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9960 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009962 table = gen_xmlHashTablePtr(n_table, 0);
9963 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9964 name = gen_const_xmlChar_ptr(n_name, 2);
9965 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9966 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9967 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9968 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009969
William M. Brackf13f77f2004-11-12 16:03:48 +00009970 ret_val = xmlHashQLookup3(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009971 desret_void_ptr(ret_val);
9972 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009973 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009974 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9975 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9976 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9977 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9978 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9979 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009980 xmlResetLastError();
9981 if (mem_base != xmlMemBlocks()) {
9982 printf("Leak of %d blocks found in xmlHashQLookup3",
9983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009984 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009985 printf(" %d", n_table);
9986 printf(" %d", n_prefix);
9987 printf(" %d", n_name);
9988 printf(" %d", n_prefix2);
9989 printf(" %d", n_name2);
9990 printf(" %d", n_prefix3);
9991 printf(" %d", n_name3);
9992 printf("\n");
9993 }
9994 }
9995 }
9996 }
9997 }
9998 }
9999 }
10000 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010001 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010002
Daniel Veillard42595322004-11-08 10:52:06 +000010003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010004}
10005
10006
10007static int
10008test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010010
Daniel Veillard42595322004-11-08 10:52:06 +000010011 int mem_base;
10012 int ret_val;
10013 xmlHashTablePtr table; /* the hash table */
10014 int n_table;
10015 xmlChar * name; /* the name of the userdata */
10016 int n_name;
10017 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10018 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010019
Daniel Veillard42595322004-11-08 10:52:06 +000010020 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10021 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10022 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10023 mem_base = xmlMemBlocks();
10024 table = gen_xmlHashTablePtr(n_table, 0);
10025 name = gen_const_xmlChar_ptr(n_name, 1);
10026 f = gen_xmlHashDeallocator(n_f, 2);
10027
William M. Brackf13f77f2004-11-12 16:03:48 +000010028 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010029 desret_int(ret_val);
10030 call_tests++;
10031 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010033 des_xmlHashDeallocator(n_f, f, 2);
10034 xmlResetLastError();
10035 if (mem_base != xmlMemBlocks()) {
10036 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10037 xmlMemBlocks() - mem_base);
10038 test_ret++;
10039 printf(" %d", n_table);
10040 printf(" %d", n_name);
10041 printf(" %d", n_f);
10042 printf("\n");
10043 }
10044 }
10045 }
10046 }
Daniel Veillard42595322004-11-08 10:52:06 +000010047 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010048
Daniel Veillard42595322004-11-08 10:52:06 +000010049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010050}
10051
10052
10053static int
10054test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010056
Daniel Veillard42595322004-11-08 10:52:06 +000010057 int mem_base;
10058 int ret_val;
10059 xmlHashTablePtr table; /* the hash table */
10060 int n_table;
10061 xmlChar * name; /* the name of the userdata */
10062 int n_name;
10063 xmlChar * name2; /* a second name of the userdata */
10064 int n_name2;
10065 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10066 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010067
Daniel Veillard42595322004-11-08 10:52:06 +000010068 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10069 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10070 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10071 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10072 mem_base = xmlMemBlocks();
10073 table = gen_xmlHashTablePtr(n_table, 0);
10074 name = gen_const_xmlChar_ptr(n_name, 1);
10075 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10076 f = gen_xmlHashDeallocator(n_f, 3);
10077
William M. Brackf13f77f2004-11-12 16:03:48 +000010078 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010079 desret_int(ret_val);
10080 call_tests++;
10081 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010082 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10083 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010084 des_xmlHashDeallocator(n_f, f, 3);
10085 xmlResetLastError();
10086 if (mem_base != xmlMemBlocks()) {
10087 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10088 xmlMemBlocks() - mem_base);
10089 test_ret++;
10090 printf(" %d", n_table);
10091 printf(" %d", n_name);
10092 printf(" %d", n_name2);
10093 printf(" %d", n_f);
10094 printf("\n");
10095 }
10096 }
10097 }
10098 }
10099 }
Daniel Veillard42595322004-11-08 10:52:06 +000010100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010101
Daniel Veillard42595322004-11-08 10:52:06 +000010102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010103}
10104
10105
10106static int
10107test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109
Daniel Veillard42595322004-11-08 10:52:06 +000010110 int mem_base;
10111 int ret_val;
10112 xmlHashTablePtr table; /* the hash table */
10113 int n_table;
10114 xmlChar * name; /* the name of the userdata */
10115 int n_name;
10116 xmlChar * name2; /* a second name of the userdata */
10117 int n_name2;
10118 xmlChar * name3; /* a third name of the userdata */
10119 int n_name3;
10120 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10121 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010122
Daniel Veillard42595322004-11-08 10:52:06 +000010123 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10124 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10125 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10126 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10127 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10128 mem_base = xmlMemBlocks();
10129 table = gen_xmlHashTablePtr(n_table, 0);
10130 name = gen_const_xmlChar_ptr(n_name, 1);
10131 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10132 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10133 f = gen_xmlHashDeallocator(n_f, 4);
10134
William M. Brackf13f77f2004-11-12 16:03:48 +000010135 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010136 desret_int(ret_val);
10137 call_tests++;
10138 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010139 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10140 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10141 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010142 des_xmlHashDeallocator(n_f, f, 4);
10143 xmlResetLastError();
10144 if (mem_base != xmlMemBlocks()) {
10145 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10146 xmlMemBlocks() - mem_base);
10147 test_ret++;
10148 printf(" %d", n_table);
10149 printf(" %d", n_name);
10150 printf(" %d", n_name2);
10151 printf(" %d", n_name3);
10152 printf(" %d", n_f);
10153 printf("\n");
10154 }
10155 }
10156 }
10157 }
10158 }
10159 }
Daniel Veillard42595322004-11-08 10:52:06 +000010160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010161
Daniel Veillard42595322004-11-08 10:52:06 +000010162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010163}
10164
10165
10166static int
10167test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010169
10170
10171 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010173}
10174
10175
10176static int
10177test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010179
10180
10181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010183}
10184
10185
10186static int
10187test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010189
10190
10191 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010193}
10194
10195
10196static int
10197test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010199
10200
10201 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010203}
10204
10205
10206static int
10207test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010209
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010210 int mem_base;
10211 int ret_val;
10212 xmlHashTablePtr table; /* the hash table */
10213 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010214
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010215 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010217 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010218
10219 ret_val = xmlHashSize(table);
10220 desret_int(ret_val);
10221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010222 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010223 xmlResetLastError();
10224 if (mem_base != xmlMemBlocks()) {
10225 printf("Leak of %d blocks found in xmlHashSize",
10226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010227 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010228 printf(" %d", n_table);
10229 printf("\n");
10230 }
10231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010233
Daniel Veillard42595322004-11-08 10:52:06 +000010234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010235}
10236
10237
10238static int
10239test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010241
Daniel Veillard42595322004-11-08 10:52:06 +000010242 int mem_base;
10243 int ret_val;
10244 xmlHashTablePtr table; /* the hash table */
10245 int n_table;
10246 xmlChar * name; /* the name of the userdata */
10247 int n_name;
10248 void * userdata; /* a pointer to the userdata */
10249 int n_userdata;
10250 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10251 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010252
Daniel Veillard42595322004-11-08 10:52:06 +000010253 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10254 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10255 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10256 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10257 mem_base = xmlMemBlocks();
10258 table = gen_xmlHashTablePtr(n_table, 0);
10259 name = gen_const_xmlChar_ptr(n_name, 1);
10260 userdata = gen_userdata(n_userdata, 2);
10261 f = gen_xmlHashDeallocator(n_f, 3);
10262
William M. Brackf13f77f2004-11-12 16:03:48 +000010263 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010264 desret_int(ret_val);
10265 call_tests++;
10266 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010267 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010268 des_userdata(n_userdata, userdata, 2);
10269 des_xmlHashDeallocator(n_f, f, 3);
10270 xmlResetLastError();
10271 if (mem_base != xmlMemBlocks()) {
10272 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10273 xmlMemBlocks() - mem_base);
10274 test_ret++;
10275 printf(" %d", n_table);
10276 printf(" %d", n_name);
10277 printf(" %d", n_userdata);
10278 printf(" %d", n_f);
10279 printf("\n");
10280 }
10281 }
10282 }
10283 }
10284 }
Daniel Veillard42595322004-11-08 10:52:06 +000010285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010286
Daniel Veillard42595322004-11-08 10:52:06 +000010287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010288}
10289
10290
10291static int
10292test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010294
Daniel Veillard42595322004-11-08 10:52:06 +000010295 int mem_base;
10296 int ret_val;
10297 xmlHashTablePtr table; /* the hash table */
10298 int n_table;
10299 xmlChar * name; /* the name of the userdata */
10300 int n_name;
10301 xmlChar * name2; /* a second name of the userdata */
10302 int n_name2;
10303 void * userdata; /* a pointer to the userdata */
10304 int n_userdata;
10305 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10306 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010307
Daniel Veillard42595322004-11-08 10:52:06 +000010308 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10310 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10311 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10312 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10313 mem_base = xmlMemBlocks();
10314 table = gen_xmlHashTablePtr(n_table, 0);
10315 name = gen_const_xmlChar_ptr(n_name, 1);
10316 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10317 userdata = gen_userdata(n_userdata, 3);
10318 f = gen_xmlHashDeallocator(n_f, 4);
10319
William M. Brackf13f77f2004-11-12 16:03:48 +000010320 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010321 desret_int(ret_val);
10322 call_tests++;
10323 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010324 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10325 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010326 des_userdata(n_userdata, userdata, 3);
10327 des_xmlHashDeallocator(n_f, f, 4);
10328 xmlResetLastError();
10329 if (mem_base != xmlMemBlocks()) {
10330 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10331 xmlMemBlocks() - mem_base);
10332 test_ret++;
10333 printf(" %d", n_table);
10334 printf(" %d", n_name);
10335 printf(" %d", n_name2);
10336 printf(" %d", n_userdata);
10337 printf(" %d", n_f);
10338 printf("\n");
10339 }
10340 }
10341 }
10342 }
10343 }
10344 }
Daniel Veillard42595322004-11-08 10:52:06 +000010345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010346
Daniel Veillard42595322004-11-08 10:52:06 +000010347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010348}
10349
10350
10351static int
10352test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010354
Daniel Veillard42595322004-11-08 10:52:06 +000010355 int mem_base;
10356 int ret_val;
10357 xmlHashTablePtr table; /* the hash table */
10358 int n_table;
10359 xmlChar * name; /* the name of the userdata */
10360 int n_name;
10361 xmlChar * name2; /* a second name of the userdata */
10362 int n_name2;
10363 xmlChar * name3; /* a third name of the userdata */
10364 int n_name3;
10365 void * userdata; /* a pointer to the userdata */
10366 int n_userdata;
10367 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10368 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010369
Daniel Veillard42595322004-11-08 10:52:06 +000010370 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10372 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10373 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10374 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10375 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10376 mem_base = xmlMemBlocks();
10377 table = gen_xmlHashTablePtr(n_table, 0);
10378 name = gen_const_xmlChar_ptr(n_name, 1);
10379 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10380 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10381 userdata = gen_userdata(n_userdata, 4);
10382 f = gen_xmlHashDeallocator(n_f, 5);
10383
William M. Brackf13f77f2004-11-12 16:03:48 +000010384 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010385 desret_int(ret_val);
10386 call_tests++;
10387 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010388 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10389 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10390 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010391 des_userdata(n_userdata, userdata, 4);
10392 des_xmlHashDeallocator(n_f, f, 5);
10393 xmlResetLastError();
10394 if (mem_base != xmlMemBlocks()) {
10395 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10396 xmlMemBlocks() - mem_base);
10397 test_ret++;
10398 printf(" %d", n_table);
10399 printf(" %d", n_name);
10400 printf(" %d", n_name2);
10401 printf(" %d", n_name3);
10402 printf(" %d", n_userdata);
10403 printf(" %d", n_f);
10404 printf("\n");
10405 }
10406 }
10407 }
10408 }
10409 }
10410 }
10411 }
Daniel Veillard42595322004-11-08 10:52:06 +000010412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010413
Daniel Veillard42595322004-11-08 10:52:06 +000010414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010415}
10416
10417static int
10418test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010420
Daniel Veillard2ae13382005-01-25 23:45:06 +000010421 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010422 test_ret += test_xmlHashAddEntry();
10423 test_ret += test_xmlHashAddEntry2();
10424 test_ret += test_xmlHashAddEntry3();
10425 test_ret += test_xmlHashCopy();
10426 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010427 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010428 test_ret += test_xmlHashLookup();
10429 test_ret += test_xmlHashLookup2();
10430 test_ret += test_xmlHashLookup3();
10431 test_ret += test_xmlHashQLookup();
10432 test_ret += test_xmlHashQLookup2();
10433 test_ret += test_xmlHashQLookup3();
10434 test_ret += test_xmlHashRemoveEntry();
10435 test_ret += test_xmlHashRemoveEntry2();
10436 test_ret += test_xmlHashRemoveEntry3();
10437 test_ret += test_xmlHashScan();
10438 test_ret += test_xmlHashScan3();
10439 test_ret += test_xmlHashScanFull();
10440 test_ret += test_xmlHashScanFull3();
10441 test_ret += test_xmlHashSize();
10442 test_ret += test_xmlHashUpdateEntry();
10443 test_ret += test_xmlHashUpdateEntry2();
10444 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010445
Daniel Veillard42595322004-11-08 10:52:06 +000010446 if (test_ret != 0)
10447 printf("Module hash: %d errors\n", test_ret);
10448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010449}
10450
Daniel Veillardce682bc2004-11-05 17:22:25 +000010451#define gen_nb_xmlLinkPtr 1
10452static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10453 return(NULL);
10454}
10455static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10456}
10457
Daniel Veillardd93f6252004-11-02 15:53:51 +000010458static int
10459test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461
Daniel Veillardce682bc2004-11-05 17:22:25 +000010462 int mem_base;
10463 void * ret_val;
10464 xmlLinkPtr lk; /* a link */
10465 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010466
Daniel Veillardce682bc2004-11-05 17:22:25 +000010467 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10468 mem_base = xmlMemBlocks();
10469 lk = gen_xmlLinkPtr(n_lk, 0);
10470
10471 ret_val = xmlLinkGetData(lk);
10472 desret_void_ptr(ret_val);
10473 call_tests++;
10474 des_xmlLinkPtr(n_lk, lk, 0);
10475 xmlResetLastError();
10476 if (mem_base != xmlMemBlocks()) {
10477 printf("Leak of %d blocks found in xmlLinkGetData",
10478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010479 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010480 printf(" %d", n_lk);
10481 printf("\n");
10482 }
10483 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010485
Daniel Veillard42595322004-11-08 10:52:06 +000010486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010487}
10488
10489
10490static int
10491test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010493
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010494 int mem_base;
10495 int ret_val;
10496 xmlListPtr l; /* a list */
10497 int n_l;
10498 void * data; /* the data */
10499 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010500
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010501 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10502 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010504 l = gen_xmlListPtr(n_l, 0);
10505 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010506
10507 ret_val = xmlListAppend(l, data);
10508 desret_int(ret_val);
10509 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010510 des_xmlListPtr(n_l, l, 0);
10511 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010512 xmlResetLastError();
10513 if (mem_base != xmlMemBlocks()) {
10514 printf("Leak of %d blocks found in xmlListAppend",
10515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010516 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010517 printf(" %d", n_l);
10518 printf(" %d", n_data);
10519 printf("\n");
10520 }
10521 }
10522 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010524
Daniel Veillard42595322004-11-08 10:52:06 +000010525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010526}
10527
10528
10529static int
10530test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010532
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010533 int mem_base;
10534 xmlListPtr l; /* a list */
10535 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010536
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010537 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010539 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010540
10541 xmlListClear(l);
10542 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010543 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010544 xmlResetLastError();
10545 if (mem_base != xmlMemBlocks()) {
10546 printf("Leak of %d blocks found in xmlListClear",
10547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010548 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010549 printf(" %d", n_l);
10550 printf("\n");
10551 }
10552 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010554
Daniel Veillard42595322004-11-08 10:52:06 +000010555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010556}
10557
10558
Daniel Veillardce682bc2004-11-05 17:22:25 +000010559#define gen_nb_const_xmlListPtr 1
10560static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10561 return(NULL);
10562}
10563static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10564}
10565
Daniel Veillardd93f6252004-11-02 15:53:51 +000010566static int
10567test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010569
Daniel Veillardce682bc2004-11-05 17:22:25 +000010570 int mem_base;
10571 int ret_val;
10572 xmlListPtr cur; /* the new list */
10573 int n_cur;
10574 xmlListPtr old; /* the old list */
10575 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576
Daniel Veillardce682bc2004-11-05 17:22:25 +000010577 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10578 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10579 mem_base = xmlMemBlocks();
10580 cur = gen_xmlListPtr(n_cur, 0);
10581 old = gen_const_xmlListPtr(n_old, 1);
10582
William M. Brackf13f77f2004-11-12 16:03:48 +000010583 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010584 desret_int(ret_val);
10585 call_tests++;
10586 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010587 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010588 xmlResetLastError();
10589 if (mem_base != xmlMemBlocks()) {
10590 printf("Leak of %d blocks found in xmlListCopy",
10591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010592 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010593 printf(" %d", n_cur);
10594 printf(" %d", n_old);
10595 printf("\n");
10596 }
10597 }
10598 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010599 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010600
Daniel Veillard42595322004-11-08 10:52:06 +000010601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010602}
10603
10604
10605static int
10606test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010608
10609
10610 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010612}
10613
10614
10615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010616test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010618
10619
10620 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010622}
10623
10624
10625static int
10626test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010629 int mem_base;
10630 int ret_val;
10631 xmlListPtr l; /* a list */
10632 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010633
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010634 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010636 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010637
10638 ret_val = xmlListEmpty(l);
10639 desret_int(ret_val);
10640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010641 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010642 xmlResetLastError();
10643 if (mem_base != xmlMemBlocks()) {
10644 printf("Leak of %d blocks found in xmlListEmpty",
10645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010646 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010647 printf(" %d", n_l);
10648 printf("\n");
10649 }
10650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010652
Daniel Veillard42595322004-11-08 10:52:06 +000010653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654}
10655
10656
10657static int
10658test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010660
10661
10662 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010664}
10665
10666
10667static int
10668test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010670
10671
10672 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010674}
10675
10676
10677static int
10678test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010680
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010681 int mem_base;
10682 int ret_val;
10683 xmlListPtr l; /* a list */
10684 int n_l;
10685 void * data; /* the data */
10686 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010687
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010688 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10689 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010691 l = gen_xmlListPtr(n_l, 0);
10692 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010693
10694 ret_val = xmlListInsert(l, data);
10695 desret_int(ret_val);
10696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010697 des_xmlListPtr(n_l, l, 0);
10698 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010699 xmlResetLastError();
10700 if (mem_base != xmlMemBlocks()) {
10701 printf("Leak of %d blocks found in xmlListInsert",
10702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010703 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010704 printf(" %d", n_l);
10705 printf(" %d", n_data);
10706 printf("\n");
10707 }
10708 }
10709 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010710 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010711
Daniel Veillard42595322004-11-08 10:52:06 +000010712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010713}
10714
10715
10716static int
10717test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010719
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720 int mem_base;
10721 xmlListPtr l1; /* the original list */
10722 int n_l1;
10723 xmlListPtr l2; /* the new list */
10724 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010725
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010726 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10727 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010729 l1 = gen_xmlListPtr(n_l1, 0);
10730 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010731
10732 xmlListMerge(l1, l2);
10733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010734 des_xmlListPtr(n_l1, l1, 0);
10735 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010736 xmlResetLastError();
10737 if (mem_base != xmlMemBlocks()) {
10738 printf("Leak of %d blocks found in xmlListMerge",
10739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010740 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010741 printf(" %d", n_l1);
10742 printf(" %d", n_l2);
10743 printf("\n");
10744 }
10745 }
10746 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010747 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010748
Daniel Veillard42595322004-11-08 10:52:06 +000010749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010750}
10751
10752
10753static int
10754test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010756
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010757 int mem_base;
10758 xmlListPtr l; /* a list */
10759 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010760
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010761 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010763 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010764
10765 xmlListPopBack(l);
10766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010767 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010768 xmlResetLastError();
10769 if (mem_base != xmlMemBlocks()) {
10770 printf("Leak of %d blocks found in xmlListPopBack",
10771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010772 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010773 printf(" %d", n_l);
10774 printf("\n");
10775 }
10776 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010778
Daniel Veillard42595322004-11-08 10:52:06 +000010779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780}
10781
10782
10783static int
10784test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010786
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010787 int mem_base;
10788 xmlListPtr l; /* a list */
10789 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010790
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010791 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010793 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010794
10795 xmlListPopFront(l);
10796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010798 xmlResetLastError();
10799 if (mem_base != xmlMemBlocks()) {
10800 printf("Leak of %d blocks found in xmlListPopFront",
10801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010802 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803 printf(" %d", n_l);
10804 printf("\n");
10805 }
10806 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010807 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010808
Daniel Veillard42595322004-11-08 10:52:06 +000010809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010810}
10811
10812
10813static int
10814test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010816
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010817 int mem_base;
10818 int ret_val;
10819 xmlListPtr l; /* a list */
10820 int n_l;
10821 void * data; /* new data */
10822 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10825 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010827 l = gen_xmlListPtr(n_l, 0);
10828 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010829
10830 ret_val = xmlListPushBack(l, data);
10831 desret_int(ret_val);
10832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010833 des_xmlListPtr(n_l, l, 0);
10834 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010835 xmlResetLastError();
10836 if (mem_base != xmlMemBlocks()) {
10837 printf("Leak of %d blocks found in xmlListPushBack",
10838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010839 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010840 printf(" %d", n_l);
10841 printf(" %d", n_data);
10842 printf("\n");
10843 }
10844 }
10845 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010846 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010847
Daniel Veillard42595322004-11-08 10:52:06 +000010848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010849}
10850
10851
10852static int
10853test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010855
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010856 int mem_base;
10857 int ret_val;
10858 xmlListPtr l; /* a list */
10859 int n_l;
10860 void * data; /* new data */
10861 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010863 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10864 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10865 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010866 l = gen_xmlListPtr(n_l, 0);
10867 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010868
10869 ret_val = xmlListPushFront(l, data);
10870 desret_int(ret_val);
10871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010872 des_xmlListPtr(n_l, l, 0);
10873 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010874 xmlResetLastError();
10875 if (mem_base != xmlMemBlocks()) {
10876 printf("Leak of %d blocks found in xmlListPushFront",
10877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010878 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010879 printf(" %d", n_l);
10880 printf(" %d", n_data);
10881 printf("\n");
10882 }
10883 }
10884 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010885 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010886
Daniel Veillard42595322004-11-08 10:52:06 +000010887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010888}
10889
10890
10891static int
10892test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010894
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010895 int mem_base;
10896 int ret_val;
10897 xmlListPtr l; /* a list */
10898 int n_l;
10899 void * data; /* list data */
10900 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010902 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10903 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010905 l = gen_xmlListPtr(n_l, 0);
10906 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010907
10908 ret_val = xmlListRemoveAll(l, data);
10909 desret_int(ret_val);
10910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010911 des_xmlListPtr(n_l, l, 0);
10912 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010913 xmlResetLastError();
10914 if (mem_base != xmlMemBlocks()) {
10915 printf("Leak of %d blocks found in xmlListRemoveAll",
10916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010917 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010918 printf(" %d", n_l);
10919 printf(" %d", n_data);
10920 printf("\n");
10921 }
10922 }
10923 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010924 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010925
Daniel Veillard42595322004-11-08 10:52:06 +000010926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010927}
10928
10929
10930static int
10931test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010933
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010934 int mem_base;
10935 int ret_val;
10936 xmlListPtr l; /* a list */
10937 int n_l;
10938 void * data; /* list data */
10939 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010940
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010941 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10942 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010944 l = gen_xmlListPtr(n_l, 0);
10945 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010946
10947 ret_val = xmlListRemoveFirst(l, data);
10948 desret_int(ret_val);
10949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010950 des_xmlListPtr(n_l, l, 0);
10951 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010952 xmlResetLastError();
10953 if (mem_base != xmlMemBlocks()) {
10954 printf("Leak of %d blocks found in xmlListRemoveFirst",
10955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010956 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010957 printf(" %d", n_l);
10958 printf(" %d", n_data);
10959 printf("\n");
10960 }
10961 }
10962 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010963 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010964
Daniel Veillard42595322004-11-08 10:52:06 +000010965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010966}
10967
10968
10969static int
10970test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010973 int mem_base;
10974 int ret_val;
10975 xmlListPtr l; /* a list */
10976 int n_l;
10977 void * data; /* list data */
10978 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010979
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010980 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10981 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10982 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010983 l = gen_xmlListPtr(n_l, 0);
10984 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010985
10986 ret_val = xmlListRemoveLast(l, data);
10987 desret_int(ret_val);
10988 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010989 des_xmlListPtr(n_l, l, 0);
10990 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010991 xmlResetLastError();
10992 if (mem_base != xmlMemBlocks()) {
10993 printf("Leak of %d blocks found in xmlListRemoveLast",
10994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010995 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010996 printf(" %d", n_l);
10997 printf(" %d", n_data);
10998 printf("\n");
10999 }
11000 }
11001 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011002 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011003
Daniel Veillard42595322004-11-08 10:52:06 +000011004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011005}
11006
11007
11008static int
11009test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011012 int mem_base;
11013 xmlListPtr l; /* a list */
11014 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011015
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011016 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011018 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011019
11020 xmlListReverse(l);
11021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011022 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011023 xmlResetLastError();
11024 if (mem_base != xmlMemBlocks()) {
11025 printf("Leak of %d blocks found in xmlListReverse",
11026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011027 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011028 printf(" %d", n_l);
11029 printf("\n");
11030 }
11031 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011033
Daniel Veillard42595322004-11-08 10:52:06 +000011034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011035}
11036
11037
11038static int
11039test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011041
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011042 int mem_base;
11043 void * ret_val;
11044 xmlListPtr l; /* a list */
11045 int n_l;
11046 void * data; /* a search value */
11047 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011048
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011049 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11050 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11051 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011052 l = gen_xmlListPtr(n_l, 0);
11053 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011054
11055 ret_val = xmlListReverseSearch(l, data);
11056 desret_void_ptr(ret_val);
11057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011058 des_xmlListPtr(n_l, l, 0);
11059 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011060 xmlResetLastError();
11061 if (mem_base != xmlMemBlocks()) {
11062 printf("Leak of %d blocks found in xmlListReverseSearch",
11063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011064 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011065 printf(" %d", n_l);
11066 printf(" %d", n_data);
11067 printf("\n");
11068 }
11069 }
11070 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011072
Daniel Veillard42595322004-11-08 10:52:06 +000011073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011074}
11075
11076
11077static int
11078test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011080
11081
11082 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011084}
11085
11086
11087static int
11088test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011090
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011091 int mem_base;
11092 void * ret_val;
11093 xmlListPtr l; /* a list */
11094 int n_l;
11095 void * data; /* a search value */
11096 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011097
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011098 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11099 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 l = gen_xmlListPtr(n_l, 0);
11102 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011103
11104 ret_val = xmlListSearch(l, data);
11105 desret_void_ptr(ret_val);
11106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011107 des_xmlListPtr(n_l, l, 0);
11108 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011109 xmlResetLastError();
11110 if (mem_base != xmlMemBlocks()) {
11111 printf("Leak of %d blocks found in xmlListSearch",
11112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011113 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011114 printf(" %d", n_l);
11115 printf(" %d", n_data);
11116 printf("\n");
11117 }
11118 }
11119 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011121
Daniel Veillard42595322004-11-08 10:52:06 +000011122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011123}
11124
11125
11126static int
11127test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011130 int mem_base;
11131 int ret_val;
11132 xmlListPtr l; /* a list */
11133 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011134
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011135 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11136 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011137 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011138
11139 ret_val = xmlListSize(l);
11140 desret_int(ret_val);
11141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011142 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011143 xmlResetLastError();
11144 if (mem_base != xmlMemBlocks()) {
11145 printf("Leak of %d blocks found in xmlListSize",
11146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011147 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011148 printf(" %d", n_l);
11149 printf("\n");
11150 }
11151 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011152 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011153
Daniel Veillard42595322004-11-08 10:52:06 +000011154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011155}
11156
11157
11158static int
11159test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011161
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011162 int mem_base;
11163 xmlListPtr l; /* a list */
11164 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011165
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011166 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011168 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011169
11170 xmlListSort(l);
11171 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011172 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011173 xmlResetLastError();
11174 if (mem_base != xmlMemBlocks()) {
11175 printf("Leak of %d blocks found in xmlListSort",
11176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011177 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011178 printf(" %d", n_l);
11179 printf("\n");
11180 }
11181 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011182 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011183
Daniel Veillard42595322004-11-08 10:52:06 +000011184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011185}
11186
11187
11188static int
11189test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011191
11192
11193 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011195}
11196
11197static int
11198test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011200
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011201 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011202 test_ret += test_xmlLinkGetData();
11203 test_ret += test_xmlListAppend();
11204 test_ret += test_xmlListClear();
11205 test_ret += test_xmlListCopy();
11206 test_ret += test_xmlListCreate();
11207 test_ret += test_xmlListDup();
11208 test_ret += test_xmlListEmpty();
11209 test_ret += test_xmlListEnd();
11210 test_ret += test_xmlListFront();
11211 test_ret += test_xmlListInsert();
11212 test_ret += test_xmlListMerge();
11213 test_ret += test_xmlListPopBack();
11214 test_ret += test_xmlListPopFront();
11215 test_ret += test_xmlListPushBack();
11216 test_ret += test_xmlListPushFront();
11217 test_ret += test_xmlListRemoveAll();
11218 test_ret += test_xmlListRemoveFirst();
11219 test_ret += test_xmlListRemoveLast();
11220 test_ret += test_xmlListReverse();
11221 test_ret += test_xmlListReverseSearch();
11222 test_ret += test_xmlListReverseWalk();
11223 test_ret += test_xmlListSearch();
11224 test_ret += test_xmlListSize();
11225 test_ret += test_xmlListSort();
11226 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227
Daniel Veillard42595322004-11-08 10:52:06 +000011228 if (test_ret != 0)
11229 printf("Module list: %d errors\n", test_ret);
11230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011231}
11232
11233static int
11234test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011236
William M. Brack21e4ef22005-01-02 09:53:13 +000011237#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011238 int mem_base;
11239 int ret_val;
11240 void * ctx; /* an FTP context */
11241 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011242
Daniel Veillard27f20102004-11-05 11:50:11 +000011243 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11244 mem_base = xmlMemBlocks();
11245 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11246
11247 ret_val = xmlNanoFTPCheckResponse(ctx);
11248 desret_int(ret_val);
11249 call_tests++;
11250 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11251 xmlResetLastError();
11252 if (mem_base != xmlMemBlocks()) {
11253 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011255 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011256 printf(" %d", n_ctx);
11257 printf("\n");
11258 }
11259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011260 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011261#endif
11262
Daniel Veillard42595322004-11-08 10:52:06 +000011263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011264}
11265
11266
11267static int
11268test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011270
William M. Brack21e4ef22005-01-02 09:53:13 +000011271#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011272 int mem_base;
11273
11274 mem_base = xmlMemBlocks();
11275
11276 xmlNanoFTPCleanup();
11277 call_tests++;
11278 xmlResetLastError();
11279 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011280 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011282 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011283 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011285 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011286#endif
11287
Daniel Veillard42595322004-11-08 10:52:06 +000011288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011289}
11290
11291
11292static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011295
William M. Brack21e4ef22005-01-02 09:53:13 +000011296#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011297 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011298 int ret_val;
11299 void * ctx; /* an FTP context */
11300 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011301
Daniel Veillard27f20102004-11-05 11:50:11 +000011302 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011303 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011304 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011305
Daniel Veillard27f20102004-11-05 11:50:11 +000011306 ret_val = xmlNanoFTPCloseConnection(ctx);
11307 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011308 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011309 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011310 xmlResetLastError();
11311 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011312 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011314 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011315 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011316 printf("\n");
11317 }
11318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011319 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011320#endif
11321
Daniel Veillard42595322004-11-08 10:52:06 +000011322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011323}
11324
11325
11326static int
11327test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011329
William M. Brack21e4ef22005-01-02 09:53:13 +000011330#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011331 int mem_base;
11332 int ret_val;
11333 void * ctx; /* an FTP context */
11334 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011335 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011336 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011337
Daniel Veillard27f20102004-11-05 11:50:11 +000011338 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11339 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11340 mem_base = xmlMemBlocks();
11341 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11342 directory = gen_const_char_ptr(n_directory, 1);
11343
William M. Brackf13f77f2004-11-12 16:03:48 +000011344 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011345 desret_int(ret_val);
11346 call_tests++;
11347 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011348 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011349 xmlResetLastError();
11350 if (mem_base != xmlMemBlocks()) {
11351 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011353 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011354 printf(" %d", n_ctx);
11355 printf(" %d", n_directory);
11356 printf("\n");
11357 }
11358 }
11359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011360 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011361#endif
11362
Daniel Veillard42595322004-11-08 10:52:06 +000011363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011364}
11365
11366
11367static int
11368test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011370
William M. Brack21e4ef22005-01-02 09:53:13 +000011371#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011372 int mem_base;
11373 int ret_val;
11374 void * ctx; /* an FTP context */
11375 int n_ctx;
11376 const char * file; /* a file or directory on the server */
11377 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011378
Daniel Veillard27f20102004-11-05 11:50:11 +000011379 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11380 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11381 mem_base = xmlMemBlocks();
11382 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11383 file = gen_filepath(n_file, 1);
11384
11385 ret_val = xmlNanoFTPDele(ctx, file);
11386 desret_int(ret_val);
11387 call_tests++;
11388 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11389 des_filepath(n_file, file, 1);
11390 xmlResetLastError();
11391 if (mem_base != xmlMemBlocks()) {
11392 printf("Leak of %d blocks found in xmlNanoFTPDele",
11393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011394 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011395 printf(" %d", n_ctx);
11396 printf(" %d", n_file);
11397 printf("\n");
11398 }
11399 }
11400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011401 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011402#endif
11403
Daniel Veillard42595322004-11-08 10:52:06 +000011404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011405}
11406
11407
11408static int
11409test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011411
11412
11413 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011415}
11416
11417
11418static int
11419test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011421
William M. Brack21e4ef22005-01-02 09:53:13 +000011422#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011423 int mem_base;
11424 int ret_val;
11425 void * ctx; /* an FTP context */
11426 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011427
Daniel Veillard27f20102004-11-05 11:50:11 +000011428 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11429 mem_base = xmlMemBlocks();
11430 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11431
11432 ret_val = xmlNanoFTPGetConnection(ctx);
11433 desret_int(ret_val);
11434 call_tests++;
11435 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11436 xmlResetLastError();
11437 if (mem_base != xmlMemBlocks()) {
11438 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011440 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011441 printf(" %d", n_ctx);
11442 printf("\n");
11443 }
11444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011445 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011446#endif
11447
Daniel Veillard42595322004-11-08 10:52:06 +000011448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011449}
11450
11451
11452static int
11453test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011455
William M. Brack21e4ef22005-01-02 09:53:13 +000011456#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011457 int mem_base;
11458 int ret_val;
11459 void * ctx; /* an FTP context */
11460 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011461
Daniel Veillard27f20102004-11-05 11:50:11 +000011462 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11463 mem_base = xmlMemBlocks();
11464 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11465
11466 ret_val = xmlNanoFTPGetResponse(ctx);
11467 desret_int(ret_val);
11468 call_tests++;
11469 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11470 xmlResetLastError();
11471 if (mem_base != xmlMemBlocks()) {
11472 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011474 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011475 printf(" %d", n_ctx);
11476 printf("\n");
11477 }
11478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011479 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011480#endif
11481
Daniel Veillard42595322004-11-08 10:52:06 +000011482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011483}
11484
11485
11486static int
11487test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011489
William M. Brack21e4ef22005-01-02 09:53:13 +000011490#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011491 int mem_base;
11492 int ret_val;
11493 void * ctx; /* an FTP context */
11494 int n_ctx;
11495 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11496 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011497
Daniel Veillard27f20102004-11-05 11:50:11 +000011498 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11499 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11500 mem_base = xmlMemBlocks();
11501 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11502 filename = gen_filepath(n_filename, 1);
11503
11504 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11505 desret_int(ret_val);
11506 call_tests++;
11507 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11508 des_filepath(n_filename, filename, 1);
11509 xmlResetLastError();
11510 if (mem_base != xmlMemBlocks()) {
11511 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011513 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011514 printf(" %d", n_ctx);
11515 printf(" %d", n_filename);
11516 printf("\n");
11517 }
11518 }
11519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011520 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011521#endif
11522
Daniel Veillard42595322004-11-08 10:52:06 +000011523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011524}
11525
11526
11527static int
11528test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011530
William M. Brack21e4ef22005-01-02 09:53:13 +000011531#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011532 int mem_base;
11533
11534 mem_base = xmlMemBlocks();
11535
11536 xmlNanoFTPInit();
11537 call_tests++;
11538 xmlResetLastError();
11539 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011540 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011542 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011543 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011545 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011546#endif
11547
Daniel Veillard42595322004-11-08 10:52:06 +000011548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011549}
11550
11551
11552static int
11553test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011555
11556
11557 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011559}
11560
11561
11562static int
11563test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011565
William M. Brack015ccb22005-02-13 08:18:52 +000011566#if defined(LIBXML_FTP_ENABLED)
11567 int mem_base;
11568 void * ret_val;
11569 const char * URL; /* The URL used to initialize the context */
11570 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011571
William M. Brack015ccb22005-02-13 08:18:52 +000011572 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11573 mem_base = xmlMemBlocks();
11574 URL = gen_filepath(n_URL, 0);
11575
11576 ret_val = xmlNanoFTPNewCtxt(URL);
11577 desret_xmlNanoFTPCtxtPtr(ret_val);
11578 call_tests++;
11579 des_filepath(n_URL, URL, 0);
11580 xmlResetLastError();
11581 if (mem_base != xmlMemBlocks()) {
11582 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
11583 xmlMemBlocks() - mem_base);
11584 test_ret++;
11585 printf(" %d", n_URL);
11586 printf("\n");
11587 }
11588 }
11589 function_tests++;
11590#endif
11591
Daniel Veillard42595322004-11-08 10:52:06 +000011592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011593}
11594
11595
11596static int
11597test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011599
William M. Brack21e4ef22005-01-02 09:53:13 +000011600#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011601 int mem_base;
11602 void * ret_val;
11603 const char * URL; /* the URL to the resource */
11604 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011605
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011606 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11607 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011608 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011609
11610 ret_val = xmlNanoFTPOpen(URL);
William M. Brack015ccb22005-02-13 08:18:52 +000011611 desret_xmlNanoFTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011612 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011613 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011614 xmlResetLastError();
11615 if (mem_base != xmlMemBlocks()) {
11616 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011618 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011619 printf(" %d", n_URL);
11620 printf("\n");
11621 }
11622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011623 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011624#endif
11625
Daniel Veillard42595322004-11-08 10:52:06 +000011626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011627}
11628
11629
11630static int
11631test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011633
William M. Brack21e4ef22005-01-02 09:53:13 +000011634#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011635 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011636 int n_host;
11637 int port; /* the proxy port */
11638 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011639 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011640 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011641 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011642 int n_passwd;
11643 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11644 int n_type;
11645
11646 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11647 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11648 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11649 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11650 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011651 host = gen_const_char_ptr(n_host, 0);
11652 port = gen_int(n_port, 1);
11653 user = gen_const_char_ptr(n_user, 2);
11654 passwd = gen_const_char_ptr(n_passwd, 3);
11655 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011656
William M. Brackf13f77f2004-11-12 16:03:48 +000011657 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011658 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011659 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011660 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011661 des_const_char_ptr(n_user, (const char *)user, 2);
11662 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011663 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664 xmlResetLastError();
11665 }
11666 }
11667 }
11668 }
11669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011670 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671#endif
11672
Daniel Veillard42595322004-11-08 10:52:06 +000011673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674}
11675
11676
11677static int
11678test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011680
William M. Brack21e4ef22005-01-02 09:53:13 +000011681#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011682 int mem_base;
11683 int ret_val;
11684 void * ctx; /* an FTP context */
11685 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011686
Daniel Veillard27f20102004-11-05 11:50:11 +000011687 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11688 mem_base = xmlMemBlocks();
11689 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11690
11691 ret_val = xmlNanoFTPQuit(ctx);
11692 desret_int(ret_val);
11693 call_tests++;
11694 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11695 xmlResetLastError();
11696 if (mem_base != xmlMemBlocks()) {
11697 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011699 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011700 printf(" %d", n_ctx);
11701 printf("\n");
11702 }
11703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011704 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011705#endif
11706
Daniel Veillard42595322004-11-08 10:52:06 +000011707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011708}
11709
11710
11711static int
11712test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011714
William M. Brack21e4ef22005-01-02 09:53:13 +000011715#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011716 int mem_base;
11717 int ret_val;
11718 void * ctx; /* the FTP context */
11719 int n_ctx;
11720 void * dest; /* a buffer */
11721 int n_dest;
11722 int len; /* the buffer length */
11723 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011724
Daniel Veillard27f20102004-11-05 11:50:11 +000011725 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11726 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11727 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11728 mem_base = xmlMemBlocks();
11729 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11730 dest = gen_void_ptr(n_dest, 1);
11731 len = gen_int(n_len, 2);
11732
11733 ret_val = xmlNanoFTPRead(ctx, dest, len);
11734 desret_int(ret_val);
11735 call_tests++;
11736 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11737 des_void_ptr(n_dest, dest, 1);
11738 des_int(n_len, len, 2);
11739 xmlResetLastError();
11740 if (mem_base != xmlMemBlocks()) {
11741 printf("Leak of %d blocks found in xmlNanoFTPRead",
11742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011743 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011744 printf(" %d", n_ctx);
11745 printf(" %d", n_dest);
11746 printf(" %d", n_len);
11747 printf("\n");
11748 }
11749 }
11750 }
11751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011752 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011753#endif
11754
Daniel Veillard42595322004-11-08 10:52:06 +000011755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011756}
11757
11758
11759static int
11760test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011762
William M. Brack21e4ef22005-01-02 09:53:13 +000011763#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764 const char * URL; /* The proxy URL used to initialize the proxy context */
11765 int n_URL;
11766
11767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011768 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011769
11770 xmlNanoFTPScanProxy(URL);
11771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011772 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011773 xmlResetLastError();
11774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011775 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011776#endif
11777
Daniel Veillard42595322004-11-08 10:52:06 +000011778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011779}
11780
11781
11782static int
11783test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011785
William M. Brack21e4ef22005-01-02 09:53:13 +000011786#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011787 int mem_base;
11788 int ret_val;
11789 void * ctx; /* an FTP context */
11790 int n_ctx;
11791 const char * URL; /* The URL used to update the context */
11792 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793
Daniel Veillard27f20102004-11-05 11:50:11 +000011794 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11795 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11796 mem_base = xmlMemBlocks();
11797 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11798 URL = gen_filepath(n_URL, 1);
11799
11800 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11801 desret_int(ret_val);
11802 call_tests++;
11803 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11804 des_filepath(n_URL, URL, 1);
11805 xmlResetLastError();
11806 if (mem_base != xmlMemBlocks()) {
11807 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011809 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011810 printf(" %d", n_ctx);
11811 printf(" %d", n_URL);
11812 printf("\n");
11813 }
11814 }
11815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011816 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011817#endif
11818
Daniel Veillard42595322004-11-08 10:52:06 +000011819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011820}
11821
11822static int
11823test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011825
William M. Brack015ccb22005-02-13 08:18:52 +000011826 if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011827 test_ret += test_xmlNanoFTPCheckResponse();
11828 test_ret += test_xmlNanoFTPCleanup();
11829 test_ret += test_xmlNanoFTPCloseConnection();
11830 test_ret += test_xmlNanoFTPCwd();
11831 test_ret += test_xmlNanoFTPDele();
11832 test_ret += test_xmlNanoFTPGet();
11833 test_ret += test_xmlNanoFTPGetConnection();
11834 test_ret += test_xmlNanoFTPGetResponse();
11835 test_ret += test_xmlNanoFTPGetSocket();
11836 test_ret += test_xmlNanoFTPInit();
11837 test_ret += test_xmlNanoFTPList();
11838 test_ret += test_xmlNanoFTPNewCtxt();
11839 test_ret += test_xmlNanoFTPOpen();
11840 test_ret += test_xmlNanoFTPProxy();
11841 test_ret += test_xmlNanoFTPQuit();
11842 test_ret += test_xmlNanoFTPRead();
11843 test_ret += test_xmlNanoFTPScanProxy();
11844 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011845
Daniel Veillard42595322004-11-08 10:52:06 +000011846 if (test_ret != 0)
11847 printf("Module nanoftp: %d errors\n", test_ret);
11848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011849}
11850
11851static int
11852test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011854
William M. Brack21e4ef22005-01-02 09:53:13 +000011855#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011856 int mem_base;
11857 const char * ret_val;
11858 void * ctx; /* the HTTP context */
11859 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011860
Daniel Veillard27f20102004-11-05 11:50:11 +000011861 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11862 mem_base = xmlMemBlocks();
11863 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11864
11865 ret_val = xmlNanoHTTPAuthHeader(ctx);
11866 desret_const_char_ptr(ret_val);
11867 call_tests++;
11868 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11869 xmlResetLastError();
11870 if (mem_base != xmlMemBlocks()) {
11871 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011873 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011874 printf(" %d", n_ctx);
11875 printf("\n");
11876 }
11877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011878 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011879#endif
11880
Daniel Veillard42595322004-11-08 10:52:06 +000011881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011882}
11883
11884
11885static int
11886test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011888
William M. Brack21e4ef22005-01-02 09:53:13 +000011889#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890 int mem_base;
11891
11892 mem_base = xmlMemBlocks();
11893
11894 xmlNanoHTTPCleanup();
11895 call_tests++;
11896 xmlResetLastError();
11897 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011898 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011900 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011903 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011904#endif
11905
Daniel Veillard42595322004-11-08 10:52:06 +000011906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011907}
11908
11909
11910static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011911test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011913
William M. Brack21e4ef22005-01-02 09:53:13 +000011914#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011915 int mem_base;
11916 int ret_val;
11917 void * ctx; /* the HTTP context */
11918 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919
Daniel Veillard27f20102004-11-05 11:50:11 +000011920 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11921 mem_base = xmlMemBlocks();
11922 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11923
11924 ret_val = xmlNanoHTTPContentLength(ctx);
11925 desret_int(ret_val);
11926 call_tests++;
11927 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11928 xmlResetLastError();
11929 if (mem_base != xmlMemBlocks()) {
11930 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011932 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011933 printf(" %d", n_ctx);
11934 printf("\n");
11935 }
11936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011937 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011938#endif
11939
Daniel Veillard42595322004-11-08 10:52:06 +000011940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011941}
11942
11943
11944static int
11945test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011947
William M. Brack21e4ef22005-01-02 09:53:13 +000011948#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011949 int mem_base;
11950 const char * ret_val;
11951 void * ctx; /* the HTTP context */
11952 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011953
Daniel Veillard27f20102004-11-05 11:50:11 +000011954 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11955 mem_base = xmlMemBlocks();
11956 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11957
11958 ret_val = xmlNanoHTTPEncoding(ctx);
11959 desret_const_char_ptr(ret_val);
11960 call_tests++;
11961 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11962 xmlResetLastError();
11963 if (mem_base != xmlMemBlocks()) {
11964 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011966 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011967 printf(" %d", n_ctx);
11968 printf("\n");
11969 }
11970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011971 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011972#endif
11973
Daniel Veillard42595322004-11-08 10:52:06 +000011974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011975}
11976
11977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011978#define gen_nb_char_ptr_ptr 1
11979static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11980 return(NULL);
11981}
11982static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11983}
11984
Daniel Veillardd93f6252004-11-02 15:53:51 +000011985static int
11986test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011988
William M. Brack21e4ef22005-01-02 09:53:13 +000011989#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011990 int mem_base;
11991 int ret_val;
11992 const char * URL; /* The URL to load */
11993 int n_URL;
11994 const char * filename; /* the filename where the content should be saved */
11995 int n_filename;
11996 char ** contentType; /* if available the Content-Type information will be returned at that location */
11997 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011998
William M. Brack015ccb22005-02-13 08:18:52 +000011999 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
12000 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012001 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12002 mem_base = xmlMemBlocks();
William M. Brack015ccb22005-02-13 08:18:52 +000012003 URL = gen_fileoutput(n_URL, 0);
12004 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012005 contentType = gen_char_ptr_ptr(n_contentType, 2);
12006
12007 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12008 desret_int(ret_val);
12009 call_tests++;
William M. Brack015ccb22005-02-13 08:18:52 +000012010 des_fileoutput(n_URL, URL, 0);
12011 des_fileoutput(n_filename, filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012012 des_char_ptr_ptr(n_contentType, contentType, 2);
12013 xmlResetLastError();
12014 if (mem_base != xmlMemBlocks()) {
12015 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012017 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012018 printf(" %d", n_URL);
12019 printf(" %d", n_filename);
12020 printf(" %d", n_contentType);
12021 printf("\n");
12022 }
12023 }
12024 }
12025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012026 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012027#endif
12028
Daniel Veillard42595322004-11-08 10:52:06 +000012029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012030}
12031
12032
12033static int
12034test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012036
William M. Brack21e4ef22005-01-02 09:53:13 +000012037#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012038 int mem_base;
12039
12040 mem_base = xmlMemBlocks();
12041
12042 xmlNanoHTTPInit();
12043 call_tests++;
12044 xmlResetLastError();
12045 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012046 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012048 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012049 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012051 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012052#endif
12053
Daniel Veillard42595322004-11-08 10:52:06 +000012054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012055}
12056
12057
12058static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012059test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012061
William M. Brack21e4ef22005-01-02 09:53:13 +000012062#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012063 int mem_base;
12064 const char * ret_val;
12065 void * ctx; /* the HTTP context */
12066 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067
Daniel Veillard27f20102004-11-05 11:50:11 +000012068 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12069 mem_base = xmlMemBlocks();
12070 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12071
12072 ret_val = xmlNanoHTTPMimeType(ctx);
12073 desret_const_char_ptr(ret_val);
12074 call_tests++;
12075 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12076 xmlResetLastError();
12077 if (mem_base != xmlMemBlocks()) {
12078 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012080 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012081 printf(" %d", n_ctx);
12082 printf("\n");
12083 }
12084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012085 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012086#endif
12087
Daniel Veillard42595322004-11-08 10:52:06 +000012088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012089}
12090
12091
12092static int
12093test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012095
William M. Brack21e4ef22005-01-02 09:53:13 +000012096#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012097 int mem_base;
12098 void * ret_val;
12099 const char * URL; /* The URL to load */
12100 int n_URL;
12101 char ** contentType; /* if available the Content-Type information will be returned at that location */
12102 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012103
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012104 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12105 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12106 mem_base = xmlMemBlocks();
12107 URL = gen_filepath(n_URL, 0);
12108 contentType = gen_char_ptr_ptr(n_contentType, 1);
12109
12110 ret_val = xmlNanoHTTPOpen(URL, contentType);
William M. Brack015ccb22005-02-13 08:18:52 +000012111 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012112 call_tests++;
12113 des_filepath(n_URL, URL, 0);
12114 des_char_ptr_ptr(n_contentType, contentType, 1);
12115 xmlResetLastError();
12116 if (mem_base != xmlMemBlocks()) {
12117 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012119 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012120 printf(" %d", n_URL);
12121 printf(" %d", n_contentType);
12122 printf("\n");
12123 }
12124 }
12125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012126 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012127#endif
12128
Daniel Veillard42595322004-11-08 10:52:06 +000012129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012130}
12131
12132
12133static int
12134test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012136
William M. Brack21e4ef22005-01-02 09:53:13 +000012137#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012138 int mem_base;
12139 void * ret_val;
12140 const char * URL; /* The URL to load */
12141 int n_URL;
12142 char ** contentType; /* if available the Content-Type information will be returned at that location */
12143 int n_contentType;
12144 char ** redir; /* if available the redirected URL will be returned */
12145 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012146
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012147 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12148 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12149 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12150 mem_base = xmlMemBlocks();
12151 URL = gen_filepath(n_URL, 0);
12152 contentType = gen_char_ptr_ptr(n_contentType, 1);
12153 redir = gen_char_ptr_ptr(n_redir, 2);
12154
12155 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
William M. Brack015ccb22005-02-13 08:18:52 +000012156 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012157 call_tests++;
12158 des_filepath(n_URL, URL, 0);
12159 des_char_ptr_ptr(n_contentType, contentType, 1);
12160 des_char_ptr_ptr(n_redir, redir, 2);
12161 xmlResetLastError();
12162 if (mem_base != xmlMemBlocks()) {
12163 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012165 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012166 printf(" %d", n_URL);
12167 printf(" %d", n_contentType);
12168 printf(" %d", n_redir);
12169 printf("\n");
12170 }
12171 }
12172 }
12173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012174 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012175#endif
12176
Daniel Veillard42595322004-11-08 10:52:06 +000012177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012178}
12179
12180
12181static int
12182test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012184
William M. Brack21e4ef22005-01-02 09:53:13 +000012185#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012186 int mem_base;
12187 int ret_val;
12188 void * ctx; /* the HTTP context */
12189 int n_ctx;
12190 void * dest; /* a buffer */
12191 int n_dest;
12192 int len; /* the buffer length */
12193 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012194
Daniel Veillard27f20102004-11-05 11:50:11 +000012195 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12196 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12197 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12198 mem_base = xmlMemBlocks();
12199 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12200 dest = gen_void_ptr(n_dest, 1);
12201 len = gen_int(n_len, 2);
12202
12203 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12204 desret_int(ret_val);
12205 call_tests++;
12206 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12207 des_void_ptr(n_dest, dest, 1);
12208 des_int(n_len, len, 2);
12209 xmlResetLastError();
12210 if (mem_base != xmlMemBlocks()) {
12211 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012213 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012214 printf(" %d", n_ctx);
12215 printf(" %d", n_dest);
12216 printf(" %d", n_len);
12217 printf("\n");
12218 }
12219 }
12220 }
12221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012222 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012223#endif
12224
Daniel Veillard42595322004-11-08 10:52:06 +000012225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012226}
12227
12228
12229static int
12230test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012232
12233
12234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012236}
12237
12238
12239static int
12240test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012242
William M. Brack21e4ef22005-01-02 09:53:13 +000012243#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012244 int mem_base;
12245 int ret_val;
12246 void * ctx; /* the HTTP context */
12247 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012248
Daniel Veillard27f20102004-11-05 11:50:11 +000012249 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12250 mem_base = xmlMemBlocks();
12251 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12252
12253 ret_val = xmlNanoHTTPReturnCode(ctx);
12254 desret_int(ret_val);
12255 call_tests++;
12256 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12257 xmlResetLastError();
12258 if (mem_base != xmlMemBlocks()) {
12259 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012261 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012262 printf(" %d", n_ctx);
12263 printf("\n");
12264 }
12265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012266 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012267#endif
12268
Daniel Veillard42595322004-11-08 10:52:06 +000012269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012270}
12271
12272
12273static int
12274test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012276
William M. Brack21e4ef22005-01-02 09:53:13 +000012277#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012278 int mem_base;
12279 int ret_val;
12280 void * ctxt; /* the HTTP context */
12281 int n_ctxt;
12282 const char * filename; /* the filename where the content should be saved */
12283 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012284
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012285 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12286 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012288 ctxt = gen_void_ptr(n_ctxt, 0);
12289 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012290
12291 ret_val = xmlNanoHTTPSave(ctxt, filename);
12292 desret_int(ret_val);
12293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012294 des_void_ptr(n_ctxt, ctxt, 0);
12295 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012296 xmlResetLastError();
12297 if (mem_base != xmlMemBlocks()) {
12298 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012300 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012301 printf(" %d", n_ctxt);
12302 printf(" %d", n_filename);
12303 printf("\n");
12304 }
12305 }
12306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012307 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012308#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012309
Daniel Veillard42595322004-11-08 10:52:06 +000012310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311}
12312
12313
12314static int
12315test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012317
William M. Brack21e4ef22005-01-02 09:53:13 +000012318#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012319 const char * URL; /* The proxy URL used to initialize the proxy context */
12320 int n_URL;
12321
12322 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012323 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
12325 xmlNanoHTTPScanProxy(URL);
12326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012327 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012328 xmlResetLastError();
12329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012330 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012331#endif
12332
Daniel Veillard42595322004-11-08 10:52:06 +000012333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012334}
12335
12336static int
12337test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012339
William M. Brack015ccb22005-02-13 08:18:52 +000012340 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012341 test_ret += test_xmlNanoHTTPAuthHeader();
12342 test_ret += test_xmlNanoHTTPCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +000012343 test_ret += test_xmlNanoHTTPContentLength();
12344 test_ret += test_xmlNanoHTTPEncoding();
12345 test_ret += test_xmlNanoHTTPFetch();
12346 test_ret += test_xmlNanoHTTPInit();
Daniel Veillard42595322004-11-08 10:52:06 +000012347 test_ret += test_xmlNanoHTTPMimeType();
12348 test_ret += test_xmlNanoHTTPOpen();
12349 test_ret += test_xmlNanoHTTPOpenRedir();
12350 test_ret += test_xmlNanoHTTPRead();
12351 test_ret += test_xmlNanoHTTPRedir();
12352 test_ret += test_xmlNanoHTTPReturnCode();
12353 test_ret += test_xmlNanoHTTPSave();
12354 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012355
Daniel Veillard42595322004-11-08 10:52:06 +000012356 if (test_ret != 0)
12357 printf("Module nanohttp: %d errors\n", test_ret);
12358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359}
12360
12361static int
12362test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012365 int mem_base;
12366 long ret_val;
12367 xmlParserCtxtPtr ctxt; /* an XML parser context */
12368 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012369
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012370 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12371 mem_base = xmlMemBlocks();
12372 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12373
12374 ret_val = xmlByteConsumed(ctxt);
12375 desret_long(ret_val);
12376 call_tests++;
12377 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12378 xmlResetLastError();
12379 if (mem_base != xmlMemBlocks()) {
12380 printf("Leak of %d blocks found in xmlByteConsumed",
12381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012382 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012383 printf(" %d", n_ctxt);
12384 printf("\n");
12385 }
12386 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012388
Daniel Veillard42595322004-11-08 10:52:06 +000012389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012390}
12391
12392
12393static int
12394test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012396
Daniel Veillardce682bc2004-11-05 17:22:25 +000012397 int mem_base;
12398 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12399 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012400
Daniel Veillardce682bc2004-11-05 17:22:25 +000012401 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12402 mem_base = xmlMemBlocks();
12403 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12404
12405 xmlClearNodeInfoSeq(seq);
12406 call_tests++;
12407 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12408 xmlResetLastError();
12409 if (mem_base != xmlMemBlocks()) {
12410 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012412 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012413 printf(" %d", n_seq);
12414 printf("\n");
12415 }
12416 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012418
Daniel Veillard42595322004-11-08 10:52:06 +000012419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012420}
12421
12422
12423static int
12424test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012426
12427 int mem_base;
12428 xmlParserCtxtPtr ctxt; /* an XML parser context */
12429 int n_ctxt;
12430
12431 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012433 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012434
12435 xmlClearParserCtxt(ctxt);
12436 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012437 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012438 xmlResetLastError();
12439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012440 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012443 printf(" %d", n_ctxt);
12444 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012445 }
12446 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012448
Daniel Veillard42595322004-11-08 10:52:06 +000012449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012450}
12451
12452
12453static int
12454test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456
Daniel Veillard34099b42004-11-04 17:34:35 +000012457 int mem_base;
12458 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012459 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012460 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012461
Daniel Veillard34099b42004-11-04 17:34:35 +000012462 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12463 mem_base = xmlMemBlocks();
12464 cur = gen_const_xmlChar_ptr(n_cur, 0);
12465
William M. Brackf13f77f2004-11-12 16:03:48 +000012466 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012467 desret_xmlParserCtxtPtr(ret_val);
12468 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012469 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012470 xmlResetLastError();
12471 if (mem_base != xmlMemBlocks()) {
12472 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012474 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012475 printf(" %d", n_cur);
12476 printf("\n");
12477 }
12478 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012480
Daniel Veillard42595322004-11-08 10:52:06 +000012481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012482}
12483
12484
12485static int
12486test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012488
William M. Brack21e4ef22005-01-02 09:53:13 +000012489#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012490 int mem_base;
12491 xmlParserCtxtPtr ret_val;
12492 xmlSAXHandlerPtr sax; /* a SAX handler */
12493 int n_sax;
12494 void * user_data; /* The user data returned on SAX callbacks */
12495 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012496 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012497 int n_chunk;
12498 int size; /* number of chars in the array */
12499 int n_size;
12500 const char * filename; /* an optional file name or URI */
12501 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012502
Daniel Veillard34099b42004-11-04 17:34:35 +000012503 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12504 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12505 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12506 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012507 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012508 mem_base = xmlMemBlocks();
12509 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12510 user_data = gen_userdata(n_user_data, 1);
12511 chunk = gen_const_char_ptr(n_chunk, 2);
12512 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012513 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012514
William M. Brackf13f77f2004-11-12 16:03:48 +000012515 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012516 desret_xmlParserCtxtPtr(ret_val);
12517 call_tests++;
12518 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12519 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012520 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012521 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012522 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012523 xmlResetLastError();
12524 if (mem_base != xmlMemBlocks()) {
12525 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012527 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012528 printf(" %d", n_sax);
12529 printf(" %d", n_user_data);
12530 printf(" %d", n_chunk);
12531 printf(" %d", n_size);
12532 printf(" %d", n_filename);
12533 printf("\n");
12534 }
12535 }
12536 }
12537 }
12538 }
12539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012540 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012541#endif
12542
Daniel Veillard42595322004-11-08 10:52:06 +000012543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012544}
12545
12546
12547static int
12548test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012550
12551 int mem_base;
12552 xmlDocPtr ret_val;
12553 xmlParserCtxtPtr ctxt; /* an XML parser context */
12554 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012555 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012556 int n_cur;
12557 const char * URL; /* the base URL to use for the document */
12558 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012559 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012560 int n_encoding;
12561 int options; /* a combination of xmlParserOption */
12562 int n_options;
12563
12564 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12565 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12566 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12567 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012568 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012570 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12571 cur = gen_const_xmlChar_ptr(n_cur, 1);
12572 URL = gen_filepath(n_URL, 2);
12573 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012574 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012575
William M. Brackf13f77f2004-11-12 16:03:48 +000012576 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012577 desret_xmlDocPtr(ret_val);
12578 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012579 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012580 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012581 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012582 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012583 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012584 xmlResetLastError();
12585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012586 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012589 printf(" %d", n_ctxt);
12590 printf(" %d", n_cur);
12591 printf(" %d", n_URL);
12592 printf(" %d", n_encoding);
12593 printf(" %d", n_options);
12594 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012595 }
12596 }
12597 }
12598 }
12599 }
12600 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012602
Daniel Veillard42595322004-11-08 10:52:06 +000012603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012604}
12605
12606
12607static int
12608test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012610
12611 int mem_base;
12612 xmlDocPtr ret_val;
12613 xmlParserCtxtPtr ctxt; /* an XML parser context */
12614 int n_ctxt;
12615 const char * filename; /* a file or URL */
12616 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012617 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012618 int n_encoding;
12619 int options; /* a combination of xmlParserOption */
12620 int n_options;
12621
12622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12623 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12624 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012625 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012627 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12628 filename = gen_filepath(n_filename, 1);
12629 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012630 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012631
William M. Brackf13f77f2004-11-12 16:03:48 +000012632 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012633 desret_xmlDocPtr(ret_val);
12634 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012635 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12636 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012637 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012638 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012639 xmlResetLastError();
12640 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012641 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012643 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012644 printf(" %d", n_ctxt);
12645 printf(" %d", n_filename);
12646 printf(" %d", n_encoding);
12647 printf(" %d", n_options);
12648 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012649 }
12650 }
12651 }
12652 }
12653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012655
Daniel Veillard42595322004-11-08 10:52:06 +000012656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012657}
12658
12659
12660static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012661test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012663
12664 int mem_base;
12665 xmlDocPtr ret_val;
12666 xmlParserCtxtPtr ctxt; /* an XML parser context */
12667 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012668 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 int n_buffer;
12670 int size; /* the size of the array */
12671 int n_size;
12672 const char * URL; /* the base URL to use for the document */
12673 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012674 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012675 int n_encoding;
12676 int options; /* a combination of xmlParserOption */
12677 int n_options;
12678
12679 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12680 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12681 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12682 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12683 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012684 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012686 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12687 buffer = gen_const_char_ptr(n_buffer, 1);
12688 size = gen_int(n_size, 2);
12689 URL = gen_filepath(n_URL, 3);
12690 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012691 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012692
William M. Brackf13f77f2004-11-12 16:03:48 +000012693 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012694 desret_xmlDocPtr(ret_val);
12695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012696 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012697 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012698 des_int(n_size, size, 2);
12699 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012700 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012701 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012702 xmlResetLastError();
12703 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012704 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012707 printf(" %d", n_ctxt);
12708 printf(" %d", n_buffer);
12709 printf(" %d", n_size);
12710 printf(" %d", n_URL);
12711 printf(" %d", n_encoding);
12712 printf(" %d", n_options);
12713 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012714 }
12715 }
12716 }
12717 }
12718 }
12719 }
12720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012722
Daniel Veillard42595322004-11-08 10:52:06 +000012723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724}
12725
12726
12727static int
12728test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730
12731 int mem_base;
12732 xmlParserCtxtPtr ctxt; /* an XML parser context */
12733 int n_ctxt;
12734
12735 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012737 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012738
12739 xmlCtxtReset(ctxt);
12740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012741 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012742 xmlResetLastError();
12743 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012744 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012746 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012747 printf(" %d", n_ctxt);
12748 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012749 }
12750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012752
Daniel Veillard42595322004-11-08 10:52:06 +000012753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012754}
12755
12756
12757static int
12758test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760
12761 int mem_base;
12762 int ret_val;
12763 xmlParserCtxtPtr ctxt; /* an XML parser context */
12764 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012765 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012766 int n_chunk;
12767 int size; /* number of chars in the array */
12768 int n_size;
12769 const char * filename; /* an optional file name or URI */
12770 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012771 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012772 int n_encoding;
12773
12774 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12775 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12776 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12777 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12778 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012780 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12781 chunk = gen_const_char_ptr(n_chunk, 1);
12782 size = gen_int(n_size, 2);
12783 filename = gen_filepath(n_filename, 3);
12784 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012785
William M. Brackf13f77f2004-11-12 16:03:48 +000012786 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 desret_int(ret_val);
12788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012789 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012790 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012791 des_int(n_size, size, 2);
12792 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012793 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012794 xmlResetLastError();
12795 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012796 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012798 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012799 printf(" %d", n_ctxt);
12800 printf(" %d", n_chunk);
12801 printf(" %d", n_size);
12802 printf(" %d", n_filename);
12803 printf(" %d", n_encoding);
12804 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805 }
12806 }
12807 }
12808 }
12809 }
12810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012812
Daniel Veillard42595322004-11-08 10:52:06 +000012813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814}
12815
12816
12817static int
12818test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012820
12821 int mem_base;
12822 int ret_val;
12823 xmlParserCtxtPtr ctxt; /* an XML parser context */
12824 int n_ctxt;
12825 int options; /* a combination of xmlParserOption */
12826 int n_options;
12827
12828 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012829 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012831 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012832 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012833
12834 ret_val = xmlCtxtUseOptions(ctxt, options);
12835 desret_int(ret_val);
12836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012837 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012838 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839 xmlResetLastError();
12840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012841 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012844 printf(" %d", n_ctxt);
12845 printf(" %d", n_options);
12846 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012847 }
12848 }
12849 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012850 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012851
Daniel Veillard42595322004-11-08 10:52:06 +000012852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012853}
12854
12855
12856static int
12857test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012859
12860
12861 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012863}
12864
12865
12866static int
12867test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869
William M. Brack21e4ef22005-01-02 09:53:13 +000012870#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012871#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012872 int mem_base;
12873 int ret_val;
12874 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12875 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012876 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012877 int n_name;
12878 void * result; /* location to store the result */
12879 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012881 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12882 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12883 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012885 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12886 name = gen_const_char_ptr(n_name, 1);
12887 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012888
William M. Brackf13f77f2004-11-12 16:03:48 +000012889 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012890 desret_int(ret_val);
12891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012892 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012893 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012894 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012895 xmlResetLastError();
12896 if (mem_base != xmlMemBlocks()) {
12897 printf("Leak of %d blocks found in xmlGetFeature",
12898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012899 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012900 printf(" %d", n_ctxt);
12901 printf(" %d", n_name);
12902 printf(" %d", n_result);
12903 printf("\n");
12904 }
12905 }
12906 }
12907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012908 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012909#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012910#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012911
Daniel Veillard42595322004-11-08 10:52:06 +000012912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012913}
12914
12915
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012916#define gen_nb_const_char_ptr_ptr 1
12917static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12918 return(NULL);
12919}
12920static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12921}
12922
Daniel Veillardd93f6252004-11-02 15:53:51 +000012923static int
12924test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012926
William M. Brack21e4ef22005-01-02 09:53:13 +000012927#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012928#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012929 int mem_base;
12930 int ret_val;
12931 int * len; /* the length of the features name array (input/output) */
12932 int n_len;
12933 char ** result; /* an array of string to be filled with the features name. */
12934 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012936 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
12937 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
12938 mem_base = xmlMemBlocks();
12939 len = gen_int_ptr(n_len, 0);
12940 result = gen_const_char_ptr_ptr(n_result, 1);
12941
William M. Brackf13f77f2004-11-12 16:03:48 +000012942 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012943 desret_int(ret_val);
12944 call_tests++;
12945 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012946 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012947 xmlResetLastError();
12948 if (mem_base != xmlMemBlocks()) {
12949 printf("Leak of %d blocks found in xmlGetFeaturesList",
12950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012951 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012952 printf(" %d", n_len);
12953 printf(" %d", n_result);
12954 printf("\n");
12955 }
12956 }
12957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012958 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012959#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012960#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012961
Daniel Veillard42595322004-11-08 10:52:06 +000012962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012963}
12964
12965
12966static int
12967test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012969
William M. Brack21e4ef22005-01-02 09:53:13 +000012970#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012971#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000012972 int mem_base;
12973 xmlDtdPtr ret_val;
12974 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12975 int n_sax;
12976 xmlParserInputBufferPtr input; /* an Input Buffer */
12977 int n_input;
12978 xmlCharEncoding enc; /* the charset encoding if known */
12979 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012980
Daniel Veillard34099b42004-11-04 17:34:35 +000012981 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12982 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
12983 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
12984 mem_base = xmlMemBlocks();
12985 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12986 input = gen_xmlParserInputBufferPtr(n_input, 1);
12987 enc = gen_xmlCharEncoding(n_enc, 2);
12988
12989 ret_val = xmlIOParseDTD(sax, input, enc);
12990 input = NULL;
12991 desret_xmlDtdPtr(ret_val);
12992 call_tests++;
12993 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12994 des_xmlParserInputBufferPtr(n_input, input, 1);
12995 des_xmlCharEncoding(n_enc, enc, 2);
12996 xmlResetLastError();
12997 if (mem_base != xmlMemBlocks()) {
12998 printf("Leak of %d blocks found in xmlIOParseDTD",
12999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013000 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013001 printf(" %d", n_sax);
13002 printf(" %d", n_input);
13003 printf(" %d", n_enc);
13004 printf("\n");
13005 }
13006 }
13007 }
13008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013009 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013010#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013011#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013012
Daniel Veillard42595322004-11-08 10:52:06 +000013013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013014}
13015
13016
13017static int
13018test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013020
Daniel Veillardce682bc2004-11-05 17:22:25 +000013021 int mem_base;
13022 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13023 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013024
Daniel Veillardce682bc2004-11-05 17:22:25 +000013025 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13026 mem_base = xmlMemBlocks();
13027 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13028
13029 xmlInitNodeInfoSeq(seq);
13030 call_tests++;
13031 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13032 xmlResetLastError();
13033 if (mem_base != xmlMemBlocks()) {
13034 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013036 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013037 printf(" %d", n_seq);
13038 printf("\n");
13039 }
13040 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013042
Daniel Veillard42595322004-11-08 10:52:06 +000013043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013044}
13045
13046
13047static int
13048test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013050
13051 int mem_base;
13052
13053 mem_base = xmlMemBlocks();
13054
13055 xmlInitParser();
13056 call_tests++;
13057 xmlResetLastError();
13058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013059 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013062 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013063 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013065
Daniel Veillard42595322004-11-08 10:52:06 +000013066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013067}
13068
13069
13070static int
13071test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013073
13074 int mem_base;
13075 int ret_val;
13076 xmlParserCtxtPtr ctxt; /* an XML parser context */
13077 int n_ctxt;
13078
13079 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013081 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013082
13083 ret_val = xmlInitParserCtxt(ctxt);
13084 desret_int(ret_val);
13085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013086 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013087 xmlResetLastError();
13088 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013089 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013091 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013092 printf(" %d", n_ctxt);
13093 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013094 }
13095 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013096 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013097
Daniel Veillard42595322004-11-08 10:52:06 +000013098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099}
13100
13101
13102static int
13103test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013105
13106 int mem_base;
13107 int ret_val;
13108 int val; /* int 0 or 1 */
13109 int n_val;
13110
13111 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013113 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013114
13115 ret_val = xmlKeepBlanksDefault(val);
13116 desret_int(ret_val);
13117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013118 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013119 xmlResetLastError();
13120 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013121 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013123 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013124 printf(" %d", n_val);
13125 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013126 }
13127 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013129
Daniel Veillard42595322004-11-08 10:52:06 +000013130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013131}
13132
13133
13134static int
13135test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013137
13138 int mem_base;
13139 int ret_val;
13140 int val; /* int 0 or 1 */
13141 int n_val;
13142
13143 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13144 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013145 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013146
13147 ret_val = xmlLineNumbersDefault(val);
13148 desret_int(ret_val);
13149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013150 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013151 xmlResetLastError();
13152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013153 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013156 printf(" %d", n_val);
13157 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158 }
13159 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013161
Daniel Veillard42595322004-11-08 10:52:06 +000013162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013163}
13164
13165
13166static int
13167test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013169
Daniel Veillard42595322004-11-08 10:52:06 +000013170 int mem_base;
13171 xmlParserInputPtr ret_val;
13172 const char * URL; /* the URL for the entity to load */
13173 int n_URL;
13174 char * ID; /* the Public ID for the entity to load */
13175 int n_ID;
13176 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13177 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178
Daniel Veillard42595322004-11-08 10:52:06 +000013179 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13180 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13182 mem_base = xmlMemBlocks();
13183 URL = gen_filepath(n_URL, 0);
13184 ID = gen_const_char_ptr(n_ID, 1);
13185 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13186
William M. Brackf13f77f2004-11-12 16:03:48 +000013187 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013188 desret_xmlParserInputPtr(ret_val);
13189 call_tests++;
13190 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013191 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013192 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13193 xmlResetLastError();
13194 if (mem_base != xmlMemBlocks()) {
13195 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13196 xmlMemBlocks() - mem_base);
13197 test_ret++;
13198 printf(" %d", n_URL);
13199 printf(" %d", n_ID);
13200 printf(" %d", n_ctxt);
13201 printf("\n");
13202 }
13203 }
13204 }
13205 }
Daniel Veillard42595322004-11-08 10:52:06 +000013206 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013207
Daniel Veillard42595322004-11-08 10:52:06 +000013208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013209}
13210
13211
13212static int
13213test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013215
Daniel Veillard42595322004-11-08 10:52:06 +000013216 int mem_base;
13217 xmlParserInputPtr ret_val;
13218 xmlParserCtxtPtr ctxt; /* an XML parser context */
13219 int n_ctxt;
13220 xmlParserInputBufferPtr input; /* an I/O Input */
13221 int n_input;
13222 xmlCharEncoding enc; /* the charset encoding if known */
13223 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013224
Daniel Veillard42595322004-11-08 10:52:06 +000013225 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13226 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13227 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13228 mem_base = xmlMemBlocks();
13229 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13230 input = gen_xmlParserInputBufferPtr(n_input, 1);
13231 enc = gen_xmlCharEncoding(n_enc, 2);
13232
13233 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13234 if (ret_val != NULL) input = NULL;
13235 desret_xmlParserInputPtr(ret_val);
13236 call_tests++;
13237 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13238 des_xmlParserInputBufferPtr(n_input, input, 1);
13239 des_xmlCharEncoding(n_enc, enc, 2);
13240 xmlResetLastError();
13241 if (mem_base != xmlMemBlocks()) {
13242 printf("Leak of %d blocks found in xmlNewIOInputStream",
13243 xmlMemBlocks() - mem_base);
13244 test_ret++;
13245 printf(" %d", n_ctxt);
13246 printf(" %d", n_input);
13247 printf(" %d", n_enc);
13248 printf("\n");
13249 }
13250 }
13251 }
13252 }
Daniel Veillard42595322004-11-08 10:52:06 +000013253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013254
Daniel Veillard42595322004-11-08 10:52:06 +000013255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013256}
13257
13258
13259static int
13260test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013262
Daniel Veillard34099b42004-11-04 17:34:35 +000013263 int mem_base;
13264 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013265
Daniel Veillard34099b42004-11-04 17:34:35 +000013266 mem_base = xmlMemBlocks();
13267
13268 ret_val = xmlNewParserCtxt();
13269 desret_xmlParserCtxtPtr(ret_val);
13270 call_tests++;
13271 xmlResetLastError();
13272 if (mem_base != xmlMemBlocks()) {
13273 printf("Leak of %d blocks found in xmlNewParserCtxt",
13274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013275 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013276 printf("\n");
13277 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013279
Daniel Veillard42595322004-11-08 10:52:06 +000013280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013281}
13282
13283
Daniel Veillardce682bc2004-11-05 17:22:25 +000013284#define gen_nb_xmlNodePtr_ptr 1
13285static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13286 return(NULL);
13287}
13288static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13289}
13290
Daniel Veillardd93f6252004-11-02 15:53:51 +000013291static int
13292test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294
William M. Brack21e4ef22005-01-02 09:53:13 +000013295#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013296#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013297 int mem_base;
13298 int ret_val;
13299 xmlDocPtr doc; /* the document the chunk pertains to */
13300 int n_doc;
13301 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13302 int n_sax;
13303 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13304 int n_user_data;
13305 int depth; /* Used for loop detection, use 0 */
13306 int n_depth;
13307 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13308 int n_string;
13309 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13310 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013311
Daniel Veillardce682bc2004-11-05 17:22:25 +000013312 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13313 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13314 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13315 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13316 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13317 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13318 mem_base = xmlMemBlocks();
13319 doc = gen_xmlDocPtr(n_doc, 0);
13320 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13321 user_data = gen_userdata(n_user_data, 2);
13322 depth = gen_int(n_depth, 3);
13323 string = gen_const_xmlChar_ptr(n_string, 4);
13324 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013325
13326#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013327 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013328#endif
13329
Daniel Veillardce682bc2004-11-05 17:22:25 +000013330
William M. Brackf13f77f2004-11-12 16:03:48 +000013331 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013332 desret_int(ret_val);
13333 call_tests++;
13334 des_xmlDocPtr(n_doc, doc, 0);
13335 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13336 des_userdata(n_user_data, user_data, 2);
13337 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013338 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013339 des_xmlNodePtr_ptr(n_lst, lst, 5);
13340 xmlResetLastError();
13341 if (mem_base != xmlMemBlocks()) {
13342 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013344 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013345 printf(" %d", n_doc);
13346 printf(" %d", n_sax);
13347 printf(" %d", n_user_data);
13348 printf(" %d", n_depth);
13349 printf(" %d", n_string);
13350 printf(" %d", n_lst);
13351 printf("\n");
13352 }
13353 }
13354 }
13355 }
13356 }
13357 }
13358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013359 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013360#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013361#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013362
Daniel Veillard42595322004-11-08 10:52:06 +000013363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013364}
13365
13366
13367static int
13368test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013370
William M. Brack21e4ef22005-01-02 09:53:13 +000013371#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013372#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013373 int mem_base;
13374 int ret_val;
13375 xmlDocPtr doc; /* the document the chunk pertains to */
13376 int n_doc;
13377 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13378 int n_sax;
13379 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13380 int n_user_data;
13381 int depth; /* Used for loop detection, use 0 */
13382 int n_depth;
13383 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13384 int n_string;
13385 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13386 int n_lst;
13387 int recover; /* return nodes even if the data is broken (use 0) */
13388 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013389
Daniel Veillardce682bc2004-11-05 17:22:25 +000013390 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13391 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13392 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13393 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13394 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13395 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13396 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13397 mem_base = xmlMemBlocks();
13398 doc = gen_xmlDocPtr(n_doc, 0);
13399 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13400 user_data = gen_userdata(n_user_data, 2);
13401 depth = gen_int(n_depth, 3);
13402 string = gen_const_xmlChar_ptr(n_string, 4);
13403 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13404 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013405
13406#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013407 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013408#endif
13409
Daniel Veillardce682bc2004-11-05 17:22:25 +000013410
William M. Brackf13f77f2004-11-12 16:03:48 +000013411 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013412 desret_int(ret_val);
13413 call_tests++;
13414 des_xmlDocPtr(n_doc, doc, 0);
13415 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13416 des_userdata(n_user_data, user_data, 2);
13417 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013418 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013419 des_xmlNodePtr_ptr(n_lst, lst, 5);
13420 des_int(n_recover, recover, 6);
13421 xmlResetLastError();
13422 if (mem_base != xmlMemBlocks()) {
13423 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013425 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013426 printf(" %d", n_doc);
13427 printf(" %d", n_sax);
13428 printf(" %d", n_user_data);
13429 printf(" %d", n_depth);
13430 printf(" %d", n_string);
13431 printf(" %d", n_lst);
13432 printf(" %d", n_recover);
13433 printf("\n");
13434 }
13435 }
13436 }
13437 }
13438 }
13439 }
13440 }
13441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013442 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013443#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013444#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013445
Daniel Veillard42595322004-11-08 10:52:06 +000013446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013447}
13448
13449
13450static int
13451test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013453
William M. Brack21e4ef22005-01-02 09:53:13 +000013454#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013455 int mem_base;
13456 int ret_val;
13457 xmlParserCtxtPtr ctxt; /* an XML parser context */
13458 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013459 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013460 int n_chunk;
13461 int size; /* the size in byte of the chunk */
13462 int n_size;
13463 int terminate; /* last chunk indicator */
13464 int n_terminate;
13465
13466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13467 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13468 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13469 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013471 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13472 chunk = gen_const_char_ptr(n_chunk, 1);
13473 size = gen_int(n_size, 2);
13474 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013475
William M. Brackf13f77f2004-11-12 16:03:48 +000013476 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013477 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013478 desret_int(ret_val);
13479 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013480 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013481 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013482 des_int(n_size, size, 2);
13483 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013484 xmlResetLastError();
13485 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013486 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013488 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013489 printf(" %d", n_ctxt);
13490 printf(" %d", n_chunk);
13491 printf(" %d", n_size);
13492 printf(" %d", n_terminate);
13493 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013494 }
13495 }
13496 }
13497 }
13498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013499 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013500#endif
13501
Daniel Veillard42595322004-11-08 10:52:06 +000013502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013503}
13504
13505
13506static int
13507test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013509
Daniel Veillardce682bc2004-11-05 17:22:25 +000013510 int mem_base;
13511 int ret_val;
13512 xmlParserCtxtPtr ctx; /* the existing parsing context */
13513 int n_ctx;
13514 xmlChar * URL; /* the URL for the entity to load */
13515 int n_URL;
13516 xmlChar * ID; /* the System ID for the entity to load */
13517 int n_ID;
13518 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13519 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013520
Daniel Veillardce682bc2004-11-05 17:22:25 +000013521 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13522 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13523 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13524 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13525 mem_base = xmlMemBlocks();
13526 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13527 URL = gen_const_xmlChar_ptr(n_URL, 1);
13528 ID = gen_const_xmlChar_ptr(n_ID, 2);
13529 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13530
William M. Brackf13f77f2004-11-12 16:03:48 +000013531 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013532 desret_int(ret_val);
13533 call_tests++;
13534 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013535 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13536 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013537 des_xmlNodePtr_ptr(n_lst, lst, 3);
13538 xmlResetLastError();
13539 if (mem_base != xmlMemBlocks()) {
13540 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013542 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013543 printf(" %d", n_ctx);
13544 printf(" %d", n_URL);
13545 printf(" %d", n_ID);
13546 printf(" %d", n_lst);
13547 printf("\n");
13548 }
13549 }
13550 }
13551 }
13552 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013554
Daniel Veillard42595322004-11-08 10:52:06 +000013555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013556}
13557
13558
13559static int
13560test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013562
William M. Brack21e4ef22005-01-02 09:53:13 +000013563#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013564#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013565 int mem_base;
13566 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013567 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013568 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013569 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013570 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013571
Daniel Veillard34099b42004-11-04 17:34:35 +000013572 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13573 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13574 mem_base = xmlMemBlocks();
13575 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13576 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13577
William M. Brackf13f77f2004-11-12 16:03:48 +000013578 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013579 desret_xmlDtdPtr(ret_val);
13580 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013581 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13582 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013583 xmlResetLastError();
13584 if (mem_base != xmlMemBlocks()) {
13585 printf("Leak of %d blocks found in xmlParseDTD",
13586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013587 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013588 printf(" %d", n_ExternalID);
13589 printf(" %d", n_SystemID);
13590 printf("\n");
13591 }
13592 }
13593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013594 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013595#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013596#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013597
Daniel Veillard42595322004-11-08 10:52:06 +000013598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013599}
13600
13601
13602static int
13603test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013605
William M. Brack21e4ef22005-01-02 09:53:13 +000013606#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013607#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013608 int mem_base;
13609 xmlDocPtr ret_val;
13610 xmlChar * cur; /* a pointer to an array of xmlChar */
13611 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013612
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013613 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13614 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013615 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013616
13617 ret_val = xmlParseDoc(cur);
13618 desret_xmlDocPtr(ret_val);
13619 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013620 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013621 xmlResetLastError();
13622 if (mem_base != xmlMemBlocks()) {
13623 printf("Leak of %d blocks found in xmlParseDoc",
13624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013625 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013626 printf(" %d", n_cur);
13627 printf("\n");
13628 }
13629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013630 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013631#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013632#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013633
Daniel Veillard42595322004-11-08 10:52:06 +000013634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013635}
13636
13637
13638static int
13639test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013641
13642 int mem_base;
13643 int ret_val;
13644 xmlParserCtxtPtr ctxt; /* an XML parser context */
13645 int n_ctxt;
13646
13647 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13648 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013649 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013650
13651 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013652 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013653 desret_int(ret_val);
13654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013655 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013656 xmlResetLastError();
13657 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013658 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013660 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013661 printf(" %d", n_ctxt);
13662 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013663 }
13664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013666
Daniel Veillard42595322004-11-08 10:52:06 +000013667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013668}
13669
13670
13671static int
13672test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013674
William M. Brack21e4ef22005-01-02 09:53:13 +000013675#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013676#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013677 int mem_base;
13678 xmlDocPtr ret_val;
13679 const char * filename; /* the filename */
13680 int n_filename;
13681
13682 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013684 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013685
13686 ret_val = xmlParseEntity(filename);
13687 desret_xmlDocPtr(ret_val);
13688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013689 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013690 xmlResetLastError();
13691 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013692 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013694 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013695 printf(" %d", n_filename);
13696 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697 }
13698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013699 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013700#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013701#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013702
Daniel Veillard42595322004-11-08 10:52:06 +000013703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013704}
13705
13706
13707static int
13708test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013710
13711 int mem_base;
13712 int ret_val;
13713 xmlParserCtxtPtr ctxt; /* an XML parser context */
13714 int n_ctxt;
13715
13716 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013718 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013719
13720 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013721 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013722 desret_int(ret_val);
13723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013724 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013725 xmlResetLastError();
13726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013727 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013730 printf(" %d", n_ctxt);
13731 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013732 }
13733 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013735
Daniel Veillard42595322004-11-08 10:52:06 +000013736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013737}
13738
13739
13740static int
13741test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013743
William M. Brack21e4ef22005-01-02 09:53:13 +000013744#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013745#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013746 int mem_base;
13747 int ret_val;
13748 xmlDocPtr doc; /* the document the chunk pertains to */
13749 int n_doc;
13750 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13751 int n_sax;
13752 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13753 int n_user_data;
13754 int depth; /* Used for loop detection, use 0 */
13755 int n_depth;
13756 xmlChar * URL; /* the URL for the entity to load */
13757 int n_URL;
13758 xmlChar * ID; /* the System ID for the entity to load */
13759 int n_ID;
13760 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13761 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013762
Daniel Veillardce682bc2004-11-05 17:22:25 +000013763 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13764 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13765 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13766 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13767 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13768 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13769 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13770 mem_base = xmlMemBlocks();
13771 doc = gen_xmlDocPtr(n_doc, 0);
13772 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13773 user_data = gen_userdata(n_user_data, 2);
13774 depth = gen_int(n_depth, 3);
13775 URL = gen_const_xmlChar_ptr(n_URL, 4);
13776 ID = gen_const_xmlChar_ptr(n_ID, 5);
13777 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13778
William M. Brackf13f77f2004-11-12 16:03:48 +000013779 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013780 desret_int(ret_val);
13781 call_tests++;
13782 des_xmlDocPtr(n_doc, doc, 0);
13783 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13784 des_userdata(n_user_data, user_data, 2);
13785 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013786 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13787 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013788 des_xmlNodePtr_ptr(n_lst, lst, 6);
13789 xmlResetLastError();
13790 if (mem_base != xmlMemBlocks()) {
13791 printf("Leak of %d blocks found in xmlParseExternalEntity",
13792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013793 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013794 printf(" %d", n_doc);
13795 printf(" %d", n_sax);
13796 printf(" %d", n_user_data);
13797 printf(" %d", n_depth);
13798 printf(" %d", n_URL);
13799 printf(" %d", n_ID);
13800 printf(" %d", n_lst);
13801 printf("\n");
13802 }
13803 }
13804 }
13805 }
13806 }
13807 }
13808 }
13809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013810 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013811#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013812#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013813
Daniel Veillard42595322004-11-08 10:52:06 +000013814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013815}
13816
13817
13818static int
13819test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013821
William M. Brack21e4ef22005-01-02 09:53:13 +000013822#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013823#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013824 int mem_base;
13825 xmlDocPtr ret_val;
13826 const char * filename; /* the filename */
13827 int n_filename;
13828
13829 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013831 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013832
13833 ret_val = xmlParseFile(filename);
13834 desret_xmlDocPtr(ret_val);
13835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013836 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013837 xmlResetLastError();
13838 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013839 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013842 printf(" %d", n_filename);
13843 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013844 }
13845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013846 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013847#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013848#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013849
Daniel Veillard42595322004-11-08 10:52:06 +000013850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013851}
13852
13853
13854static int
13855test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857
Daniel Veillard57b25162004-11-06 14:50:18 +000013858 int mem_base;
13859 xmlParserErrors ret_val;
13860 xmlNodePtr node; /* the context node */
13861 int n_node;
13862 char * data; /* the input string */
13863 int n_data;
13864 int datalen; /* the input string length in bytes */
13865 int n_datalen;
13866 int options; /* a combination of xmlParserOption */
13867 int n_options;
13868 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13869 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013870
Daniel Veillard57b25162004-11-06 14:50:18 +000013871 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13872 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13873 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013874 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013875 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13876 mem_base = xmlMemBlocks();
13877 node = gen_xmlNodePtr(n_node, 0);
13878 data = gen_const_char_ptr(n_data, 1);
13879 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013880 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013881 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13882
William M. Brackf13f77f2004-11-12 16:03:48 +000013883 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013884 desret_xmlParserErrors(ret_val);
13885 call_tests++;
13886 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013887 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013888 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013889 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013890 des_xmlNodePtr_ptr(n_lst, lst, 4);
13891 xmlResetLastError();
13892 if (mem_base != xmlMemBlocks()) {
13893 printf("Leak of %d blocks found in xmlParseInNodeContext",
13894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013895 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013896 printf(" %d", n_node);
13897 printf(" %d", n_data);
13898 printf(" %d", n_datalen);
13899 printf(" %d", n_options);
13900 printf(" %d", n_lst);
13901 printf("\n");
13902 }
13903 }
13904 }
13905 }
13906 }
13907 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013908 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013909
Daniel Veillard42595322004-11-08 10:52:06 +000013910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013911}
13912
13913
13914static int
13915test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
William M. Brack21e4ef22005-01-02 09:53:13 +000013918#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013919#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013920 int mem_base;
13921 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013922 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013923 int n_buffer;
13924 int size; /* the size of the array */
13925 int n_size;
13926
13927 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13928 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013930 buffer = gen_const_char_ptr(n_buffer, 0);
13931 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013932
William M. Brackf13f77f2004-11-12 16:03:48 +000013933 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013934 desret_xmlDocPtr(ret_val);
13935 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013936 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013937 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013938 xmlResetLastError();
13939 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013940 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013942 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013943 printf(" %d", n_buffer);
13944 printf(" %d", n_size);
13945 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013946 }
13947 }
13948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013949 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013950#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013951#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
Daniel Veillard42595322004-11-08 10:52:06 +000013953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013954}
13955
13956
Daniel Veillardce682bc2004-11-05 17:22:25 +000013957#define gen_nb_const_xmlParserNodeInfoPtr 1
13958static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13959 return(NULL);
13960}
13961static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13962}
13963
Daniel Veillardd93f6252004-11-02 15:53:51 +000013964static int
13965test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013967
Daniel Veillardce682bc2004-11-05 17:22:25 +000013968 int mem_base;
13969 xmlParserCtxtPtr ctxt; /* an XML parser context */
13970 int n_ctxt;
13971 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13972 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013973
Daniel Veillardce682bc2004-11-05 17:22:25 +000013974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13975 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
13976 mem_base = xmlMemBlocks();
13977 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13978 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
13979
William M. Brackf13f77f2004-11-12 16:03:48 +000013980 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013981 call_tests++;
13982 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013983 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013984 xmlResetLastError();
13985 if (mem_base != xmlMemBlocks()) {
13986 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
13987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013988 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013989 printf(" %d", n_ctxt);
13990 printf(" %d", n_info);
13991 printf("\n");
13992 }
13993 }
13994 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013996
Daniel Veillard42595322004-11-08 10:52:06 +000013997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013998}
13999
14000
Daniel Veillardce682bc2004-11-05 17:22:25 +000014001#define gen_nb_const_xmlParserCtxtPtr 1
14002static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14003 return(NULL);
14004}
14005static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14006}
14007
Daniel Veillarda521d282004-11-09 14:59:59 +000014008#define gen_nb_const_xmlNodePtr 1
14009static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14010 return(NULL);
14011}
14012static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14013}
14014
Daniel Veillardd93f6252004-11-02 15:53:51 +000014015static int
14016test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014018
William M. Brack094dd862004-11-14 14:28:34 +000014019 int mem_base;
14020 const xmlParserNodeInfo * ret_val;
14021 xmlParserCtxtPtr ctx; /* an XML parser context */
14022 int n_ctx;
14023 xmlNodePtr node; /* an XML node within the tree */
14024 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014025
William M. Brack094dd862004-11-14 14:28:34 +000014026 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14027 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14028 mem_base = xmlMemBlocks();
14029 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14030 node = gen_const_xmlNodePtr(n_node, 1);
14031
14032 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14033 desret_const_xmlParserNodeInfo_ptr(ret_val);
14034 call_tests++;
14035 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14036 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14037 xmlResetLastError();
14038 if (mem_base != xmlMemBlocks()) {
14039 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14040 xmlMemBlocks() - mem_base);
14041 test_ret++;
14042 printf(" %d", n_ctx);
14043 printf(" %d", n_node);
14044 printf("\n");
14045 }
14046 }
14047 }
14048 function_tests++;
14049
Daniel Veillard42595322004-11-08 10:52:06 +000014050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014051}
14052
14053
Daniel Veillardce682bc2004-11-05 17:22:25 +000014054#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14055static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14056 return(NULL);
14057}
14058static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14059}
14060
Daniel Veillardd93f6252004-11-02 15:53:51 +000014061static int
14062test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014064
William M. Brack094dd862004-11-14 14:28:34 +000014065 int mem_base;
14066 unsigned long ret_val;
14067 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14068 int n_seq;
14069 xmlNodePtr node; /* an XML node pointer */
14070 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014071
William M. Brack094dd862004-11-14 14:28:34 +000014072 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14073 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14074 mem_base = xmlMemBlocks();
14075 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14076 node = gen_const_xmlNodePtr(n_node, 1);
14077
14078 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14079 desret_unsigned_long(ret_val);
14080 call_tests++;
14081 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14082 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14083 xmlResetLastError();
14084 if (mem_base != xmlMemBlocks()) {
14085 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14086 xmlMemBlocks() - mem_base);
14087 test_ret++;
14088 printf(" %d", n_seq);
14089 printf(" %d", n_node);
14090 printf("\n");
14091 }
14092 }
14093 }
14094 function_tests++;
14095
Daniel Veillard42595322004-11-08 10:52:06 +000014096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014097}
14098
14099
Daniel Veillardce682bc2004-11-05 17:22:25 +000014100#define gen_nb_xmlParserInputPtr 1
14101static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14102 return(NULL);
14103}
14104static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14105}
14106
Daniel Veillardd93f6252004-11-02 15:53:51 +000014107static int
14108test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014110
Daniel Veillardce682bc2004-11-05 17:22:25 +000014111 int mem_base;
14112 int ret_val;
14113 xmlParserInputPtr in; /* an XML parser input */
14114 int n_in;
14115 int len; /* an indicative size for the lookahead */
14116 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014117
Daniel Veillardce682bc2004-11-05 17:22:25 +000014118 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14119 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14120 mem_base = xmlMemBlocks();
14121 in = gen_xmlParserInputPtr(n_in, 0);
14122 len = gen_int(n_len, 1);
14123
14124 ret_val = xmlParserInputGrow(in, len);
14125 desret_int(ret_val);
14126 call_tests++;
14127 des_xmlParserInputPtr(n_in, in, 0);
14128 des_int(n_len, len, 1);
14129 xmlResetLastError();
14130 if (mem_base != xmlMemBlocks()) {
14131 printf("Leak of %d blocks found in xmlParserInputGrow",
14132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014134 printf(" %d", n_in);
14135 printf(" %d", n_len);
14136 printf("\n");
14137 }
14138 }
14139 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014141
Daniel Veillard42595322004-11-08 10:52:06 +000014142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014143}
14144
14145
14146static int
14147test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014149
Daniel Veillardce682bc2004-11-05 17:22:25 +000014150 int mem_base;
14151 int ret_val;
14152 xmlParserInputPtr in; /* an XML parser input */
14153 int n_in;
14154 int len; /* an indicative size for the lookahead */
14155 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014156
Daniel Veillardce682bc2004-11-05 17:22:25 +000014157 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14158 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14159 mem_base = xmlMemBlocks();
14160 in = gen_xmlParserInputPtr(n_in, 0);
14161 len = gen_int(n_len, 1);
14162
14163 ret_val = xmlParserInputRead(in, len);
14164 desret_int(ret_val);
14165 call_tests++;
14166 des_xmlParserInputPtr(n_in, in, 0);
14167 des_int(n_len, len, 1);
14168 xmlResetLastError();
14169 if (mem_base != xmlMemBlocks()) {
14170 printf("Leak of %d blocks found in xmlParserInputRead",
14171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014173 printf(" %d", n_in);
14174 printf(" %d", n_len);
14175 printf("\n");
14176 }
14177 }
14178 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014180
Daniel Veillard42595322004-11-08 10:52:06 +000014181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182}
14183
14184
14185static int
14186test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014188
14189 int mem_base;
14190 int ret_val;
14191 int val; /* int 0 or 1 */
14192 int n_val;
14193
14194 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014196 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014197
14198 ret_val = xmlPedanticParserDefault(val);
14199 desret_int(ret_val);
14200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014201 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014202 xmlResetLastError();
14203 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014204 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014206 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014207 printf(" %d", n_val);
14208 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209 }
14210 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014211 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014212
Daniel Veillard42595322004-11-08 10:52:06 +000014213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014214}
14215
14216
14217static int
14218test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014220
14221 int mem_base;
14222 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014223 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014224 int n_cur;
14225 const char * URL; /* the base URL to use for the document */
14226 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014227 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014228 int n_encoding;
14229 int options; /* a combination of xmlParserOption */
14230 int n_options;
14231
14232 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14233 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14234 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014235 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014237 cur = gen_const_xmlChar_ptr(n_cur, 0);
14238 URL = gen_filepath(n_URL, 1);
14239 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014240 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014241
William M. Brackf13f77f2004-11-12 16:03:48 +000014242 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014243 desret_xmlDocPtr(ret_val);
14244 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014245 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014246 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014247 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014248 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249 xmlResetLastError();
14250 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014251 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014253 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014254 printf(" %d", n_cur);
14255 printf(" %d", n_URL);
14256 printf(" %d", n_encoding);
14257 printf(" %d", n_options);
14258 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014259 }
14260 }
14261 }
14262 }
14263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014265
Daniel Veillard42595322004-11-08 10:52:06 +000014266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014267}
14268
14269
14270static int
14271test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273
14274 int mem_base;
14275 xmlDocPtr ret_val;
14276 const char * filename; /* a file or URL */
14277 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014278 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014279 int n_encoding;
14280 int options; /* a combination of xmlParserOption */
14281 int n_options;
14282
14283 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14284 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014285 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014287 filename = gen_filepath(n_filename, 0);
14288 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014289 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014290
William M. Brackf13f77f2004-11-12 16:03:48 +000014291 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014292 desret_xmlDocPtr(ret_val);
14293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014294 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014295 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014296 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014297 xmlResetLastError();
14298 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014299 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014301 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014302 printf(" %d", n_filename);
14303 printf(" %d", n_encoding);
14304 printf(" %d", n_options);
14305 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014306 }
14307 }
14308 }
14309 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014311
Daniel Veillard42595322004-11-08 10:52:06 +000014312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014313}
14314
14315
14316static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014317test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014319
14320 int mem_base;
14321 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014322 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014323 int n_buffer;
14324 int size; /* the size of the array */
14325 int n_size;
14326 const char * URL; /* the base URL to use for the document */
14327 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014328 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329 int n_encoding;
14330 int options; /* a combination of xmlParserOption */
14331 int n_options;
14332
14333 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14334 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14335 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14336 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014337 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014338 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014339 buffer = gen_const_char_ptr(n_buffer, 0);
14340 size = gen_int(n_size, 1);
14341 URL = gen_filepath(n_URL, 2);
14342 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014343 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344
William M. Brackf13f77f2004-11-12 16:03:48 +000014345 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014346 desret_xmlDocPtr(ret_val);
14347 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014348 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014349 des_int(n_size, size, 1);
14350 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014351 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014352 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014353 xmlResetLastError();
14354 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014355 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014357 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014358 printf(" %d", n_buffer);
14359 printf(" %d", n_size);
14360 printf(" %d", n_URL);
14361 printf(" %d", n_encoding);
14362 printf(" %d", n_options);
14363 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364 }
14365 }
14366 }
14367 }
14368 }
14369 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014371
Daniel Veillard42595322004-11-08 10:52:06 +000014372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014373}
14374
14375
14376static int
14377test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014379
William M. Brack21e4ef22005-01-02 09:53:13 +000014380#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014381#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014382 int mem_base;
14383 xmlDocPtr ret_val;
14384 xmlChar * cur; /* a pointer to an array of xmlChar */
14385 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014386
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014387 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014389 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014390
14391 ret_val = xmlRecoverDoc(cur);
14392 desret_xmlDocPtr(ret_val);
14393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014394 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014395 xmlResetLastError();
14396 if (mem_base != xmlMemBlocks()) {
14397 printf("Leak of %d blocks found in xmlRecoverDoc",
14398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014399 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014400 printf(" %d", n_cur);
14401 printf("\n");
14402 }
14403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014404 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014405#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014406#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014407
Daniel Veillard42595322004-11-08 10:52:06 +000014408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014409}
14410
14411
14412static int
14413test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014415
William M. Brack21e4ef22005-01-02 09:53:13 +000014416#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014417#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014418 int mem_base;
14419 xmlDocPtr ret_val;
14420 const char * filename; /* the filename */
14421 int n_filename;
14422
14423 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014425 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014426
14427 ret_val = xmlRecoverFile(filename);
14428 desret_xmlDocPtr(ret_val);
14429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014430 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014431 xmlResetLastError();
14432 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014433 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014435 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014436 printf(" %d", n_filename);
14437 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 }
14439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014440 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014441#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014442#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014443
Daniel Veillard42595322004-11-08 10:52:06 +000014444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014445}
14446
14447
14448static int
14449test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014451
William M. Brack21e4ef22005-01-02 09:53:13 +000014452#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014453#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014454 int mem_base;
14455 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014456 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014457 int n_buffer;
14458 int size; /* the size of the array */
14459 int n_size;
14460
14461 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14462 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14463 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014464 buffer = gen_const_char_ptr(n_buffer, 0);
14465 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466
William M. Brackf13f77f2004-11-12 16:03:48 +000014467 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014468 desret_xmlDocPtr(ret_val);
14469 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014470 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014471 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014472 xmlResetLastError();
14473 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014474 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014477 printf(" %d", n_buffer);
14478 printf(" %d", n_size);
14479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014480 }
14481 }
14482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014483 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014484#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014485#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014486
Daniel Veillard42595322004-11-08 10:52:06 +000014487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014488}
14489
14490
14491static int
14492test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014494
William M. Brack21e4ef22005-01-02 09:53:13 +000014495#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014496#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014497 int mem_base;
14498 xmlDtdPtr ret_val;
14499 xmlSAXHandlerPtr sax; /* the SAX handler block */
14500 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014501 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014502 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014503 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014504 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014505
Daniel Veillard34099b42004-11-04 17:34:35 +000014506 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14507 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14508 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14509 mem_base = xmlMemBlocks();
14510 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14511 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14512 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14513
William M. Brackf13f77f2004-11-12 16:03:48 +000014514 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014515 desret_xmlDtdPtr(ret_val);
14516 call_tests++;
14517 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014518 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14519 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014520 xmlResetLastError();
14521 if (mem_base != xmlMemBlocks()) {
14522 printf("Leak of %d blocks found in xmlSAXParseDTD",
14523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014524 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014525 printf(" %d", n_sax);
14526 printf(" %d", n_ExternalID);
14527 printf(" %d", n_SystemID);
14528 printf("\n");
14529 }
14530 }
14531 }
14532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014533 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014534#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014535#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014536
Daniel Veillard42595322004-11-08 10:52:06 +000014537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538}
14539
14540
14541static int
14542test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014544
William M. Brack21e4ef22005-01-02 09:53:13 +000014545#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014546#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014547 int mem_base;
14548 xmlDocPtr ret_val;
14549 xmlSAXHandlerPtr sax; /* the SAX handler block */
14550 int n_sax;
14551 xmlChar * cur; /* a pointer to an array of xmlChar */
14552 int n_cur;
14553 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14554 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014555
Daniel Veillard34099b42004-11-04 17:34:35 +000014556 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14557 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14558 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14559 mem_base = xmlMemBlocks();
14560 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14561 cur = gen_xmlChar_ptr(n_cur, 1);
14562 recovery = gen_int(n_recovery, 2);
14563
14564 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14565 desret_xmlDocPtr(ret_val);
14566 call_tests++;
14567 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14568 des_xmlChar_ptr(n_cur, cur, 1);
14569 des_int(n_recovery, recovery, 2);
14570 xmlResetLastError();
14571 if (mem_base != xmlMemBlocks()) {
14572 printf("Leak of %d blocks found in xmlSAXParseDoc",
14573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014574 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014575 printf(" %d", n_sax);
14576 printf(" %d", n_cur);
14577 printf(" %d", n_recovery);
14578 printf("\n");
14579 }
14580 }
14581 }
14582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014583 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014584#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014585#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014586
Daniel Veillard42595322004-11-08 10:52:06 +000014587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014588}
14589
14590
14591static int
14592test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014594
William M. Brack21e4ef22005-01-02 09:53:13 +000014595#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014596#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014597 int mem_base;
14598 xmlDocPtr ret_val;
14599 xmlSAXHandlerPtr sax; /* the SAX handler block */
14600 int n_sax;
14601 const char * filename; /* the filename */
14602 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014603
Daniel Veillard34099b42004-11-04 17:34:35 +000014604 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14605 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14606 mem_base = xmlMemBlocks();
14607 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14608 filename = gen_filepath(n_filename, 1);
14609
14610 ret_val = xmlSAXParseEntity(sax, filename);
14611 desret_xmlDocPtr(ret_val);
14612 call_tests++;
14613 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14614 des_filepath(n_filename, filename, 1);
14615 xmlResetLastError();
14616 if (mem_base != xmlMemBlocks()) {
14617 printf("Leak of %d blocks found in xmlSAXParseEntity",
14618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014619 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014620 printf(" %d", n_sax);
14621 printf(" %d", n_filename);
14622 printf("\n");
14623 }
14624 }
14625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014626 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014627#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014628#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014629
Daniel Veillard42595322004-11-08 10:52:06 +000014630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014631}
14632
14633
14634static int
14635test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014637
William M. Brack21e4ef22005-01-02 09:53:13 +000014638#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014639#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014640 int mem_base;
14641 xmlDocPtr ret_val;
14642 xmlSAXHandlerPtr sax; /* the SAX handler block */
14643 int n_sax;
14644 const char * filename; /* the filename */
14645 int n_filename;
14646 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14647 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014648
Daniel Veillard34099b42004-11-04 17:34:35 +000014649 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14650 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14651 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14652 mem_base = xmlMemBlocks();
14653 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14654 filename = gen_filepath(n_filename, 1);
14655 recovery = gen_int(n_recovery, 2);
14656
14657 ret_val = xmlSAXParseFile(sax, filename, recovery);
14658 desret_xmlDocPtr(ret_val);
14659 call_tests++;
14660 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14661 des_filepath(n_filename, filename, 1);
14662 des_int(n_recovery, recovery, 2);
14663 xmlResetLastError();
14664 if (mem_base != xmlMemBlocks()) {
14665 printf("Leak of %d blocks found in xmlSAXParseFile",
14666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014667 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014668 printf(" %d", n_sax);
14669 printf(" %d", n_filename);
14670 printf(" %d", n_recovery);
14671 printf("\n");
14672 }
14673 }
14674 }
14675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014676 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014677#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014678#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014679
Daniel Veillard42595322004-11-08 10:52:06 +000014680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014681}
14682
14683
14684static int
14685test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014687
William M. Brack21e4ef22005-01-02 09:53:13 +000014688#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014689#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014690 int mem_base;
14691 xmlDocPtr ret_val;
14692 xmlSAXHandlerPtr sax; /* the SAX handler block */
14693 int n_sax;
14694 const char * filename; /* the filename */
14695 int n_filename;
14696 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14697 int n_recovery;
14698 void * data; /* the userdata */
14699 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014700
Daniel Veillard34099b42004-11-04 17:34:35 +000014701 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14702 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14703 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14704 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14705 mem_base = xmlMemBlocks();
14706 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14707 filename = gen_filepath(n_filename, 1);
14708 recovery = gen_int(n_recovery, 2);
14709 data = gen_userdata(n_data, 3);
14710
14711 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14712 desret_xmlDocPtr(ret_val);
14713 call_tests++;
14714 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14715 des_filepath(n_filename, filename, 1);
14716 des_int(n_recovery, recovery, 2);
14717 des_userdata(n_data, data, 3);
14718 xmlResetLastError();
14719 if (mem_base != xmlMemBlocks()) {
14720 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014722 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014723 printf(" %d", n_sax);
14724 printf(" %d", n_filename);
14725 printf(" %d", n_recovery);
14726 printf(" %d", n_data);
14727 printf("\n");
14728 }
14729 }
14730 }
14731 }
14732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014733 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014734#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014735#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014736
Daniel Veillard42595322004-11-08 10:52:06 +000014737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014738}
14739
14740
14741static int
14742test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014744
William M. Brack21e4ef22005-01-02 09:53:13 +000014745#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014746#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014747 int mem_base;
14748 xmlDocPtr ret_val;
14749 xmlSAXHandlerPtr sax; /* the SAX handler block */
14750 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014751 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014752 int n_buffer;
14753 int size; /* the size of the array */
14754 int n_size;
14755 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14756 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014757
Daniel Veillard34099b42004-11-04 17:34:35 +000014758 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14759 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14760 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14761 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14762 mem_base = xmlMemBlocks();
14763 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14764 buffer = gen_const_char_ptr(n_buffer, 1);
14765 size = gen_int(n_size, 2);
14766 recovery = gen_int(n_recovery, 3);
14767
William M. Brackf13f77f2004-11-12 16:03:48 +000014768 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014769 desret_xmlDocPtr(ret_val);
14770 call_tests++;
14771 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014772 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014773 des_int(n_size, size, 2);
14774 des_int(n_recovery, recovery, 3);
14775 xmlResetLastError();
14776 if (mem_base != xmlMemBlocks()) {
14777 printf("Leak of %d blocks found in xmlSAXParseMemory",
14778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014779 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014780 printf(" %d", n_sax);
14781 printf(" %d", n_buffer);
14782 printf(" %d", n_size);
14783 printf(" %d", n_recovery);
14784 printf("\n");
14785 }
14786 }
14787 }
14788 }
14789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014790 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014791#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014792#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014793
Daniel Veillard42595322004-11-08 10:52:06 +000014794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014795}
14796
14797
14798static int
14799test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801
William M. Brack21e4ef22005-01-02 09:53:13 +000014802#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014803#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014804 int mem_base;
14805 xmlDocPtr ret_val;
14806 xmlSAXHandlerPtr sax; /* the SAX handler block */
14807 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014808 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014809 int n_buffer;
14810 int size; /* the size of the array */
14811 int n_size;
14812 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14813 int n_recovery;
14814 void * data; /* the userdata */
14815 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014816
Daniel Veillard34099b42004-11-04 17:34:35 +000014817 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14818 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14819 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14820 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14821 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14822 mem_base = xmlMemBlocks();
14823 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14824 buffer = gen_const_char_ptr(n_buffer, 1);
14825 size = gen_int(n_size, 2);
14826 recovery = gen_int(n_recovery, 3);
14827 data = gen_userdata(n_data, 4);
14828
William M. Brackf13f77f2004-11-12 16:03:48 +000014829 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014830 desret_xmlDocPtr(ret_val);
14831 call_tests++;
14832 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014833 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014834 des_int(n_size, size, 2);
14835 des_int(n_recovery, recovery, 3);
14836 des_userdata(n_data, data, 4);
14837 xmlResetLastError();
14838 if (mem_base != xmlMemBlocks()) {
14839 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014841 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014842 printf(" %d", n_sax);
14843 printf(" %d", n_buffer);
14844 printf(" %d", n_size);
14845 printf(" %d", n_recovery);
14846 printf(" %d", n_data);
14847 printf("\n");
14848 }
14849 }
14850 }
14851 }
14852 }
14853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014854 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014855#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014856#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014857
Daniel Veillard42595322004-11-08 10:52:06 +000014858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014859}
14860
14861
14862static int
14863test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014865
William M. Brack21e4ef22005-01-02 09:53:13 +000014866#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014867#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014868 int mem_base;
14869 int ret_val;
14870 xmlSAXHandlerPtr sax; /* a SAX handler */
14871 int n_sax;
14872 void * user_data; /* The user data returned on SAX callbacks */
14873 int n_user_data;
14874 const char * filename; /* a file name */
14875 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014876
Daniel Veillard34099b42004-11-04 17:34:35 +000014877 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14878 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14879 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14880 mem_base = xmlMemBlocks();
14881 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14882 user_data = gen_userdata(n_user_data, 1);
14883 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014884
14885#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014886 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014887#endif
14888
Daniel Veillard34099b42004-11-04 17:34:35 +000014889
14890 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14891 desret_int(ret_val);
14892 call_tests++;
14893 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14894 des_userdata(n_user_data, user_data, 1);
14895 des_filepath(n_filename, filename, 2);
14896 xmlResetLastError();
14897 if (mem_base != xmlMemBlocks()) {
14898 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014900 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014901 printf(" %d", n_sax);
14902 printf(" %d", n_user_data);
14903 printf(" %d", n_filename);
14904 printf("\n");
14905 }
14906 }
14907 }
14908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014909 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014910#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014911#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014912
Daniel Veillard42595322004-11-08 10:52:06 +000014913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014914}
14915
14916
14917static int
14918test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014920
William M. Brack21e4ef22005-01-02 09:53:13 +000014921#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014922#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014923 int mem_base;
14924 int ret_val;
14925 xmlSAXHandlerPtr sax; /* a SAX handler */
14926 int n_sax;
14927 void * user_data; /* The user data returned on SAX callbacks */
14928 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014929 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014930 int n_buffer;
14931 int size; /* the length of the XML document in bytes */
14932 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014933
Daniel Veillard34099b42004-11-04 17:34:35 +000014934 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14935 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14936 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14937 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14938 mem_base = xmlMemBlocks();
14939 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14940 user_data = gen_userdata(n_user_data, 1);
14941 buffer = gen_const_char_ptr(n_buffer, 2);
14942 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014943
14944#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014945 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014946#endif
14947
Daniel Veillard34099b42004-11-04 17:34:35 +000014948
William M. Brackf13f77f2004-11-12 16:03:48 +000014949 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 desret_int(ret_val);
14951 call_tests++;
14952 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14953 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014954 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014955 des_int(n_size, size, 3);
14956 xmlResetLastError();
14957 if (mem_base != xmlMemBlocks()) {
14958 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014960 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014961 printf(" %d", n_sax);
14962 printf(" %d", n_user_data);
14963 printf(" %d", n_buffer);
14964 printf(" %d", n_size);
14965 printf("\n");
14966 }
14967 }
14968 }
14969 }
14970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014971 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014972#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014973#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014974
Daniel Veillard42595322004-11-08 10:52:06 +000014975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014976}
14977
14978
14979static int
14980test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014982
14983
14984 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014986}
14987
14988
14989static int
14990test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014992
William M. Brack21e4ef22005-01-02 09:53:13 +000014993#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014994#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014995 int mem_base;
14996 int ret_val;
14997 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
14998 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014999 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015000 int n_name;
15001 void * value; /* pointer to the location of the new value */
15002 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015003
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015004 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15005 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15006 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15007 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015008 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15009 name = gen_const_char_ptr(n_name, 1);
15010 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015011
William M. Brackf13f77f2004-11-12 16:03:48 +000015012 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015013 desret_int(ret_val);
15014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015015 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015016 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015017 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015018 xmlResetLastError();
15019 if (mem_base != xmlMemBlocks()) {
15020 printf("Leak of %d blocks found in xmlSetFeature",
15021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015022 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015023 printf(" %d", n_ctxt);
15024 printf(" %d", n_name);
15025 printf(" %d", n_value);
15026 printf("\n");
15027 }
15028 }
15029 }
15030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015031 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015032#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015033#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015034
Daniel Veillard42595322004-11-08 10:52:06 +000015035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015036}
15037
15038
15039static int
15040test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015042
William M. Brack21e4ef22005-01-02 09:53:13 +000015043#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015044#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015045 int mem_base;
15046 xmlParserCtxtPtr ctxt; /* an XML parser context */
15047 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015048 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015049 int n_buffer;
15050 const char * filename; /* a file name */
15051 int n_filename;
15052
15053 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15054 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15055 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15056 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015057 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15058 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15059 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015060
William M. Brackf13f77f2004-11-12 16:03:48 +000015061 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015063 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015064 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015065 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015066 xmlResetLastError();
15067 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015068 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015070 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015071 printf(" %d", n_ctxt);
15072 printf(" %d", n_buffer);
15073 printf(" %d", n_filename);
15074 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015075 }
15076 }
15077 }
15078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015079 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015080#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015081#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015082
Daniel Veillard42595322004-11-08 10:52:06 +000015083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015084}
15085
15086
15087static int
15088test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015090
William M. Brack21e4ef22005-01-02 09:53:13 +000015091#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015092#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015093 int mem_base;
15094 xmlParserCtxtPtr ctxt; /* an XML parser context */
15095 int n_ctxt;
15096
15097 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015099 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015100
15101 xmlStopParser(ctxt);
15102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015103 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015104 xmlResetLastError();
15105 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015106 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015108 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015109 printf(" %d", n_ctxt);
15110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015111 }
15112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015113 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015114#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015115#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015116
Daniel Veillard42595322004-11-08 10:52:06 +000015117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015118}
15119
15120
15121static int
15122test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015124
15125 int mem_base;
15126 int ret_val;
15127 int val; /* int 0 or 1 */
15128 int n_val;
15129
15130 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015132 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015133
15134 ret_val = xmlSubstituteEntitiesDefault(val);
15135 desret_int(ret_val);
15136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015137 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015138 xmlResetLastError();
15139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015140 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015143 printf(" %d", n_val);
15144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145 }
15146 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015147 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015148
Daniel Veillard42595322004-11-08 10:52:06 +000015149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015150}
15151
15152static int
15153test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015155
William M. Brack094dd862004-11-14 14:28:34 +000015156 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015157 test_ret += test_xmlByteConsumed();
15158 test_ret += test_xmlClearNodeInfoSeq();
15159 test_ret += test_xmlClearParserCtxt();
15160 test_ret += test_xmlCreateDocParserCtxt();
15161 test_ret += test_xmlCreatePushParserCtxt();
15162 test_ret += test_xmlCtxtReadDoc();
15163 test_ret += test_xmlCtxtReadFile();
15164 test_ret += test_xmlCtxtReadMemory();
15165 test_ret += test_xmlCtxtReset();
15166 test_ret += test_xmlCtxtResetPush();
15167 test_ret += test_xmlCtxtUseOptions();
15168 test_ret += test_xmlGetExternalEntityLoader();
15169 test_ret += test_xmlGetFeature();
15170 test_ret += test_xmlGetFeaturesList();
15171 test_ret += test_xmlIOParseDTD();
15172 test_ret += test_xmlInitNodeInfoSeq();
15173 test_ret += test_xmlInitParser();
15174 test_ret += test_xmlInitParserCtxt();
15175 test_ret += test_xmlKeepBlanksDefault();
15176 test_ret += test_xmlLineNumbersDefault();
15177 test_ret += test_xmlLoadExternalEntity();
15178 test_ret += test_xmlNewIOInputStream();
15179 test_ret += test_xmlNewParserCtxt();
15180 test_ret += test_xmlParseBalancedChunkMemory();
15181 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15182 test_ret += test_xmlParseChunk();
15183 test_ret += test_xmlParseCtxtExternalEntity();
15184 test_ret += test_xmlParseDTD();
15185 test_ret += test_xmlParseDoc();
15186 test_ret += test_xmlParseDocument();
15187 test_ret += test_xmlParseEntity();
15188 test_ret += test_xmlParseExtParsedEnt();
15189 test_ret += test_xmlParseExternalEntity();
15190 test_ret += test_xmlParseFile();
15191 test_ret += test_xmlParseInNodeContext();
15192 test_ret += test_xmlParseMemory();
15193 test_ret += test_xmlParserAddNodeInfo();
15194 test_ret += test_xmlParserFindNodeInfo();
15195 test_ret += test_xmlParserFindNodeInfoIndex();
15196 test_ret += test_xmlParserInputGrow();
15197 test_ret += test_xmlParserInputRead();
15198 test_ret += test_xmlPedanticParserDefault();
15199 test_ret += test_xmlReadDoc();
15200 test_ret += test_xmlReadFile();
15201 test_ret += test_xmlReadMemory();
15202 test_ret += test_xmlRecoverDoc();
15203 test_ret += test_xmlRecoverFile();
15204 test_ret += test_xmlRecoverMemory();
15205 test_ret += test_xmlSAXParseDTD();
15206 test_ret += test_xmlSAXParseDoc();
15207 test_ret += test_xmlSAXParseEntity();
15208 test_ret += test_xmlSAXParseFile();
15209 test_ret += test_xmlSAXParseFileWithData();
15210 test_ret += test_xmlSAXParseMemory();
15211 test_ret += test_xmlSAXParseMemoryWithData();
15212 test_ret += test_xmlSAXUserParseFile();
15213 test_ret += test_xmlSAXUserParseMemory();
15214 test_ret += test_xmlSetExternalEntityLoader();
15215 test_ret += test_xmlSetFeature();
15216 test_ret += test_xmlSetupParserForBuffer();
15217 test_ret += test_xmlStopParser();
15218 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015219
Daniel Veillard42595322004-11-08 10:52:06 +000015220 if (test_ret != 0)
15221 printf("Module parser: %d errors\n", test_ret);
15222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015223}
15224
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015225static int
15226test_htmlCreateFileParserCtxt(void) {
15227 int test_ret = 0;
15228
William M. Brack21e4ef22005-01-02 09:53:13 +000015229#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015230 int mem_base;
15231 htmlParserCtxtPtr ret_val;
15232 const char * filename; /* the filename */
15233 int n_filename;
15234 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15235 int n_encoding;
15236
15237 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15238 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15239 mem_base = xmlMemBlocks();
15240 filename = gen_fileoutput(n_filename, 0);
15241 encoding = gen_const_char_ptr(n_encoding, 1);
15242
William M. Brackf13f77f2004-11-12 16:03:48 +000015243 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015244 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015245 call_tests++;
15246 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015247 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015248 xmlResetLastError();
15249 if (mem_base != xmlMemBlocks()) {
15250 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15251 xmlMemBlocks() - mem_base);
15252 test_ret++;
15253 printf(" %d", n_filename);
15254 printf(" %d", n_encoding);
15255 printf("\n");
15256 }
15257 }
15258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015259 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015260#endif
15261
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015262 return(test_ret);
15263}
15264
15265
15266static int
15267test_htmlInitAutoClose(void) {
15268 int test_ret = 0;
15269
William M. Brack21e4ef22005-01-02 09:53:13 +000015270#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015271 int mem_base;
15272
15273 mem_base = xmlMemBlocks();
15274
15275 htmlInitAutoClose();
15276 call_tests++;
15277 xmlResetLastError();
15278 if (mem_base != xmlMemBlocks()) {
15279 printf("Leak of %d blocks found in htmlInitAutoClose",
15280 xmlMemBlocks() - mem_base);
15281 test_ret++;
15282 printf("\n");
15283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015284 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015285#endif
15286
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015287 return(test_ret);
15288}
15289
15290
15291static int
15292test_inputPop(void) {
15293 int test_ret = 0;
15294
15295 int mem_base;
15296 xmlParserInputPtr ret_val;
15297 xmlParserCtxtPtr ctxt; /* an XML parser context */
15298 int n_ctxt;
15299
15300 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15301 mem_base = xmlMemBlocks();
15302 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15303
15304 ret_val = inputPop(ctxt);
15305 desret_xmlParserInputPtr(ret_val);
15306 call_tests++;
15307 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15308 xmlResetLastError();
15309 if (mem_base != xmlMemBlocks()) {
15310 printf("Leak of %d blocks found in inputPop",
15311 xmlMemBlocks() - mem_base);
15312 test_ret++;
15313 printf(" %d", n_ctxt);
15314 printf("\n");
15315 }
15316 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015318
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015319 return(test_ret);
15320}
15321
15322
15323static int
15324test_inputPush(void) {
15325 int test_ret = 0;
15326
15327 int mem_base;
15328 int ret_val;
15329 xmlParserCtxtPtr ctxt; /* an XML parser context */
15330 int n_ctxt;
15331 xmlParserInputPtr value; /* the parser input */
15332 int n_value;
15333
15334 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15335 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15336 mem_base = xmlMemBlocks();
15337 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15338 value = gen_xmlParserInputPtr(n_value, 1);
15339
15340 ret_val = inputPush(ctxt, value);
15341 desret_int(ret_val);
15342 call_tests++;
15343 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15344 des_xmlParserInputPtr(n_value, value, 1);
15345 xmlResetLastError();
15346 if (mem_base != xmlMemBlocks()) {
15347 printf("Leak of %d blocks found in inputPush",
15348 xmlMemBlocks() - mem_base);
15349 test_ret++;
15350 printf(" %d", n_ctxt);
15351 printf(" %d", n_value);
15352 printf("\n");
15353 }
15354 }
15355 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015357
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015358 return(test_ret);
15359}
15360
15361
15362static int
15363test_namePop(void) {
15364 int test_ret = 0;
15365
15366 int mem_base;
15367 const xmlChar * ret_val;
15368 xmlParserCtxtPtr ctxt; /* an XML parser context */
15369 int n_ctxt;
15370
15371 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15372 mem_base = xmlMemBlocks();
15373 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15374
15375 ret_val = namePop(ctxt);
15376 desret_const_xmlChar_ptr(ret_val);
15377 call_tests++;
15378 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15379 xmlResetLastError();
15380 if (mem_base != xmlMemBlocks()) {
15381 printf("Leak of %d blocks found in namePop",
15382 xmlMemBlocks() - mem_base);
15383 test_ret++;
15384 printf(" %d", n_ctxt);
15385 printf("\n");
15386 }
15387 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015389
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015390 return(test_ret);
15391}
15392
15393
15394static int
15395test_namePush(void) {
15396 int test_ret = 0;
15397
15398 int mem_base;
15399 int ret_val;
15400 xmlParserCtxtPtr ctxt; /* an XML parser context */
15401 int n_ctxt;
15402 xmlChar * value; /* the element name */
15403 int n_value;
15404
15405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15406 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15407 mem_base = xmlMemBlocks();
15408 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15409 value = gen_const_xmlChar_ptr(n_value, 1);
15410
William M. Brackf13f77f2004-11-12 16:03:48 +000015411 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015412 desret_int(ret_val);
15413 call_tests++;
15414 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015415 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015416 xmlResetLastError();
15417 if (mem_base != xmlMemBlocks()) {
15418 printf("Leak of %d blocks found in namePush",
15419 xmlMemBlocks() - mem_base);
15420 test_ret++;
15421 printf(" %d", n_ctxt);
15422 printf(" %d", n_value);
15423 printf("\n");
15424 }
15425 }
15426 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015428
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015429 return(test_ret);
15430}
15431
15432
15433static int
15434test_nodePop(void) {
15435 int test_ret = 0;
15436
15437 int mem_base;
15438 xmlNodePtr ret_val;
15439 xmlParserCtxtPtr ctxt; /* an XML parser context */
15440 int n_ctxt;
15441
15442 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15443 mem_base = xmlMemBlocks();
15444 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15445
15446 ret_val = nodePop(ctxt);
15447 desret_xmlNodePtr(ret_val);
15448 call_tests++;
15449 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15450 xmlResetLastError();
15451 if (mem_base != xmlMemBlocks()) {
15452 printf("Leak of %d blocks found in nodePop",
15453 xmlMemBlocks() - mem_base);
15454 test_ret++;
15455 printf(" %d", n_ctxt);
15456 printf("\n");
15457 }
15458 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015460
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015461 return(test_ret);
15462}
15463
15464
15465static int
15466test_nodePush(void) {
15467 int test_ret = 0;
15468
15469 int mem_base;
15470 int ret_val;
15471 xmlParserCtxtPtr ctxt; /* an XML parser context */
15472 int n_ctxt;
15473 xmlNodePtr value; /* the element node */
15474 int n_value;
15475
15476 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15477 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15478 mem_base = xmlMemBlocks();
15479 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15480 value = gen_xmlNodePtr(n_value, 1);
15481
15482 ret_val = nodePush(ctxt, value);
15483 desret_int(ret_val);
15484 call_tests++;
15485 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15486 des_xmlNodePtr(n_value, value, 1);
15487 xmlResetLastError();
15488 if (mem_base != xmlMemBlocks()) {
15489 printf("Leak of %d blocks found in nodePush",
15490 xmlMemBlocks() - mem_base);
15491 test_ret++;
15492 printf(" %d", n_ctxt);
15493 printf(" %d", n_value);
15494 printf("\n");
15495 }
15496 }
15497 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015499
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015500 return(test_ret);
15501}
15502
15503
15504static int
15505test_xmlCheckLanguageID(void) {
15506 int test_ret = 0;
15507
15508 int mem_base;
15509 int ret_val;
15510 xmlChar * lang; /* pointer to the string value */
15511 int n_lang;
15512
15513 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15514 mem_base = xmlMemBlocks();
15515 lang = gen_const_xmlChar_ptr(n_lang, 0);
15516
William M. Brackf13f77f2004-11-12 16:03:48 +000015517 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015518 desret_int(ret_val);
15519 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015520 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015521 xmlResetLastError();
15522 if (mem_base != xmlMemBlocks()) {
15523 printf("Leak of %d blocks found in xmlCheckLanguageID",
15524 xmlMemBlocks() - mem_base);
15525 test_ret++;
15526 printf(" %d", n_lang);
15527 printf("\n");
15528 }
15529 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015531
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015532 return(test_ret);
15533}
15534
15535
15536static int
15537test_xmlCopyChar(void) {
15538 int test_ret = 0;
15539
15540 int mem_base;
15541 int ret_val;
15542 int len; /* Ignored, compatibility */
15543 int n_len;
15544 xmlChar * out; /* pointer to an array of xmlChar */
15545 int n_out;
15546 int val; /* the char value */
15547 int n_val;
15548
15549 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15550 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15551 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15552 mem_base = xmlMemBlocks();
15553 len = gen_int(n_len, 0);
15554 out = gen_xmlChar_ptr(n_out, 1);
15555 val = gen_int(n_val, 2);
15556
15557 ret_val = xmlCopyChar(len, out, val);
15558 desret_int(ret_val);
15559 call_tests++;
15560 des_int(n_len, len, 0);
15561 des_xmlChar_ptr(n_out, out, 1);
15562 des_int(n_val, val, 2);
15563 xmlResetLastError();
15564 if (mem_base != xmlMemBlocks()) {
15565 printf("Leak of %d blocks found in xmlCopyChar",
15566 xmlMemBlocks() - mem_base);
15567 test_ret++;
15568 printf(" %d", n_len);
15569 printf(" %d", n_out);
15570 printf(" %d", n_val);
15571 printf("\n");
15572 }
15573 }
15574 }
15575 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015576 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015577
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015578 return(test_ret);
15579}
15580
15581
15582static int
15583test_xmlCopyCharMultiByte(void) {
15584 int test_ret = 0;
15585
15586 int mem_base;
15587 int ret_val;
15588 xmlChar * out; /* pointer to an array of xmlChar */
15589 int n_out;
15590 int val; /* the char value */
15591 int n_val;
15592
15593 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15594 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15595 mem_base = xmlMemBlocks();
15596 out = gen_xmlChar_ptr(n_out, 0);
15597 val = gen_int(n_val, 1);
15598
15599 ret_val = xmlCopyCharMultiByte(out, val);
15600 desret_int(ret_val);
15601 call_tests++;
15602 des_xmlChar_ptr(n_out, out, 0);
15603 des_int(n_val, val, 1);
15604 xmlResetLastError();
15605 if (mem_base != xmlMemBlocks()) {
15606 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15607 xmlMemBlocks() - mem_base);
15608 test_ret++;
15609 printf(" %d", n_out);
15610 printf(" %d", n_val);
15611 printf("\n");
15612 }
15613 }
15614 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015616
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015617 return(test_ret);
15618}
15619
15620
15621static int
15622test_xmlCreateEntityParserCtxt(void) {
15623 int test_ret = 0;
15624
15625 int mem_base;
15626 xmlParserCtxtPtr ret_val;
15627 xmlChar * URL; /* the entity URL */
15628 int n_URL;
15629 xmlChar * ID; /* the entity PUBLIC ID */
15630 int n_ID;
15631 xmlChar * base; /* a possible base for the target URI */
15632 int n_base;
15633
15634 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15635 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15636 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15637 mem_base = xmlMemBlocks();
15638 URL = gen_const_xmlChar_ptr(n_URL, 0);
15639 ID = gen_const_xmlChar_ptr(n_ID, 1);
15640 base = gen_const_xmlChar_ptr(n_base, 2);
15641
William M. Brackf13f77f2004-11-12 16:03:48 +000015642 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015643 desret_xmlParserCtxtPtr(ret_val);
15644 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015645 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15646 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15647 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015648 xmlResetLastError();
15649 if (mem_base != xmlMemBlocks()) {
15650 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15651 xmlMemBlocks() - mem_base);
15652 test_ret++;
15653 printf(" %d", n_URL);
15654 printf(" %d", n_ID);
15655 printf(" %d", n_base);
15656 printf("\n");
15657 }
15658 }
15659 }
15660 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015662
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015663 return(test_ret);
15664}
15665
15666
15667static int
15668test_xmlCreateFileParserCtxt(void) {
15669 int test_ret = 0;
15670
15671 int mem_base;
15672 xmlParserCtxtPtr ret_val;
15673 const char * filename; /* the filename */
15674 int n_filename;
15675
15676 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15677 mem_base = xmlMemBlocks();
15678 filename = gen_fileoutput(n_filename, 0);
15679
15680 ret_val = xmlCreateFileParserCtxt(filename);
15681 desret_xmlParserCtxtPtr(ret_val);
15682 call_tests++;
15683 des_fileoutput(n_filename, filename, 0);
15684 xmlResetLastError();
15685 if (mem_base != xmlMemBlocks()) {
15686 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15687 xmlMemBlocks() - mem_base);
15688 test_ret++;
15689 printf(" %d", n_filename);
15690 printf("\n");
15691 }
15692 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015693 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015694
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015695 return(test_ret);
15696}
15697
15698
15699static int
15700test_xmlCreateMemoryParserCtxt(void) {
15701 int test_ret = 0;
15702
15703 int mem_base;
15704 xmlParserCtxtPtr ret_val;
15705 char * buffer; /* a pointer to a char array */
15706 int n_buffer;
15707 int size; /* the size of the array */
15708 int n_size;
15709
15710 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15711 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15712 mem_base = xmlMemBlocks();
15713 buffer = gen_const_char_ptr(n_buffer, 0);
15714 size = gen_int(n_size, 1);
15715
William M. Brackf13f77f2004-11-12 16:03:48 +000015716 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015717 desret_xmlParserCtxtPtr(ret_val);
15718 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015719 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015720 des_int(n_size, size, 1);
15721 xmlResetLastError();
15722 if (mem_base != xmlMemBlocks()) {
15723 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15724 xmlMemBlocks() - mem_base);
15725 test_ret++;
15726 printf(" %d", n_buffer);
15727 printf(" %d", n_size);
15728 printf("\n");
15729 }
15730 }
15731 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015733
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015734 return(test_ret);
15735}
15736
15737
15738static int
15739test_xmlCreateURLParserCtxt(void) {
15740 int test_ret = 0;
15741
15742 int mem_base;
15743 xmlParserCtxtPtr ret_val;
15744 const char * filename; /* the filename or URL */
15745 int n_filename;
15746 int options; /* a combination of xmlParserOption */
15747 int n_options;
15748
15749 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15750 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15751 mem_base = xmlMemBlocks();
15752 filename = gen_fileoutput(n_filename, 0);
15753 options = gen_int(n_options, 1);
15754
15755 ret_val = xmlCreateURLParserCtxt(filename, options);
15756 desret_xmlParserCtxtPtr(ret_val);
15757 call_tests++;
15758 des_fileoutput(n_filename, filename, 0);
15759 des_int(n_options, options, 1);
15760 xmlResetLastError();
15761 if (mem_base != xmlMemBlocks()) {
15762 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15763 xmlMemBlocks() - mem_base);
15764 test_ret++;
15765 printf(" %d", n_filename);
15766 printf(" %d", n_options);
15767 printf("\n");
15768 }
15769 }
15770 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015772
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015773 return(test_ret);
15774}
15775
15776
15777static int
15778test_xmlCurrentChar(void) {
15779 int test_ret = 0;
15780
15781 int mem_base;
15782 int ret_val;
15783 xmlParserCtxtPtr ctxt; /* the XML parser context */
15784 int n_ctxt;
15785 int * len; /* pointer to the length of the char read */
15786 int n_len;
15787
15788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15789 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15790 mem_base = xmlMemBlocks();
15791 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15792 len = gen_int_ptr(n_len, 1);
15793
15794 ret_val = xmlCurrentChar(ctxt, len);
15795 desret_int(ret_val);
15796 call_tests++;
15797 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15798 des_int_ptr(n_len, len, 1);
15799 xmlResetLastError();
15800 if (mem_base != xmlMemBlocks()) {
15801 printf("Leak of %d blocks found in xmlCurrentChar",
15802 xmlMemBlocks() - mem_base);
15803 test_ret++;
15804 printf(" %d", n_ctxt);
15805 printf(" %d", n_len);
15806 printf("\n");
15807 }
15808 }
15809 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015811
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015812 return(test_ret);
15813}
15814
15815
15816static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015817test_xmlErrMemory(void) {
15818 int test_ret = 0;
15819
15820 int mem_base;
15821 xmlParserCtxtPtr ctxt; /* an XML parser context */
15822 int n_ctxt;
15823 char * extra; /* extra informations */
15824 int n_extra;
15825
15826 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15827 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15828 mem_base = xmlMemBlocks();
15829 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15830 extra = gen_const_char_ptr(n_extra, 1);
15831
William M. Brackf13f77f2004-11-12 16:03:48 +000015832 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015833 call_tests++;
15834 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015835 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015836 xmlResetLastError();
15837 if (mem_base != xmlMemBlocks()) {
15838 printf("Leak of %d blocks found in xmlErrMemory",
15839 xmlMemBlocks() - mem_base);
15840 test_ret++;
15841 printf(" %d", n_ctxt);
15842 printf(" %d", n_extra);
15843 printf("\n");
15844 }
15845 }
15846 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015847 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015848
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015849 return(test_ret);
15850}
15851
15852
15853static int
15854test_xmlIsLetter(void) {
15855 int test_ret = 0;
15856
15857 int mem_base;
15858 int ret_val;
15859 int c; /* an unicode character (int) */
15860 int n_c;
15861
15862 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15863 mem_base = xmlMemBlocks();
15864 c = gen_int(n_c, 0);
15865
15866 ret_val = xmlIsLetter(c);
15867 desret_int(ret_val);
15868 call_tests++;
15869 des_int(n_c, c, 0);
15870 xmlResetLastError();
15871 if (mem_base != xmlMemBlocks()) {
15872 printf("Leak of %d blocks found in xmlIsLetter",
15873 xmlMemBlocks() - mem_base);
15874 test_ret++;
15875 printf(" %d", n_c);
15876 printf("\n");
15877 }
15878 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015879 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015880
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015881 return(test_ret);
15882}
15883
15884
15885static int
15886test_xmlNewEntityInputStream(void) {
15887 int test_ret = 0;
15888
15889 int mem_base;
15890 xmlParserInputPtr ret_val;
15891 xmlParserCtxtPtr ctxt; /* an XML parser context */
15892 int n_ctxt;
15893 xmlEntityPtr entity; /* an Entity pointer */
15894 int n_entity;
15895
15896 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15897 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15898 mem_base = xmlMemBlocks();
15899 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15900 entity = gen_xmlEntityPtr(n_entity, 1);
15901
15902 ret_val = xmlNewEntityInputStream(ctxt, entity);
15903 desret_xmlParserInputPtr(ret_val);
15904 call_tests++;
15905 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15906 des_xmlEntityPtr(n_entity, entity, 1);
15907 xmlResetLastError();
15908 if (mem_base != xmlMemBlocks()) {
15909 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15910 xmlMemBlocks() - mem_base);
15911 test_ret++;
15912 printf(" %d", n_ctxt);
15913 printf(" %d", n_entity);
15914 printf("\n");
15915 }
15916 }
15917 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015919
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015920 return(test_ret);
15921}
15922
15923
15924static int
15925test_xmlNewInputFromFile(void) {
15926 int test_ret = 0;
15927
15928 int mem_base;
15929 xmlParserInputPtr ret_val;
15930 xmlParserCtxtPtr ctxt; /* an XML parser context */
15931 int n_ctxt;
15932 const char * filename; /* the filename to use as entity */
15933 int n_filename;
15934
15935 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15936 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15937 mem_base = xmlMemBlocks();
15938 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15939 filename = gen_filepath(n_filename, 1);
15940
15941 ret_val = xmlNewInputFromFile(ctxt, filename);
15942 desret_xmlParserInputPtr(ret_val);
15943 call_tests++;
15944 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15945 des_filepath(n_filename, filename, 1);
15946 xmlResetLastError();
15947 if (mem_base != xmlMemBlocks()) {
15948 printf("Leak of %d blocks found in xmlNewInputFromFile",
15949 xmlMemBlocks() - mem_base);
15950 test_ret++;
15951 printf(" %d", n_ctxt);
15952 printf(" %d", n_filename);
15953 printf("\n");
15954 }
15955 }
15956 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015958
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015959 return(test_ret);
15960}
15961
15962
15963static int
15964test_xmlNewInputStream(void) {
15965 int test_ret = 0;
15966
15967 int mem_base;
15968 xmlParserInputPtr ret_val;
15969 xmlParserCtxtPtr ctxt; /* an XML parser context */
15970 int n_ctxt;
15971
15972 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15973 mem_base = xmlMemBlocks();
15974 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15975
15976 ret_val = xmlNewInputStream(ctxt);
15977 desret_xmlParserInputPtr(ret_val);
15978 call_tests++;
15979 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15980 xmlResetLastError();
15981 if (mem_base != xmlMemBlocks()) {
15982 printf("Leak of %d blocks found in xmlNewInputStream",
15983 xmlMemBlocks() - mem_base);
15984 test_ret++;
15985 printf(" %d", n_ctxt);
15986 printf("\n");
15987 }
15988 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015989 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015990
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015991 return(test_ret);
15992}
15993
15994
15995static int
15996test_xmlNewStringInputStream(void) {
15997 int test_ret = 0;
15998
15999 int mem_base;
16000 xmlParserInputPtr ret_val;
16001 xmlParserCtxtPtr ctxt; /* an XML parser context */
16002 int n_ctxt;
16003 xmlChar * buffer; /* an memory buffer */
16004 int n_buffer;
16005
16006 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16007 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16008 mem_base = xmlMemBlocks();
16009 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16010 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16011
William M. Brackf13f77f2004-11-12 16:03:48 +000016012 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016013 desret_xmlParserInputPtr(ret_val);
16014 call_tests++;
16015 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016016 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016017 xmlResetLastError();
16018 if (mem_base != xmlMemBlocks()) {
16019 printf("Leak of %d blocks found in xmlNewStringInputStream",
16020 xmlMemBlocks() - mem_base);
16021 test_ret++;
16022 printf(" %d", n_ctxt);
16023 printf(" %d", n_buffer);
16024 printf("\n");
16025 }
16026 }
16027 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016029
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016030 return(test_ret);
16031}
16032
16033
16034static int
16035test_xmlNextChar(void) {
16036 int test_ret = 0;
16037
16038 int mem_base;
16039 xmlParserCtxtPtr ctxt; /* the XML parser context */
16040 int n_ctxt;
16041
16042 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16043 mem_base = xmlMemBlocks();
16044 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16045
16046 xmlNextChar(ctxt);
16047 call_tests++;
16048 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16049 xmlResetLastError();
16050 if (mem_base != xmlMemBlocks()) {
16051 printf("Leak of %d blocks found in xmlNextChar",
16052 xmlMemBlocks() - mem_base);
16053 test_ret++;
16054 printf(" %d", n_ctxt);
16055 printf("\n");
16056 }
16057 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016058 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016059
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016060 return(test_ret);
16061}
16062
16063
16064static int
16065test_xmlParserInputShrink(void) {
16066 int test_ret = 0;
16067
16068 int mem_base;
16069 xmlParserInputPtr in; /* an XML parser input */
16070 int n_in;
16071
16072 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16073 mem_base = xmlMemBlocks();
16074 in = gen_xmlParserInputPtr(n_in, 0);
16075
16076 xmlParserInputShrink(in);
16077 call_tests++;
16078 des_xmlParserInputPtr(n_in, in, 0);
16079 xmlResetLastError();
16080 if (mem_base != xmlMemBlocks()) {
16081 printf("Leak of %d blocks found in xmlParserInputShrink",
16082 xmlMemBlocks() - mem_base);
16083 test_ret++;
16084 printf(" %d", n_in);
16085 printf("\n");
16086 }
16087 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016088 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016089
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016090 return(test_ret);
16091}
16092
16093
16094static int
16095test_xmlPopInput(void) {
16096 int test_ret = 0;
16097
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016098 int mem_base;
16099 xmlChar ret_val;
16100 xmlParserCtxtPtr ctxt; /* an XML parser context */
16101 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016102
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016103 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16104 mem_base = xmlMemBlocks();
16105 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16106
16107 ret_val = xmlPopInput(ctxt);
16108 desret_xmlChar(ret_val);
16109 call_tests++;
16110 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16111 xmlResetLastError();
16112 if (mem_base != xmlMemBlocks()) {
16113 printf("Leak of %d blocks found in xmlPopInput",
16114 xmlMemBlocks() - mem_base);
16115 test_ret++;
16116 printf(" %d", n_ctxt);
16117 printf("\n");
16118 }
16119 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016121
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016122 return(test_ret);
16123}
16124
16125
16126static int
16127test_xmlPushInput(void) {
16128 int test_ret = 0;
16129
16130 int mem_base;
16131 xmlParserCtxtPtr ctxt; /* an XML parser context */
16132 int n_ctxt;
16133 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16134 int n_input;
16135
16136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16137 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16138 mem_base = xmlMemBlocks();
16139 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16140 input = gen_xmlParserInputPtr(n_input, 1);
16141
16142 xmlPushInput(ctxt, input);
16143 call_tests++;
16144 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16145 des_xmlParserInputPtr(n_input, input, 1);
16146 xmlResetLastError();
16147 if (mem_base != xmlMemBlocks()) {
16148 printf("Leak of %d blocks found in xmlPushInput",
16149 xmlMemBlocks() - mem_base);
16150 test_ret++;
16151 printf(" %d", n_ctxt);
16152 printf(" %d", n_input);
16153 printf("\n");
16154 }
16155 }
16156 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016158
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016159 return(test_ret);
16160}
16161
16162
16163static int
16164test_xmlSetEntityReferenceFunc(void) {
16165 int test_ret = 0;
16166
16167
16168 /* missing type support */
16169 return(test_ret);
16170}
16171
16172
16173static int
16174test_xmlSplitQName(void) {
16175 int test_ret = 0;
16176
16177 int mem_base;
16178 xmlChar * ret_val;
16179 xmlParserCtxtPtr ctxt; /* an XML parser context */
16180 int n_ctxt;
16181 xmlChar * name; /* an XML parser context */
16182 int n_name;
16183 xmlChar ** prefix; /* a xmlChar ** */
16184 int n_prefix;
16185
16186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16187 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16188 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16189 mem_base = xmlMemBlocks();
16190 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16191 name = gen_const_xmlChar_ptr(n_name, 1);
16192 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16193
William M. Brackf13f77f2004-11-12 16:03:48 +000016194 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016195 desret_xmlChar_ptr(ret_val);
16196 call_tests++;
16197 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016199 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16200 xmlResetLastError();
16201 if (mem_base != xmlMemBlocks()) {
16202 printf("Leak of %d blocks found in xmlSplitQName",
16203 xmlMemBlocks() - mem_base);
16204 test_ret++;
16205 printf(" %d", n_ctxt);
16206 printf(" %d", n_name);
16207 printf(" %d", n_prefix);
16208 printf("\n");
16209 }
16210 }
16211 }
16212 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016214
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016215 return(test_ret);
16216}
16217
16218
16219static int
16220test_xmlStringCurrentChar(void) {
16221 int test_ret = 0;
16222
16223 int mem_base;
16224 int ret_val;
16225 xmlParserCtxtPtr ctxt; /* the XML parser context */
16226 int n_ctxt;
16227 xmlChar * cur; /* pointer to the beginning of the char */
16228 int n_cur;
16229 int * len; /* pointer to the length of the char read */
16230 int n_len;
16231
16232 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16233 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16234 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16235 mem_base = xmlMemBlocks();
16236 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16237 cur = gen_const_xmlChar_ptr(n_cur, 1);
16238 len = gen_int_ptr(n_len, 2);
16239
William M. Brackf13f77f2004-11-12 16:03:48 +000016240 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016241 desret_int(ret_val);
16242 call_tests++;
16243 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016244 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016245 des_int_ptr(n_len, len, 2);
16246 xmlResetLastError();
16247 if (mem_base != xmlMemBlocks()) {
16248 printf("Leak of %d blocks found in xmlStringCurrentChar",
16249 xmlMemBlocks() - mem_base);
16250 test_ret++;
16251 printf(" %d", n_ctxt);
16252 printf(" %d", n_cur);
16253 printf(" %d", n_len);
16254 printf("\n");
16255 }
16256 }
16257 }
16258 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016259 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016260
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016261 return(test_ret);
16262}
16263
16264
16265static int
16266test_xmlStringDecodeEntities(void) {
16267 int test_ret = 0;
16268
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016269 int mem_base;
16270 xmlChar * ret_val;
16271 xmlParserCtxtPtr ctxt; /* the parser context */
16272 int n_ctxt;
16273 xmlChar * str; /* the input string */
16274 int n_str;
16275 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16276 int n_what;
16277 xmlChar end; /* an end marker xmlChar, 0 if none */
16278 int n_end;
16279 xmlChar end2; /* an end marker xmlChar, 0 if none */
16280 int n_end2;
16281 xmlChar end3; /* an end marker xmlChar, 0 if none */
16282 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016283
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16285 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16286 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16287 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16288 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16289 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16290 mem_base = xmlMemBlocks();
16291 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16292 str = gen_const_xmlChar_ptr(n_str, 1);
16293 what = gen_int(n_what, 2);
16294 end = gen_xmlChar(n_end, 3);
16295 end2 = gen_xmlChar(n_end2, 4);
16296 end3 = gen_xmlChar(n_end3, 5);
16297
William M. Brackf13f77f2004-11-12 16:03:48 +000016298 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016299 desret_xmlChar_ptr(ret_val);
16300 call_tests++;
16301 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016302 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016303 des_int(n_what, what, 2);
16304 des_xmlChar(n_end, end, 3);
16305 des_xmlChar(n_end2, end2, 4);
16306 des_xmlChar(n_end3, end3, 5);
16307 xmlResetLastError();
16308 if (mem_base != xmlMemBlocks()) {
16309 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16310 xmlMemBlocks() - mem_base);
16311 test_ret++;
16312 printf(" %d", n_ctxt);
16313 printf(" %d", n_str);
16314 printf(" %d", n_what);
16315 printf(" %d", n_end);
16316 printf(" %d", n_end2);
16317 printf(" %d", n_end3);
16318 printf("\n");
16319 }
16320 }
16321 }
16322 }
16323 }
16324 }
16325 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016326 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016327
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016328 return(test_ret);
16329}
16330
16331
16332static int
16333test_xmlStringLenDecodeEntities(void) {
16334 int test_ret = 0;
16335
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016336 int mem_base;
16337 xmlChar * ret_val;
16338 xmlParserCtxtPtr ctxt; /* the parser context */
16339 int n_ctxt;
16340 xmlChar * str; /* the input string */
16341 int n_str;
16342 int len; /* the string length */
16343 int n_len;
16344 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16345 int n_what;
16346 xmlChar end; /* an end marker xmlChar, 0 if none */
16347 int n_end;
16348 xmlChar end2; /* an end marker xmlChar, 0 if none */
16349 int n_end2;
16350 xmlChar end3; /* an end marker xmlChar, 0 if none */
16351 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016352
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16354 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16355 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16356 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16357 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16358 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16359 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16360 mem_base = xmlMemBlocks();
16361 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16362 str = gen_const_xmlChar_ptr(n_str, 1);
16363 len = gen_int(n_len, 2);
16364 what = gen_int(n_what, 3);
16365 end = gen_xmlChar(n_end, 4);
16366 end2 = gen_xmlChar(n_end2, 5);
16367 end3 = gen_xmlChar(n_end3, 6);
16368
William M. Brackf13f77f2004-11-12 16:03:48 +000016369 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016370 desret_xmlChar_ptr(ret_val);
16371 call_tests++;
16372 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016373 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016374 des_int(n_len, len, 2);
16375 des_int(n_what, what, 3);
16376 des_xmlChar(n_end, end, 4);
16377 des_xmlChar(n_end2, end2, 5);
16378 des_xmlChar(n_end3, end3, 6);
16379 xmlResetLastError();
16380 if (mem_base != xmlMemBlocks()) {
16381 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16382 xmlMemBlocks() - mem_base);
16383 test_ret++;
16384 printf(" %d", n_ctxt);
16385 printf(" %d", n_str);
16386 printf(" %d", n_len);
16387 printf(" %d", n_what);
16388 printf(" %d", n_end);
16389 printf(" %d", n_end2);
16390 printf(" %d", n_end3);
16391 printf("\n");
16392 }
16393 }
16394 }
16395 }
16396 }
16397 }
16398 }
16399 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016400 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016401
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016402 return(test_ret);
16403}
16404
16405
16406static int
16407test_xmlSwitchEncoding(void) {
16408 int test_ret = 0;
16409
16410 int mem_base;
16411 int ret_val;
16412 xmlParserCtxtPtr ctxt; /* the parser context */
16413 int n_ctxt;
16414 xmlCharEncoding enc; /* the encoding value (number) */
16415 int n_enc;
16416
16417 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16418 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16419 mem_base = xmlMemBlocks();
16420 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16421 enc = gen_xmlCharEncoding(n_enc, 1);
16422
16423 ret_val = xmlSwitchEncoding(ctxt, enc);
16424 desret_int(ret_val);
16425 call_tests++;
16426 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16427 des_xmlCharEncoding(n_enc, enc, 1);
16428 xmlResetLastError();
16429 if (mem_base != xmlMemBlocks()) {
16430 printf("Leak of %d blocks found in xmlSwitchEncoding",
16431 xmlMemBlocks() - mem_base);
16432 test_ret++;
16433 printf(" %d", n_ctxt);
16434 printf(" %d", n_enc);
16435 printf("\n");
16436 }
16437 }
16438 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016440
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016441 return(test_ret);
16442}
16443
16444
16445static int
16446test_xmlSwitchInputEncoding(void) {
16447 int test_ret = 0;
16448
16449 int mem_base;
16450 int ret_val;
16451 xmlParserCtxtPtr ctxt; /* the parser context */
16452 int n_ctxt;
16453 xmlParserInputPtr input; /* the input stream */
16454 int n_input;
16455 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16456 int n_handler;
16457
16458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16459 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16460 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16461 mem_base = xmlMemBlocks();
16462 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16463 input = gen_xmlParserInputPtr(n_input, 1);
16464 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16465
16466 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16467 desret_int(ret_val);
16468 call_tests++;
16469 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16470 des_xmlParserInputPtr(n_input, input, 1);
16471 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16472 xmlResetLastError();
16473 if (mem_base != xmlMemBlocks()) {
16474 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16475 xmlMemBlocks() - mem_base);
16476 test_ret++;
16477 printf(" %d", n_ctxt);
16478 printf(" %d", n_input);
16479 printf(" %d", n_handler);
16480 printf("\n");
16481 }
16482 }
16483 }
16484 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016486
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016487 return(test_ret);
16488}
16489
16490
16491static int
16492test_xmlSwitchToEncoding(void) {
16493 int test_ret = 0;
16494
16495 int mem_base;
16496 int ret_val;
16497 xmlParserCtxtPtr ctxt; /* the parser context */
16498 int n_ctxt;
16499 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16500 int n_handler;
16501
16502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16503 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16504 mem_base = xmlMemBlocks();
16505 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16506 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16507
16508 ret_val = xmlSwitchToEncoding(ctxt, handler);
16509 desret_int(ret_val);
16510 call_tests++;
16511 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16512 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16513 xmlResetLastError();
16514 if (mem_base != xmlMemBlocks()) {
16515 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16516 xmlMemBlocks() - mem_base);
16517 test_ret++;
16518 printf(" %d", n_ctxt);
16519 printf(" %d", n_handler);
16520 printf("\n");
16521 }
16522 }
16523 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016525
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016526 return(test_ret);
16527}
16528
16529static int
16530test_parserInternals(void) {
16531 int test_ret = 0;
16532
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016533 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016534 test_ret += test_htmlCreateFileParserCtxt();
16535 test_ret += test_htmlInitAutoClose();
16536 test_ret += test_inputPop();
16537 test_ret += test_inputPush();
16538 test_ret += test_namePop();
16539 test_ret += test_namePush();
16540 test_ret += test_nodePop();
16541 test_ret += test_nodePush();
16542 test_ret += test_xmlCheckLanguageID();
16543 test_ret += test_xmlCopyChar();
16544 test_ret += test_xmlCopyCharMultiByte();
16545 test_ret += test_xmlCreateEntityParserCtxt();
16546 test_ret += test_xmlCreateFileParserCtxt();
16547 test_ret += test_xmlCreateMemoryParserCtxt();
16548 test_ret += test_xmlCreateURLParserCtxt();
16549 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016550 test_ret += test_xmlErrMemory();
16551 test_ret += test_xmlIsLetter();
16552 test_ret += test_xmlNewEntityInputStream();
16553 test_ret += test_xmlNewInputFromFile();
16554 test_ret += test_xmlNewInputStream();
16555 test_ret += test_xmlNewStringInputStream();
16556 test_ret += test_xmlNextChar();
16557 test_ret += test_xmlParserInputShrink();
16558 test_ret += test_xmlPopInput();
16559 test_ret += test_xmlPushInput();
16560 test_ret += test_xmlSetEntityReferenceFunc();
16561 test_ret += test_xmlSplitQName();
16562 test_ret += test_xmlStringCurrentChar();
16563 test_ret += test_xmlStringDecodeEntities();
16564 test_ret += test_xmlStringLenDecodeEntities();
16565 test_ret += test_xmlSwitchEncoding();
16566 test_ret += test_xmlSwitchInputEncoding();
16567 test_ret += test_xmlSwitchToEncoding();
16568
16569 if (test_ret != 0)
16570 printf("Module parserInternals: %d errors\n", test_ret);
16571 return(test_ret);
16572}
16573
Daniel Veillardd93f6252004-11-02 15:53:51 +000016574static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016575test_xmlPatternFromRoot(void) {
16576 int test_ret = 0;
16577
16578#if defined(LIBXML_PATTERN_ENABLED)
16579 int mem_base;
16580 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016581 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016582 int n_comp;
16583
16584 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16585 mem_base = xmlMemBlocks();
16586 comp = gen_xmlPatternPtr(n_comp, 0);
16587
16588 ret_val = xmlPatternFromRoot(comp);
16589 desret_int(ret_val);
16590 call_tests++;
16591 des_xmlPatternPtr(n_comp, comp, 0);
16592 xmlResetLastError();
16593 if (mem_base != xmlMemBlocks()) {
16594 printf("Leak of %d blocks found in xmlPatternFromRoot",
16595 xmlMemBlocks() - mem_base);
16596 test_ret++;
16597 printf(" %d", n_comp);
16598 printf("\n");
16599 }
16600 }
16601 function_tests++;
16602#endif
16603
16604 return(test_ret);
16605}
16606
16607
16608static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016609test_xmlPatternGetStreamCtxt(void) {
16610 int test_ret = 0;
16611
16612
16613 /* missing type support */
16614 return(test_ret);
16615}
16616
16617
16618static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016619test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016621
William M. Brack21e4ef22005-01-02 09:53:13 +000016622#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016623 int mem_base;
16624 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016625 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016626 int n_comp;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016627 xmlNodePtr node; /* a node */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016628 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016629
Daniel Veillardce682bc2004-11-05 17:22:25 +000016630 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16631 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16632 mem_base = xmlMemBlocks();
16633 comp = gen_xmlPatternPtr(n_comp, 0);
16634 node = gen_xmlNodePtr(n_node, 1);
16635
16636 ret_val = xmlPatternMatch(comp, node);
16637 desret_int(ret_val);
16638 call_tests++;
16639 des_xmlPatternPtr(n_comp, comp, 0);
16640 des_xmlNodePtr(n_node, node, 1);
16641 xmlResetLastError();
16642 if (mem_base != xmlMemBlocks()) {
16643 printf("Leak of %d blocks found in xmlPatternMatch",
16644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016646 printf(" %d", n_comp);
16647 printf(" %d", n_node);
16648 printf("\n");
16649 }
16650 }
16651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016653#endif
16654
Daniel Veillard42595322004-11-08 10:52:06 +000016655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016656}
16657
16658
16659static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016660test_xmlPatternMaxDepth(void) {
16661 int test_ret = 0;
16662
16663#if defined(LIBXML_PATTERN_ENABLED)
16664 int mem_base;
16665 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016666 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016667 int n_comp;
16668
16669 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16670 mem_base = xmlMemBlocks();
16671 comp = gen_xmlPatternPtr(n_comp, 0);
16672
16673 ret_val = xmlPatternMaxDepth(comp);
16674 desret_int(ret_val);
16675 call_tests++;
16676 des_xmlPatternPtr(n_comp, comp, 0);
16677 xmlResetLastError();
16678 if (mem_base != xmlMemBlocks()) {
16679 printf("Leak of %d blocks found in xmlPatternMaxDepth",
16680 xmlMemBlocks() - mem_base);
16681 test_ret++;
16682 printf(" %d", n_comp);
16683 printf("\n");
16684 }
16685 }
16686 function_tests++;
16687#endif
16688
16689 return(test_ret);
16690}
16691
16692
16693static int
16694test_xmlPatternStreamable(void) {
16695 int test_ret = 0;
16696
16697#if defined(LIBXML_PATTERN_ENABLED)
16698 int mem_base;
16699 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016700 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016701 int n_comp;
16702
16703 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16704 mem_base = xmlMemBlocks();
16705 comp = gen_xmlPatternPtr(n_comp, 0);
16706
16707 ret_val = xmlPatternStreamable(comp);
16708 desret_int(ret_val);
16709 call_tests++;
16710 des_xmlPatternPtr(n_comp, comp, 0);
16711 xmlResetLastError();
16712 if (mem_base != xmlMemBlocks()) {
16713 printf("Leak of %d blocks found in xmlPatternStreamable",
16714 xmlMemBlocks() - mem_base);
16715 test_ret++;
16716 printf(" %d", n_comp);
16717 printf("\n");
16718 }
16719 }
16720 function_tests++;
16721#endif
16722
16723 return(test_ret);
16724}
16725
16726
16727static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016728test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016730
16731
16732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016734}
16735
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016736
16737#define gen_nb_xmlStreamCtxtPtr 1
16738static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16739 return(NULL);
16740}
16741static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16742}
16743
16744static int
16745test_xmlStreamPop(void) {
16746 int test_ret = 0;
16747
16748#if defined(LIBXML_PATTERN_ENABLED)
16749 int mem_base;
16750 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016751 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016752 int n_stream;
16753
16754 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16755 mem_base = xmlMemBlocks();
16756 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16757
16758 ret_val = xmlStreamPop(stream);
16759 desret_int(ret_val);
16760 call_tests++;
16761 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16762 xmlResetLastError();
16763 if (mem_base != xmlMemBlocks()) {
16764 printf("Leak of %d blocks found in xmlStreamPop",
16765 xmlMemBlocks() - mem_base);
16766 test_ret++;
16767 printf(" %d", n_stream);
16768 printf("\n");
16769 }
16770 }
16771 function_tests++;
16772#endif
16773
16774 return(test_ret);
16775}
16776
16777
16778static int
16779test_xmlStreamPush(void) {
16780 int test_ret = 0;
16781
16782#if defined(LIBXML_PATTERN_ENABLED)
16783 int mem_base;
16784 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016785 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016786 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016787 xmlChar * name; /* the current name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016788 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016789 xmlChar * ns; /* the namespace name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016790 int n_ns;
16791
16792 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16793 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16794 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16795 mem_base = xmlMemBlocks();
16796 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16797 name = gen_const_xmlChar_ptr(n_name, 1);
16798 ns = gen_const_xmlChar_ptr(n_ns, 2);
16799
16800 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16801 desret_int(ret_val);
16802 call_tests++;
16803 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16804 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16805 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16806 xmlResetLastError();
16807 if (mem_base != xmlMemBlocks()) {
16808 printf("Leak of %d blocks found in xmlStreamPush",
16809 xmlMemBlocks() - mem_base);
16810 test_ret++;
16811 printf(" %d", n_stream);
16812 printf(" %d", n_name);
16813 printf(" %d", n_ns);
16814 printf("\n");
16815 }
16816 }
16817 }
16818 }
16819 function_tests++;
16820#endif
16821
16822 return(test_ret);
16823}
16824
Daniel Veillardb5839c32005-02-19 18:27:14 +000016825
16826static int
16827test_xmlStreamPushAttr(void) {
16828 int test_ret = 0;
16829
16830#if defined(LIBXML_PATTERN_ENABLED)
16831 int mem_base;
16832 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016833 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016834 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016835 xmlChar * name; /* the current name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016836 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016837 xmlChar * ns; /* the namespace name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016838 int n_ns;
16839
16840 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16841 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16842 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16843 mem_base = xmlMemBlocks();
16844 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16845 name = gen_const_xmlChar_ptr(n_name, 1);
16846 ns = gen_const_xmlChar_ptr(n_ns, 2);
16847
16848 ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns);
16849 desret_int(ret_val);
16850 call_tests++;
16851 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16852 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16853 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16854 xmlResetLastError();
16855 if (mem_base != xmlMemBlocks()) {
16856 printf("Leak of %d blocks found in xmlStreamPushAttr",
16857 xmlMemBlocks() - mem_base);
16858 test_ret++;
16859 printf(" %d", n_stream);
16860 printf(" %d", n_name);
16861 printf(" %d", n_ns);
16862 printf("\n");
16863 }
16864 }
16865 }
16866 }
16867 function_tests++;
16868#endif
16869
16870 return(test_ret);
16871}
16872
Daniel Veillardd93f6252004-11-02 15:53:51 +000016873static int
16874test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016876
Daniel Veillardb5839c32005-02-19 18:27:14 +000016877 if (quiet == 0) printf("Testing pattern : 7 of 12 functions ...\n");
16878 test_ret += test_xmlPatternFromRoot();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016879 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016880 test_ret += test_xmlPatternMatch();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016881 test_ret += test_xmlPatternMaxDepth();
16882 test_ret += test_xmlPatternStreamable();
Daniel Veillard42595322004-11-08 10:52:06 +000016883 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016884 test_ret += test_xmlStreamPop();
16885 test_ret += test_xmlStreamPush();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016886 test_ret += test_xmlStreamPushAttr();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016887
Daniel Veillard42595322004-11-08 10:52:06 +000016888 if (test_ret != 0)
16889 printf("Module pattern: %d errors\n", test_ret);
16890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016891}
Daniel Veillarda521d282004-11-09 14:59:59 +000016892#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016893
Daniel Veillardce682bc2004-11-05 17:22:25 +000016894#define gen_nb_xmlRelaxNGPtr 1
16895static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16896 return(NULL);
16897}
16898static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16899}
Daniel Veillarda521d282004-11-09 14:59:59 +000016900#endif
16901
Daniel Veillardce682bc2004-11-05 17:22:25 +000016902
Daniel Veillardd93f6252004-11-02 15:53:51 +000016903static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016904test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016906
William M. Brack21e4ef22005-01-02 09:53:13 +000016907#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016908 int mem_base;
16909 FILE * output; /* the file output */
16910 int n_output;
16911 xmlRelaxNGPtr schema; /* a schema structure */
16912 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016913
Daniel Veillardce682bc2004-11-05 17:22:25 +000016914 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16915 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16916 mem_base = xmlMemBlocks();
16917 output = gen_FILE_ptr(n_output, 0);
16918 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16919
16920 xmlRelaxNGDump(output, schema);
16921 call_tests++;
16922 des_FILE_ptr(n_output, output, 0);
16923 des_xmlRelaxNGPtr(n_schema, schema, 1);
16924 xmlResetLastError();
16925 if (mem_base != xmlMemBlocks()) {
16926 printf("Leak of %d blocks found in xmlRelaxNGDump",
16927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016928 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016929 printf(" %d", n_output);
16930 printf(" %d", n_schema);
16931 printf("\n");
16932 }
16933 }
16934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016935 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016936#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016937
Daniel Veillard42595322004-11-08 10:52:06 +000016938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016939}
16940
16941
16942static int
16943test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016945
William M. Brack21e4ef22005-01-02 09:53:13 +000016946#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016947 int mem_base;
16948 FILE * output; /* the file output */
16949 int n_output;
16950 xmlRelaxNGPtr schema; /* a schema structure */
16951 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016952
Daniel Veillardce682bc2004-11-05 17:22:25 +000016953 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16954 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16955 mem_base = xmlMemBlocks();
16956 output = gen_FILE_ptr(n_output, 0);
16957 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16958
16959 xmlRelaxNGDumpTree(output, schema);
16960 call_tests++;
16961 des_FILE_ptr(n_output, output, 0);
16962 des_xmlRelaxNGPtr(n_schema, schema, 1);
16963 xmlResetLastError();
16964 if (mem_base != xmlMemBlocks()) {
16965 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016967 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016968 printf(" %d", n_output);
16969 printf(" %d", n_schema);
16970 printf("\n");
16971 }
16972 }
16973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016974 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016975#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016976
Daniel Veillard42595322004-11-08 10:52:06 +000016977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016978}
16979
Daniel Veillarda521d282004-11-09 14:59:59 +000016980#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016981
Daniel Veillardce682bc2004-11-05 17:22:25 +000016982#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16983static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16984 return(NULL);
16985}
16986static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16987}
Daniel Veillarda521d282004-11-09 14:59:59 +000016988#endif
16989
16990#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016991
16992#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16993static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16994 return(NULL);
16995}
16996static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16997}
Daniel Veillarda521d282004-11-09 14:59:59 +000016998#endif
16999
17000#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017001
17002#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17003static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17004 return(NULL);
17005}
17006static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17007}
Daniel Veillarda521d282004-11-09 14:59:59 +000017008#endif
17009
17010#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017011
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017012#define gen_nb_void_ptr_ptr 1
17013static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17014 return(NULL);
17015}
17016static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17017}
Daniel Veillarda521d282004-11-09 14:59:59 +000017018#endif
17019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017020
Daniel Veillardd93f6252004-11-02 15:53:51 +000017021static int
17022test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017024
William M. Brack21e4ef22005-01-02 09:53:13 +000017025#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017026 int mem_base;
17027 int ret_val;
17028 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17029 int n_ctxt;
17030 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17031 int n_err;
17032 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17033 int n_warn;
17034 void ** ctx; /* contextual data for the callbacks result */
17035 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017036
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017037 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17038 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17039 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17040 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17041 mem_base = xmlMemBlocks();
17042 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17043 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17044 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17045 ctx = gen_void_ptr_ptr(n_ctx, 3);
17046
17047 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17048 desret_int(ret_val);
17049 call_tests++;
17050 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17051 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17052 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17053 des_void_ptr_ptr(n_ctx, ctx, 3);
17054 xmlResetLastError();
17055 if (mem_base != xmlMemBlocks()) {
17056 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017058 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017059 printf(" %d", n_ctxt);
17060 printf(" %d", n_err);
17061 printf(" %d", n_warn);
17062 printf(" %d", n_ctx);
17063 printf("\n");
17064 }
17065 }
17066 }
17067 }
17068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017069 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017070#endif
17071
Daniel Veillard42595322004-11-08 10:52:06 +000017072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017073}
17074
Daniel Veillarda521d282004-11-09 14:59:59 +000017075#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017076
Daniel Veillardce682bc2004-11-05 17:22:25 +000017077#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17078static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17079 return(NULL);
17080}
17081static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17082}
Daniel Veillarda521d282004-11-09 14:59:59 +000017083#endif
17084
Daniel Veillardce682bc2004-11-05 17:22:25 +000017085
Daniel Veillardd93f6252004-11-02 15:53:51 +000017086static int
17087test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017089
William M. Brack21e4ef22005-01-02 09:53:13 +000017090#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017091 int mem_base;
17092 int ret_val;
17093 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17094 int n_ctxt;
17095 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17096 int n_err;
17097 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17098 int n_warn;
17099 void ** ctx; /* the functions context result */
17100 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017101
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017102 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17103 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17104 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17105 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17106 mem_base = xmlMemBlocks();
17107 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17108 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17109 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17110 ctx = gen_void_ptr_ptr(n_ctx, 3);
17111
17112 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17113 desret_int(ret_val);
17114 call_tests++;
17115 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17116 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17117 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17118 des_void_ptr_ptr(n_ctx, ctx, 3);
17119 xmlResetLastError();
17120 if (mem_base != xmlMemBlocks()) {
17121 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017123 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017124 printf(" %d", n_ctxt);
17125 printf(" %d", n_err);
17126 printf(" %d", n_warn);
17127 printf(" %d", n_ctx);
17128 printf("\n");
17129 }
17130 }
17131 }
17132 }
17133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017134 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017135#endif
17136
Daniel Veillard42595322004-11-08 10:52:06 +000017137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017138}
17139
17140
17141static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017142test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017143 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017144
William M. Brack21e4ef22005-01-02 09:53:13 +000017145#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017146 int mem_base;
17147 int ret_val;
17148
17149 mem_base = xmlMemBlocks();
17150
17151 ret_val = xmlRelaxNGInitTypes();
17152 desret_int(ret_val);
17153 call_tests++;
17154 xmlResetLastError();
17155 if (mem_base != xmlMemBlocks()) {
17156 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017158 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017159 printf("\n");
17160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017161 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017162#endif
17163
Daniel Veillard42595322004-11-08 10:52:06 +000017164 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017165}
17166
17167
17168static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017169test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017171
William M. Brack21e4ef22005-01-02 09:53:13 +000017172#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017173 int mem_base;
17174 xmlRelaxNGParserCtxtPtr ret_val;
17175 xmlDocPtr doc; /* a preparsed document tree */
17176 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017177
Daniel Veillard42595322004-11-08 10:52:06 +000017178 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17179 mem_base = xmlMemBlocks();
17180 doc = gen_xmlDocPtr(n_doc, 0);
17181
17182 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17183 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17184 call_tests++;
17185 des_xmlDocPtr(n_doc, doc, 0);
17186 xmlResetLastError();
17187 if (mem_base != xmlMemBlocks()) {
17188 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17189 xmlMemBlocks() - mem_base);
17190 test_ret++;
17191 printf(" %d", n_doc);
17192 printf("\n");
17193 }
17194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017196#endif
17197
Daniel Veillard42595322004-11-08 10:52:06 +000017198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017199}
17200
17201
17202static int
17203test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017205
William M. Brack21e4ef22005-01-02 09:53:13 +000017206#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017207 int mem_base;
17208 xmlRelaxNGParserCtxtPtr ret_val;
17209 char * buffer; /* a pointer to a char array containing the schemas */
17210 int n_buffer;
17211 int size; /* the size of the array */
17212 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017213
Daniel Veillard42595322004-11-08 10:52:06 +000017214 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17215 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17216 mem_base = xmlMemBlocks();
17217 buffer = gen_const_char_ptr(n_buffer, 0);
17218 size = gen_int(n_size, 1);
17219
William M. Brackf13f77f2004-11-12 16:03:48 +000017220 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017221 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17222 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017223 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017224 des_int(n_size, size, 1);
17225 xmlResetLastError();
17226 if (mem_base != xmlMemBlocks()) {
17227 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17228 xmlMemBlocks() - mem_base);
17229 test_ret++;
17230 printf(" %d", n_buffer);
17231 printf(" %d", n_size);
17232 printf("\n");
17233 }
17234 }
17235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017236 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017237#endif
17238
Daniel Veillard42595322004-11-08 10:52:06 +000017239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017240}
17241
17242
17243static int
17244test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017246
William M. Brack21e4ef22005-01-02 09:53:13 +000017247#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017248 int mem_base;
17249 xmlRelaxNGParserCtxtPtr ret_val;
17250 char * URL; /* the location of the schema */
17251 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017252
Daniel Veillard42595322004-11-08 10:52:06 +000017253 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17254 mem_base = xmlMemBlocks();
17255 URL = gen_const_char_ptr(n_URL, 0);
17256
William M. Brackf13f77f2004-11-12 16:03:48 +000017257 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017258 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17259 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017260 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017261 xmlResetLastError();
17262 if (mem_base != xmlMemBlocks()) {
17263 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17264 xmlMemBlocks() - mem_base);
17265 test_ret++;
17266 printf(" %d", n_URL);
17267 printf("\n");
17268 }
17269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017270 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017271#endif
17272
Daniel Veillard42595322004-11-08 10:52:06 +000017273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017274}
17275
17276
17277static int
17278test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017280
17281
17282 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017284}
17285
17286
17287static int
17288test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017290
17291
17292 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017294}
17295
17296
17297static int
17298test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017300
17301
17302 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017304}
17305
17306
17307static int
17308test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017310
17311
17312 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017314}
17315
17316
17317static int
17318test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017320
William M. Brack21e4ef22005-01-02 09:53:13 +000017321#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017322 int mem_base;
17323 int ret_val;
17324 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17325 int n_ctxt;
17326 xmlDocPtr doc; /* a parsed document tree */
17327 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017328
Daniel Veillardce682bc2004-11-05 17:22:25 +000017329 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17330 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17331 mem_base = xmlMemBlocks();
17332 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17333 doc = gen_xmlDocPtr(n_doc, 1);
17334
17335 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17336 desret_int(ret_val);
17337 call_tests++;
17338 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17339 des_xmlDocPtr(n_doc, doc, 1);
17340 xmlResetLastError();
17341 if (mem_base != xmlMemBlocks()) {
17342 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017344 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017345 printf(" %d", n_ctxt);
17346 printf(" %d", n_doc);
17347 printf("\n");
17348 }
17349 }
17350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017351 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017352#endif
17353
Daniel Veillard42595322004-11-08 10:52:06 +000017354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017355}
17356
17357
17358static int
17359test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017361
William M. Brack21e4ef22005-01-02 09:53:13 +000017362#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017363 int mem_base;
17364 int ret_val;
17365 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17366 int n_ctxt;
17367 xmlDocPtr doc; /* a document instance */
17368 int n_doc;
17369 xmlNodePtr elem; /* an element instance */
17370 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017371
Daniel Veillardce682bc2004-11-05 17:22:25 +000017372 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17373 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17374 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17375 mem_base = xmlMemBlocks();
17376 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17377 doc = gen_xmlDocPtr(n_doc, 1);
17378 elem = gen_xmlNodePtr(n_elem, 2);
17379
17380 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17381 desret_int(ret_val);
17382 call_tests++;
17383 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17384 des_xmlDocPtr(n_doc, doc, 1);
17385 des_xmlNodePtr(n_elem, elem, 2);
17386 xmlResetLastError();
17387 if (mem_base != xmlMemBlocks()) {
17388 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017390 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017391 printf(" %d", n_ctxt);
17392 printf(" %d", n_doc);
17393 printf(" %d", n_elem);
17394 printf("\n");
17395 }
17396 }
17397 }
17398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017399 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017400#endif
17401
Daniel Veillard42595322004-11-08 10:52:06 +000017402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017403}
17404
17405
17406static int
17407test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017409
William M. Brack21e4ef22005-01-02 09:53:13 +000017410#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017411 int mem_base;
17412 int ret_val;
17413 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17414 int n_ctxt;
17415 xmlDocPtr doc; /* a document instance */
17416 int n_doc;
17417 xmlNodePtr elem; /* an element instance */
17418 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017419
Daniel Veillardce682bc2004-11-05 17:22:25 +000017420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17421 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17422 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17423 mem_base = xmlMemBlocks();
17424 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17425 doc = gen_xmlDocPtr(n_doc, 1);
17426 elem = gen_xmlNodePtr(n_elem, 2);
17427
17428 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17429 desret_int(ret_val);
17430 call_tests++;
17431 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17432 des_xmlDocPtr(n_doc, doc, 1);
17433 des_xmlNodePtr(n_elem, elem, 2);
17434 xmlResetLastError();
17435 if (mem_base != xmlMemBlocks()) {
17436 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017439 printf(" %d", n_ctxt);
17440 printf(" %d", n_doc);
17441 printf(" %d", n_elem);
17442 printf("\n");
17443 }
17444 }
17445 }
17446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017447 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017448#endif
17449
Daniel Veillard42595322004-11-08 10:52:06 +000017450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017451}
17452
17453
17454static int
17455test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017457
William M. Brack21e4ef22005-01-02 09:53:13 +000017458#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017459 int mem_base;
17460 int ret_val;
17461 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17462 int n_ctxt;
17463 xmlChar * data; /* some character data read */
17464 int n_data;
17465 int len; /* the lenght of the data */
17466 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017467
Daniel Veillardce682bc2004-11-05 17:22:25 +000017468 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17469 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17470 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17471 mem_base = xmlMemBlocks();
17472 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17473 data = gen_const_xmlChar_ptr(n_data, 1);
17474 len = gen_int(n_len, 2);
17475
William M. Brackf13f77f2004-11-12 16:03:48 +000017476 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017477 desret_int(ret_val);
17478 call_tests++;
17479 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017480 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017481 des_int(n_len, len, 2);
17482 xmlResetLastError();
17483 if (mem_base != xmlMemBlocks()) {
17484 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017486 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017487 printf(" %d", n_ctxt);
17488 printf(" %d", n_data);
17489 printf(" %d", n_len);
17490 printf("\n");
17491 }
17492 }
17493 }
17494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017495 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017496#endif
17497
Daniel Veillard42595322004-11-08 10:52:06 +000017498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017499}
17500
17501
17502static int
17503test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017505
William M. Brack21e4ef22005-01-02 09:53:13 +000017506#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017507 int mem_base;
17508 int ret_val;
17509 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17510 int n_ctxt;
17511 xmlDocPtr doc; /* a document instance */
17512 int n_doc;
17513 xmlNodePtr elem; /* an element instance */
17514 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017515
Daniel Veillardce682bc2004-11-05 17:22:25 +000017516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17517 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17518 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17519 mem_base = xmlMemBlocks();
17520 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17521 doc = gen_xmlDocPtr(n_doc, 1);
17522 elem = gen_xmlNodePtr(n_elem, 2);
17523
17524 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17525 desret_int(ret_val);
17526 call_tests++;
17527 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17528 des_xmlDocPtr(n_doc, doc, 1);
17529 des_xmlNodePtr(n_elem, elem, 2);
17530 xmlResetLastError();
17531 if (mem_base != xmlMemBlocks()) {
17532 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017534 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017535 printf(" %d", n_ctxt);
17536 printf(" %d", n_doc);
17537 printf(" %d", n_elem);
17538 printf("\n");
17539 }
17540 }
17541 }
17542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017543 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017544#endif
17545
Daniel Veillard42595322004-11-08 10:52:06 +000017546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017547}
17548
17549
17550static int
17551test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017553
William M. Brack21e4ef22005-01-02 09:53:13 +000017554#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017555 int mem_base;
17556 int ret_val;
17557 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17558 int n_ctxt;
17559 int flags; /* a set of flags values */
17560 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017561
Daniel Veillardce682bc2004-11-05 17:22:25 +000017562 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17563 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17564 mem_base = xmlMemBlocks();
17565 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17566 flags = gen_int(n_flags, 1);
17567
17568 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17569 desret_int(ret_val);
17570 call_tests++;
17571 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17572 des_int(n_flags, flags, 1);
17573 xmlResetLastError();
17574 if (mem_base != xmlMemBlocks()) {
17575 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017577 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017578 printf(" %d", n_ctxt);
17579 printf(" %d", n_flags);
17580 printf("\n");
17581 }
17582 }
17583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017584 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017585#endif
17586
Daniel Veillard42595322004-11-08 10:52:06 +000017587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017588}
17589
17590static int
17591test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017593
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017594 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017595 test_ret += test_xmlRelaxNGDump();
17596 test_ret += test_xmlRelaxNGDumpTree();
17597 test_ret += test_xmlRelaxNGGetParserErrors();
17598 test_ret += test_xmlRelaxNGGetValidErrors();
17599 test_ret += test_xmlRelaxNGInitTypes();
17600 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17601 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17602 test_ret += test_xmlRelaxNGNewParserCtxt();
17603 test_ret += test_xmlRelaxNGNewValidCtxt();
17604 test_ret += test_xmlRelaxNGParse();
17605 test_ret += test_xmlRelaxNGSetParserErrors();
17606 test_ret += test_xmlRelaxNGSetValidErrors();
17607 test_ret += test_xmlRelaxNGValidateDoc();
17608 test_ret += test_xmlRelaxNGValidateFullElement();
17609 test_ret += test_xmlRelaxNGValidatePopElement();
17610 test_ret += test_xmlRelaxNGValidatePushCData();
17611 test_ret += test_xmlRelaxNGValidatePushElement();
17612 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017613
Daniel Veillard42595322004-11-08 10:52:06 +000017614 if (test_ret != 0)
17615 printf("Module relaxng: %d errors\n", test_ret);
17616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017617}
17618static int
17619test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017621
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017622 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017623
Daniel Veillard42595322004-11-08 10:52:06 +000017624 if (test_ret != 0)
17625 printf("Module schemasInternals: %d errors\n", test_ret);
17626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017627}
17628
17629static int
17630test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017632
17633 int mem_base;
17634 xmlNodePtr ret_val;
17635 xmlNodePtr parent; /* the parent node */
17636 int n_parent;
17637 xmlNodePtr cur; /* the child node */
17638 int n_cur;
17639
Daniel Veillarda03e3652004-11-02 18:45:30 +000017640 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017641 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017643 parent = gen_xmlNodePtr(n_parent, 0);
17644 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645
17646 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017647 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017648 desret_xmlNodePtr(ret_val);
17649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017650 des_xmlNodePtr(n_parent, parent, 0);
17651 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017652 xmlResetLastError();
17653 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017654 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017656 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017657 printf(" %d", n_parent);
17658 printf(" %d", n_cur);
17659 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017660 }
17661 }
17662 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017663 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017664
Daniel Veillard42595322004-11-08 10:52:06 +000017665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017666}
17667
17668
17669static int
17670test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017672
17673 int mem_base;
17674 xmlNodePtr ret_val;
17675 xmlNodePtr parent; /* the parent node */
17676 int n_parent;
17677 xmlNodePtr cur; /* the first node in the list */
17678 int n_cur;
17679
Daniel Veillarda03e3652004-11-02 18:45:30 +000017680 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017681 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17682 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017683 parent = gen_xmlNodePtr(n_parent, 0);
17684 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017685
17686 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017687 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017688 desret_xmlNodePtr(ret_val);
17689 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017690 des_xmlNodePtr(n_parent, parent, 0);
17691 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017692 xmlResetLastError();
17693 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017694 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017696 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017697 printf(" %d", n_parent);
17698 printf(" %d", n_cur);
17699 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017700 }
17701 }
17702 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017703 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017704
Daniel Veillard42595322004-11-08 10:52:06 +000017705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017706}
17707
17708
17709static int
17710test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712
17713 int mem_base;
17714 xmlNodePtr ret_val;
17715 xmlNodePtr cur; /* the child node */
17716 int n_cur;
17717 xmlNodePtr elem; /* the new node */
17718 int n_elem;
17719
17720 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017721 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017723 cur = gen_xmlNodePtr(n_cur, 0);
17724 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017725
17726 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017727 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017728 desret_xmlNodePtr(ret_val);
17729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017730 des_xmlNodePtr(n_cur, cur, 0);
17731 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017732 xmlResetLastError();
17733 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017734 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017736 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017737 printf(" %d", n_cur);
17738 printf(" %d", n_elem);
17739 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017740 }
17741 }
17742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017744
Daniel Veillard42595322004-11-08 10:52:06 +000017745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017746}
17747
17748
17749static int
17750test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017752
William M. Brack21e4ef22005-01-02 09:53:13 +000017753#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017754 int mem_base;
17755 xmlNodePtr ret_val;
17756 xmlNodePtr cur; /* the child node */
17757 int n_cur;
17758 xmlNodePtr elem; /* the new node */
17759 int n_elem;
17760
17761 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017762 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017763 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017764 cur = gen_xmlNodePtr(n_cur, 0);
17765 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017766
17767 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017768 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017769 desret_xmlNodePtr(ret_val);
17770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017771 des_xmlNodePtr(n_cur, cur, 0);
17772 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017773 xmlResetLastError();
17774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017775 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017778 printf(" %d", n_cur);
17779 printf(" %d", n_elem);
17780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017781 }
17782 }
17783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017784 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017785#endif
17786
Daniel Veillard42595322004-11-08 10:52:06 +000017787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017788}
17789
17790
17791static int
17792test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017794
17795 int mem_base;
17796 xmlNodePtr ret_val;
17797 xmlNodePtr cur; /* the child node */
17798 int n_cur;
17799 xmlNodePtr elem; /* the new node */
17800 int n_elem;
17801
17802 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017803 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017805 cur = gen_xmlNodePtr(n_cur, 0);
17806 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017807
17808 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017809 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017810 desret_xmlNodePtr(ret_val);
17811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017812 des_xmlNodePtr(n_cur, cur, 0);
17813 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017814 xmlResetLastError();
17815 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017816 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017818 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017819 printf(" %d", n_cur);
17820 printf(" %d", n_elem);
17821 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017822 }
17823 }
17824 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017825 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017826
Daniel Veillard42595322004-11-08 10:52:06 +000017827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017828}
17829
17830
17831static int
17832test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017834
William M. Brack21e4ef22005-01-02 09:53:13 +000017835#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017836#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017837 int mem_base;
17838 xmlBufferPtr buf; /* the XML buffer output */
17839 int n_buf;
17840 xmlDocPtr doc; /* the document */
17841 int n_doc;
17842 xmlAttrPtr attr; /* the attribute node */
17843 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017844 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017845 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017846
Daniel Veillardce244ad2004-11-05 10:03:46 +000017847 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17848 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17849 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17850 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17851 mem_base = xmlMemBlocks();
17852 buf = gen_xmlBufferPtr(n_buf, 0);
17853 doc = gen_xmlDocPtr(n_doc, 1);
17854 attr = gen_xmlAttrPtr(n_attr, 2);
17855 string = gen_const_xmlChar_ptr(n_string, 3);
17856
William M. Brackf13f77f2004-11-12 16:03:48 +000017857 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017858 call_tests++;
17859 des_xmlBufferPtr(n_buf, buf, 0);
17860 des_xmlDocPtr(n_doc, doc, 1);
17861 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017862 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017863 xmlResetLastError();
17864 if (mem_base != xmlMemBlocks()) {
17865 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017867 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017868 printf(" %d", n_buf);
17869 printf(" %d", n_doc);
17870 printf(" %d", n_attr);
17871 printf(" %d", n_string);
17872 printf("\n");
17873 }
17874 }
17875 }
17876 }
17877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017878 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017879#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017880#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017881
Daniel Veillard42595322004-11-08 10:52:06 +000017882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017883}
17884
17885
17886static int
17887test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017889
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017890 int mem_base;
17891 int ret_val;
17892 xmlBufferPtr buf; /* the buffer to dump */
17893 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017894 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017895 int n_str;
17896 int len; /* the number of #xmlChar to add */
17897 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017898
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017899 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17900 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17901 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17902 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017903 buf = gen_xmlBufferPtr(n_buf, 0);
17904 str = gen_const_xmlChar_ptr(n_str, 1);
17905 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017906
William M. Brackf13f77f2004-11-12 16:03:48 +000017907 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017908 desret_int(ret_val);
17909 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017910 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017911 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017912 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017913 xmlResetLastError();
17914 if (mem_base != xmlMemBlocks()) {
17915 printf("Leak of %d blocks found in xmlBufferAdd",
17916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017917 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017918 printf(" %d", n_buf);
17919 printf(" %d", n_str);
17920 printf(" %d", n_len);
17921 printf("\n");
17922 }
17923 }
17924 }
17925 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017926 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017927
Daniel Veillard42595322004-11-08 10:52:06 +000017928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017929}
17930
17931
17932static int
17933test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017935
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017936 int mem_base;
17937 int ret_val;
17938 xmlBufferPtr buf; /* the buffer */
17939 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017940 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017941 int n_str;
17942 int len; /* the number of #xmlChar to add */
17943 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017944
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017945 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17946 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17947 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17948 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017949 buf = gen_xmlBufferPtr(n_buf, 0);
17950 str = gen_const_xmlChar_ptr(n_str, 1);
17951 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017952
William M. Brackf13f77f2004-11-12 16:03:48 +000017953 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017954 desret_int(ret_val);
17955 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017956 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017957 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017958 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017959 xmlResetLastError();
17960 if (mem_base != xmlMemBlocks()) {
17961 printf("Leak of %d blocks found in xmlBufferAddHead",
17962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017963 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017964 printf(" %d", n_buf);
17965 printf(" %d", n_str);
17966 printf(" %d", n_len);
17967 printf("\n");
17968 }
17969 }
17970 }
17971 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017972 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017973
Daniel Veillard42595322004-11-08 10:52:06 +000017974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017975}
17976
17977
17978static int
17979test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017981
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017982 int mem_base;
17983 int ret_val;
17984 xmlBufferPtr buf; /* the buffer to dump */
17985 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017986 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017987 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017988
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017989 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17990 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017992 buf = gen_xmlBufferPtr(n_buf, 0);
17993 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017994
William M. Brackf13f77f2004-11-12 16:03:48 +000017995 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017996 desret_int(ret_val);
17997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017998 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017999 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018000 xmlResetLastError();
18001 if (mem_base != xmlMemBlocks()) {
18002 printf("Leak of %d blocks found in xmlBufferCCat",
18003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018004 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018005 printf(" %d", n_buf);
18006 printf(" %d", n_str);
18007 printf("\n");
18008 }
18009 }
18010 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018011 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018012
Daniel Veillard42595322004-11-08 10:52:06 +000018013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018014}
18015
18016
18017static int
18018test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018020
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018021 int mem_base;
18022 int ret_val;
18023 xmlBufferPtr buf; /* the buffer to add to */
18024 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018025 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018026 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018027
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018028 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18029 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018031 buf = gen_xmlBufferPtr(n_buf, 0);
18032 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018033
William M. Brackf13f77f2004-11-12 16:03:48 +000018034 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018035 desret_int(ret_val);
18036 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018037 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018038 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018039 xmlResetLastError();
18040 if (mem_base != xmlMemBlocks()) {
18041 printf("Leak of %d blocks found in xmlBufferCat",
18042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018043 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018044 printf(" %d", n_buf);
18045 printf(" %d", n_str);
18046 printf("\n");
18047 }
18048 }
18049 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018050 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018051
Daniel Veillard42595322004-11-08 10:52:06 +000018052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018053}
18054
18055
Daniel Veillardce682bc2004-11-05 17:22:25 +000018056#define gen_nb_const_xmlBufferPtr 1
18057static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18058 return(NULL);
18059}
18060static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18061}
18062
Daniel Veillardd93f6252004-11-02 15:53:51 +000018063static int
18064test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018066
Daniel Veillardce682bc2004-11-05 17:22:25 +000018067 int mem_base;
18068 const xmlChar * ret_val;
18069 xmlBufferPtr buf; /* the buffer */
18070 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018071
Daniel Veillardce682bc2004-11-05 17:22:25 +000018072 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18073 mem_base = xmlMemBlocks();
18074 buf = gen_const_xmlBufferPtr(n_buf, 0);
18075
William M. Brackf13f77f2004-11-12 16:03:48 +000018076 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018077 desret_const_xmlChar_ptr(ret_val);
18078 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018079 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018080 xmlResetLastError();
18081 if (mem_base != xmlMemBlocks()) {
18082 printf("Leak of %d blocks found in xmlBufferContent",
18083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018084 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018085 printf(" %d", n_buf);
18086 printf("\n");
18087 }
18088 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018089 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018090
Daniel Veillard42595322004-11-08 10:52:06 +000018091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018092}
18093
18094
18095static int
18096test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018098
Daniel Veillard3d95c732004-11-06 22:25:14 +000018099 int mem_base;
18100 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018101
Daniel Veillard3d95c732004-11-06 22:25:14 +000018102 mem_base = xmlMemBlocks();
18103
18104 ret_val = xmlBufferCreate();
18105 desret_xmlBufferPtr(ret_val);
18106 call_tests++;
18107 xmlResetLastError();
18108 if (mem_base != xmlMemBlocks()) {
18109 printf("Leak of %d blocks found in xmlBufferCreate",
18110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018111 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018112 printf("\n");
18113 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018114 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018115
Daniel Veillard42595322004-11-08 10:52:06 +000018116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018117}
18118
18119
18120static int
18121test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018123
18124
18125 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018127}
18128
18129
18130static int
18131test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018133
18134
18135 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018137}
18138
18139
18140static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018141test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018143
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018144 int mem_base;
18145 xmlBufferPtr buf; /* the buffer */
18146 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018147
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018148 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018150 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018151
18152 xmlBufferEmpty(buf);
18153 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018154 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018155 xmlResetLastError();
18156 if (mem_base != xmlMemBlocks()) {
18157 printf("Leak of %d blocks found in xmlBufferEmpty",
18158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018159 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018160 printf(" %d", n_buf);
18161 printf("\n");
18162 }
18163 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018165
Daniel Veillard42595322004-11-08 10:52:06 +000018166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018167}
18168
18169
18170static int
18171test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018173
Daniel Veillard3d97e662004-11-04 10:49:00 +000018174 int mem_base;
18175 int ret_val;
18176 xmlBufferPtr buf; /* the buffer */
18177 int n_buf;
18178 unsigned int len; /* the minimum free size to allocate */
18179 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018180
Daniel Veillard3d97e662004-11-04 10:49:00 +000018181 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18182 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18183 mem_base = xmlMemBlocks();
18184 buf = gen_xmlBufferPtr(n_buf, 0);
18185 len = gen_unsigned_int(n_len, 1);
18186
18187 ret_val = xmlBufferGrow(buf, len);
18188 desret_int(ret_val);
18189 call_tests++;
18190 des_xmlBufferPtr(n_buf, buf, 0);
18191 des_unsigned_int(n_len, len, 1);
18192 xmlResetLastError();
18193 if (mem_base != xmlMemBlocks()) {
18194 printf("Leak of %d blocks found in xmlBufferGrow",
18195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018196 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018197 printf(" %d", n_buf);
18198 printf(" %d", n_len);
18199 printf("\n");
18200 }
18201 }
18202 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018203 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018204
Daniel Veillard42595322004-11-08 10:52:06 +000018205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018206}
18207
18208
18209static int
18210test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018212
Daniel Veillardce682bc2004-11-05 17:22:25 +000018213 int mem_base;
18214 int ret_val;
18215 xmlBufferPtr buf; /* the buffer */
18216 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018217
Daniel Veillardce682bc2004-11-05 17:22:25 +000018218 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18219 mem_base = xmlMemBlocks();
18220 buf = gen_const_xmlBufferPtr(n_buf, 0);
18221
William M. Brackf13f77f2004-11-12 16:03:48 +000018222 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018223 desret_int(ret_val);
18224 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018225 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018226 xmlResetLastError();
18227 if (mem_base != xmlMemBlocks()) {
18228 printf("Leak of %d blocks found in xmlBufferLength",
18229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018230 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018231 printf(" %d", n_buf);
18232 printf("\n");
18233 }
18234 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018235 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018236
Daniel Veillard42595322004-11-08 10:52:06 +000018237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018238}
18239
18240
18241static int
18242test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018244
Daniel Veillard3d97e662004-11-04 10:49:00 +000018245 int mem_base;
18246 int ret_val;
18247 xmlBufferPtr buf; /* the buffer to resize */
18248 int n_buf;
18249 unsigned int size; /* the desired size */
18250 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018251
Daniel Veillard3d97e662004-11-04 10:49:00 +000018252 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18253 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18254 mem_base = xmlMemBlocks();
18255 buf = gen_xmlBufferPtr(n_buf, 0);
18256 size = gen_unsigned_int(n_size, 1);
18257
18258 ret_val = xmlBufferResize(buf, size);
18259 desret_int(ret_val);
18260 call_tests++;
18261 des_xmlBufferPtr(n_buf, buf, 0);
18262 des_unsigned_int(n_size, size, 1);
18263 xmlResetLastError();
18264 if (mem_base != xmlMemBlocks()) {
18265 printf("Leak of %d blocks found in xmlBufferResize",
18266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018267 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018268 printf(" %d", n_buf);
18269 printf(" %d", n_size);
18270 printf("\n");
18271 }
18272 }
18273 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018274 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018275
Daniel Veillard42595322004-11-08 10:52:06 +000018276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018277}
18278
18279
18280static int
18281test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018283
Daniel Veillard57b25162004-11-06 14:50:18 +000018284 int mem_base;
18285 xmlBufferPtr buf; /* the buffer to tune */
18286 int n_buf;
18287 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18288 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018289
Daniel Veillard57b25162004-11-06 14:50:18 +000018290 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18291 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18292 mem_base = xmlMemBlocks();
18293 buf = gen_xmlBufferPtr(n_buf, 0);
18294 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18295
18296 xmlBufferSetAllocationScheme(buf, scheme);
18297 call_tests++;
18298 des_xmlBufferPtr(n_buf, buf, 0);
18299 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18300 xmlResetLastError();
18301 if (mem_base != xmlMemBlocks()) {
18302 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018304 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018305 printf(" %d", n_buf);
18306 printf(" %d", n_scheme);
18307 printf("\n");
18308 }
18309 }
18310 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018311 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018312
Daniel Veillard42595322004-11-08 10:52:06 +000018313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018314}
18315
18316
18317static int
18318test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018320
Daniel Veillard3d97e662004-11-04 10:49:00 +000018321 int mem_base;
18322 int ret_val;
18323 xmlBufferPtr buf; /* the buffer to dump */
18324 int n_buf;
18325 unsigned int len; /* the number of xmlChar to remove */
18326 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018327
Daniel Veillard3d97e662004-11-04 10:49:00 +000018328 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18329 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18330 mem_base = xmlMemBlocks();
18331 buf = gen_xmlBufferPtr(n_buf, 0);
18332 len = gen_unsigned_int(n_len, 1);
18333
18334 ret_val = xmlBufferShrink(buf, len);
18335 desret_int(ret_val);
18336 call_tests++;
18337 des_xmlBufferPtr(n_buf, buf, 0);
18338 des_unsigned_int(n_len, len, 1);
18339 xmlResetLastError();
18340 if (mem_base != xmlMemBlocks()) {
18341 printf("Leak of %d blocks found in xmlBufferShrink",
18342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018343 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018344 printf(" %d", n_buf);
18345 printf(" %d", n_len);
18346 printf("\n");
18347 }
18348 }
18349 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018350 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018351
Daniel Veillard42595322004-11-08 10:52:06 +000018352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018353}
18354
18355
18356static int
18357test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018359
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018360 int mem_base;
18361 xmlBufferPtr buf; /* the XML buffer */
18362 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018363 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018364 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018365
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018366 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18367 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18368 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018369 buf = gen_xmlBufferPtr(n_buf, 0);
18370 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018371
William M. Brackf13f77f2004-11-12 16:03:48 +000018372 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018374 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018375 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018376 xmlResetLastError();
18377 if (mem_base != xmlMemBlocks()) {
18378 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018380 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018381 printf(" %d", n_buf);
18382 printf(" %d", n_string);
18383 printf("\n");
18384 }
18385 }
18386 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018388
Daniel Veillard42595322004-11-08 10:52:06 +000018389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018390}
18391
18392
18393static int
18394test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018396
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018397 int mem_base;
18398 xmlBufferPtr buf; /* the XML buffer output */
18399 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018400 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018401 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018402
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018403 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18404 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18405 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018406 buf = gen_xmlBufferPtr(n_buf, 0);
18407 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018408
William M. Brackf13f77f2004-11-12 16:03:48 +000018409 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018411 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018412 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018413 xmlResetLastError();
18414 if (mem_base != xmlMemBlocks()) {
18415 printf("Leak of %d blocks found in xmlBufferWriteChar",
18416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018417 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018418 printf(" %d", n_buf);
18419 printf(" %d", n_string);
18420 printf("\n");
18421 }
18422 }
18423 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018425
Daniel Veillard42595322004-11-08 10:52:06 +000018426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018427}
18428
18429
18430static int
18431test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018433
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018434 int mem_base;
18435 xmlBufferPtr buf; /* the XML buffer output */
18436 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018437 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018438 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018439
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018440 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18441 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018443 buf = gen_xmlBufferPtr(n_buf, 0);
18444 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018445
William M. Brackf13f77f2004-11-12 16:03:48 +000018446 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018447 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018448 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018449 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018450 xmlResetLastError();
18451 if (mem_base != xmlMemBlocks()) {
18452 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018454 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018455 printf(" %d", n_buf);
18456 printf(" %d", n_string);
18457 printf("\n");
18458 }
18459 }
18460 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018461 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018462
Daniel Veillard42595322004-11-08 10:52:06 +000018463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018464}
18465
18466
18467static int
18468test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018470
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018471 int mem_base;
18472 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018473 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018474 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018475 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018476 int n_prefix;
18477 xmlChar * memory; /* preallocated memory */
18478 int n_memory;
18479 int len; /* preallocated memory length */
18480 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018481
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018482 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18483 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18484 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18485 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018487 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18488 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18489 memory = gen_xmlChar_ptr(n_memory, 2);
18490 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018491
William M. Brackf13f77f2004-11-12 16:03:48 +000018492 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018493 if ((ret_val != NULL) && (ret_val != ncname) &&
18494 (ret_val != prefix) && (ret_val != memory))
18495 xmlFree(ret_val);
18496 ret_val = NULL;
18497 desret_xmlChar_ptr(ret_val);
18498 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018499 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18500 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018501 des_xmlChar_ptr(n_memory, memory, 2);
18502 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018503 xmlResetLastError();
18504 if (mem_base != xmlMemBlocks()) {
18505 printf("Leak of %d blocks found in xmlBuildQName",
18506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018507 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018508 printf(" %d", n_ncname);
18509 printf(" %d", n_prefix);
18510 printf(" %d", n_memory);
18511 printf(" %d", n_len);
18512 printf("\n");
18513 }
18514 }
18515 }
18516 }
18517 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018519
Daniel Veillard42595322004-11-08 10:52:06 +000018520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018521}
18522
18523
18524static int
18525test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018527
William M. Brack21e4ef22005-01-02 09:53:13 +000018528#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018529 int mem_base;
18530 xmlDocPtr ret_val;
18531 xmlDocPtr doc; /* the document */
18532 int n_doc;
18533 int recursive; /* if not zero do a recursive copy. */
18534 int n_recursive;
18535
18536 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18537 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018539 doc = gen_xmlDocPtr(n_doc, 0);
18540 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018541
18542 ret_val = xmlCopyDoc(doc, recursive);
18543 desret_xmlDocPtr(ret_val);
18544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018545 des_xmlDocPtr(n_doc, doc, 0);
18546 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018547 xmlResetLastError();
18548 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018549 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018551 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018552 printf(" %d", n_doc);
18553 printf(" %d", n_recursive);
18554 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018555 }
18556 }
18557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018558 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018559#endif
18560
Daniel Veillard42595322004-11-08 10:52:06 +000018561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018562}
18563
18564
18565static int
18566test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018568
William M. Brack21e4ef22005-01-02 09:53:13 +000018569#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018570 int mem_base;
18571 xmlDtdPtr ret_val;
18572 xmlDtdPtr dtd; /* the dtd */
18573 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018574
Daniel Veillard27f20102004-11-05 11:50:11 +000018575 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18576 mem_base = xmlMemBlocks();
18577 dtd = gen_xmlDtdPtr(n_dtd, 0);
18578
18579 ret_val = xmlCopyDtd(dtd);
18580 desret_xmlDtdPtr(ret_val);
18581 call_tests++;
18582 des_xmlDtdPtr(n_dtd, dtd, 0);
18583 xmlResetLastError();
18584 if (mem_base != xmlMemBlocks()) {
18585 printf("Leak of %d blocks found in xmlCopyDtd",
18586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018587 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018588 printf(" %d", n_dtd);
18589 printf("\n");
18590 }
18591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018592 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018593#endif
18594
Daniel Veillard42595322004-11-08 10:52:06 +000018595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018596}
18597
18598
18599static int
18600test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018602
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018603 int mem_base;
18604 xmlNsPtr ret_val;
18605 xmlNsPtr cur; /* the namespace */
18606 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018607
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018608 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18609 mem_base = xmlMemBlocks();
18610 cur = gen_xmlNsPtr(n_cur, 0);
18611
18612 ret_val = xmlCopyNamespace(cur);
18613 if (ret_val != NULL) xmlFreeNs(ret_val);
18614 desret_xmlNsPtr(ret_val);
18615 call_tests++;
18616 des_xmlNsPtr(n_cur, cur, 0);
18617 xmlResetLastError();
18618 if (mem_base != xmlMemBlocks()) {
18619 printf("Leak of %d blocks found in xmlCopyNamespace",
18620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018621 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018622 printf(" %d", n_cur);
18623 printf("\n");
18624 }
18625 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018626 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018627
Daniel Veillard42595322004-11-08 10:52:06 +000018628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018629}
18630
18631
18632static int
18633test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018635
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018636 int mem_base;
18637 xmlNsPtr ret_val;
18638 xmlNsPtr cur; /* the first namespace */
18639 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018640
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018641 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18642 mem_base = xmlMemBlocks();
18643 cur = gen_xmlNsPtr(n_cur, 0);
18644
18645 ret_val = xmlCopyNamespaceList(cur);
18646 if (ret_val != NULL) xmlFreeNsList(ret_val);
18647 desret_xmlNsPtr(ret_val);
18648 call_tests++;
18649 des_xmlNsPtr(n_cur, cur, 0);
18650 xmlResetLastError();
18651 if (mem_base != xmlMemBlocks()) {
18652 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018654 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018655 printf(" %d", n_cur);
18656 printf("\n");
18657 }
18658 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018660
Daniel Veillard42595322004-11-08 10:52:06 +000018661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018662}
18663
18664
18665static int
18666test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018668
Daniel Veillardce682bc2004-11-05 17:22:25 +000018669 int mem_base;
18670 xmlNodePtr ret_val;
18671 xmlNodePtr node; /* the node */
18672 int n_node;
18673 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18674 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018675
Daniel Veillardce682bc2004-11-05 17:22:25 +000018676 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18677 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18678 mem_base = xmlMemBlocks();
18679 node = gen_const_xmlNodePtr(n_node, 0);
18680 extended = gen_int(n_extended, 1);
18681
William M. Brackf13f77f2004-11-12 16:03:48 +000018682 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018683 desret_xmlNodePtr(ret_val);
18684 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018685 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018686 des_int(n_extended, extended, 1);
18687 xmlResetLastError();
18688 if (mem_base != xmlMemBlocks()) {
18689 printf("Leak of %d blocks found in xmlCopyNode",
18690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018691 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018692 printf(" %d", n_node);
18693 printf(" %d", n_extended);
18694 printf("\n");
18695 }
18696 }
18697 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018699
Daniel Veillard42595322004-11-08 10:52:06 +000018700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018701}
18702
18703
18704static int
18705test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018707
Daniel Veillardce682bc2004-11-05 17:22:25 +000018708 int mem_base;
18709 xmlNodePtr ret_val;
18710 xmlNodePtr node; /* the first node in the list. */
18711 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018712
Daniel Veillardce682bc2004-11-05 17:22:25 +000018713 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18714 mem_base = xmlMemBlocks();
18715 node = gen_const_xmlNodePtr(n_node, 0);
18716
William M. Brackf13f77f2004-11-12 16:03:48 +000018717 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 desret_xmlNodePtr(ret_val);
18719 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018720 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018721 xmlResetLastError();
18722 if (mem_base != xmlMemBlocks()) {
18723 printf("Leak of %d blocks found in xmlCopyNodeList",
18724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018725 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018726 printf(" %d", n_node);
18727 printf("\n");
18728 }
18729 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018731
Daniel Veillard42595322004-11-08 10:52:06 +000018732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018733}
18734
18735
18736static int
18737test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018739
Daniel Veillard57b25162004-11-06 14:50:18 +000018740 int mem_base;
18741 xmlAttrPtr ret_val;
18742 xmlNodePtr target; /* the element where the attribute will be grafted */
18743 int n_target;
18744 xmlAttrPtr cur; /* the attribute */
18745 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018746
Daniel Veillard57b25162004-11-06 14:50:18 +000018747 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18748 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18749 mem_base = xmlMemBlocks();
18750 target = gen_xmlNodePtr(n_target, 0);
18751 cur = gen_xmlAttrPtr(n_cur, 1);
18752
18753 ret_val = xmlCopyProp(target, cur);
18754 desret_xmlAttrPtr(ret_val);
18755 call_tests++;
18756 des_xmlNodePtr(n_target, target, 0);
18757 des_xmlAttrPtr(n_cur, cur, 1);
18758 xmlResetLastError();
18759 if (mem_base != xmlMemBlocks()) {
18760 printf("Leak of %d blocks found in xmlCopyProp",
18761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018762 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018763 printf(" %d", n_target);
18764 printf(" %d", n_cur);
18765 printf("\n");
18766 }
18767 }
18768 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018769 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018770
Daniel Veillard42595322004-11-08 10:52:06 +000018771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018772}
18773
18774
18775static int
18776test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018778
Daniel Veillard57b25162004-11-06 14:50:18 +000018779 int mem_base;
18780 xmlAttrPtr ret_val;
18781 xmlNodePtr target; /* the element where the attributes will be grafted */
18782 int n_target;
18783 xmlAttrPtr cur; /* the first attribute */
18784 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018785
Daniel Veillard57b25162004-11-06 14:50:18 +000018786 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18787 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18788 mem_base = xmlMemBlocks();
18789 target = gen_xmlNodePtr(n_target, 0);
18790 cur = gen_xmlAttrPtr(n_cur, 1);
18791
18792 ret_val = xmlCopyPropList(target, cur);
18793 desret_xmlAttrPtr(ret_val);
18794 call_tests++;
18795 des_xmlNodePtr(n_target, target, 0);
18796 des_xmlAttrPtr(n_cur, cur, 1);
18797 xmlResetLastError();
18798 if (mem_base != xmlMemBlocks()) {
18799 printf("Leak of %d blocks found in xmlCopyPropList",
18800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018801 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018802 printf(" %d", n_target);
18803 printf(" %d", n_cur);
18804 printf("\n");
18805 }
18806 }
18807 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018808 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018809
Daniel Veillard42595322004-11-08 10:52:06 +000018810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018811}
18812
18813
18814static int
18815test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018817
Daniel Veillard34099b42004-11-04 17:34:35 +000018818 int mem_base;
18819 xmlDtdPtr ret_val;
18820 xmlDocPtr doc; /* the document pointer */
18821 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018822 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018823 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018824 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018825 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018826 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018827 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018828
Daniel Veillard34099b42004-11-04 17:34:35 +000018829 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18830 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18831 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18832 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18833 mem_base = xmlMemBlocks();
18834 doc = gen_xmlDocPtr(n_doc, 0);
18835 name = gen_const_xmlChar_ptr(n_name, 1);
18836 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18837 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18838
William M. Brackf13f77f2004-11-12 16:03:48 +000018839 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018840 desret_xmlDtdPtr(ret_val);
18841 call_tests++;
18842 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018843 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18844 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18845 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018846 xmlResetLastError();
18847 if (mem_base != xmlMemBlocks()) {
18848 printf("Leak of %d blocks found in xmlCreateIntSubset",
18849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018850 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018851 printf(" %d", n_doc);
18852 printf(" %d", n_name);
18853 printf(" %d", n_ExternalID);
18854 printf(" %d", n_SystemID);
18855 printf("\n");
18856 }
18857 }
18858 }
18859 }
18860 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018861 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018862
Daniel Veillard42595322004-11-08 10:52:06 +000018863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018864}
18865
18866
18867static int
18868test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018870
Daniel Veillardce682bc2004-11-05 17:22:25 +000018871 int mem_base;
18872 xmlNodePtr ret_val;
18873 xmlNodePtr node; /* the node */
18874 int n_node;
18875 xmlDocPtr doc; /* the document */
18876 int n_doc;
18877 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18878 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018879
Daniel Veillardce682bc2004-11-05 17:22:25 +000018880 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18881 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18882 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18883 mem_base = xmlMemBlocks();
18884 node = gen_const_xmlNodePtr(n_node, 0);
18885 doc = gen_xmlDocPtr(n_doc, 1);
18886 extended = gen_int(n_extended, 2);
18887
William M. Brackf13f77f2004-11-12 16:03:48 +000018888 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018889 desret_xmlNodePtr(ret_val);
18890 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018891 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018892 des_xmlDocPtr(n_doc, doc, 1);
18893 des_int(n_extended, extended, 2);
18894 xmlResetLastError();
18895 if (mem_base != xmlMemBlocks()) {
18896 printf("Leak of %d blocks found in xmlDocCopyNode",
18897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018898 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018899 printf(" %d", n_node);
18900 printf(" %d", n_doc);
18901 printf(" %d", n_extended);
18902 printf("\n");
18903 }
18904 }
18905 }
18906 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018907 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018908
Daniel Veillard42595322004-11-08 10:52:06 +000018909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018910}
18911
18912
18913static int
18914test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018916
Daniel Veillardce682bc2004-11-05 17:22:25 +000018917 int mem_base;
18918 xmlNodePtr ret_val;
18919 xmlDocPtr doc; /* the target document */
18920 int n_doc;
18921 xmlNodePtr node; /* the first node in the list. */
18922 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018923
Daniel Veillardce682bc2004-11-05 17:22:25 +000018924 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18925 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18926 mem_base = xmlMemBlocks();
18927 doc = gen_xmlDocPtr(n_doc, 0);
18928 node = gen_const_xmlNodePtr(n_node, 1);
18929
William M. Brackf13f77f2004-11-12 16:03:48 +000018930 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018931 desret_xmlNodePtr(ret_val);
18932 call_tests++;
18933 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018934 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018935 xmlResetLastError();
18936 if (mem_base != xmlMemBlocks()) {
18937 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018939 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018940 printf(" %d", n_doc);
18941 printf(" %d", n_node);
18942 printf("\n");
18943 }
18944 }
18945 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018946 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018947
Daniel Veillard42595322004-11-08 10:52:06 +000018948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018949}
18950
18951
18952static int
18953test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018955
William M. Brack21e4ef22005-01-02 09:53:13 +000018956#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018957 int mem_base;
18958 int ret_val;
18959 FILE * f; /* the FILE* */
18960 int n_f;
18961 xmlDocPtr cur; /* the document */
18962 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018963
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018964 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18965 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18966 mem_base = xmlMemBlocks();
18967 f = gen_FILE_ptr(n_f, 0);
18968 cur = gen_xmlDocPtr(n_cur, 1);
18969
18970 ret_val = xmlDocDump(f, cur);
18971 desret_int(ret_val);
18972 call_tests++;
18973 des_FILE_ptr(n_f, f, 0);
18974 des_xmlDocPtr(n_cur, cur, 1);
18975 xmlResetLastError();
18976 if (mem_base != xmlMemBlocks()) {
18977 printf("Leak of %d blocks found in xmlDocDump",
18978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018979 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018980 printf(" %d", n_f);
18981 printf(" %d", n_cur);
18982 printf("\n");
18983 }
18984 }
18985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018986 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018987#endif
18988
Daniel Veillard42595322004-11-08 10:52:06 +000018989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018990}
18991
18992
18993static int
18994test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018996
William M. Brack21e4ef22005-01-02 09:53:13 +000018997#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018998 int mem_base;
18999 xmlDocPtr cur; /* the document */
19000 int n_cur;
19001 xmlChar ** mem; /* OUT: the memory pointer */
19002 int n_mem;
19003 int * size; /* OUT: the memory length */
19004 int n_size;
19005 int format; /* should formatting spaces been added */
19006 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019007
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019008 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19009 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19010 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19011 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19012 mem_base = xmlMemBlocks();
19013 cur = gen_xmlDocPtr(n_cur, 0);
19014 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19015 size = gen_int_ptr(n_size, 2);
19016 format = gen_int(n_format, 3);
19017
19018 xmlDocDumpFormatMemory(cur, mem, size, format);
19019 call_tests++;
19020 des_xmlDocPtr(n_cur, cur, 0);
19021 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19022 des_int_ptr(n_size, size, 2);
19023 des_int(n_format, format, 3);
19024 xmlResetLastError();
19025 if (mem_base != xmlMemBlocks()) {
19026 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019028 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019029 printf(" %d", n_cur);
19030 printf(" %d", n_mem);
19031 printf(" %d", n_size);
19032 printf(" %d", n_format);
19033 printf("\n");
19034 }
19035 }
19036 }
19037 }
19038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019039 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019040#endif
19041
Daniel Veillard42595322004-11-08 10:52:06 +000019042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019043}
19044
19045
19046static int
19047test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019049
William M. Brack21e4ef22005-01-02 09:53:13 +000019050#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019051 int mem_base;
19052 xmlDocPtr out_doc; /* Document to generate XML text from */
19053 int n_out_doc;
19054 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19055 int n_doc_txt_ptr;
19056 int * doc_txt_len; /* Length of the generated XML text */
19057 int n_doc_txt_len;
19058 char * txt_encoding; /* Character encoding to use when generating XML text */
19059 int n_txt_encoding;
19060 int format; /* should formatting spaces been added */
19061 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019062
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019063 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19064 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19065 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19066 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19067 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19068 mem_base = xmlMemBlocks();
19069 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19070 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19071 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19072 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19073 format = gen_int(n_format, 4);
19074
William M. Brackf13f77f2004-11-12 16:03:48 +000019075 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019076 call_tests++;
19077 des_xmlDocPtr(n_out_doc, out_doc, 0);
19078 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19079 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019080 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019081 des_int(n_format, format, 4);
19082 xmlResetLastError();
19083 if (mem_base != xmlMemBlocks()) {
19084 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019086 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019087 printf(" %d", n_out_doc);
19088 printf(" %d", n_doc_txt_ptr);
19089 printf(" %d", n_doc_txt_len);
19090 printf(" %d", n_txt_encoding);
19091 printf(" %d", n_format);
19092 printf("\n");
19093 }
19094 }
19095 }
19096 }
19097 }
19098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019099 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019100#endif
19101
Daniel Veillard42595322004-11-08 10:52:06 +000019102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019103}
19104
19105
19106static int
19107test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019109
William M. Brack21e4ef22005-01-02 09:53:13 +000019110#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019111 int mem_base;
19112 xmlDocPtr cur; /* the document */
19113 int n_cur;
19114 xmlChar ** mem; /* OUT: the memory pointer */
19115 int n_mem;
19116 int * size; /* OUT: the memory length */
19117 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019118
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019119 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19120 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19121 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19122 mem_base = xmlMemBlocks();
19123 cur = gen_xmlDocPtr(n_cur, 0);
19124 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19125 size = gen_int_ptr(n_size, 2);
19126
19127 xmlDocDumpMemory(cur, mem, size);
19128 call_tests++;
19129 des_xmlDocPtr(n_cur, cur, 0);
19130 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19131 des_int_ptr(n_size, size, 2);
19132 xmlResetLastError();
19133 if (mem_base != xmlMemBlocks()) {
19134 printf("Leak of %d blocks found in xmlDocDumpMemory",
19135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019136 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019137 printf(" %d", n_cur);
19138 printf(" %d", n_mem);
19139 printf(" %d", n_size);
19140 printf("\n");
19141 }
19142 }
19143 }
19144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019145 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019146#endif
19147
Daniel Veillard42595322004-11-08 10:52:06 +000019148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019149}
19150
19151
19152static int
19153test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019155
William M. Brack21e4ef22005-01-02 09:53:13 +000019156#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019157 int mem_base;
19158 xmlDocPtr out_doc; /* Document to generate XML text from */
19159 int n_out_doc;
19160 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19161 int n_doc_txt_ptr;
19162 int * doc_txt_len; /* Length of the generated XML text */
19163 int n_doc_txt_len;
19164 char * txt_encoding; /* Character encoding to use when generating XML text */
19165 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019166
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019167 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19168 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19169 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19170 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19171 mem_base = xmlMemBlocks();
19172 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19173 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19174 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19175 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19176
William M. Brackf13f77f2004-11-12 16:03:48 +000019177 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019178 call_tests++;
19179 des_xmlDocPtr(n_out_doc, out_doc, 0);
19180 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19181 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019182 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019183 xmlResetLastError();
19184 if (mem_base != xmlMemBlocks()) {
19185 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019187 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019188 printf(" %d", n_out_doc);
19189 printf(" %d", n_doc_txt_ptr);
19190 printf(" %d", n_doc_txt_len);
19191 printf(" %d", n_txt_encoding);
19192 printf("\n");
19193 }
19194 }
19195 }
19196 }
19197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019198 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019199#endif
19200
Daniel Veillard42595322004-11-08 10:52:06 +000019201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019202}
19203
19204
19205static int
19206test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019208
William M. Brack21e4ef22005-01-02 09:53:13 +000019209#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019210 int mem_base;
19211 int ret_val;
19212 FILE * f; /* the FILE* */
19213 int n_f;
19214 xmlDocPtr cur; /* the document */
19215 int n_cur;
19216 int format; /* should formatting spaces been added */
19217 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019218
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019219 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19220 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19221 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19222 mem_base = xmlMemBlocks();
19223 f = gen_FILE_ptr(n_f, 0);
19224 cur = gen_xmlDocPtr(n_cur, 1);
19225 format = gen_int(n_format, 2);
19226
19227 ret_val = xmlDocFormatDump(f, cur, format);
19228 desret_int(ret_val);
19229 call_tests++;
19230 des_FILE_ptr(n_f, f, 0);
19231 des_xmlDocPtr(n_cur, cur, 1);
19232 des_int(n_format, format, 2);
19233 xmlResetLastError();
19234 if (mem_base != xmlMemBlocks()) {
19235 printf("Leak of %d blocks found in xmlDocFormatDump",
19236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019237 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019238 printf(" %d", n_f);
19239 printf(" %d", n_cur);
19240 printf(" %d", n_format);
19241 printf("\n");
19242 }
19243 }
19244 }
19245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019246 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019247#endif
19248
Daniel Veillard42595322004-11-08 10:52:06 +000019249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019250}
19251
19252
19253static int
19254test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019256
19257 int mem_base;
19258 xmlNodePtr ret_val;
19259 xmlDocPtr doc; /* the document */
19260 int n_doc;
19261
19262 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019264 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019265
19266 ret_val = xmlDocGetRootElement(doc);
19267 desret_xmlNodePtr(ret_val);
19268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019269 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019270 xmlResetLastError();
19271 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019272 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019274 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019275 printf(" %d", n_doc);
19276 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019277 }
19278 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019279 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019280
Daniel Veillard42595322004-11-08 10:52:06 +000019281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019282}
19283
19284
19285static int
19286test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019288
William M. Brack21e4ef22005-01-02 09:53:13 +000019289#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290 int mem_base;
19291 xmlNodePtr ret_val;
19292 xmlDocPtr doc; /* the document */
19293 int n_doc;
19294 xmlNodePtr root; /* the new document root element */
19295 int n_root;
19296
19297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019298 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019300 doc = gen_xmlDocPtr(n_doc, 0);
19301 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019302
19303 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019304 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019305 desret_xmlNodePtr(ret_val);
19306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019307 des_xmlDocPtr(n_doc, doc, 0);
19308 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019309 xmlResetLastError();
19310 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019311 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019313 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019314 printf(" %d", n_doc);
19315 printf(" %d", n_root);
19316 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019317 }
19318 }
19319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019320 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019321#endif
19322
Daniel Veillard42595322004-11-08 10:52:06 +000019323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019324}
19325
19326
19327static int
19328test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330
William M. Brack21e4ef22005-01-02 09:53:13 +000019331#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019332 int mem_base;
19333 FILE * f; /* the FILE * for the output */
19334 int n_f;
19335 xmlDocPtr doc; /* the document */
19336 int n_doc;
19337 xmlNodePtr cur; /* the current node */
19338 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019339
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019340 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19341 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19342 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19343 mem_base = xmlMemBlocks();
19344 f = gen_FILE_ptr(n_f, 0);
19345 doc = gen_xmlDocPtr(n_doc, 1);
19346 cur = gen_xmlNodePtr(n_cur, 2);
19347
19348 xmlElemDump(f, doc, cur);
19349 call_tests++;
19350 des_FILE_ptr(n_f, f, 0);
19351 des_xmlDocPtr(n_doc, doc, 1);
19352 des_xmlNodePtr(n_cur, cur, 2);
19353 xmlResetLastError();
19354 if (mem_base != xmlMemBlocks()) {
19355 printf("Leak of %d blocks found in xmlElemDump",
19356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019357 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019358 printf(" %d", n_f);
19359 printf(" %d", n_doc);
19360 printf(" %d", n_cur);
19361 printf("\n");
19362 }
19363 }
19364 }
19365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019366 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019367#endif
19368
Daniel Veillard42595322004-11-08 10:52:06 +000019369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019370}
19371
19372
19373static int
19374test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019376
Daniel Veillard57b25162004-11-06 14:50:18 +000019377 int mem_base;
19378 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019379
Daniel Veillard57b25162004-11-06 14:50:18 +000019380 mem_base = xmlMemBlocks();
19381
19382 ret_val = xmlGetBufferAllocationScheme();
19383 desret_xmlBufferAllocationScheme(ret_val);
19384 call_tests++;
19385 xmlResetLastError();
19386 if (mem_base != xmlMemBlocks()) {
19387 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019389 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019390 printf("\n");
19391 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019393
Daniel Veillard42595322004-11-08 10:52:06 +000019394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019395}
19396
19397
19398static int
19399test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019401
19402 int mem_base;
19403 int ret_val;
19404
19405 mem_base = xmlMemBlocks();
19406
19407 ret_val = xmlGetCompressMode();
19408 desret_int(ret_val);
19409 call_tests++;
19410 xmlResetLastError();
19411 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019412 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019414 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019415 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019418
Daniel Veillard42595322004-11-08 10:52:06 +000019419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019420}
19421
19422
19423static int
19424test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019426
19427 int mem_base;
19428 int ret_val;
19429 xmlDocPtr doc; /* the document */
19430 int n_doc;
19431
19432 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19433 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019434 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019435
19436 ret_val = xmlGetDocCompressMode(doc);
19437 desret_int(ret_val);
19438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019439 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019440 xmlResetLastError();
19441 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019442 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019444 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019445 printf(" %d", n_doc);
19446 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019447 }
19448 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019449 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019450
Daniel Veillard42595322004-11-08 10:52:06 +000019451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019452}
19453
19454
19455static int
19456test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458
Daniel Veillard34099b42004-11-04 17:34:35 +000019459 int mem_base;
19460 xmlDtdPtr ret_val;
19461 xmlDocPtr doc; /* the document pointer */
19462 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019463
Daniel Veillard34099b42004-11-04 17:34:35 +000019464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19465 mem_base = xmlMemBlocks();
19466 doc = gen_xmlDocPtr(n_doc, 0);
19467
19468 ret_val = xmlGetIntSubset(doc);
19469 desret_xmlDtdPtr(ret_val);
19470 call_tests++;
19471 des_xmlDocPtr(n_doc, doc, 0);
19472 xmlResetLastError();
19473 if (mem_base != xmlMemBlocks()) {
19474 printf("Leak of %d blocks found in xmlGetIntSubset",
19475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019476 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019477 printf(" %d", n_doc);
19478 printf("\n");
19479 }
19480 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019481 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019482
Daniel Veillard42595322004-11-08 10:52:06 +000019483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019484}
19485
19486
19487static int
19488test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019490
19491 int mem_base;
19492 xmlNodePtr ret_val;
19493 xmlNodePtr parent; /* the parent node */
19494 int n_parent;
19495
19496 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019498 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019499
19500 ret_val = xmlGetLastChild(parent);
19501 desret_xmlNodePtr(ret_val);
19502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019503 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019504 xmlResetLastError();
19505 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019506 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019508 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019509 printf(" %d", n_parent);
19510 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019511 }
19512 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019513 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019514
Daniel Veillard42595322004-11-08 10:52:06 +000019515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019516}
19517
19518
19519static int
19520test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019522
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019523 int mem_base;
19524 long ret_val;
19525 xmlNodePtr node; /* valid node */
19526 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019527
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019528 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19529 mem_base = xmlMemBlocks();
19530 node = gen_xmlNodePtr(n_node, 0);
19531
19532 ret_val = xmlGetLineNo(node);
19533 desret_long(ret_val);
19534 call_tests++;
19535 des_xmlNodePtr(n_node, node, 0);
19536 xmlResetLastError();
19537 if (mem_base != xmlMemBlocks()) {
19538 printf("Leak of %d blocks found in xmlGetLineNo",
19539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019540 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019541 printf(" %d", n_node);
19542 printf("\n");
19543 }
19544 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019546
Daniel Veillard42595322004-11-08 10:52:06 +000019547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019548}
19549
19550
19551static int
19552test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019554
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019555 int mem_base;
19556 xmlChar * ret_val;
19557 xmlNodePtr node; /* the node */
19558 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019559 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019560 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019561
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019562 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19563 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19564 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019565 node = gen_xmlNodePtr(n_node, 0);
19566 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019567
William M. Brackf13f77f2004-11-12 16:03:48 +000019568 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019569 desret_xmlChar_ptr(ret_val);
19570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019571 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019572 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019573 xmlResetLastError();
19574 if (mem_base != xmlMemBlocks()) {
19575 printf("Leak of %d blocks found in xmlGetNoNsProp",
19576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019577 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019578 printf(" %d", n_node);
19579 printf(" %d", n_name);
19580 printf("\n");
19581 }
19582 }
19583 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019584 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019585
Daniel Veillard42595322004-11-08 10:52:06 +000019586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019587}
19588
19589
19590static int
19591test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019593
William M. Brack21e4ef22005-01-02 09:53:13 +000019594#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019595 int mem_base;
19596 xmlChar * ret_val;
19597 xmlNodePtr node; /* a node */
19598 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019599
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019600 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019602 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019603
19604 ret_val = xmlGetNodePath(node);
19605 desret_xmlChar_ptr(ret_val);
19606 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019607 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019608 xmlResetLastError();
19609 if (mem_base != xmlMemBlocks()) {
19610 printf("Leak of %d blocks found in xmlGetNodePath",
19611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019612 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019613 printf(" %d", n_node);
19614 printf("\n");
19615 }
19616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019617 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019618#endif
19619
Daniel Veillard42595322004-11-08 10:52:06 +000019620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019621}
19622
19623
19624static int
19625test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019627
19628
19629 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019631}
19632
19633
19634static int
19635test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019637
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019638 int mem_base;
19639 xmlChar * ret_val;
19640 xmlNodePtr node; /* the node */
19641 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019642 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019643 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019644 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019645 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019646
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019647 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19648 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19649 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019651 node = gen_xmlNodePtr(n_node, 0);
19652 name = gen_const_xmlChar_ptr(n_name, 1);
19653 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019654
William M. Brackf13f77f2004-11-12 16:03:48 +000019655 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019656 desret_xmlChar_ptr(ret_val);
19657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019658 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019659 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19660 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019661 xmlResetLastError();
19662 if (mem_base != xmlMemBlocks()) {
19663 printf("Leak of %d blocks found in xmlGetNsProp",
19664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019665 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019666 printf(" %d", n_node);
19667 printf(" %d", n_name);
19668 printf(" %d", n_nameSpace);
19669 printf("\n");
19670 }
19671 }
19672 }
19673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019675
Daniel Veillard42595322004-11-08 10:52:06 +000019676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019677}
19678
19679
19680static int
19681test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019684 int mem_base;
19685 xmlChar * ret_val;
19686 xmlNodePtr node; /* the node */
19687 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019688 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019689 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019690
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019691 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19692 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19693 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019694 node = gen_xmlNodePtr(n_node, 0);
19695 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019696
William M. Brackf13f77f2004-11-12 16:03:48 +000019697 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019698 desret_xmlChar_ptr(ret_val);
19699 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019700 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019701 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019702 xmlResetLastError();
19703 if (mem_base != xmlMemBlocks()) {
19704 printf("Leak of %d blocks found in xmlGetProp",
19705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019706 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019707 printf(" %d", n_node);
19708 printf(" %d", n_name);
19709 printf("\n");
19710 }
19711 }
19712 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019713 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019714
Daniel Veillard42595322004-11-08 10:52:06 +000019715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019716}
19717
19718
19719static int
19720test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019722
Daniel Veillard57b25162004-11-06 14:50:18 +000019723 int mem_base;
19724 xmlAttrPtr ret_val;
19725 xmlNodePtr node; /* the node */
19726 int n_node;
19727 xmlChar * name; /* the attribute name */
19728 int n_name;
19729 xmlChar * nameSpace; /* the URI of the namespace */
19730 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731
Daniel Veillard57b25162004-11-06 14:50:18 +000019732 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19733 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19734 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19735 mem_base = xmlMemBlocks();
19736 node = gen_xmlNodePtr(n_node, 0);
19737 name = gen_const_xmlChar_ptr(n_name, 1);
19738 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19739
William M. Brackf13f77f2004-11-12 16:03:48 +000019740 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019741 desret_xmlAttrPtr(ret_val);
19742 call_tests++;
19743 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019744 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19745 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019746 xmlResetLastError();
19747 if (mem_base != xmlMemBlocks()) {
19748 printf("Leak of %d blocks found in xmlHasNsProp",
19749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019750 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019751 printf(" %d", n_node);
19752 printf(" %d", n_name);
19753 printf(" %d", n_nameSpace);
19754 printf("\n");
19755 }
19756 }
19757 }
19758 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019759 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019760
Daniel Veillard42595322004-11-08 10:52:06 +000019761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019762}
19763
19764
19765static int
19766test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019768
Daniel Veillard57b25162004-11-06 14:50:18 +000019769 int mem_base;
19770 xmlAttrPtr ret_val;
19771 xmlNodePtr node; /* the node */
19772 int n_node;
19773 xmlChar * name; /* the attribute name */
19774 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019775
Daniel Veillard57b25162004-11-06 14:50:18 +000019776 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19777 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19778 mem_base = xmlMemBlocks();
19779 node = gen_xmlNodePtr(n_node, 0);
19780 name = gen_const_xmlChar_ptr(n_name, 1);
19781
William M. Brackf13f77f2004-11-12 16:03:48 +000019782 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019783 desret_xmlAttrPtr(ret_val);
19784 call_tests++;
19785 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019786 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019787 xmlResetLastError();
19788 if (mem_base != xmlMemBlocks()) {
19789 printf("Leak of %d blocks found in xmlHasProp",
19790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019791 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019792 printf(" %d", n_node);
19793 printf(" %d", n_name);
19794 printf("\n");
19795 }
19796 }
19797 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019798 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019799
Daniel Veillard42595322004-11-08 10:52:06 +000019800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019801}
19802
19803
19804static int
19805test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019807
19808 int mem_base;
19809 int ret_val;
19810 xmlNodePtr node; /* the node */
19811 int n_node;
19812
19813 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019815 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019816
19817 ret_val = xmlIsBlankNode(node);
19818 desret_int(ret_val);
19819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019820 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019821 xmlResetLastError();
19822 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019823 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019825 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019826 printf(" %d", n_node);
19827 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019828 }
19829 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019831
Daniel Veillard42595322004-11-08 10:52:06 +000019832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019833}
19834
19835
19836static int
19837test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019839
19840 int mem_base;
19841 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019842 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019843 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019844 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019845 int n_publicID;
19846
19847 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19848 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19849 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019850 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19851 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019852
William M. Brackf13f77f2004-11-12 16:03:48 +000019853 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019854 desret_int(ret_val);
19855 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019856 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19857 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858 xmlResetLastError();
19859 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019860 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019862 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019863 printf(" %d", n_systemID);
19864 printf(" %d", n_publicID);
19865 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019866 }
19867 }
19868 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019869 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019870
Daniel Veillard42595322004-11-08 10:52:06 +000019871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019872}
19873
19874
19875static int
19876test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019878
19879 int mem_base;
19880 xmlNodePtr ret_val;
19881 xmlDocPtr doc; /* the document */
19882 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019883 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019884 int n_content;
19885 int len; /* the length of the block */
19886 int n_len;
19887
19888 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19889 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19890 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19891 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019892 doc = gen_xmlDocPtr(n_doc, 0);
19893 content = gen_const_xmlChar_ptr(n_content, 1);
19894 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895
William M. Brackf13f77f2004-11-12 16:03:48 +000019896 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019897 desret_xmlNodePtr(ret_val);
19898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019899 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019900 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019901 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019902 xmlResetLastError();
19903 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019904 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019906 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019907 printf(" %d", n_doc);
19908 printf(" %d", n_content);
19909 printf(" %d", n_len);
19910 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019911 }
19912 }
19913 }
19914 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019915 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019916
Daniel Veillard42595322004-11-08 10:52:06 +000019917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019918}
19919
19920
19921static int
19922test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019924
19925 int mem_base;
19926 xmlNodePtr ret_val;
19927 xmlDocPtr doc; /* the document */
19928 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019929 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930 int n_name;
19931
19932 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19933 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19934 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019935 doc = gen_xmlDocPtr(n_doc, 0);
19936 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019937
William M. Brackf13f77f2004-11-12 16:03:48 +000019938 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019939 desret_xmlNodePtr(ret_val);
19940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019941 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019942 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019943 xmlResetLastError();
19944 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019945 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019947 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019948 printf(" %d", n_doc);
19949 printf(" %d", n_name);
19950 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019951 }
19952 }
19953 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019954 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019955
Daniel Veillard42595322004-11-08 10:52:06 +000019956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019957}
19958
19959
19960static int
19961test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019963
William M. Brack21e4ef22005-01-02 09:53:13 +000019964#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019965#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019966 int mem_base;
19967 xmlNodePtr ret_val;
19968 xmlNodePtr parent; /* the parent node */
19969 int n_parent;
19970 xmlNsPtr ns; /* a namespace if any */
19971 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019972 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019973 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019974 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019975 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019976
Daniel Veillard27f20102004-11-05 11:50:11 +000019977 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19978 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19979 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19980 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19981 mem_base = xmlMemBlocks();
19982 parent = gen_xmlNodePtr(n_parent, 0);
19983 ns = gen_xmlNsPtr(n_ns, 1);
19984 name = gen_const_xmlChar_ptr(n_name, 2);
19985 content = gen_const_xmlChar_ptr(n_content, 3);
19986
William M. Brackf13f77f2004-11-12 16:03:48 +000019987 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019988 desret_xmlNodePtr(ret_val);
19989 call_tests++;
19990 des_xmlNodePtr(n_parent, parent, 0);
19991 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019992 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19993 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019994 xmlResetLastError();
19995 if (mem_base != xmlMemBlocks()) {
19996 printf("Leak of %d blocks found in xmlNewChild",
19997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019998 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019999 printf(" %d", n_parent);
20000 printf(" %d", n_ns);
20001 printf(" %d", n_name);
20002 printf(" %d", n_content);
20003 printf("\n");
20004 }
20005 }
20006 }
20007 }
20008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020009 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020010#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020011#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020012
Daniel Veillard42595322004-11-08 10:52:06 +000020013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020014}
20015
20016
20017static int
20018test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020020
20021 int mem_base;
20022 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020023 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020024 int n_content;
20025
20026 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020028 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020029
William M. Brackf13f77f2004-11-12 16:03:48 +000020030 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020031 desret_xmlNodePtr(ret_val);
20032 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020033 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020034 xmlResetLastError();
20035 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020036 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020038 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020039 printf(" %d", n_content);
20040 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020041 }
20042 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020044
Daniel Veillard42595322004-11-08 10:52:06 +000020045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020046}
20047
20048
20049static int
20050test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020052
20053 int mem_base;
20054 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020055 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020056 int n_version;
20057
20058 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020060 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020061
William M. Brackf13f77f2004-11-12 16:03:48 +000020062 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020063 desret_xmlDocPtr(ret_val);
20064 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020065 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020066 xmlResetLastError();
20067 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020068 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020070 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020071 printf(" %d", n_version);
20072 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020073 }
20074 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020076
Daniel Veillard42595322004-11-08 10:52:06 +000020077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020078}
20079
20080
20081static int
20082test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020084
20085 int mem_base;
20086 xmlNodePtr ret_val;
20087 xmlDocPtr doc; /* the document */
20088 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020089 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020090 int n_content;
20091
20092 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20093 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020095 doc = gen_xmlDocPtr(n_doc, 0);
20096 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020097
William M. Brackf13f77f2004-11-12 16:03:48 +000020098 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020099 desret_xmlNodePtr(ret_val);
20100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020101 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020102 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020103 xmlResetLastError();
20104 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020105 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020107 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020108 printf(" %d", n_doc);
20109 printf(" %d", n_content);
20110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 }
20112 }
20113 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020114 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020115
Daniel Veillard42595322004-11-08 10:52:06 +000020116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020117}
20118
20119
20120static int
20121test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020123
William M. Brack21e4ef22005-01-02 09:53:13 +000020124#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000020125 int mem_base;
20126 xmlNodePtr ret_val;
20127 xmlDocPtr doc; /* the document owning the fragment */
20128 int n_doc;
20129
20130 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020132 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020133
20134 ret_val = xmlNewDocFragment(doc);
20135 desret_xmlNodePtr(ret_val);
20136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020137 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138 xmlResetLastError();
20139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020140 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020143 printf(" %d", n_doc);
20144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020145 }
20146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020147 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020148#endif
20149
Daniel Veillard42595322004-11-08 10:52:06 +000020150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020151}
20152
20153
20154static int
20155test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020157
Daniel Veillard27f20102004-11-05 11:50:11 +000020158 int mem_base;
20159 xmlNodePtr ret_val;
20160 xmlDocPtr doc; /* the document */
20161 int n_doc;
20162 xmlNsPtr ns; /* namespace if any */
20163 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020164 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020165 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020166 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020167 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020168
Daniel Veillard27f20102004-11-05 11:50:11 +000020169 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20170 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20172 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20173 mem_base = xmlMemBlocks();
20174 doc = gen_xmlDocPtr(n_doc, 0);
20175 ns = gen_xmlNsPtr(n_ns, 1);
20176 name = gen_const_xmlChar_ptr(n_name, 2);
20177 content = gen_const_xmlChar_ptr(n_content, 3);
20178
William M. Brackf13f77f2004-11-12 16:03:48 +000020179 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020180 desret_xmlNodePtr(ret_val);
20181 call_tests++;
20182 des_xmlDocPtr(n_doc, doc, 0);
20183 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020184 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20185 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020186 xmlResetLastError();
20187 if (mem_base != xmlMemBlocks()) {
20188 printf("Leak of %d blocks found in xmlNewDocNode",
20189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020190 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020191 printf(" %d", n_doc);
20192 printf(" %d", n_ns);
20193 printf(" %d", n_name);
20194 printf(" %d", n_content);
20195 printf("\n");
20196 }
20197 }
20198 }
20199 }
20200 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020202
Daniel Veillard42595322004-11-08 10:52:06 +000020203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020204}
20205
20206
20207static int
20208test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020210
Daniel Veillard27f20102004-11-05 11:50:11 +000020211 int mem_base;
20212 xmlNodePtr ret_val;
20213 xmlDocPtr doc; /* the document */
20214 int n_doc;
20215 xmlNsPtr ns; /* namespace if any */
20216 int n_ns;
20217 xmlChar * name; /* the node name */
20218 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020219 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020220 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020221
Daniel Veillard27f20102004-11-05 11:50:11 +000020222 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20223 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20224 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20225 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20226 mem_base = xmlMemBlocks();
20227 doc = gen_xmlDocPtr(n_doc, 0);
20228 ns = gen_xmlNsPtr(n_ns, 1);
20229 name = gen_eaten_name(n_name, 2);
20230 content = gen_const_xmlChar_ptr(n_content, 3);
20231
William M. Brackf13f77f2004-11-12 16:03:48 +000020232 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020233 desret_xmlNodePtr(ret_val);
20234 call_tests++;
20235 des_xmlDocPtr(n_doc, doc, 0);
20236 des_xmlNsPtr(n_ns, ns, 1);
20237 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020238 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020239 xmlResetLastError();
20240 if (mem_base != xmlMemBlocks()) {
20241 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020243 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020244 printf(" %d", n_doc);
20245 printf(" %d", n_ns);
20246 printf(" %d", n_name);
20247 printf(" %d", n_content);
20248 printf("\n");
20249 }
20250 }
20251 }
20252 }
20253 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020254 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020255
Daniel Veillard42595322004-11-08 10:52:06 +000020256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020257}
20258
20259
20260static int
20261test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020263
20264 int mem_base;
20265 xmlNodePtr ret_val;
20266 xmlDocPtr doc; /* the target document */
20267 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020268 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020269 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020270 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020271 int n_content;
20272
20273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20274 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20275 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20276 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020277 doc = gen_xmlDocPtr(n_doc, 0);
20278 name = gen_const_xmlChar_ptr(n_name, 1);
20279 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020280
William M. Brackf13f77f2004-11-12 16:03:48 +000020281 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020282 desret_xmlNodePtr(ret_val);
20283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020284 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020285 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20286 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020287 xmlResetLastError();
20288 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020289 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020291 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020292 printf(" %d", n_doc);
20293 printf(" %d", n_name);
20294 printf(" %d", n_content);
20295 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020296 }
20297 }
20298 }
20299 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020300 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020301
Daniel Veillard42595322004-11-08 10:52:06 +000020302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020303}
20304
20305
20306static int
20307test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020309
Daniel Veillard57b25162004-11-06 14:50:18 +000020310 int mem_base;
20311 xmlAttrPtr ret_val;
20312 xmlDocPtr doc; /* the document */
20313 int n_doc;
20314 xmlChar * name; /* the name of the attribute */
20315 int n_name;
20316 xmlChar * value; /* the value of the attribute */
20317 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020318
Daniel Veillard57b25162004-11-06 14:50:18 +000020319 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20320 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20321 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20322 mem_base = xmlMemBlocks();
20323 doc = gen_xmlDocPtr(n_doc, 0);
20324 name = gen_const_xmlChar_ptr(n_name, 1);
20325 value = gen_const_xmlChar_ptr(n_value, 2);
20326
William M. Brackf13f77f2004-11-12 16:03:48 +000020327 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020328 desret_xmlAttrPtr(ret_val);
20329 call_tests++;
20330 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020331 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20332 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020333 xmlResetLastError();
20334 if (mem_base != xmlMemBlocks()) {
20335 printf("Leak of %d blocks found in xmlNewDocProp",
20336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020337 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020338 printf(" %d", n_doc);
20339 printf(" %d", n_name);
20340 printf(" %d", n_value);
20341 printf("\n");
20342 }
20343 }
20344 }
20345 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020347
Daniel Veillard42595322004-11-08 10:52:06 +000020348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349}
20350
20351
20352static int
20353test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355
William M. Brack21e4ef22005-01-02 09:53:13 +000020356#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020357#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020358 int mem_base;
20359 xmlNodePtr ret_val;
20360 xmlDocPtr doc; /* the document */
20361 int n_doc;
20362 xmlNsPtr ns; /* namespace if any */
20363 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020364 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020365 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020366 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020367 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020368
Daniel Veillard27f20102004-11-05 11:50:11 +000020369 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20370 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20372 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20373 mem_base = xmlMemBlocks();
20374 doc = gen_xmlDocPtr(n_doc, 0);
20375 ns = gen_xmlNsPtr(n_ns, 1);
20376 name = gen_const_xmlChar_ptr(n_name, 2);
20377 content = gen_const_xmlChar_ptr(n_content, 3);
20378
William M. Brackf13f77f2004-11-12 16:03:48 +000020379 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020380 desret_xmlNodePtr(ret_val);
20381 call_tests++;
20382 des_xmlDocPtr(n_doc, doc, 0);
20383 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020384 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20385 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020386 xmlResetLastError();
20387 if (mem_base != xmlMemBlocks()) {
20388 printf("Leak of %d blocks found in xmlNewDocRawNode",
20389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020390 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020391 printf(" %d", n_doc);
20392 printf(" %d", n_ns);
20393 printf(" %d", n_name);
20394 printf(" %d", n_content);
20395 printf("\n");
20396 }
20397 }
20398 }
20399 }
20400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020401 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020402#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020403#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020404
Daniel Veillard42595322004-11-08 10:52:06 +000020405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020406}
20407
20408
20409static int
20410test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020412
20413 int mem_base;
20414 xmlNodePtr ret_val;
20415 xmlDocPtr doc; /* the document */
20416 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020417 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418 int n_content;
20419
20420 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20421 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020423 doc = gen_xmlDocPtr(n_doc, 0);
20424 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020425
William M. Brackf13f77f2004-11-12 16:03:48 +000020426 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020427 desret_xmlNodePtr(ret_val);
20428 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020429 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020430 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020431 xmlResetLastError();
20432 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020433 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020435 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020436 printf(" %d", n_doc);
20437 printf(" %d", n_content);
20438 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020439 }
20440 }
20441 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020442 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020443
Daniel Veillard42595322004-11-08 10:52:06 +000020444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020445}
20446
20447
20448static int
20449test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020451
20452 int mem_base;
20453 xmlNodePtr ret_val;
20454 xmlDocPtr doc; /* the document */
20455 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020456 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020457 int n_content;
20458 int len; /* the text len. */
20459 int n_len;
20460
20461 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20462 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20463 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020465 doc = gen_xmlDocPtr(n_doc, 0);
20466 content = gen_const_xmlChar_ptr(n_content, 1);
20467 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020468
William M. Brackf13f77f2004-11-12 16:03:48 +000020469 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020470 desret_xmlNodePtr(ret_val);
20471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020472 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020473 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020474 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020475 xmlResetLastError();
20476 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020477 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020479 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020480 printf(" %d", n_doc);
20481 printf(" %d", n_content);
20482 printf(" %d", n_len);
20483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020484 }
20485 }
20486 }
20487 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020489
Daniel Veillard42595322004-11-08 10:52:06 +000020490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020491}
20492
20493
20494static int
20495test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020497
Daniel Veillard34099b42004-11-04 17:34:35 +000020498 int mem_base;
20499 xmlDtdPtr ret_val;
20500 xmlDocPtr doc; /* the document pointer */
20501 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020502 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020503 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020504 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020505 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020506 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020507 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020508
Daniel Veillard34099b42004-11-04 17:34:35 +000020509 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20510 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20511 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20512 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20513 mem_base = xmlMemBlocks();
20514 doc = gen_xmlDocPtr(n_doc, 0);
20515 name = gen_const_xmlChar_ptr(n_name, 1);
20516 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20517 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20518
William M. Brackf13f77f2004-11-12 16:03:48 +000020519 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020520 desret_xmlDtdPtr(ret_val);
20521 call_tests++;
20522 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20524 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20525 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020526 xmlResetLastError();
20527 if (mem_base != xmlMemBlocks()) {
20528 printf("Leak of %d blocks found in xmlNewDtd",
20529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020530 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020531 printf(" %d", n_doc);
20532 printf(" %d", n_name);
20533 printf(" %d", n_ExternalID);
20534 printf(" %d", n_SystemID);
20535 printf("\n");
20536 }
20537 }
20538 }
20539 }
20540 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020542
Daniel Veillard42595322004-11-08 10:52:06 +000020543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020544}
20545
20546
20547static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020548test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020550
Daniel Veillard27f20102004-11-05 11:50:11 +000020551 int mem_base;
20552 xmlNodePtr ret_val;
20553 xmlNsPtr ns; /* namespace if any */
20554 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020555 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020556 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020557
Daniel Veillard27f20102004-11-05 11:50:11 +000020558 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20559 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20560 mem_base = xmlMemBlocks();
20561 ns = gen_xmlNsPtr(n_ns, 0);
20562 name = gen_const_xmlChar_ptr(n_name, 1);
20563
William M. Brackf13f77f2004-11-12 16:03:48 +000020564 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020565 desret_xmlNodePtr(ret_val);
20566 call_tests++;
20567 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020568 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020569 xmlResetLastError();
20570 if (mem_base != xmlMemBlocks()) {
20571 printf("Leak of %d blocks found in xmlNewNode",
20572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020573 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020574 printf(" %d", n_ns);
20575 printf(" %d", n_name);
20576 printf("\n");
20577 }
20578 }
20579 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020581
Daniel Veillard42595322004-11-08 10:52:06 +000020582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020583}
20584
20585
20586static int
20587test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020589
Daniel Veillard27f20102004-11-05 11:50:11 +000020590 int mem_base;
20591 xmlNodePtr ret_val;
20592 xmlNsPtr ns; /* namespace if any */
20593 int n_ns;
20594 xmlChar * name; /* the node name */
20595 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020596
Daniel Veillard27f20102004-11-05 11:50:11 +000020597 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20598 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20599 mem_base = xmlMemBlocks();
20600 ns = gen_xmlNsPtr(n_ns, 0);
20601 name = gen_eaten_name(n_name, 1);
20602
20603 ret_val = xmlNewNodeEatName(ns, name);
20604 desret_xmlNodePtr(ret_val);
20605 call_tests++;
20606 des_xmlNsPtr(n_ns, ns, 0);
20607 des_eaten_name(n_name, name, 1);
20608 xmlResetLastError();
20609 if (mem_base != xmlMemBlocks()) {
20610 printf("Leak of %d blocks found in xmlNewNodeEatName",
20611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020612 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020613 printf(" %d", n_ns);
20614 printf(" %d", n_name);
20615 printf("\n");
20616 }
20617 }
20618 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020620
Daniel Veillard42595322004-11-08 10:52:06 +000020621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020622}
20623
20624
20625static int
20626test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020628
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020629 int mem_base;
20630 xmlNsPtr ret_val;
20631 xmlNodePtr node; /* the element carrying the namespace */
20632 int n_node;
20633 xmlChar * href; /* the URI associated */
20634 int n_href;
20635 xmlChar * prefix; /* the prefix for the namespace */
20636 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020637
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020638 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20639 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20640 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20641 mem_base = xmlMemBlocks();
20642 node = gen_xmlNodePtr(n_node, 0);
20643 href = gen_const_xmlChar_ptr(n_href, 1);
20644 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20645
William M. Brackf13f77f2004-11-12 16:03:48 +000020646 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020647 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20648 desret_xmlNsPtr(ret_val);
20649 call_tests++;
20650 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020651 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20652 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020653 xmlResetLastError();
20654 if (mem_base != xmlMemBlocks()) {
20655 printf("Leak of %d blocks found in xmlNewNs",
20656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020657 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020658 printf(" %d", n_node);
20659 printf(" %d", n_href);
20660 printf(" %d", n_prefix);
20661 printf("\n");
20662 }
20663 }
20664 }
20665 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020666 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020667
Daniel Veillard42595322004-11-08 10:52:06 +000020668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020669}
20670
20671
20672static int
20673test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020675
Daniel Veillard57b25162004-11-06 14:50:18 +000020676 int mem_base;
20677 xmlAttrPtr ret_val;
20678 xmlNodePtr node; /* the holding node */
20679 int n_node;
20680 xmlNsPtr ns; /* the namespace */
20681 int n_ns;
20682 xmlChar * name; /* the name of the attribute */
20683 int n_name;
20684 xmlChar * value; /* the value of the attribute */
20685 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020686
Daniel Veillard57b25162004-11-06 14:50:18 +000020687 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20688 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20689 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20690 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20691 mem_base = xmlMemBlocks();
20692 node = gen_xmlNodePtr(n_node, 0);
20693 ns = gen_xmlNsPtr(n_ns, 1);
20694 name = gen_const_xmlChar_ptr(n_name, 2);
20695 value = gen_const_xmlChar_ptr(n_value, 3);
20696
William M. Brackf13f77f2004-11-12 16:03:48 +000020697 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020698 desret_xmlAttrPtr(ret_val);
20699 call_tests++;
20700 des_xmlNodePtr(n_node, node, 0);
20701 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020702 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20703 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020704 xmlResetLastError();
20705 if (mem_base != xmlMemBlocks()) {
20706 printf("Leak of %d blocks found in xmlNewNsProp",
20707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020708 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020709 printf(" %d", n_node);
20710 printf(" %d", n_ns);
20711 printf(" %d", n_name);
20712 printf(" %d", n_value);
20713 printf("\n");
20714 }
20715 }
20716 }
20717 }
20718 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020719 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020720
Daniel Veillard42595322004-11-08 10:52:06 +000020721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020722}
20723
20724
20725static int
20726test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020728
Daniel Veillard57b25162004-11-06 14:50:18 +000020729 int mem_base;
20730 xmlAttrPtr ret_val;
20731 xmlNodePtr node; /* the holding node */
20732 int n_node;
20733 xmlNsPtr ns; /* the namespace */
20734 int n_ns;
20735 xmlChar * name; /* the name of the attribute */
20736 int n_name;
20737 xmlChar * value; /* the value of the attribute */
20738 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020739
Daniel Veillard57b25162004-11-06 14:50:18 +000020740 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20741 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20742 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20743 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20744 mem_base = xmlMemBlocks();
20745 node = gen_xmlNodePtr(n_node, 0);
20746 ns = gen_xmlNsPtr(n_ns, 1);
20747 name = gen_eaten_name(n_name, 2);
20748 value = gen_const_xmlChar_ptr(n_value, 3);
20749
William M. Brackf13f77f2004-11-12 16:03:48 +000020750 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020751 desret_xmlAttrPtr(ret_val);
20752 call_tests++;
20753 des_xmlNodePtr(n_node, node, 0);
20754 des_xmlNsPtr(n_ns, ns, 1);
20755 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020756 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020757 xmlResetLastError();
20758 if (mem_base != xmlMemBlocks()) {
20759 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020761 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020762 printf(" %d", n_node);
20763 printf(" %d", n_ns);
20764 printf(" %d", n_name);
20765 printf(" %d", n_value);
20766 printf("\n");
20767 }
20768 }
20769 }
20770 }
20771 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020773
Daniel Veillard42595322004-11-08 10:52:06 +000020774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020775}
20776
20777
20778static int
20779test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020781
20782 int mem_base;
20783 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020784 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020785 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020786 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020787 int n_content;
20788
20789 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20790 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020792 name = gen_const_xmlChar_ptr(n_name, 0);
20793 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020794
William M. Brackf13f77f2004-11-12 16:03:48 +000020795 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020796 desret_xmlNodePtr(ret_val);
20797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020798 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20799 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020800 xmlResetLastError();
20801 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020802 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020804 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020805 printf(" %d", n_name);
20806 printf(" %d", n_content);
20807 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020808 }
20809 }
20810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020812
Daniel Veillard42595322004-11-08 10:52:06 +000020813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020814}
20815
20816
20817static int
20818test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020820
William M. Brack21e4ef22005-01-02 09:53:13 +000020821#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020822#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020823 int mem_base;
20824 xmlAttrPtr ret_val;
20825 xmlNodePtr node; /* the holding node */
20826 int n_node;
20827 xmlChar * name; /* the name of the attribute */
20828 int n_name;
20829 xmlChar * value; /* the value of the attribute */
20830 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831
Daniel Veillard57b25162004-11-06 14:50:18 +000020832 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20834 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20835 mem_base = xmlMemBlocks();
20836 node = gen_xmlNodePtr(n_node, 0);
20837 name = gen_const_xmlChar_ptr(n_name, 1);
20838 value = gen_const_xmlChar_ptr(n_value, 2);
20839
William M. Brackf13f77f2004-11-12 16:03:48 +000020840 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020841 desret_xmlAttrPtr(ret_val);
20842 call_tests++;
20843 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020844 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20845 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020846 xmlResetLastError();
20847 if (mem_base != xmlMemBlocks()) {
20848 printf("Leak of %d blocks found in xmlNewProp",
20849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020850 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020851 printf(" %d", n_node);
20852 printf(" %d", n_name);
20853 printf(" %d", n_value);
20854 printf("\n");
20855 }
20856 }
20857 }
20858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020859 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020860#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020861#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020862
Daniel Veillard42595322004-11-08 10:52:06 +000020863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020864}
20865
20866
20867static int
20868test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020870
20871 int mem_base;
20872 xmlNodePtr ret_val;
20873 xmlDocPtr doc; /* the document */
20874 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020875 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020876 int n_name;
20877
20878 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020881 doc = gen_xmlDocPtr(n_doc, 0);
20882 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020883
William M. Brackf13f77f2004-11-12 16:03:48 +000020884 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020885 desret_xmlNodePtr(ret_val);
20886 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020887 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020888 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020889 xmlResetLastError();
20890 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020891 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020893 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020894 printf(" %d", n_doc);
20895 printf(" %d", n_name);
20896 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020897 }
20898 }
20899 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020900 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020901
Daniel Veillard42595322004-11-08 10:52:06 +000020902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020903}
20904
20905
20906static int
20907test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020909
20910 int mem_base;
20911 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020912 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020913 int n_content;
20914
20915 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020917 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020918
William M. Brackf13f77f2004-11-12 16:03:48 +000020919 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020920 desret_xmlNodePtr(ret_val);
20921 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020922 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020923 xmlResetLastError();
20924 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020925 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020927 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020928 printf(" %d", n_content);
20929 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020930 }
20931 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020933
Daniel Veillard42595322004-11-08 10:52:06 +000020934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020935}
20936
20937
20938static int
20939test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020941
William M. Brack21e4ef22005-01-02 09:53:13 +000020942#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020943#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020944 int mem_base;
20945 xmlNodePtr ret_val;
20946 xmlNodePtr parent; /* the parent node */
20947 int n_parent;
20948 xmlNsPtr ns; /* a namespace if any */
20949 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020950 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020951 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020952 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020953 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020954
Daniel Veillard27f20102004-11-05 11:50:11 +000020955 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20956 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20957 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20958 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20959 mem_base = xmlMemBlocks();
20960 parent = gen_xmlNodePtr(n_parent, 0);
20961 ns = gen_xmlNsPtr(n_ns, 1);
20962 name = gen_const_xmlChar_ptr(n_name, 2);
20963 content = gen_const_xmlChar_ptr(n_content, 3);
20964
William M. Brackf13f77f2004-11-12 16:03:48 +000020965 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020966 desret_xmlNodePtr(ret_val);
20967 call_tests++;
20968 des_xmlNodePtr(n_parent, parent, 0);
20969 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020970 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20971 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020972 xmlResetLastError();
20973 if (mem_base != xmlMemBlocks()) {
20974 printf("Leak of %d blocks found in xmlNewTextChild",
20975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020976 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020977 printf(" %d", n_parent);
20978 printf(" %d", n_ns);
20979 printf(" %d", n_name);
20980 printf(" %d", n_content);
20981 printf("\n");
20982 }
20983 }
20984 }
20985 }
20986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020987 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020988#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020989#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020990
Daniel Veillard42595322004-11-08 10:52:06 +000020991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020992}
20993
20994
20995static int
20996test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020998
20999 int mem_base;
21000 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021001 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002 int n_content;
21003 int len; /* the text len. */
21004 int n_len;
21005
21006 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21007 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21008 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021009 content = gen_const_xmlChar_ptr(n_content, 0);
21010 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021011
William M. Brackf13f77f2004-11-12 16:03:48 +000021012 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021013 desret_xmlNodePtr(ret_val);
21014 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021015 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021016 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017 xmlResetLastError();
21018 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021019 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021021 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021022 printf(" %d", n_content);
21023 printf(" %d", n_len);
21024 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021025 }
21026 }
21027 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021029
Daniel Veillard42595322004-11-08 10:52:06 +000021030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021031}
21032
21033
21034static int
21035test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021037
21038 int mem_base;
21039 xmlNodePtr cur; /* the node being modified */
21040 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021041 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021042 int n_content;
21043
21044 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21045 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021047 cur = gen_xmlNodePtr(n_cur, 0);
21048 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021049
William M. Brackf13f77f2004-11-12 16:03:48 +000021050 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021051 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021052 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021053 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021054 xmlResetLastError();
21055 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021056 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021058 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021059 printf(" %d", n_cur);
21060 printf(" %d", n_content);
21061 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021062 }
21063 }
21064 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021066
Daniel Veillard42595322004-11-08 10:52:06 +000021067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021068}
21069
21070
21071static int
21072test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021074
21075 int mem_base;
21076 xmlNodePtr cur; /* the node being modified */
21077 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021078 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021079 int n_content;
21080 int len; /* the size of @content */
21081 int n_len;
21082
21083 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21084 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21085 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021087 cur = gen_xmlNodePtr(n_cur, 0);
21088 content = gen_const_xmlChar_ptr(n_content, 1);
21089 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021090
William M. Brackf13f77f2004-11-12 16:03:48 +000021091 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021092 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021093 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021094 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021095 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021096 xmlResetLastError();
21097 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021098 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021100 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021101 printf(" %d", n_cur);
21102 printf(" %d", n_content);
21103 printf(" %d", n_len);
21104 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021105 }
21106 }
21107 }
21108 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021109 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021110
Daniel Veillard42595322004-11-08 10:52:06 +000021111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021112}
21113
21114
21115static int
21116test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021118
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021119 int mem_base;
21120 int ret_val;
21121 xmlBufferPtr buffer; /* a buffer */
21122 int n_buffer;
21123 xmlNodePtr cur; /* the node being read */
21124 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021125
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021126 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21127 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021129 buffer = gen_xmlBufferPtr(n_buffer, 0);
21130 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021131
21132 ret_val = xmlNodeBufGetContent(buffer, cur);
21133 desret_int(ret_val);
21134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021135 des_xmlBufferPtr(n_buffer, buffer, 0);
21136 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021137 xmlResetLastError();
21138 if (mem_base != xmlMemBlocks()) {
21139 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021141 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021142 printf(" %d", n_buffer);
21143 printf(" %d", n_cur);
21144 printf("\n");
21145 }
21146 }
21147 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021149
Daniel Veillard42595322004-11-08 10:52:06 +000021150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021151}
21152
21153
21154static int
21155test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021157
William M. Brack21e4ef22005-01-02 09:53:13 +000021158#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021159 int mem_base;
21160 int ret_val;
21161 xmlBufferPtr buf; /* the XML buffer output */
21162 int n_buf;
21163 xmlDocPtr doc; /* the document */
21164 int n_doc;
21165 xmlNodePtr cur; /* the current node */
21166 int n_cur;
21167 int level; /* the imbrication level for indenting */
21168 int n_level;
21169 int format; /* is formatting allowed */
21170 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021171
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021172 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21174 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21175 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21176 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021178 buf = gen_xmlBufferPtr(n_buf, 0);
21179 doc = gen_xmlDocPtr(n_doc, 1);
21180 cur = gen_xmlNodePtr(n_cur, 2);
21181 level = gen_int(n_level, 3);
21182 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021183
21184 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21185 desret_int(ret_val);
21186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021187 des_xmlBufferPtr(n_buf, buf, 0);
21188 des_xmlDocPtr(n_doc, doc, 1);
21189 des_xmlNodePtr(n_cur, cur, 2);
21190 des_int(n_level, level, 3);
21191 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021192 xmlResetLastError();
21193 if (mem_base != xmlMemBlocks()) {
21194 printf("Leak of %d blocks found in xmlNodeDump",
21195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021196 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021197 printf(" %d", n_buf);
21198 printf(" %d", n_doc);
21199 printf(" %d", n_cur);
21200 printf(" %d", n_level);
21201 printf(" %d", n_format);
21202 printf("\n");
21203 }
21204 }
21205 }
21206 }
21207 }
21208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021209 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021210#endif
21211
Daniel Veillard42595322004-11-08 10:52:06 +000021212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021213}
21214
21215
21216static int
21217test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021219
William M. Brack21e4ef22005-01-02 09:53:13 +000021220#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021221 int mem_base;
21222 xmlOutputBufferPtr buf; /* the XML buffer output */
21223 int n_buf;
21224 xmlDocPtr doc; /* the document */
21225 int n_doc;
21226 xmlNodePtr cur; /* the current node */
21227 int n_cur;
21228 int level; /* the imbrication level for indenting */
21229 int n_level;
21230 int format; /* is formatting allowed */
21231 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021232 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021233 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021234
Daniel Veillard3d97e662004-11-04 10:49:00 +000021235 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21236 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21237 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21238 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21239 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21240 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21241 mem_base = xmlMemBlocks();
21242 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21243 doc = gen_xmlDocPtr(n_doc, 1);
21244 cur = gen_xmlNodePtr(n_cur, 2);
21245 level = gen_int(n_level, 3);
21246 format = gen_int(n_format, 4);
21247 encoding = gen_const_char_ptr(n_encoding, 5);
21248
William M. Brackf13f77f2004-11-12 16:03:48 +000021249 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021250 call_tests++;
21251 des_xmlOutputBufferPtr(n_buf, buf, 0);
21252 des_xmlDocPtr(n_doc, doc, 1);
21253 des_xmlNodePtr(n_cur, cur, 2);
21254 des_int(n_level, level, 3);
21255 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021256 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021257 xmlResetLastError();
21258 if (mem_base != xmlMemBlocks()) {
21259 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021261 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021262 printf(" %d", n_buf);
21263 printf(" %d", n_doc);
21264 printf(" %d", n_cur);
21265 printf(" %d", n_level);
21266 printf(" %d", n_format);
21267 printf(" %d", n_encoding);
21268 printf("\n");
21269 }
21270 }
21271 }
21272 }
21273 }
21274 }
21275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021276 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021277#endif
21278
Daniel Veillard42595322004-11-08 10:52:06 +000021279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021280}
21281
21282
21283static int
21284test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021286
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021287 int mem_base;
21288 xmlChar * ret_val;
21289 xmlDocPtr doc; /* the document the node pertains to */
21290 int n_doc;
21291 xmlNodePtr cur; /* the node being checked */
21292 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021293
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021294 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21295 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021297 doc = gen_xmlDocPtr(n_doc, 0);
21298 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021299
21300 ret_val = xmlNodeGetBase(doc, cur);
21301 desret_xmlChar_ptr(ret_val);
21302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021303 des_xmlDocPtr(n_doc, doc, 0);
21304 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021305 xmlResetLastError();
21306 if (mem_base != xmlMemBlocks()) {
21307 printf("Leak of %d blocks found in xmlNodeGetBase",
21308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021309 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021310 printf(" %d", n_doc);
21311 printf(" %d", n_cur);
21312 printf("\n");
21313 }
21314 }
21315 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021316 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021317
Daniel Veillard42595322004-11-08 10:52:06 +000021318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021319}
21320
21321
21322static int
21323test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021325
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021326 int mem_base;
21327 xmlChar * ret_val;
21328 xmlNodePtr cur; /* the node being read */
21329 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021331 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021333 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021334
21335 ret_val = xmlNodeGetContent(cur);
21336 desret_xmlChar_ptr(ret_val);
21337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021338 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021339 xmlResetLastError();
21340 if (mem_base != xmlMemBlocks()) {
21341 printf("Leak of %d blocks found in xmlNodeGetContent",
21342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021343 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021344 printf(" %d", n_cur);
21345 printf("\n");
21346 }
21347 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021349
Daniel Veillard42595322004-11-08 10:52:06 +000021350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021351}
21352
21353
21354static int
21355test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021357
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021358 int mem_base;
21359 xmlChar * ret_val;
21360 xmlNodePtr cur; /* the node being checked */
21361 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021362
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021363 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021365 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021366
21367 ret_val = xmlNodeGetLang(cur);
21368 desret_xmlChar_ptr(ret_val);
21369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021370 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021371 xmlResetLastError();
21372 if (mem_base != xmlMemBlocks()) {
21373 printf("Leak of %d blocks found in xmlNodeGetLang",
21374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021375 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021376 printf(" %d", n_cur);
21377 printf("\n");
21378 }
21379 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021381
Daniel Veillard42595322004-11-08 10:52:06 +000021382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021383}
21384
21385
21386static int
21387test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021389
21390 int mem_base;
21391 int ret_val;
21392 xmlNodePtr cur; /* the node being checked */
21393 int n_cur;
21394
21395 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21396 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021397 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021398
21399 ret_val = xmlNodeGetSpacePreserve(cur);
21400 desret_int(ret_val);
21401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021402 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021403 xmlResetLastError();
21404 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021405 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021407 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021408 printf(" %d", n_cur);
21409 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021410 }
21411 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021413
Daniel Veillard42595322004-11-08 10:52:06 +000021414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021415}
21416
21417
21418static int
21419test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421
21422 int mem_base;
21423 int ret_val;
21424 xmlNodePtr node; /* the node */
21425 int n_node;
21426
21427 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021429 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021430
21431 ret_val = xmlNodeIsText(node);
21432 desret_int(ret_val);
21433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021434 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021435 xmlResetLastError();
21436 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021437 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021439 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021440 printf(" %d", n_node);
21441 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021442 }
21443 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021444 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021445
Daniel Veillard42595322004-11-08 10:52:06 +000021446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021447}
21448
21449
21450static int
21451test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021453
William M. Brack21e4ef22005-01-02 09:53:13 +000021454#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021455 int mem_base;
21456 xmlChar * ret_val;
21457 xmlDocPtr doc; /* the document */
21458 int n_doc;
21459 xmlNodePtr list; /* a Node list */
21460 int n_list;
21461 int inLine; /* should we replace entity contents or show their external form */
21462 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021463
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21465 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21466 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021468 doc = gen_xmlDocPtr(n_doc, 0);
21469 list = gen_xmlNodePtr(n_list, 1);
21470 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021471
21472 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21473 desret_xmlChar_ptr(ret_val);
21474 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021475 des_xmlDocPtr(n_doc, doc, 0);
21476 des_xmlNodePtr(n_list, list, 1);
21477 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021478 xmlResetLastError();
21479 if (mem_base != xmlMemBlocks()) {
21480 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021482 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021483 printf(" %d", n_doc);
21484 printf(" %d", n_list);
21485 printf(" %d", n_inLine);
21486 printf("\n");
21487 }
21488 }
21489 }
21490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021491 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021492#endif
21493
Daniel Veillard42595322004-11-08 10:52:06 +000021494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021495}
21496
21497
21498static int
21499test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021502 int mem_base;
21503 xmlChar * ret_val;
21504 xmlDocPtr doc; /* the document */
21505 int n_doc;
21506 xmlNodePtr list; /* a Node list */
21507 int n_list;
21508 int inLine; /* should we replace entity contents or show their external form */
21509 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021510
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021511 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21512 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21513 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021515 doc = gen_xmlDocPtr(n_doc, 0);
21516 list = gen_xmlNodePtr(n_list, 1);
21517 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021518
21519 ret_val = xmlNodeListGetString(doc, list, inLine);
21520 desret_xmlChar_ptr(ret_val);
21521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021522 des_xmlDocPtr(n_doc, doc, 0);
21523 des_xmlNodePtr(n_list, list, 1);
21524 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021525 xmlResetLastError();
21526 if (mem_base != xmlMemBlocks()) {
21527 printf("Leak of %d blocks found in xmlNodeListGetString",
21528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021529 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021530 printf(" %d", n_doc);
21531 printf(" %d", n_list);
21532 printf(" %d", n_inLine);
21533 printf("\n");
21534 }
21535 }
21536 }
21537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021539
Daniel Veillard42595322004-11-08 10:52:06 +000021540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021541}
21542
21543
21544static int
21545test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021547
William M. Brack21e4ef22005-01-02 09:53:13 +000021548#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021549 int mem_base;
21550 xmlNodePtr cur; /* the node being changed */
21551 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021552 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021553 int n_uri;
21554
21555 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21556 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021558 cur = gen_xmlNodePtr(n_cur, 0);
21559 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021560
William M. Brackf13f77f2004-11-12 16:03:48 +000021561 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021563 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021564 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565 xmlResetLastError();
21566 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021567 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021569 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021570 printf(" %d", n_cur);
21571 printf(" %d", n_uri);
21572 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021573 }
21574 }
21575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021576 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021577#endif
21578
Daniel Veillard42595322004-11-08 10:52:06 +000021579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021580}
21581
21582
21583static int
21584test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021586
21587 int mem_base;
21588 xmlNodePtr cur; /* the node being modified */
21589 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021590 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591 int n_content;
21592
21593 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21594 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21595 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021596 cur = gen_xmlNodePtr(n_cur, 0);
21597 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021598
William M. Brackf13f77f2004-11-12 16:03:48 +000021599 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021601 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021602 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021603 xmlResetLastError();
21604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021605 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021607 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021608 printf(" %d", n_cur);
21609 printf(" %d", n_content);
21610 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021611 }
21612 }
21613 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021614 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021615
Daniel Veillard42595322004-11-08 10:52:06 +000021616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021617}
21618
21619
21620static int
21621test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021623
William M. Brack21e4ef22005-01-02 09:53:13 +000021624#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021625 int mem_base;
21626 xmlNodePtr cur; /* the node being modified */
21627 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021628 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629 int n_content;
21630 int len; /* the size of @content */
21631 int n_len;
21632
21633 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21634 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21635 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021637 cur = gen_xmlNodePtr(n_cur, 0);
21638 content = gen_const_xmlChar_ptr(n_content, 1);
21639 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021640
William M. Brackf13f77f2004-11-12 16:03:48 +000021641 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021642 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021643 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021644 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021645 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021646 xmlResetLastError();
21647 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021648 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021650 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021651 printf(" %d", n_cur);
21652 printf(" %d", n_content);
21653 printf(" %d", n_len);
21654 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021655 }
21656 }
21657 }
21658 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021659 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021660#endif
21661
Daniel Veillard42595322004-11-08 10:52:06 +000021662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021663}
21664
21665
21666static int
21667test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021669
William M. Brack21e4ef22005-01-02 09:53:13 +000021670#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021671 int mem_base;
21672 xmlNodePtr cur; /* the node being changed */
21673 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021674 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021675 int n_lang;
21676
21677 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21678 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21679 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021680 cur = gen_xmlNodePtr(n_cur, 0);
21681 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021682
William M. Brackf13f77f2004-11-12 16:03:48 +000021683 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021684 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021685 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021686 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687 xmlResetLastError();
21688 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021689 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021691 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021692 printf(" %d", n_cur);
21693 printf(" %d", n_lang);
21694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695 }
21696 }
21697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021698 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021699#endif
21700
Daniel Veillard42595322004-11-08 10:52:06 +000021701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021702}
21703
21704
21705static int
21706test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021708
William M. Brack21e4ef22005-01-02 09:53:13 +000021709#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021710 int mem_base;
21711 xmlNodePtr cur; /* the node being changed */
21712 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021713 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021714 int n_name;
21715
21716 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021719 cur = gen_xmlNodePtr(n_cur, 0);
21720 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021721
William M. Brackf13f77f2004-11-12 16:03:48 +000021722 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021724 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021725 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021726 xmlResetLastError();
21727 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021728 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021730 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021731 printf(" %d", n_cur);
21732 printf(" %d", n_name);
21733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734 }
21735 }
21736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021737 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021738#endif
21739
Daniel Veillard42595322004-11-08 10:52:06 +000021740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741}
21742
21743
21744static int
21745test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021747
William M. Brack21e4ef22005-01-02 09:53:13 +000021748#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749 int mem_base;
21750 xmlNodePtr cur; /* the node being changed */
21751 int n_cur;
21752 int val; /* the xml:space value ("0": default, 1: "preserve") */
21753 int n_val;
21754
21755 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21756 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021758 cur = gen_xmlNodePtr(n_cur, 0);
21759 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021760
21761 xmlNodeSetSpacePreserve(cur, val);
21762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021763 des_xmlNodePtr(n_cur, cur, 0);
21764 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021765 xmlResetLastError();
21766 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021767 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021769 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021770 printf(" %d", n_cur);
21771 printf(" %d", n_val);
21772 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773 }
21774 }
21775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021776 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021777#endif
21778
Daniel Veillard42595322004-11-08 10:52:06 +000021779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021780}
21781
21782
21783static int
21784test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021786
William M. Brack21e4ef22005-01-02 09:53:13 +000021787#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021788#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021789 int mem_base;
21790 int ret_val;
21791 xmlDocPtr doc; /* the document */
21792 int n_doc;
21793 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21794 int n_tree;
21795
21796 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21797 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021799 doc = gen_xmlDocPtr(n_doc, 0);
21800 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021801
21802 ret_val = xmlReconciliateNs(doc, tree);
21803 desret_int(ret_val);
21804 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021805 des_xmlDocPtr(n_doc, doc, 0);
21806 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021807 xmlResetLastError();
21808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021809 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021812 printf(" %d", n_doc);
21813 printf(" %d", n_tree);
21814 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021815 }
21816 }
21817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021818 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021819#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021820#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021821
Daniel Veillard42595322004-11-08 10:52:06 +000021822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021823}
21824
21825
21826static int
21827test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021829
William M. Brack21e4ef22005-01-02 09:53:13 +000021830#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021831 int mem_base;
21832 int ret_val;
21833 xmlAttrPtr cur; /* an attribute */
21834 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021835
Daniel Veillardce244ad2004-11-05 10:03:46 +000021836 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21837 mem_base = xmlMemBlocks();
21838 cur = gen_xmlAttrPtr(n_cur, 0);
21839
21840 ret_val = xmlRemoveProp(cur);
21841 cur = NULL;
21842 desret_int(ret_val);
21843 call_tests++;
21844 des_xmlAttrPtr(n_cur, cur, 0);
21845 xmlResetLastError();
21846 if (mem_base != xmlMemBlocks()) {
21847 printf("Leak of %d blocks found in xmlRemoveProp",
21848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021849 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021850 printf(" %d", n_cur);
21851 printf("\n");
21852 }
21853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021854 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021855#endif
21856
Daniel Veillard42595322004-11-08 10:52:06 +000021857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021858}
21859
21860
21861static int
21862test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021864
William M. Brack21e4ef22005-01-02 09:53:13 +000021865#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021866 int mem_base;
21867 xmlNodePtr ret_val;
21868 xmlNodePtr old; /* the old node */
21869 int n_old;
21870 xmlNodePtr cur; /* the node */
21871 int n_cur;
21872
21873 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021874 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021876 old = gen_xmlNodePtr(n_old, 0);
21877 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021878
21879 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021880 if (cur != NULL) {
21881 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021882 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021883 if (old != NULL) {
21884 xmlUnlinkNode(old);
21885 xmlFreeNode(old) ; old = NULL ; }
21886 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021887 desret_xmlNodePtr(ret_val);
21888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021889 des_xmlNodePtr(n_old, old, 0);
21890 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021891 xmlResetLastError();
21892 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021893 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021895 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021896 printf(" %d", n_old);
21897 printf(" %d", n_cur);
21898 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021899 }
21900 }
21901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021902 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021903#endif
21904
Daniel Veillard42595322004-11-08 10:52:06 +000021905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021906}
21907
21908
21909static int
21910test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021912
William M. Brack21e4ef22005-01-02 09:53:13 +000021913#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914 int mem_base;
21915 int ret_val;
21916 const char * filename; /* the filename (or URL) */
21917 int n_filename;
21918 xmlDocPtr cur; /* the document */
21919 int n_cur;
21920
21921 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21922 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021924 filename = gen_fileoutput(n_filename, 0);
21925 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021926
21927 ret_val = xmlSaveFile(filename, cur);
21928 desret_int(ret_val);
21929 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021930 des_fileoutput(n_filename, filename, 0);
21931 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021932 xmlResetLastError();
21933 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021934 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021936 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021937 printf(" %d", n_filename);
21938 printf(" %d", n_cur);
21939 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021940 }
21941 }
21942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021943 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021944#endif
21945
Daniel Veillard42595322004-11-08 10:52:06 +000021946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947}
21948
21949
21950static int
21951test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021953
William M. Brack21e4ef22005-01-02 09:53:13 +000021954#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021955 int mem_base;
21956 int ret_val;
21957 const char * filename; /* the filename (or URL) */
21958 int n_filename;
21959 xmlDocPtr cur; /* the document */
21960 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021961 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021962 int n_encoding;
21963
21964 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21965 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21966 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021968 filename = gen_fileoutput(n_filename, 0);
21969 cur = gen_xmlDocPtr(n_cur, 1);
21970 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021971
William M. Brackf13f77f2004-11-12 16:03:48 +000021972 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973 desret_int(ret_val);
21974 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021975 des_fileoutput(n_filename, filename, 0);
21976 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021977 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021978 xmlResetLastError();
21979 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021980 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021982 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021983 printf(" %d", n_filename);
21984 printf(" %d", n_cur);
21985 printf(" %d", n_encoding);
21986 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021987 }
21988 }
21989 }
21990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021991 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021992#endif
21993
Daniel Veillard42595322004-11-08 10:52:06 +000021994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021995}
21996
21997
21998static int
21999test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022001
William M. Brack21e4ef22005-01-02 09:53:13 +000022002#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022003 int mem_base;
22004 int ret_val;
22005 xmlOutputBufferPtr buf; /* an output I/O buffer */
22006 int n_buf;
22007 xmlDocPtr cur; /* the document */
22008 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022009 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022010 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022011
Daniel Veillard3d97e662004-11-04 10:49:00 +000022012 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22013 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22014 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22015 mem_base = xmlMemBlocks();
22016 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22017 cur = gen_xmlDocPtr(n_cur, 1);
22018 encoding = gen_const_char_ptr(n_encoding, 2);
22019
William M. Brackf13f77f2004-11-12 16:03:48 +000022020 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022021 buf = NULL;
22022 desret_int(ret_val);
22023 call_tests++;
22024 des_xmlOutputBufferPtr(n_buf, buf, 0);
22025 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022026 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022027 xmlResetLastError();
22028 if (mem_base != xmlMemBlocks()) {
22029 printf("Leak of %d blocks found in xmlSaveFileTo",
22030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022031 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022032 printf(" %d", n_buf);
22033 printf(" %d", n_cur);
22034 printf(" %d", n_encoding);
22035 printf("\n");
22036 }
22037 }
22038 }
22039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022040 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022041#endif
22042
Daniel Veillard42595322004-11-08 10:52:06 +000022043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022044}
22045
22046
22047static int
22048test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022050
William M. Brack21e4ef22005-01-02 09:53:13 +000022051#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022052 int mem_base;
22053 int ret_val;
22054 const char * filename; /* the filename (or URL) */
22055 int n_filename;
22056 xmlDocPtr cur; /* the document */
22057 int n_cur;
22058 int format; /* should formatting spaces been added */
22059 int n_format;
22060
22061 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22062 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22063 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022065 filename = gen_fileoutput(n_filename, 0);
22066 cur = gen_xmlDocPtr(n_cur, 1);
22067 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022068
22069 ret_val = xmlSaveFormatFile(filename, cur, format);
22070 desret_int(ret_val);
22071 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022072 des_fileoutput(n_filename, filename, 0);
22073 des_xmlDocPtr(n_cur, cur, 1);
22074 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022075 xmlResetLastError();
22076 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022077 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022079 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022080 printf(" %d", n_filename);
22081 printf(" %d", n_cur);
22082 printf(" %d", n_format);
22083 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022084 }
22085 }
22086 }
22087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022088 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022089#endif
22090
Daniel Veillard42595322004-11-08 10:52:06 +000022091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022092}
22093
22094
22095static int
22096test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022098
William M. Brack21e4ef22005-01-02 09:53:13 +000022099#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022100 int mem_base;
22101 int ret_val;
22102 const char * filename; /* the filename or URL to output */
22103 int n_filename;
22104 xmlDocPtr cur; /* the document being saved */
22105 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022106 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022107 int n_encoding;
22108 int format; /* should formatting spaces be added. */
22109 int n_format;
22110
22111 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22112 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22113 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22114 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022116 filename = gen_fileoutput(n_filename, 0);
22117 cur = gen_xmlDocPtr(n_cur, 1);
22118 encoding = gen_const_char_ptr(n_encoding, 2);
22119 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022120
William M. Brackf13f77f2004-11-12 16:03:48 +000022121 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122 desret_int(ret_val);
22123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022124 des_fileoutput(n_filename, filename, 0);
22125 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022126 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022127 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022128 xmlResetLastError();
22129 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022130 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022132 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022133 printf(" %d", n_filename);
22134 printf(" %d", n_cur);
22135 printf(" %d", n_encoding);
22136 printf(" %d", n_format);
22137 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022138 }
22139 }
22140 }
22141 }
22142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022143 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022144#endif
22145
Daniel Veillard42595322004-11-08 10:52:06 +000022146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022147}
22148
22149
22150static int
22151test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022153
William M. Brack21e4ef22005-01-02 09:53:13 +000022154#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022155 int mem_base;
22156 int ret_val;
22157 xmlOutputBufferPtr buf; /* an output I/O buffer */
22158 int n_buf;
22159 xmlDocPtr cur; /* the document */
22160 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022161 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022162 int n_encoding;
22163 int format; /* should formatting spaces been added */
22164 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022165
Daniel Veillard3d97e662004-11-04 10:49:00 +000022166 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22167 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22168 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22169 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22170 mem_base = xmlMemBlocks();
22171 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22172 cur = gen_xmlDocPtr(n_cur, 1);
22173 encoding = gen_const_char_ptr(n_encoding, 2);
22174 format = gen_int(n_format, 3);
22175
William M. Brackf13f77f2004-11-12 16:03:48 +000022176 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022177 buf = NULL;
22178 desret_int(ret_val);
22179 call_tests++;
22180 des_xmlOutputBufferPtr(n_buf, buf, 0);
22181 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022182 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022183 des_int(n_format, format, 3);
22184 xmlResetLastError();
22185 if (mem_base != xmlMemBlocks()) {
22186 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022188 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022189 printf(" %d", n_buf);
22190 printf(" %d", n_cur);
22191 printf(" %d", n_encoding);
22192 printf(" %d", n_format);
22193 printf("\n");
22194 }
22195 }
22196 }
22197 }
22198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022199 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022200#endif
22201
Daniel Veillard42595322004-11-08 10:52:06 +000022202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022203}
22204
22205
22206static int
22207test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022209
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022210 int mem_base;
22211 xmlNsPtr ret_val;
22212 xmlDocPtr doc; /* the document */
22213 int n_doc;
22214 xmlNodePtr node; /* the current node */
22215 int n_node;
22216 xmlChar * nameSpace; /* the namespace prefix */
22217 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022218
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022219 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22220 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22221 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22222 mem_base = xmlMemBlocks();
22223 doc = gen_xmlDocPtr(n_doc, 0);
22224 node = gen_xmlNodePtr(n_node, 1);
22225 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22226
William M. Brackf13f77f2004-11-12 16:03:48 +000022227 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022228 desret_xmlNsPtr(ret_val);
22229 call_tests++;
22230 des_xmlDocPtr(n_doc, doc, 0);
22231 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022232 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022233 xmlResetLastError();
22234 if (mem_base != xmlMemBlocks()) {
22235 printf("Leak of %d blocks found in xmlSearchNs",
22236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022237 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022238 printf(" %d", n_doc);
22239 printf(" %d", n_node);
22240 printf(" %d", n_nameSpace);
22241 printf("\n");
22242 }
22243 }
22244 }
22245 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022247
Daniel Veillard42595322004-11-08 10:52:06 +000022248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022249}
22250
22251
22252static int
22253test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022255
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022256 int mem_base;
22257 xmlNsPtr ret_val;
22258 xmlDocPtr doc; /* the document */
22259 int n_doc;
22260 xmlNodePtr node; /* the current node */
22261 int n_node;
22262 xmlChar * href; /* the namespace value */
22263 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022264
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022265 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22266 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22267 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22268 mem_base = xmlMemBlocks();
22269 doc = gen_xmlDocPtr(n_doc, 0);
22270 node = gen_xmlNodePtr(n_node, 1);
22271 href = gen_const_xmlChar_ptr(n_href, 2);
22272
William M. Brackf13f77f2004-11-12 16:03:48 +000022273 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022274 desret_xmlNsPtr(ret_val);
22275 call_tests++;
22276 des_xmlDocPtr(n_doc, doc, 0);
22277 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022278 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022279 xmlResetLastError();
22280 if (mem_base != xmlMemBlocks()) {
22281 printf("Leak of %d blocks found in xmlSearchNsByHref",
22282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022283 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022284 printf(" %d", n_doc);
22285 printf(" %d", n_node);
22286 printf(" %d", n_href);
22287 printf("\n");
22288 }
22289 }
22290 }
22291 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022293
Daniel Veillard42595322004-11-08 10:52:06 +000022294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022295}
22296
22297
22298static int
22299test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022301
Daniel Veillard57b25162004-11-06 14:50:18 +000022302 int mem_base;
22303 xmlBufferAllocationScheme scheme; /* allocation method to use */
22304 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022305
Daniel Veillard57b25162004-11-06 14:50:18 +000022306 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22307 mem_base = xmlMemBlocks();
22308 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22309
22310 xmlSetBufferAllocationScheme(scheme);
22311 call_tests++;
22312 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22313 xmlResetLastError();
22314 if (mem_base != xmlMemBlocks()) {
22315 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022317 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022318 printf(" %d", n_scheme);
22319 printf("\n");
22320 }
22321 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022322 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022323
Daniel Veillard42595322004-11-08 10:52:06 +000022324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022325}
22326
22327
22328static int
22329test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022331
22332 int mem_base;
22333 int mode; /* the compression ratio */
22334 int n_mode;
22335
22336 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22337 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022338 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339
22340 xmlSetCompressMode(mode);
22341 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022342 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022343 xmlResetLastError();
22344 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022345 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022347 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022348 printf(" %d", n_mode);
22349 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022350 }
22351 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022352 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022353
Daniel Veillard42595322004-11-08 10:52:06 +000022354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022355}
22356
22357
22358static int
22359test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022361
22362 int mem_base;
22363 xmlDocPtr doc; /* the document */
22364 int n_doc;
22365 int mode; /* the compression ratio */
22366 int n_mode;
22367
22368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22369 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022371 doc = gen_xmlDocPtr(n_doc, 0);
22372 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022373
22374 xmlSetDocCompressMode(doc, mode);
22375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022376 des_xmlDocPtr(n_doc, doc, 0);
22377 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022378 xmlResetLastError();
22379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022380 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022383 printf(" %d", n_doc);
22384 printf(" %d", n_mode);
22385 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022386 }
22387 }
22388 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022389 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022390
Daniel Veillard42595322004-11-08 10:52:06 +000022391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022392}
22393
22394
22395static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022396test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022398
Daniel Veillard27f20102004-11-05 11:50:11 +000022399 int mem_base;
22400 xmlNodePtr node; /* a node in the document */
22401 int n_node;
22402 xmlNsPtr ns; /* a namespace pointer */
22403 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022404
Daniel Veillard27f20102004-11-05 11:50:11 +000022405 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22406 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22407 mem_base = xmlMemBlocks();
22408 node = gen_xmlNodePtr(n_node, 0);
22409 ns = gen_xmlNsPtr(n_ns, 1);
22410
22411 xmlSetNs(node, ns);
22412 call_tests++;
22413 des_xmlNodePtr(n_node, node, 0);
22414 des_xmlNsPtr(n_ns, ns, 1);
22415 xmlResetLastError();
22416 if (mem_base != xmlMemBlocks()) {
22417 printf("Leak of %d blocks found in xmlSetNs",
22418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022419 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022420 printf(" %d", n_node);
22421 printf(" %d", n_ns);
22422 printf("\n");
22423 }
22424 }
22425 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022427
Daniel Veillard42595322004-11-08 10:52:06 +000022428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022429}
22430
22431
22432static int
22433test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022435
William M. Brack21e4ef22005-01-02 09:53:13 +000022436#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022437 int mem_base;
22438 xmlAttrPtr ret_val;
22439 xmlNodePtr node; /* the node */
22440 int n_node;
22441 xmlNsPtr ns; /* the namespace definition */
22442 int n_ns;
22443 xmlChar * name; /* the attribute name */
22444 int n_name;
22445 xmlChar * value; /* the attribute value */
22446 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022447
Daniel Veillard57b25162004-11-06 14:50:18 +000022448 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22449 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22450 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22451 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22452 mem_base = xmlMemBlocks();
22453 node = gen_xmlNodePtr(n_node, 0);
22454 ns = gen_xmlNsPtr(n_ns, 1);
22455 name = gen_const_xmlChar_ptr(n_name, 2);
22456 value = gen_const_xmlChar_ptr(n_value, 3);
22457
William M. Brackf13f77f2004-11-12 16:03:48 +000022458 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022459 desret_xmlAttrPtr(ret_val);
22460 call_tests++;
22461 des_xmlNodePtr(n_node, node, 0);
22462 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022463 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22464 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022465 xmlResetLastError();
22466 if (mem_base != xmlMemBlocks()) {
22467 printf("Leak of %d blocks found in xmlSetNsProp",
22468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022469 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022470 printf(" %d", n_node);
22471 printf(" %d", n_ns);
22472 printf(" %d", n_name);
22473 printf(" %d", n_value);
22474 printf("\n");
22475 }
22476 }
22477 }
22478 }
22479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022480 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022481#endif
22482
Daniel Veillard42595322004-11-08 10:52:06 +000022483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022484}
22485
22486
22487static int
22488test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022490
William M. Brack21e4ef22005-01-02 09:53:13 +000022491#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022492 int mem_base;
22493 xmlAttrPtr ret_val;
22494 xmlNodePtr node; /* the node */
22495 int n_node;
22496 xmlChar * name; /* the attribute name */
22497 int n_name;
22498 xmlChar * value; /* the attribute value */
22499 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022500
Daniel Veillard57b25162004-11-06 14:50:18 +000022501 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22503 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22504 mem_base = xmlMemBlocks();
22505 node = gen_xmlNodePtr(n_node, 0);
22506 name = gen_const_xmlChar_ptr(n_name, 1);
22507 value = gen_const_xmlChar_ptr(n_value, 2);
22508
William M. Brackf13f77f2004-11-12 16:03:48 +000022509 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022510 desret_xmlAttrPtr(ret_val);
22511 call_tests++;
22512 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022513 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22514 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022515 xmlResetLastError();
22516 if (mem_base != xmlMemBlocks()) {
22517 printf("Leak of %d blocks found in xmlSetProp",
22518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022519 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022520 printf(" %d", n_node);
22521 printf(" %d", n_name);
22522 printf(" %d", n_value);
22523 printf("\n");
22524 }
22525 }
22526 }
22527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022528 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022529#endif
22530
Daniel Veillard42595322004-11-08 10:52:06 +000022531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022532}
22533
22534
22535static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022536test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022539 int mem_base;
22540 xmlChar * ret_val;
22541 xmlChar * name; /* the full QName */
22542 int n_name;
22543 xmlChar ** prefix; /* a xmlChar ** */
22544 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022545
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022546 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22547 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22548 mem_base = xmlMemBlocks();
22549 name = gen_const_xmlChar_ptr(n_name, 0);
22550 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22551
William M. Brackf13f77f2004-11-12 16:03:48 +000022552 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022553 desret_xmlChar_ptr(ret_val);
22554 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022555 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022556 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22557 xmlResetLastError();
22558 if (mem_base != xmlMemBlocks()) {
22559 printf("Leak of %d blocks found in xmlSplitQName2",
22560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022561 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022562 printf(" %d", n_name);
22563 printf(" %d", n_prefix);
22564 printf("\n");
22565 }
22566 }
22567 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022569
Daniel Veillard42595322004-11-08 10:52:06 +000022570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022571}
22572
22573
22574static int
22575test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022577
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022578 int mem_base;
22579 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022580 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022581 int n_name;
22582 int * len; /* an int * */
22583 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022584
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022585 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22586 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22587 mem_base = xmlMemBlocks();
22588 name = gen_const_xmlChar_ptr(n_name, 0);
22589 len = gen_int_ptr(n_len, 1);
22590
William M. Brackf13f77f2004-11-12 16:03:48 +000022591 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022592 desret_const_xmlChar_ptr(ret_val);
22593 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022594 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022595 des_int_ptr(n_len, len, 1);
22596 xmlResetLastError();
22597 if (mem_base != xmlMemBlocks()) {
22598 printf("Leak of %d blocks found in xmlSplitQName3",
22599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022600 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022601 printf(" %d", n_name);
22602 printf(" %d", n_len);
22603 printf("\n");
22604 }
22605 }
22606 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022607 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022608
Daniel Veillard42595322004-11-08 10:52:06 +000022609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022610}
22611
22612
22613static int
22614test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022616
22617 int mem_base;
22618 xmlNodePtr ret_val;
22619 xmlDocPtr doc; /* the document */
22620 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022621 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022622 int n_value;
22623
22624 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22625 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022627 doc = gen_xmlDocPtr(n_doc, 0);
22628 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022629
William M. Brackf13f77f2004-11-12 16:03:48 +000022630 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022631 desret_xmlNodePtr(ret_val);
22632 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022633 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022634 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022635 xmlResetLastError();
22636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022637 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022640 printf(" %d", n_doc);
22641 printf(" %d", n_value);
22642 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022643 }
22644 }
22645 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022647
Daniel Veillard42595322004-11-08 10:52:06 +000022648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022649}
22650
22651
22652static int
22653test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022655
22656 int mem_base;
22657 xmlNodePtr ret_val;
22658 xmlDocPtr doc; /* the document */
22659 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022660 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022661 int n_value;
22662 int len; /* the length of the string value */
22663 int n_len;
22664
22665 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22666 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22667 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022669 doc = gen_xmlDocPtr(n_doc, 0);
22670 value = gen_const_xmlChar_ptr(n_value, 1);
22671 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022672
William M. Brackf13f77f2004-11-12 16:03:48 +000022673 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022674 desret_xmlNodePtr(ret_val);
22675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022676 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022677 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022678 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022679 xmlResetLastError();
22680 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022681 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022683 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022684 printf(" %d", n_doc);
22685 printf(" %d", n_value);
22686 printf(" %d", n_len);
22687 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022688 }
22689 }
22690 }
22691 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022692 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022693
Daniel Veillard42595322004-11-08 10:52:06 +000022694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022695}
22696
22697
22698static int
22699test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022701
22702 int mem_base;
22703 int ret_val;
22704 xmlNodePtr node; /* the node */
22705 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022706 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707 int n_content;
22708 int len; /* @content length */
22709 int n_len;
22710
22711 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22712 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22713 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022715 node = gen_xmlNodePtr(n_node, 0);
22716 content = gen_const_xmlChar_ptr(n_content, 1);
22717 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022718
William M. Brackf13f77f2004-11-12 16:03:48 +000022719 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022720 desret_int(ret_val);
22721 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022722 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022723 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022724 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022725 xmlResetLastError();
22726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022727 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 printf(" %d", n_node);
22731 printf(" %d", n_content);
22732 printf(" %d", n_len);
22733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022734 }
22735 }
22736 }
22737 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022738 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022739
Daniel Veillard42595322004-11-08 10:52:06 +000022740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022741}
22742
22743
22744static int
22745test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022747
22748 int mem_base;
22749 xmlNodePtr ret_val;
22750 xmlNodePtr first; /* the first text node */
22751 int n_first;
22752 xmlNodePtr second; /* the second text node being merged */
22753 int n_second;
22754
Daniel Veillarda03e3652004-11-02 18:45:30 +000022755 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22756 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022758 first = gen_xmlNodePtr_in(n_first, 0);
22759 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022760
22761 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022762 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022763 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022764 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022765 desret_xmlNodePtr(ret_val);
22766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022767 des_xmlNodePtr_in(n_first, first, 0);
22768 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022769 xmlResetLastError();
22770 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022771 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022773 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022774 printf(" %d", n_first);
22775 printf(" %d", n_second);
22776 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022777 }
22778 }
22779 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022780 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022781
Daniel Veillard42595322004-11-08 10:52:06 +000022782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022783}
22784
22785
22786static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022787test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022789
William M. Brack21e4ef22005-01-02 09:53:13 +000022790#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022791 int mem_base;
22792 int ret_val;
22793 xmlNodePtr node; /* the node */
22794 int n_node;
22795 xmlNsPtr ns; /* the namespace definition */
22796 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022797 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022798 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022799
Daniel Veillard27f20102004-11-05 11:50:11 +000022800 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22801 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22802 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22803 mem_base = xmlMemBlocks();
22804 node = gen_xmlNodePtr(n_node, 0);
22805 ns = gen_xmlNsPtr(n_ns, 1);
22806 name = gen_const_xmlChar_ptr(n_name, 2);
22807
William M. Brackf13f77f2004-11-12 16:03:48 +000022808 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022809 desret_int(ret_val);
22810 call_tests++;
22811 des_xmlNodePtr(n_node, node, 0);
22812 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022813 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022814 xmlResetLastError();
22815 if (mem_base != xmlMemBlocks()) {
22816 printf("Leak of %d blocks found in xmlUnsetNsProp",
22817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022818 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022819 printf(" %d", n_node);
22820 printf(" %d", n_ns);
22821 printf(" %d", n_name);
22822 printf("\n");
22823 }
22824 }
22825 }
22826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022827 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022828#endif
22829
Daniel Veillard42595322004-11-08 10:52:06 +000022830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022831}
22832
22833
22834static int
22835test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022837
William M. Brack21e4ef22005-01-02 09:53:13 +000022838#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022839 int mem_base;
22840 int ret_val;
22841 xmlNodePtr node; /* the node */
22842 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022843 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022844 int n_name;
22845
22846 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22847 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022849 node = gen_xmlNodePtr(n_node, 0);
22850 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022851
William M. Brackf13f77f2004-11-12 16:03:48 +000022852 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022853 desret_int(ret_val);
22854 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022855 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022856 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857 xmlResetLastError();
22858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022859 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022862 printf(" %d", n_node);
22863 printf(" %d", n_name);
22864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865 }
22866 }
22867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022868 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022869#endif
22870
Daniel Veillard42595322004-11-08 10:52:06 +000022871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022872}
22873
22874
22875static int
22876test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022878
William M. Brack21e4ef22005-01-02 09:53:13 +000022879#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022880#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022881 int mem_base;
22882 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022883 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022884 int n_value;
22885 int space; /* allow spaces in front and end of the string */
22886 int n_space;
22887
22888 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22889 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022891 value = gen_const_xmlChar_ptr(n_value, 0);
22892 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022893
William M. Brackf13f77f2004-11-12 16:03:48 +000022894 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022895 desret_int(ret_val);
22896 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022897 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022898 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022899 xmlResetLastError();
22900 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022901 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022903 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022904 printf(" %d", n_value);
22905 printf(" %d", n_space);
22906 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022907 }
22908 }
22909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022910 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022911#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022912#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022913
Daniel Veillard42595322004-11-08 10:52:06 +000022914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022915}
22916
22917
22918static int
22919test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022921
William M. Brack21e4ef22005-01-02 09:53:13 +000022922#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022923#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022924 int mem_base;
22925 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022926 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022927 int n_value;
22928 int space; /* allow spaces in front and end of the string */
22929 int n_space;
22930
22931 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22932 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022934 value = gen_const_xmlChar_ptr(n_value, 0);
22935 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022936
William M. Brackf13f77f2004-11-12 16:03:48 +000022937 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022938 desret_int(ret_val);
22939 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022940 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022941 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022942 xmlResetLastError();
22943 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022944 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022946 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022947 printf(" %d", n_value);
22948 printf(" %d", n_space);
22949 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022950 }
22951 }
22952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022953 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022954#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022955#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022956
Daniel Veillard42595322004-11-08 10:52:06 +000022957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022958}
22959
22960
22961static int
22962test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022964
William M. Brack21e4ef22005-01-02 09:53:13 +000022965#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022966#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022967 int mem_base;
22968 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022969 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022970 int n_value;
22971 int space; /* allow spaces in front and end of the string */
22972 int n_space;
22973
22974 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22975 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022977 value = gen_const_xmlChar_ptr(n_value, 0);
22978 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022979
William M. Brackf13f77f2004-11-12 16:03:48 +000022980 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022981 desret_int(ret_val);
22982 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022983 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022984 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022985 xmlResetLastError();
22986 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022987 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022989 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022990 printf(" %d", n_value);
22991 printf(" %d", n_space);
22992 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022993 }
22994 }
22995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022996 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022997#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022998#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022999
Daniel Veillard42595322004-11-08 10:52:06 +000023000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023001}
23002
23003
23004static int
23005test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023007
William M. Brack21e4ef22005-01-02 09:53:13 +000023008#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023009#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023010 int mem_base;
23011 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023012 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023013 int n_value;
23014 int space; /* allow spaces in front and end of the string */
23015 int n_space;
23016
23017 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23018 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023020 value = gen_const_xmlChar_ptr(n_value, 0);
23021 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023022
William M. Brackf13f77f2004-11-12 16:03:48 +000023023 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023024 desret_int(ret_val);
23025 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023026 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023027 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023028 xmlResetLastError();
23029 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023030 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023032 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023033 printf(" %d", n_value);
23034 printf(" %d", n_space);
23035 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023036 }
23037 }
23038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023039 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023040#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023041#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023042
Daniel Veillard42595322004-11-08 10:52:06 +000023043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023044}
23045
23046static int
23047test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023049
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023050 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023051 test_ret += test_xmlAddChild();
23052 test_ret += test_xmlAddChildList();
23053 test_ret += test_xmlAddNextSibling();
23054 test_ret += test_xmlAddPrevSibling();
23055 test_ret += test_xmlAddSibling();
23056 test_ret += test_xmlAttrSerializeTxtContent();
23057 test_ret += test_xmlBufferAdd();
23058 test_ret += test_xmlBufferAddHead();
23059 test_ret += test_xmlBufferCCat();
23060 test_ret += test_xmlBufferCat();
23061 test_ret += test_xmlBufferContent();
23062 test_ret += test_xmlBufferCreate();
23063 test_ret += test_xmlBufferCreateSize();
23064 test_ret += test_xmlBufferCreateStatic();
23065 test_ret += test_xmlBufferEmpty();
23066 test_ret += test_xmlBufferGrow();
23067 test_ret += test_xmlBufferLength();
23068 test_ret += test_xmlBufferResize();
23069 test_ret += test_xmlBufferSetAllocationScheme();
23070 test_ret += test_xmlBufferShrink();
23071 test_ret += test_xmlBufferWriteCHAR();
23072 test_ret += test_xmlBufferWriteChar();
23073 test_ret += test_xmlBufferWriteQuotedString();
23074 test_ret += test_xmlBuildQName();
23075 test_ret += test_xmlCopyDoc();
23076 test_ret += test_xmlCopyDtd();
23077 test_ret += test_xmlCopyNamespace();
23078 test_ret += test_xmlCopyNamespaceList();
23079 test_ret += test_xmlCopyNode();
23080 test_ret += test_xmlCopyNodeList();
23081 test_ret += test_xmlCopyProp();
23082 test_ret += test_xmlCopyPropList();
23083 test_ret += test_xmlCreateIntSubset();
23084 test_ret += test_xmlDocCopyNode();
23085 test_ret += test_xmlDocCopyNodeList();
23086 test_ret += test_xmlDocDump();
23087 test_ret += test_xmlDocDumpFormatMemory();
23088 test_ret += test_xmlDocDumpFormatMemoryEnc();
23089 test_ret += test_xmlDocDumpMemory();
23090 test_ret += test_xmlDocDumpMemoryEnc();
23091 test_ret += test_xmlDocFormatDump();
23092 test_ret += test_xmlDocGetRootElement();
23093 test_ret += test_xmlDocSetRootElement();
23094 test_ret += test_xmlElemDump();
23095 test_ret += test_xmlGetBufferAllocationScheme();
23096 test_ret += test_xmlGetCompressMode();
23097 test_ret += test_xmlGetDocCompressMode();
23098 test_ret += test_xmlGetIntSubset();
23099 test_ret += test_xmlGetLastChild();
23100 test_ret += test_xmlGetLineNo();
23101 test_ret += test_xmlGetNoNsProp();
23102 test_ret += test_xmlGetNodePath();
23103 test_ret += test_xmlGetNsList();
23104 test_ret += test_xmlGetNsProp();
23105 test_ret += test_xmlGetProp();
23106 test_ret += test_xmlHasNsProp();
23107 test_ret += test_xmlHasProp();
23108 test_ret += test_xmlIsBlankNode();
23109 test_ret += test_xmlIsXHTML();
23110 test_ret += test_xmlNewCDataBlock();
23111 test_ret += test_xmlNewCharRef();
23112 test_ret += test_xmlNewChild();
23113 test_ret += test_xmlNewComment();
23114 test_ret += test_xmlNewDoc();
23115 test_ret += test_xmlNewDocComment();
23116 test_ret += test_xmlNewDocFragment();
23117 test_ret += test_xmlNewDocNode();
23118 test_ret += test_xmlNewDocNodeEatName();
23119 test_ret += test_xmlNewDocPI();
23120 test_ret += test_xmlNewDocProp();
23121 test_ret += test_xmlNewDocRawNode();
23122 test_ret += test_xmlNewDocText();
23123 test_ret += test_xmlNewDocTextLen();
23124 test_ret += test_xmlNewDtd();
23125 test_ret += test_xmlNewNode();
23126 test_ret += test_xmlNewNodeEatName();
23127 test_ret += test_xmlNewNs();
23128 test_ret += test_xmlNewNsProp();
23129 test_ret += test_xmlNewNsPropEatName();
23130 test_ret += test_xmlNewPI();
23131 test_ret += test_xmlNewProp();
23132 test_ret += test_xmlNewReference();
23133 test_ret += test_xmlNewText();
23134 test_ret += test_xmlNewTextChild();
23135 test_ret += test_xmlNewTextLen();
23136 test_ret += test_xmlNodeAddContent();
23137 test_ret += test_xmlNodeAddContentLen();
23138 test_ret += test_xmlNodeBufGetContent();
23139 test_ret += test_xmlNodeDump();
23140 test_ret += test_xmlNodeDumpOutput();
23141 test_ret += test_xmlNodeGetBase();
23142 test_ret += test_xmlNodeGetContent();
23143 test_ret += test_xmlNodeGetLang();
23144 test_ret += test_xmlNodeGetSpacePreserve();
23145 test_ret += test_xmlNodeIsText();
23146 test_ret += test_xmlNodeListGetRawString();
23147 test_ret += test_xmlNodeListGetString();
23148 test_ret += test_xmlNodeSetBase();
23149 test_ret += test_xmlNodeSetContent();
23150 test_ret += test_xmlNodeSetContentLen();
23151 test_ret += test_xmlNodeSetLang();
23152 test_ret += test_xmlNodeSetName();
23153 test_ret += test_xmlNodeSetSpacePreserve();
23154 test_ret += test_xmlReconciliateNs();
23155 test_ret += test_xmlRemoveProp();
23156 test_ret += test_xmlReplaceNode();
23157 test_ret += test_xmlSaveFile();
23158 test_ret += test_xmlSaveFileEnc();
23159 test_ret += test_xmlSaveFileTo();
23160 test_ret += test_xmlSaveFormatFile();
23161 test_ret += test_xmlSaveFormatFileEnc();
23162 test_ret += test_xmlSaveFormatFileTo();
23163 test_ret += test_xmlSearchNs();
23164 test_ret += test_xmlSearchNsByHref();
23165 test_ret += test_xmlSetBufferAllocationScheme();
23166 test_ret += test_xmlSetCompressMode();
23167 test_ret += test_xmlSetDocCompressMode();
23168 test_ret += test_xmlSetNs();
23169 test_ret += test_xmlSetNsProp();
23170 test_ret += test_xmlSetProp();
23171 test_ret += test_xmlSplitQName2();
23172 test_ret += test_xmlSplitQName3();
23173 test_ret += test_xmlStringGetNodeList();
23174 test_ret += test_xmlStringLenGetNodeList();
23175 test_ret += test_xmlTextConcat();
23176 test_ret += test_xmlTextMerge();
23177 test_ret += test_xmlUnsetNsProp();
23178 test_ret += test_xmlUnsetProp();
23179 test_ret += test_xmlValidateNCName();
23180 test_ret += test_xmlValidateNMToken();
23181 test_ret += test_xmlValidateName();
23182 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023183
Daniel Veillard42595322004-11-08 10:52:06 +000023184 if (test_ret != 0)
23185 printf("Module tree: %d errors\n", test_ret);
23186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023187}
23188
23189static int
23190test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023192
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023193 int mem_base;
23194 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023195 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023196 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023197 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023198 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023199
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023200 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23201 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023203 URI = gen_const_xmlChar_ptr(n_URI, 0);
23204 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023205
William M. Brackf13f77f2004-11-12 16:03:48 +000023206 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023207 desret_xmlChar_ptr(ret_val);
23208 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023209 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23210 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023211 xmlResetLastError();
23212 if (mem_base != xmlMemBlocks()) {
23213 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023215 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023216 printf(" %d", n_URI);
23217 printf(" %d", n_base);
23218 printf("\n");
23219 }
23220 }
23221 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023222 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023223
Daniel Veillard42595322004-11-08 10:52:06 +000023224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023225}
23226
23227
23228static int
23229test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023231
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023232 int mem_base;
23233 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023234 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023235 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023236 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023237 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023238
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023239 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23240 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23241 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023242 URI = gen_const_xmlChar_ptr(n_URI, 0);
23243 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023244
William M. Brackf13f77f2004-11-12 16:03:48 +000023245 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023246 desret_xmlChar_ptr(ret_val);
23247 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023248 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23249 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023250 xmlResetLastError();
23251 if (mem_base != xmlMemBlocks()) {
23252 printf("Leak of %d blocks found in xmlBuildURI",
23253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023254 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023255 printf(" %d", n_URI);
23256 printf(" %d", n_base);
23257 printf("\n");
23258 }
23259 }
23260 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023261 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023262
Daniel Veillard42595322004-11-08 10:52:06 +000023263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023264}
23265
23266
23267static int
23268test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023270
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023271 int mem_base;
23272 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023273 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023274 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023275
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023276 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023278 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023279
William M. Brackf13f77f2004-11-12 16:03:48 +000023280 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023281 desret_xmlChar_ptr(ret_val);
23282 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023283 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023284 xmlResetLastError();
23285 if (mem_base != xmlMemBlocks()) {
23286 printf("Leak of %d blocks found in xmlCanonicPath",
23287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023288 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023289 printf(" %d", n_path);
23290 printf("\n");
23291 }
23292 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023294
Daniel Veillard42595322004-11-08 10:52:06 +000023295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023296}
23297
23298
23299static int
23300test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023302
23303
23304 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023306}
23307
23308
23309static int
23310test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023312
Daniel Veillardce682bc2004-11-05 17:22:25 +000023313 int mem_base;
23314 int ret_val;
23315 char * path; /* pointer to the path string */
23316 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023317
Daniel Veillardce682bc2004-11-05 17:22:25 +000023318 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23319 mem_base = xmlMemBlocks();
23320 path = gen_char_ptr(n_path, 0);
23321
23322 ret_val = xmlNormalizeURIPath(path);
23323 desret_int(ret_val);
23324 call_tests++;
23325 des_char_ptr(n_path, path, 0);
23326 xmlResetLastError();
23327 if (mem_base != xmlMemBlocks()) {
23328 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023330 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023331 printf(" %d", n_path);
23332 printf("\n");
23333 }
23334 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023336
Daniel Veillard42595322004-11-08 10:52:06 +000023337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023338}
23339
23340
23341static int
23342test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023344
23345
23346 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023348}
23349
23350
Daniel Veillardce682bc2004-11-05 17:22:25 +000023351#define gen_nb_xmlURIPtr 1
23352static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23353 return(NULL);
23354}
23355static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23356}
23357
Daniel Veillardd93f6252004-11-02 15:53:51 +000023358static int
23359test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023361
Daniel Veillardce682bc2004-11-05 17:22:25 +000023362 int mem_base;
23363 int ret_val;
23364 xmlURIPtr uri; /* pointer to an URI structure */
23365 int n_uri;
23366 char * str; /* the string to analyze */
23367 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023368
Daniel Veillardce682bc2004-11-05 17:22:25 +000023369 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23370 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23371 mem_base = xmlMemBlocks();
23372 uri = gen_xmlURIPtr(n_uri, 0);
23373 str = gen_const_char_ptr(n_str, 1);
23374
William M. Brackf13f77f2004-11-12 16:03:48 +000023375 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023376 desret_int(ret_val);
23377 call_tests++;
23378 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023379 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023380 xmlResetLastError();
23381 if (mem_base != xmlMemBlocks()) {
23382 printf("Leak of %d blocks found in xmlParseURIReference",
23383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023385 printf(" %d", n_uri);
23386 printf(" %d", n_str);
23387 printf("\n");
23388 }
23389 }
23390 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023391 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023392
Daniel Veillard42595322004-11-08 10:52:06 +000023393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023394}
23395
23396
23397static int
23398test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023400
Daniel Veillardce682bc2004-11-05 17:22:25 +000023401 int mem_base;
23402 FILE * stream; /* a FILE* for the output */
23403 int n_stream;
23404 xmlURIPtr uri; /* pointer to an xmlURI */
23405 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023406
Daniel Veillardce682bc2004-11-05 17:22:25 +000023407 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23408 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23409 mem_base = xmlMemBlocks();
23410 stream = gen_FILE_ptr(n_stream, 0);
23411 uri = gen_xmlURIPtr(n_uri, 1);
23412
23413 xmlPrintURI(stream, uri);
23414 call_tests++;
23415 des_FILE_ptr(n_stream, stream, 0);
23416 des_xmlURIPtr(n_uri, uri, 1);
23417 xmlResetLastError();
23418 if (mem_base != xmlMemBlocks()) {
23419 printf("Leak of %d blocks found in xmlPrintURI",
23420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023421 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023422 printf(" %d", n_stream);
23423 printf(" %d", n_uri);
23424 printf("\n");
23425 }
23426 }
23427 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023428 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023429
Daniel Veillard42595322004-11-08 10:52:06 +000023430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023431}
23432
23433
23434static int
23435test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023437
Daniel Veillardce682bc2004-11-05 17:22:25 +000023438 int mem_base;
23439 xmlChar * ret_val;
23440 xmlURIPtr uri; /* pointer to an xmlURI */
23441 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023442
Daniel Veillardce682bc2004-11-05 17:22:25 +000023443 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23444 mem_base = xmlMemBlocks();
23445 uri = gen_xmlURIPtr(n_uri, 0);
23446
23447 ret_val = xmlSaveUri(uri);
23448 desret_xmlChar_ptr(ret_val);
23449 call_tests++;
23450 des_xmlURIPtr(n_uri, uri, 0);
23451 xmlResetLastError();
23452 if (mem_base != xmlMemBlocks()) {
23453 printf("Leak of %d blocks found in xmlSaveUri",
23454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023455 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023456 printf(" %d", n_uri);
23457 printf("\n");
23458 }
23459 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023460 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023461
Daniel Veillard42595322004-11-08 10:52:06 +000023462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023463}
23464
23465
23466static int
23467test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023469
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023470 int mem_base;
23471 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023472 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023473 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023474
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023475 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023477 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023478
William M. Brackf13f77f2004-11-12 16:03:48 +000023479 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023480 desret_xmlChar_ptr(ret_val);
23481 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023482 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023483 xmlResetLastError();
23484 if (mem_base != xmlMemBlocks()) {
23485 printf("Leak of %d blocks found in xmlURIEscape",
23486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023487 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023488 printf(" %d", n_str);
23489 printf("\n");
23490 }
23491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023493
Daniel Veillard42595322004-11-08 10:52:06 +000023494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023495}
23496
23497
23498static int
23499test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023502 int mem_base;
23503 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023504 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023505 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023506 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023507 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023508
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023509 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23510 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023512 str = gen_const_xmlChar_ptr(n_str, 0);
23513 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023514
William M. Brackf13f77f2004-11-12 16:03:48 +000023515 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023516 desret_xmlChar_ptr(ret_val);
23517 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023518 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23519 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023520 xmlResetLastError();
23521 if (mem_base != xmlMemBlocks()) {
23522 printf("Leak of %d blocks found in xmlURIEscapeStr",
23523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023524 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023525 printf(" %d", n_str);
23526 printf(" %d", n_list);
23527 printf("\n");
23528 }
23529 }
23530 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023531 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023532
Daniel Veillard42595322004-11-08 10:52:06 +000023533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023534}
23535
23536
23537static int
23538test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023540
23541
23542 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023544}
23545
23546static int
23547test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023549
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023550 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023551 test_ret += test_xmlBuildRelativeURI();
23552 test_ret += test_xmlBuildURI();
23553 test_ret += test_xmlCanonicPath();
23554 test_ret += test_xmlCreateURI();
23555 test_ret += test_xmlNormalizeURIPath();
23556 test_ret += test_xmlParseURI();
23557 test_ret += test_xmlParseURIReference();
23558 test_ret += test_xmlPrintURI();
23559 test_ret += test_xmlSaveUri();
23560 test_ret += test_xmlURIEscape();
23561 test_ret += test_xmlURIEscapeStr();
23562 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023563
Daniel Veillard42595322004-11-08 10:52:06 +000023564 if (test_ret != 0)
23565 printf("Module uri: %d errors\n", test_ret);
23566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023567}
23568
23569static int
23570test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023572
Daniel Veillard42595322004-11-08 10:52:06 +000023573 int mem_base;
23574 xmlAttributePtr ret_val;
23575 xmlValidCtxtPtr ctxt; /* the validation context */
23576 int n_ctxt;
23577 xmlDtdPtr dtd; /* pointer to the DTD */
23578 int n_dtd;
23579 xmlChar * elem; /* the element name */
23580 int n_elem;
23581 xmlChar * name; /* the attribute name */
23582 int n_name;
23583 xmlChar * ns; /* the attribute namespace prefix */
23584 int n_ns;
23585 xmlAttributeType type; /* the attribute type */
23586 int n_type;
23587 xmlAttributeDefault def; /* the attribute default type */
23588 int n_def;
23589 xmlChar * defaultValue; /* the attribute default value */
23590 int n_defaultValue;
23591 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23592 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593
Daniel Veillard42595322004-11-08 10:52:06 +000023594 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23595 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23596 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23597 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23598 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23599 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23600 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23601 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23602 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23603 mem_base = xmlMemBlocks();
23604 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23605 dtd = gen_xmlDtdPtr(n_dtd, 1);
23606 elem = gen_const_xmlChar_ptr(n_elem, 2);
23607 name = gen_const_xmlChar_ptr(n_name, 3);
23608 ns = gen_const_xmlChar_ptr(n_ns, 4);
23609 type = gen_xmlAttributeType(n_type, 5);
23610 def = gen_xmlAttributeDefault(n_def, 6);
23611 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23612 tree = gen_xmlEnumerationPtr(n_tree, 8);
23613
William M. Brackf13f77f2004-11-12 16:03:48 +000023614 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 +000023615 desret_xmlAttributePtr(ret_val);
23616 call_tests++;
23617 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23618 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023619 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23620 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23621 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023622 des_xmlAttributeType(n_type, type, 5);
23623 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023624 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023625 des_xmlEnumerationPtr(n_tree, tree, 8);
23626 xmlResetLastError();
23627 if (mem_base != xmlMemBlocks()) {
23628 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23629 xmlMemBlocks() - mem_base);
23630 test_ret++;
23631 printf(" %d", n_ctxt);
23632 printf(" %d", n_dtd);
23633 printf(" %d", n_elem);
23634 printf(" %d", n_name);
23635 printf(" %d", n_ns);
23636 printf(" %d", n_type);
23637 printf(" %d", n_def);
23638 printf(" %d", n_defaultValue);
23639 printf(" %d", n_tree);
23640 printf("\n");
23641 }
23642 }
23643 }
23644 }
23645 }
23646 }
23647 }
23648 }
23649 }
23650 }
Daniel Veillard42595322004-11-08 10:52:06 +000023651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023652
Daniel Veillard42595322004-11-08 10:52:06 +000023653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023654}
23655
23656
23657static int
23658test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023660
Daniel Veillard42595322004-11-08 10:52:06 +000023661 int mem_base;
23662 xmlElementPtr ret_val;
23663 xmlValidCtxtPtr ctxt; /* the validation context */
23664 int n_ctxt;
23665 xmlDtdPtr dtd; /* pointer to the DTD */
23666 int n_dtd;
23667 xmlChar * name; /* the entity name */
23668 int n_name;
23669 xmlElementTypeVal type; /* the element type */
23670 int n_type;
23671 xmlElementContentPtr content; /* the element content tree or NULL */
23672 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023673
Daniel Veillard42595322004-11-08 10:52:06 +000023674 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23675 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23676 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23677 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23678 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23679 mem_base = xmlMemBlocks();
23680 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23681 dtd = gen_xmlDtdPtr(n_dtd, 1);
23682 name = gen_const_xmlChar_ptr(n_name, 2);
23683 type = gen_xmlElementTypeVal(n_type, 3);
23684 content = gen_xmlElementContentPtr(n_content, 4);
23685
William M. Brackf13f77f2004-11-12 16:03:48 +000023686 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023687 desret_xmlElementPtr(ret_val);
23688 call_tests++;
23689 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23690 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023691 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023692 des_xmlElementTypeVal(n_type, type, 3);
23693 des_xmlElementContentPtr(n_content, content, 4);
23694 xmlResetLastError();
23695 if (mem_base != xmlMemBlocks()) {
23696 printf("Leak of %d blocks found in xmlAddElementDecl",
23697 xmlMemBlocks() - mem_base);
23698 test_ret++;
23699 printf(" %d", n_ctxt);
23700 printf(" %d", n_dtd);
23701 printf(" %d", n_name);
23702 printf(" %d", n_type);
23703 printf(" %d", n_content);
23704 printf("\n");
23705 }
23706 }
23707 }
23708 }
23709 }
23710 }
Daniel Veillard42595322004-11-08 10:52:06 +000023711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023712
Daniel Veillard42595322004-11-08 10:52:06 +000023713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023714}
23715
23716
23717static int
23718test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023720
23721
23722 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023724}
23725
23726
23727static int
23728test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023730
23731
23732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023734}
23735
23736
23737static int
23738test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023740
23741
23742 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023744}
23745
23746
Daniel Veillardce682bc2004-11-05 17:22:25 +000023747#define gen_nb_xmlAttributeTablePtr 1
23748static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23749 return(NULL);
23750}
23751static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23752}
23753
Daniel Veillardd93f6252004-11-02 15:53:51 +000023754static int
23755test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023757
23758
23759 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023761}
23762
23763
23764static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023765test_xmlCopyDocElementContent(void) {
23766 int test_ret = 0;
23767
23768 int mem_base;
23769 xmlElementContentPtr ret_val;
23770 xmlDocPtr doc; /* the document owning the element declaration */
23771 int n_doc;
23772 xmlElementContentPtr cur; /* An element content pointer. */
23773 int n_cur;
23774
23775 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23776 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23777 mem_base = xmlMemBlocks();
23778 doc = gen_xmlDocPtr(n_doc, 0);
23779 cur = gen_xmlElementContentPtr(n_cur, 1);
23780
23781 ret_val = xmlCopyDocElementContent(doc, cur);
23782 desret_xmlElementContentPtr(ret_val);
23783 call_tests++;
23784 des_xmlDocPtr(n_doc, doc, 0);
23785 des_xmlElementContentPtr(n_cur, cur, 1);
23786 xmlResetLastError();
23787 if (mem_base != xmlMemBlocks()) {
23788 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23789 xmlMemBlocks() - mem_base);
23790 test_ret++;
23791 printf(" %d", n_doc);
23792 printf(" %d", n_cur);
23793 printf("\n");
23794 }
23795 }
23796 }
23797 function_tests++;
23798
23799 return(test_ret);
23800}
23801
23802
23803static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023804test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023806
William M. Brack094dd862004-11-14 14:28:34 +000023807 int mem_base;
23808 xmlElementContentPtr ret_val;
23809 xmlElementContentPtr cur; /* An element content pointer. */
23810 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023811
William M. Brack094dd862004-11-14 14:28:34 +000023812 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23813 mem_base = xmlMemBlocks();
23814 cur = gen_xmlElementContentPtr(n_cur, 0);
23815
23816 ret_val = xmlCopyElementContent(cur);
23817 desret_xmlElementContentPtr(ret_val);
23818 call_tests++;
23819 des_xmlElementContentPtr(n_cur, cur, 0);
23820 xmlResetLastError();
23821 if (mem_base != xmlMemBlocks()) {
23822 printf("Leak of %d blocks found in xmlCopyElementContent",
23823 xmlMemBlocks() - mem_base);
23824 test_ret++;
23825 printf(" %d", n_cur);
23826 printf("\n");
23827 }
23828 }
23829 function_tests++;
23830
Daniel Veillard42595322004-11-08 10:52:06 +000023831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023832}
23833
23834
Daniel Veillardce682bc2004-11-05 17:22:25 +000023835#define gen_nb_xmlElementTablePtr 1
23836static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23837 return(NULL);
23838}
23839static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23840}
23841
Daniel Veillardd93f6252004-11-02 15:53:51 +000023842static int
23843test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845
23846
23847 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023849}
23850
23851
23852static int
23853test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023855
23856
23857 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023859}
23860
23861
Daniel Veillardce682bc2004-11-05 17:22:25 +000023862#define gen_nb_xmlNotationTablePtr 1
23863static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23864 return(NULL);
23865}
23866static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23867}
23868
Daniel Veillardd93f6252004-11-02 15:53:51 +000023869static int
23870test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872
23873
23874 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023876}
23877
23878
23879static int
23880test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023882
23883
23884 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023886}
23887
23888
Daniel Veillardce682bc2004-11-05 17:22:25 +000023889#define gen_nb_xmlAttributePtr 1
23890static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23891 return(NULL);
23892}
23893static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23894}
23895
Daniel Veillardd93f6252004-11-02 15:53:51 +000023896static int
23897test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023899
William M. Brack21e4ef22005-01-02 09:53:13 +000023900#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023901 int mem_base;
23902 xmlBufferPtr buf; /* the XML buffer output */
23903 int n_buf;
23904 xmlAttributePtr attr; /* An attribute declaration */
23905 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023906
Daniel Veillardce682bc2004-11-05 17:22:25 +000023907 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23908 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23909 mem_base = xmlMemBlocks();
23910 buf = gen_xmlBufferPtr(n_buf, 0);
23911 attr = gen_xmlAttributePtr(n_attr, 1);
23912
23913 xmlDumpAttributeDecl(buf, attr);
23914 call_tests++;
23915 des_xmlBufferPtr(n_buf, buf, 0);
23916 des_xmlAttributePtr(n_attr, attr, 1);
23917 xmlResetLastError();
23918 if (mem_base != xmlMemBlocks()) {
23919 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023921 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023922 printf(" %d", n_buf);
23923 printf(" %d", n_attr);
23924 printf("\n");
23925 }
23926 }
23927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023928 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023929#endif
23930
Daniel Veillard42595322004-11-08 10:52:06 +000023931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023932}
23933
23934
23935static int
23936test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023938
William M. Brack21e4ef22005-01-02 09:53:13 +000023939#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023940 int mem_base;
23941 xmlBufferPtr buf; /* the XML buffer output */
23942 int n_buf;
23943 xmlAttributeTablePtr table; /* An attribute table */
23944 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023945
Daniel Veillardce682bc2004-11-05 17:22:25 +000023946 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23947 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23948 mem_base = xmlMemBlocks();
23949 buf = gen_xmlBufferPtr(n_buf, 0);
23950 table = gen_xmlAttributeTablePtr(n_table, 1);
23951
23952 xmlDumpAttributeTable(buf, table);
23953 call_tests++;
23954 des_xmlBufferPtr(n_buf, buf, 0);
23955 des_xmlAttributeTablePtr(n_table, table, 1);
23956 xmlResetLastError();
23957 if (mem_base != xmlMemBlocks()) {
23958 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023960 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023961 printf(" %d", n_buf);
23962 printf(" %d", n_table);
23963 printf("\n");
23964 }
23965 }
23966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023967 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023968#endif
23969
Daniel Veillard42595322004-11-08 10:52:06 +000023970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023971}
23972
23973
Daniel Veillardce682bc2004-11-05 17:22:25 +000023974#define gen_nb_xmlElementPtr 1
23975static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23976 return(NULL);
23977}
23978static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23979}
23980
Daniel Veillardd93f6252004-11-02 15:53:51 +000023981static int
23982test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023984
William M. Brack21e4ef22005-01-02 09:53:13 +000023985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023986 int mem_base;
23987 xmlBufferPtr buf; /* the XML buffer output */
23988 int n_buf;
23989 xmlElementPtr elem; /* An element table */
23990 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023991
Daniel Veillardce682bc2004-11-05 17:22:25 +000023992 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23993 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23994 mem_base = xmlMemBlocks();
23995 buf = gen_xmlBufferPtr(n_buf, 0);
23996 elem = gen_xmlElementPtr(n_elem, 1);
23997
23998 xmlDumpElementDecl(buf, elem);
23999 call_tests++;
24000 des_xmlBufferPtr(n_buf, buf, 0);
24001 des_xmlElementPtr(n_elem, elem, 1);
24002 xmlResetLastError();
24003 if (mem_base != xmlMemBlocks()) {
24004 printf("Leak of %d blocks found in xmlDumpElementDecl",
24005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024006 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024007 printf(" %d", n_buf);
24008 printf(" %d", n_elem);
24009 printf("\n");
24010 }
24011 }
24012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024013 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024014#endif
24015
Daniel Veillard42595322004-11-08 10:52:06 +000024016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024017}
24018
24019
24020static int
24021test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024023
William M. Brack21e4ef22005-01-02 09:53:13 +000024024#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024025 int mem_base;
24026 xmlBufferPtr buf; /* the XML buffer output */
24027 int n_buf;
24028 xmlElementTablePtr table; /* An element table */
24029 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024030
Daniel Veillardce682bc2004-11-05 17:22:25 +000024031 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24032 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24033 mem_base = xmlMemBlocks();
24034 buf = gen_xmlBufferPtr(n_buf, 0);
24035 table = gen_xmlElementTablePtr(n_table, 1);
24036
24037 xmlDumpElementTable(buf, table);
24038 call_tests++;
24039 des_xmlBufferPtr(n_buf, buf, 0);
24040 des_xmlElementTablePtr(n_table, table, 1);
24041 xmlResetLastError();
24042 if (mem_base != xmlMemBlocks()) {
24043 printf("Leak of %d blocks found in xmlDumpElementTable",
24044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024045 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024046 printf(" %d", n_buf);
24047 printf(" %d", n_table);
24048 printf("\n");
24049 }
24050 }
24051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024052 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024053#endif
24054
Daniel Veillard42595322004-11-08 10:52:06 +000024055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024056}
24057
24058
Daniel Veillardce682bc2004-11-05 17:22:25 +000024059#define gen_nb_xmlNotationPtr 1
24060static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24061 return(NULL);
24062}
24063static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24064}
24065
Daniel Veillardd93f6252004-11-02 15:53:51 +000024066static int
24067test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024069
William M. Brack21e4ef22005-01-02 09:53:13 +000024070#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024071 int mem_base;
24072 xmlBufferPtr buf; /* the XML buffer output */
24073 int n_buf;
24074 xmlNotationPtr nota; /* A notation declaration */
24075 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024076
Daniel Veillardce682bc2004-11-05 17:22:25 +000024077 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24078 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24079 mem_base = xmlMemBlocks();
24080 buf = gen_xmlBufferPtr(n_buf, 0);
24081 nota = gen_xmlNotationPtr(n_nota, 1);
24082
24083 xmlDumpNotationDecl(buf, nota);
24084 call_tests++;
24085 des_xmlBufferPtr(n_buf, buf, 0);
24086 des_xmlNotationPtr(n_nota, nota, 1);
24087 xmlResetLastError();
24088 if (mem_base != xmlMemBlocks()) {
24089 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024091 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024092 printf(" %d", n_buf);
24093 printf(" %d", n_nota);
24094 printf("\n");
24095 }
24096 }
24097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024098 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024099#endif
24100
Daniel Veillard42595322004-11-08 10:52:06 +000024101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024102}
24103
24104
24105static int
24106test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024108
William M. Brack21e4ef22005-01-02 09:53:13 +000024109#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024110 int mem_base;
24111 xmlBufferPtr buf; /* the XML buffer output */
24112 int n_buf;
24113 xmlNotationTablePtr table; /* A notation table */
24114 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024115
Daniel Veillardce682bc2004-11-05 17:22:25 +000024116 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24117 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24118 mem_base = xmlMemBlocks();
24119 buf = gen_xmlBufferPtr(n_buf, 0);
24120 table = gen_xmlNotationTablePtr(n_table, 1);
24121
24122 xmlDumpNotationTable(buf, table);
24123 call_tests++;
24124 des_xmlBufferPtr(n_buf, buf, 0);
24125 des_xmlNotationTablePtr(n_table, table, 1);
24126 xmlResetLastError();
24127 if (mem_base != xmlMemBlocks()) {
24128 printf("Leak of %d blocks found in xmlDumpNotationTable",
24129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024130 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024131 printf(" %d", n_buf);
24132 printf(" %d", n_table);
24133 printf("\n");
24134 }
24135 }
24136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024137 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024138#endif
24139
Daniel Veillard42595322004-11-08 10:52:06 +000024140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024141}
24142
24143
24144static int
24145test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024147
Daniel Veillard42595322004-11-08 10:52:06 +000024148 int mem_base;
24149 xmlAttributePtr ret_val;
24150 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24151 int n_dtd;
24152 xmlChar * elem; /* the element name */
24153 int n_elem;
24154 xmlChar * name; /* the attribute name */
24155 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024156
Daniel Veillard42595322004-11-08 10:52:06 +000024157 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24158 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24159 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24160 mem_base = xmlMemBlocks();
24161 dtd = gen_xmlDtdPtr(n_dtd, 0);
24162 elem = gen_const_xmlChar_ptr(n_elem, 1);
24163 name = gen_const_xmlChar_ptr(n_name, 2);
24164
William M. Brackf13f77f2004-11-12 16:03:48 +000024165 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024166 desret_xmlAttributePtr(ret_val);
24167 call_tests++;
24168 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024169 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24170 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024171 xmlResetLastError();
24172 if (mem_base != xmlMemBlocks()) {
24173 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24174 xmlMemBlocks() - mem_base);
24175 test_ret++;
24176 printf(" %d", n_dtd);
24177 printf(" %d", n_elem);
24178 printf(" %d", n_name);
24179 printf("\n");
24180 }
24181 }
24182 }
24183 }
Daniel Veillard42595322004-11-08 10:52:06 +000024184 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024185
Daniel Veillard42595322004-11-08 10:52:06 +000024186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024187}
24188
24189
24190static int
24191test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024193
Daniel Veillard42595322004-11-08 10:52:06 +000024194 int mem_base;
24195 xmlElementPtr ret_val;
24196 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24197 int n_dtd;
24198 xmlChar * name; /* the element name */
24199 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024200
Daniel Veillard42595322004-11-08 10:52:06 +000024201 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24203 mem_base = xmlMemBlocks();
24204 dtd = gen_xmlDtdPtr(n_dtd, 0);
24205 name = gen_const_xmlChar_ptr(n_name, 1);
24206
William M. Brackf13f77f2004-11-12 16:03:48 +000024207 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024208 desret_xmlElementPtr(ret_val);
24209 call_tests++;
24210 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024211 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024212 xmlResetLastError();
24213 if (mem_base != xmlMemBlocks()) {
24214 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24215 xmlMemBlocks() - mem_base);
24216 test_ret++;
24217 printf(" %d", n_dtd);
24218 printf(" %d", n_name);
24219 printf("\n");
24220 }
24221 }
24222 }
Daniel Veillard42595322004-11-08 10:52:06 +000024223 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024224
Daniel Veillard42595322004-11-08 10:52:06 +000024225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024226}
24227
24228
24229static int
24230test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024232
24233
24234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024236}
24237
24238
24239static int
24240test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024242
Daniel Veillard42595322004-11-08 10:52:06 +000024243 int mem_base;
24244 xmlAttributePtr ret_val;
24245 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24246 int n_dtd;
24247 xmlChar * elem; /* the element name */
24248 int n_elem;
24249 xmlChar * name; /* the attribute name */
24250 int n_name;
24251 xmlChar * prefix; /* the attribute namespace prefix */
24252 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024253
Daniel Veillard42595322004-11-08 10:52:06 +000024254 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24255 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24256 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24257 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24258 mem_base = xmlMemBlocks();
24259 dtd = gen_xmlDtdPtr(n_dtd, 0);
24260 elem = gen_const_xmlChar_ptr(n_elem, 1);
24261 name = gen_const_xmlChar_ptr(n_name, 2);
24262 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24263
William M. Brackf13f77f2004-11-12 16:03:48 +000024264 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024265 desret_xmlAttributePtr(ret_val);
24266 call_tests++;
24267 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024268 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24269 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24270 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024271 xmlResetLastError();
24272 if (mem_base != xmlMemBlocks()) {
24273 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24274 xmlMemBlocks() - mem_base);
24275 test_ret++;
24276 printf(" %d", n_dtd);
24277 printf(" %d", n_elem);
24278 printf(" %d", n_name);
24279 printf(" %d", n_prefix);
24280 printf("\n");
24281 }
24282 }
24283 }
24284 }
24285 }
Daniel Veillard42595322004-11-08 10:52:06 +000024286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024287
Daniel Veillard42595322004-11-08 10:52:06 +000024288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024289}
24290
24291
24292static int
24293test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024295
Daniel Veillard42595322004-11-08 10:52:06 +000024296 int mem_base;
24297 xmlElementPtr ret_val;
24298 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24299 int n_dtd;
24300 xmlChar * name; /* the element name */
24301 int n_name;
24302 xmlChar * prefix; /* the element namespace prefix */
24303 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024304
Daniel Veillard42595322004-11-08 10:52:06 +000024305 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24306 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24307 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24308 mem_base = xmlMemBlocks();
24309 dtd = gen_xmlDtdPtr(n_dtd, 0);
24310 name = gen_const_xmlChar_ptr(n_name, 1);
24311 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24312
William M. Brackf13f77f2004-11-12 16:03:48 +000024313 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024314 desret_xmlElementPtr(ret_val);
24315 call_tests++;
24316 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024317 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24318 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024319 xmlResetLastError();
24320 if (mem_base != xmlMemBlocks()) {
24321 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24322 xmlMemBlocks() - mem_base);
24323 test_ret++;
24324 printf(" %d", n_dtd);
24325 printf(" %d", n_name);
24326 printf(" %d", n_prefix);
24327 printf("\n");
24328 }
24329 }
24330 }
24331 }
Daniel Veillard42595322004-11-08 10:52:06 +000024332 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024333
Daniel Veillard42595322004-11-08 10:52:06 +000024334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024335}
24336
24337
24338static int
24339test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024341
Daniel Veillard57b25162004-11-06 14:50:18 +000024342 int mem_base;
24343 xmlAttrPtr ret_val;
24344 xmlDocPtr doc; /* pointer to the document */
24345 int n_doc;
24346 xmlChar * ID; /* the ID value */
24347 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024348
Daniel Veillard57b25162004-11-06 14:50:18 +000024349 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24350 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24351 mem_base = xmlMemBlocks();
24352 doc = gen_xmlDocPtr(n_doc, 0);
24353 ID = gen_const_xmlChar_ptr(n_ID, 1);
24354
William M. Brackf13f77f2004-11-12 16:03:48 +000024355 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024356 desret_xmlAttrPtr(ret_val);
24357 call_tests++;
24358 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024359 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024360 xmlResetLastError();
24361 if (mem_base != xmlMemBlocks()) {
24362 printf("Leak of %d blocks found in xmlGetID",
24363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024364 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024365 printf(" %d", n_doc);
24366 printf(" %d", n_ID);
24367 printf("\n");
24368 }
24369 }
24370 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024372
Daniel Veillard42595322004-11-08 10:52:06 +000024373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024374}
24375
24376
24377static int
24378test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024380
24381
24382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024384}
24385
24386
24387static int
24388test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024390
Daniel Veillardce244ad2004-11-05 10:03:46 +000024391 int mem_base;
24392 int ret_val;
24393 xmlDocPtr doc; /* the document */
24394 int n_doc;
24395 xmlNodePtr elem; /* the element carrying the attribute */
24396 int n_elem;
24397 xmlAttrPtr attr; /* the attribute */
24398 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399
Daniel Veillardce244ad2004-11-05 10:03:46 +000024400 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24401 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24402 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24403 mem_base = xmlMemBlocks();
24404 doc = gen_xmlDocPtr(n_doc, 0);
24405 elem = gen_xmlNodePtr(n_elem, 1);
24406 attr = gen_xmlAttrPtr(n_attr, 2);
24407
24408 ret_val = xmlIsID(doc, elem, attr);
24409 desret_int(ret_val);
24410 call_tests++;
24411 des_xmlDocPtr(n_doc, doc, 0);
24412 des_xmlNodePtr(n_elem, elem, 1);
24413 des_xmlAttrPtr(n_attr, attr, 2);
24414 xmlResetLastError();
24415 if (mem_base != xmlMemBlocks()) {
24416 printf("Leak of %d blocks found in xmlIsID",
24417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024418 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024419 printf(" %d", n_doc);
24420 printf(" %d", n_elem);
24421 printf(" %d", n_attr);
24422 printf("\n");
24423 }
24424 }
24425 }
24426 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024428
Daniel Veillard42595322004-11-08 10:52:06 +000024429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024430}
24431
24432
24433static int
24434test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024436
24437 int mem_base;
24438 int ret_val;
24439 xmlDocPtr doc; /* the document */
24440 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024441 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024442 int n_name;
24443
24444 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24445 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24446 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024447 doc = gen_xmlDocPtr(n_doc, 0);
24448 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024449
William M. Brackf13f77f2004-11-12 16:03:48 +000024450 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024451 desret_int(ret_val);
24452 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024453 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024454 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024455 xmlResetLastError();
24456 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024457 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024459 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024460 printf(" %d", n_doc);
24461 printf(" %d", n_name);
24462 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024463 }
24464 }
24465 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024466 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024467
Daniel Veillard42595322004-11-08 10:52:06 +000024468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024469}
24470
24471
24472static int
24473test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024475
Daniel Veillardce244ad2004-11-05 10:03:46 +000024476 int mem_base;
24477 int ret_val;
24478 xmlDocPtr doc; /* the document */
24479 int n_doc;
24480 xmlNodePtr elem; /* the element carrying the attribute */
24481 int n_elem;
24482 xmlAttrPtr attr; /* the attribute */
24483 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024484
Daniel Veillardce244ad2004-11-05 10:03:46 +000024485 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24486 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24487 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24488 mem_base = xmlMemBlocks();
24489 doc = gen_xmlDocPtr(n_doc, 0);
24490 elem = gen_xmlNodePtr(n_elem, 1);
24491 attr = gen_xmlAttrPtr(n_attr, 2);
24492
24493 ret_val = xmlIsRef(doc, elem, attr);
24494 desret_int(ret_val);
24495 call_tests++;
24496 des_xmlDocPtr(n_doc, doc, 0);
24497 des_xmlNodePtr(n_elem, elem, 1);
24498 des_xmlAttrPtr(n_attr, attr, 2);
24499 xmlResetLastError();
24500 if (mem_base != xmlMemBlocks()) {
24501 printf("Leak of %d blocks found in xmlIsRef",
24502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024503 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024504 printf(" %d", n_doc);
24505 printf(" %d", n_elem);
24506 printf(" %d", n_attr);
24507 printf("\n");
24508 }
24509 }
24510 }
24511 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024513
Daniel Veillard42595322004-11-08 10:52:06 +000024514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024515}
24516
24517
24518static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024519test_xmlNewDocElementContent(void) {
24520 int test_ret = 0;
24521
24522 int mem_base;
24523 xmlElementContentPtr ret_val;
24524 xmlDocPtr doc; /* the document */
24525 int n_doc;
24526 xmlChar * name; /* the subelement name or NULL */
24527 int n_name;
24528 xmlElementContentType type; /* the type of element content decl */
24529 int n_type;
24530
24531 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24532 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24533 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24534 mem_base = xmlMemBlocks();
24535 doc = gen_xmlDocPtr(n_doc, 0);
24536 name = gen_const_xmlChar_ptr(n_name, 1);
24537 type = gen_xmlElementContentType(n_type, 2);
24538
24539 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024540 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024541 desret_xmlElementContentPtr(ret_val);
24542 call_tests++;
24543 des_xmlDocPtr(n_doc, doc, 0);
24544 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24545 des_xmlElementContentType(n_type, type, 2);
24546 xmlResetLastError();
24547 if (mem_base != xmlMemBlocks()) {
24548 printf("Leak of %d blocks found in xmlNewDocElementContent",
24549 xmlMemBlocks() - mem_base);
24550 test_ret++;
24551 printf(" %d", n_doc);
24552 printf(" %d", n_name);
24553 printf(" %d", n_type);
24554 printf("\n");
24555 }
24556 }
24557 }
24558 }
24559 function_tests++;
24560
24561 return(test_ret);
24562}
24563
24564
24565static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024566test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024568
William M. Brack094dd862004-11-14 14:28:34 +000024569 int mem_base;
24570 xmlElementContentPtr ret_val;
24571 xmlChar * name; /* the subelement name or NULL */
24572 int n_name;
24573 xmlElementContentType type; /* the type of element content decl */
24574 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024575
William M. Brack094dd862004-11-14 14:28:34 +000024576 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24577 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24578 mem_base = xmlMemBlocks();
24579 name = gen_const_xmlChar_ptr(n_name, 0);
24580 type = gen_xmlElementContentType(n_type, 1);
24581
24582 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24583 desret_xmlElementContentPtr(ret_val);
24584 call_tests++;
24585 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24586 des_xmlElementContentType(n_type, type, 1);
24587 xmlResetLastError();
24588 if (mem_base != xmlMemBlocks()) {
24589 printf("Leak of %d blocks found in xmlNewElementContent",
24590 xmlMemBlocks() - mem_base);
24591 test_ret++;
24592 printf(" %d", n_name);
24593 printf(" %d", n_type);
24594 printf("\n");
24595 }
24596 }
24597 }
24598 function_tests++;
24599
Daniel Veillard42595322004-11-08 10:52:06 +000024600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024601}
24602
24603
24604static int
24605test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024607
24608
24609 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024611}
24612
24613
24614static int
24615test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024616 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024617
Daniel Veillardce244ad2004-11-05 10:03:46 +000024618 int mem_base;
24619 int ret_val;
24620 xmlDocPtr doc; /* the document */
24621 int n_doc;
24622 xmlAttrPtr attr; /* the attribute */
24623 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024624
Daniel Veillardce244ad2004-11-05 10:03:46 +000024625 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24626 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24627 mem_base = xmlMemBlocks();
24628 doc = gen_xmlDocPtr(n_doc, 0);
24629 attr = gen_xmlAttrPtr(n_attr, 1);
24630
24631 ret_val = xmlRemoveID(doc, attr);
24632 desret_int(ret_val);
24633 call_tests++;
24634 des_xmlDocPtr(n_doc, doc, 0);
24635 des_xmlAttrPtr(n_attr, attr, 1);
24636 xmlResetLastError();
24637 if (mem_base != xmlMemBlocks()) {
24638 printf("Leak of %d blocks found in xmlRemoveID",
24639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024640 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024641 printf(" %d", n_doc);
24642 printf(" %d", n_attr);
24643 printf("\n");
24644 }
24645 }
24646 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024648
Daniel Veillard42595322004-11-08 10:52:06 +000024649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024650}
24651
24652
24653static int
24654test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024656
Daniel Veillardce244ad2004-11-05 10:03:46 +000024657 int mem_base;
24658 int ret_val;
24659 xmlDocPtr doc; /* the document */
24660 int n_doc;
24661 xmlAttrPtr attr; /* the attribute */
24662 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024663
Daniel Veillardce244ad2004-11-05 10:03:46 +000024664 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24665 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24666 mem_base = xmlMemBlocks();
24667 doc = gen_xmlDocPtr(n_doc, 0);
24668 attr = gen_xmlAttrPtr(n_attr, 1);
24669
24670 ret_val = xmlRemoveRef(doc, attr);
24671 desret_int(ret_val);
24672 call_tests++;
24673 des_xmlDocPtr(n_doc, doc, 0);
24674 des_xmlAttrPtr(n_attr, attr, 1);
24675 xmlResetLastError();
24676 if (mem_base != xmlMemBlocks()) {
24677 printf("Leak of %d blocks found in xmlRemoveRef",
24678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024679 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024680 printf(" %d", n_doc);
24681 printf(" %d", n_attr);
24682 printf("\n");
24683 }
24684 }
24685 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024687
Daniel Veillard42595322004-11-08 10:52:06 +000024688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024689}
24690
24691
24692static int
24693test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024695
Daniel Veillardce682bc2004-11-05 17:22:25 +000024696 int mem_base;
24697 char * buf; /* an output buffer */
24698 int n_buf;
24699 int size; /* the buffer size */
24700 int n_size;
24701 xmlElementContentPtr content; /* An element table */
24702 int n_content;
24703 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24704 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024705
Daniel Veillardce682bc2004-11-05 17:22:25 +000024706 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24707 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24708 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24709 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24710 mem_base = xmlMemBlocks();
24711 buf = gen_char_ptr(n_buf, 0);
24712 size = gen_int(n_size, 1);
24713 content = gen_xmlElementContentPtr(n_content, 2);
24714 glob = gen_int(n_glob, 3);
24715
24716 xmlSnprintfElementContent(buf, size, content, glob);
24717 call_tests++;
24718 des_char_ptr(n_buf, buf, 0);
24719 des_int(n_size, size, 1);
24720 des_xmlElementContentPtr(n_content, content, 2);
24721 des_int(n_glob, glob, 3);
24722 xmlResetLastError();
24723 if (mem_base != xmlMemBlocks()) {
24724 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024726 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024727 printf(" %d", n_buf);
24728 printf(" %d", n_size);
24729 printf(" %d", n_content);
24730 printf(" %d", n_glob);
24731 printf("\n");
24732 }
24733 }
24734 }
24735 }
24736 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024737 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024738
Daniel Veillard42595322004-11-08 10:52:06 +000024739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024740}
24741
24742
24743static int
24744test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024746
William M. Brack21e4ef22005-01-02 09:53:13 +000024747#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024748#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024749 int mem_base;
24750 char * buf; /* an output buffer */
24751 int n_buf;
24752 xmlElementContentPtr content; /* An element table */
24753 int n_content;
24754 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24755 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024756
Daniel Veillardce682bc2004-11-05 17:22:25 +000024757 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24758 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24759 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24760 mem_base = xmlMemBlocks();
24761 buf = gen_char_ptr(n_buf, 0);
24762 content = gen_xmlElementContentPtr(n_content, 1);
24763 glob = gen_int(n_glob, 2);
24764
24765 xmlSprintfElementContent(buf, content, glob);
24766 call_tests++;
24767 des_char_ptr(n_buf, buf, 0);
24768 des_xmlElementContentPtr(n_content, content, 1);
24769 des_int(n_glob, glob, 2);
24770 xmlResetLastError();
24771 if (mem_base != xmlMemBlocks()) {
24772 printf("Leak of %d blocks found in xmlSprintfElementContent",
24773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024774 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024775 printf(" %d", n_buf);
24776 printf(" %d", n_content);
24777 printf(" %d", n_glob);
24778 printf("\n");
24779 }
24780 }
24781 }
24782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024783 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024784#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024785#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024786
Daniel Veillard42595322004-11-08 10:52:06 +000024787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024788}
24789
24790
24791static int
24792test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024794
William M. Brack21e4ef22005-01-02 09:53:13 +000024795#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024796 int mem_base;
24797 int ret_val;
24798 xmlValidCtxtPtr ctxt; /* a validation context */
24799 int n_ctxt;
24800 xmlElementPtr elem; /* an element declaration node */
24801 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024802
Daniel Veillardce682bc2004-11-05 17:22:25 +000024803 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24804 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24805 mem_base = xmlMemBlocks();
24806 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24807 elem = gen_xmlElementPtr(n_elem, 1);
24808
24809 ret_val = xmlValidBuildContentModel(ctxt, elem);
24810 desret_int(ret_val);
24811 call_tests++;
24812 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24813 des_xmlElementPtr(n_elem, elem, 1);
24814 xmlResetLastError();
24815 if (mem_base != xmlMemBlocks()) {
24816 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024818 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024819 printf(" %d", n_ctxt);
24820 printf(" %d", n_elem);
24821 printf("\n");
24822 }
24823 }
24824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024825 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024826#endif
24827
Daniel Veillard42595322004-11-08 10:52:06 +000024828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024829}
24830
24831
24832static int
24833test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024835
William M. Brack21e4ef22005-01-02 09:53:13 +000024836#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024837 int mem_base;
24838 xmlChar * ret_val;
24839 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24840 int n_ctxt;
24841 xmlDocPtr doc; /* the document */
24842 int n_doc;
24843 xmlNodePtr elem; /* the parent */
24844 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024845 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024846 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024847 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024848 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024849
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024850 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24851 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24852 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24853 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24854 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24855 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024856 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24857 doc = gen_xmlDocPtr(n_doc, 1);
24858 elem = gen_xmlNodePtr(n_elem, 2);
24859 name = gen_const_xmlChar_ptr(n_name, 3);
24860 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024861
William M. Brackf13f77f2004-11-12 16:03:48 +000024862 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024863 desret_xmlChar_ptr(ret_val);
24864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024865 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24866 des_xmlDocPtr(n_doc, doc, 1);
24867 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024868 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24869 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024870 xmlResetLastError();
24871 if (mem_base != xmlMemBlocks()) {
24872 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024874 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024875 printf(" %d", n_ctxt);
24876 printf(" %d", n_doc);
24877 printf(" %d", n_elem);
24878 printf(" %d", n_name);
24879 printf(" %d", n_value);
24880 printf("\n");
24881 }
24882 }
24883 }
24884 }
24885 }
24886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024887 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024888#endif
24889
Daniel Veillard42595322004-11-08 10:52:06 +000024890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024891}
24892
24893
Daniel Veillardce682bc2004-11-05 17:22:25 +000024894#define gen_nb_xmlElementContent_ptr 1
24895static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24896 return(NULL);
24897}
24898static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24899}
24900
Daniel Veillardd93f6252004-11-02 15:53:51 +000024901static int
24902test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024904
William M. Brack21e4ef22005-01-02 09:53:13 +000024905#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024906#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024907 int mem_base;
24908 int ret_val;
24909 xmlElementContent * ctree; /* an element content tree */
24910 int n_ctree;
24911 xmlChar ** list; /* an array to store the list of child names */
24912 int n_list;
24913 int * len; /* a pointer to the number of element in the list */
24914 int n_len;
24915 int max; /* the size of the array */
24916 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024917
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024918 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24919 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24920 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24921 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24922 mem_base = xmlMemBlocks();
24923 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24924 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24925 len = gen_int_ptr(n_len, 2);
24926 max = gen_int(n_max, 3);
24927
William M. Brackf13f77f2004-11-12 16:03:48 +000024928 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024929 desret_int(ret_val);
24930 call_tests++;
24931 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024932 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024933 des_int_ptr(n_len, len, 2);
24934 des_int(n_max, max, 3);
24935 xmlResetLastError();
24936 if (mem_base != xmlMemBlocks()) {
24937 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024939 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024940 printf(" %d", n_ctree);
24941 printf(" %d", n_list);
24942 printf(" %d", n_len);
24943 printf(" %d", n_max);
24944 printf("\n");
24945 }
24946 }
24947 }
24948 }
24949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024950 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024951#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024952#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024953
Daniel Veillard42595322004-11-08 10:52:06 +000024954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024955}
24956
24957
24958static int
24959test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024961
William M. Brack21e4ef22005-01-02 09:53:13 +000024962#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024963#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024964 int mem_base;
24965 int ret_val;
24966 xmlNode * prev; /* an element to insert after */
24967 int n_prev;
24968 xmlNode * next; /* an element to insert next */
24969 int n_next;
24970 xmlChar ** names; /* an array to store the list of child names */
24971 int n_names;
24972 int max; /* the size of the array */
24973 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024974
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024975 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24976 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24977 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24978 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24979 mem_base = xmlMemBlocks();
24980 prev = gen_xmlNodePtr(n_prev, 0);
24981 next = gen_xmlNodePtr(n_next, 1);
24982 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24983 max = gen_int(n_max, 3);
24984
William M. Brackf13f77f2004-11-12 16:03:48 +000024985 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024986 desret_int(ret_val);
24987 call_tests++;
24988 des_xmlNodePtr(n_prev, prev, 0);
24989 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024990 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024991 des_int(n_max, max, 3);
24992 xmlResetLastError();
24993 if (mem_base != xmlMemBlocks()) {
24994 printf("Leak of %d blocks found in xmlValidGetValidElements",
24995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024996 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024997 printf(" %d", n_prev);
24998 printf(" %d", n_next);
24999 printf(" %d", n_names);
25000 printf(" %d", n_max);
25001 printf("\n");
25002 }
25003 }
25004 }
25005 }
25006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025007 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000025008#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000025009#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025010
Daniel Veillard42595322004-11-08 10:52:06 +000025011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025012}
25013
25014
25015static int
25016test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025018
William M. Brack21e4ef22005-01-02 09:53:13 +000025019#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025020 int mem_base;
25021 xmlChar * ret_val;
25022 xmlDocPtr doc; /* the document */
25023 int n_doc;
25024 xmlNodePtr elem; /* the parent */
25025 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025026 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025027 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025028 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025029 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025030
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025031 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25032 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25033 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25034 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25035 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025036 doc = gen_xmlDocPtr(n_doc, 0);
25037 elem = gen_xmlNodePtr(n_elem, 1);
25038 name = gen_const_xmlChar_ptr(n_name, 2);
25039 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025040
William M. Brackf13f77f2004-11-12 16:03:48 +000025041 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025042 desret_xmlChar_ptr(ret_val);
25043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025044 des_xmlDocPtr(n_doc, doc, 0);
25045 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025046 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
25047 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025048 xmlResetLastError();
25049 if (mem_base != xmlMemBlocks()) {
25050 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
25051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025052 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025053 printf(" %d", n_doc);
25054 printf(" %d", n_elem);
25055 printf(" %d", n_name);
25056 printf(" %d", n_value);
25057 printf("\n");
25058 }
25059 }
25060 }
25061 }
25062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025063 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025064#endif
25065
Daniel Veillard42595322004-11-08 10:52:06 +000025066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025067}
25068
25069
25070static int
25071test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025073
William M. Brack21e4ef22005-01-02 09:53:13 +000025074#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025075 int mem_base;
25076 int ret_val;
25077 xmlValidCtxtPtr ctxt; /* the validation context */
25078 int n_ctxt;
25079 xmlDocPtr doc; /* a document instance */
25080 int n_doc;
25081 xmlAttributePtr attr; /* an attribute definition */
25082 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025083
Daniel Veillardce682bc2004-11-05 17:22:25 +000025084 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25086 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25087 mem_base = xmlMemBlocks();
25088 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25089 doc = gen_xmlDocPtr(n_doc, 1);
25090 attr = gen_xmlAttributePtr(n_attr, 2);
25091
25092 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25093 desret_int(ret_val);
25094 call_tests++;
25095 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25096 des_xmlDocPtr(n_doc, doc, 1);
25097 des_xmlAttributePtr(n_attr, attr, 2);
25098 xmlResetLastError();
25099 if (mem_base != xmlMemBlocks()) {
25100 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025102 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025103 printf(" %d", n_ctxt);
25104 printf(" %d", n_doc);
25105 printf(" %d", n_attr);
25106 printf("\n");
25107 }
25108 }
25109 }
25110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025111 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025112#endif
25113
Daniel Veillard42595322004-11-08 10:52:06 +000025114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025115}
25116
25117
25118static int
25119test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025121
William M. Brack21e4ef22005-01-02 09:53:13 +000025122#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000025123 int mem_base;
25124 int ret_val;
25125 xmlAttributeType type; /* an attribute type */
25126 int n_type;
25127 xmlChar * value; /* an attribute value */
25128 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025129
Daniel Veillard57b25162004-11-06 14:50:18 +000025130 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25131 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25132 mem_base = xmlMemBlocks();
25133 type = gen_xmlAttributeType(n_type, 0);
25134 value = gen_const_xmlChar_ptr(n_value, 1);
25135
William M. Brackf13f77f2004-11-12 16:03:48 +000025136 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025137 desret_int(ret_val);
25138 call_tests++;
25139 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025140 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025141 xmlResetLastError();
25142 if (mem_base != xmlMemBlocks()) {
25143 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025145 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025146 printf(" %d", n_type);
25147 printf(" %d", n_value);
25148 printf("\n");
25149 }
25150 }
25151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025152 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025153#endif
25154
Daniel Veillard42595322004-11-08 10:52:06 +000025155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025156}
25157
25158
25159static int
25160test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025162
William M. Brack21e4ef22005-01-02 09:53:13 +000025163#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025164 int mem_base;
25165 int ret_val;
25166 xmlValidCtxtPtr ctxt; /* the validation context */
25167 int n_ctxt;
25168 xmlDocPtr doc; /* a document instance */
25169 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025170
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025171 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025174 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25175 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025176
25177 ret_val = xmlValidateDocument(ctxt, doc);
25178 desret_int(ret_val);
25179 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025180 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25181 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025182 xmlResetLastError();
25183 if (mem_base != xmlMemBlocks()) {
25184 printf("Leak of %d blocks found in xmlValidateDocument",
25185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025186 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025187 printf(" %d", n_ctxt);
25188 printf(" %d", n_doc);
25189 printf("\n");
25190 }
25191 }
25192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025193 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025194#endif
25195
Daniel Veillard42595322004-11-08 10:52:06 +000025196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197}
25198
25199
25200static int
25201test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025203
William M. Brack21e4ef22005-01-02 09:53:13 +000025204#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025205 int mem_base;
25206 int ret_val;
25207 xmlValidCtxtPtr ctxt; /* the validation context */
25208 int n_ctxt;
25209 xmlDocPtr doc; /* a document instance */
25210 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025211
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025212 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25213 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025215 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25216 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025217
25218 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25219 desret_int(ret_val);
25220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025221 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25222 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025223 xmlResetLastError();
25224 if (mem_base != xmlMemBlocks()) {
25225 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025227 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025228 printf(" %d", n_ctxt);
25229 printf(" %d", n_doc);
25230 printf("\n");
25231 }
25232 }
25233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025234 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025235#endif
25236
Daniel Veillard42595322004-11-08 10:52:06 +000025237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025238}
25239
25240
25241static int
25242test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025244
William M. Brack21e4ef22005-01-02 09:53:13 +000025245#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025246 int mem_base;
25247 int ret_val;
25248 xmlValidCtxtPtr ctxt; /* the validation context */
25249 int n_ctxt;
25250 xmlDocPtr doc; /* a document instance */
25251 int n_doc;
25252 xmlDtdPtr dtd; /* a dtd instance */
25253 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025254
Daniel Veillard27f20102004-11-05 11:50:11 +000025255 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25256 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25257 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25258 mem_base = xmlMemBlocks();
25259 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25260 doc = gen_xmlDocPtr(n_doc, 1);
25261 dtd = gen_xmlDtdPtr(n_dtd, 2);
25262
25263 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25264 desret_int(ret_val);
25265 call_tests++;
25266 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25267 des_xmlDocPtr(n_doc, doc, 1);
25268 des_xmlDtdPtr(n_dtd, dtd, 2);
25269 xmlResetLastError();
25270 if (mem_base != xmlMemBlocks()) {
25271 printf("Leak of %d blocks found in xmlValidateDtd",
25272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025273 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025274 printf(" %d", n_ctxt);
25275 printf(" %d", n_doc);
25276 printf(" %d", n_dtd);
25277 printf("\n");
25278 }
25279 }
25280 }
25281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025282 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025283#endif
25284
Daniel Veillard42595322004-11-08 10:52:06 +000025285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025286}
25287
25288
25289static int
25290test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025292
William M. Brack21e4ef22005-01-02 09:53:13 +000025293#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025294 int mem_base;
25295 int ret_val;
25296 xmlValidCtxtPtr ctxt; /* the validation context */
25297 int n_ctxt;
25298 xmlDocPtr doc; /* a document instance */
25299 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025300
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25302 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25303 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025304 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25305 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025306
25307 ret_val = xmlValidateDtdFinal(ctxt, doc);
25308 desret_int(ret_val);
25309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025310 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25311 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025312 xmlResetLastError();
25313 if (mem_base != xmlMemBlocks()) {
25314 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025316 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025317 printf(" %d", n_ctxt);
25318 printf(" %d", n_doc);
25319 printf("\n");
25320 }
25321 }
25322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025323 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025324#endif
25325
Daniel Veillard42595322004-11-08 10:52:06 +000025326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025327}
25328
25329
25330static int
25331test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025333
William M. Brack21e4ef22005-01-02 09:53:13 +000025334#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025335 int mem_base;
25336 int ret_val;
25337 xmlValidCtxtPtr ctxt; /* the validation context */
25338 int n_ctxt;
25339 xmlDocPtr doc; /* a document instance */
25340 int n_doc;
25341 xmlNodePtr elem; /* an element instance */
25342 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025343
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025344 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25345 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25346 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025348 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25349 doc = gen_xmlDocPtr(n_doc, 1);
25350 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025351
25352 ret_val = xmlValidateElement(ctxt, doc, elem);
25353 desret_int(ret_val);
25354 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025355 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25356 des_xmlDocPtr(n_doc, doc, 1);
25357 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025358 xmlResetLastError();
25359 if (mem_base != xmlMemBlocks()) {
25360 printf("Leak of %d blocks found in xmlValidateElement",
25361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025362 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025363 printf(" %d", n_ctxt);
25364 printf(" %d", n_doc);
25365 printf(" %d", n_elem);
25366 printf("\n");
25367 }
25368 }
25369 }
25370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025371 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025372#endif
25373
Daniel Veillard42595322004-11-08 10:52:06 +000025374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025375}
25376
25377
25378static int
25379test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025381
William M. Brack21e4ef22005-01-02 09:53:13 +000025382#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025383 int mem_base;
25384 int ret_val;
25385 xmlValidCtxtPtr ctxt; /* the validation context */
25386 int n_ctxt;
25387 xmlDocPtr doc; /* a document instance */
25388 int n_doc;
25389 xmlElementPtr elem; /* an element definition */
25390 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025391
Daniel Veillardce682bc2004-11-05 17:22:25 +000025392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25393 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25394 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25395 mem_base = xmlMemBlocks();
25396 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25397 doc = gen_xmlDocPtr(n_doc, 1);
25398 elem = gen_xmlElementPtr(n_elem, 2);
25399
25400 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25401 desret_int(ret_val);
25402 call_tests++;
25403 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25404 des_xmlDocPtr(n_doc, doc, 1);
25405 des_xmlElementPtr(n_elem, elem, 2);
25406 xmlResetLastError();
25407 if (mem_base != xmlMemBlocks()) {
25408 printf("Leak of %d blocks found in xmlValidateElementDecl",
25409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025411 printf(" %d", n_ctxt);
25412 printf(" %d", n_doc);
25413 printf(" %d", n_elem);
25414 printf("\n");
25415 }
25416 }
25417 }
25418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025419 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025420#endif
25421
Daniel Veillard42595322004-11-08 10:52:06 +000025422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025423}
25424
25425
25426static int
25427test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025429
William M. Brack21e4ef22005-01-02 09:53:13 +000025430#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025431 int mem_base;
25432 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025433 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025434 int n_value;
25435
25436 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025438 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025439
William M. Brackf13f77f2004-11-12 16:03:48 +000025440 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025441 desret_int(ret_val);
25442 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025443 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025444 xmlResetLastError();
25445 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025446 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025448 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025449 printf(" %d", n_value);
25450 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025451 }
25452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025453 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025454#endif
25455
Daniel Veillard42595322004-11-08 10:52:06 +000025456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025457}
25458
25459
25460static int
25461test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025463
William M. Brack21e4ef22005-01-02 09:53:13 +000025464#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025465 int mem_base;
25466 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025467 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025468 int n_value;
25469
25470 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025472 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025473
William M. Brackf13f77f2004-11-12 16:03:48 +000025474 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025475 desret_int(ret_val);
25476 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025477 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025478 xmlResetLastError();
25479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025480 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025483 printf(" %d", n_value);
25484 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025485 }
25486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025487 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025488#endif
25489
Daniel Veillard42595322004-11-08 10:52:06 +000025490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025491}
25492
25493
25494static int
25495test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025497
William M. Brack21e4ef22005-01-02 09:53:13 +000025498#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025499 int mem_base;
25500 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025501 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025502 int n_value;
25503
25504 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025506 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025507
William M. Brackf13f77f2004-11-12 16:03:48 +000025508 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025509 desret_int(ret_val);
25510 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025511 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025512 xmlResetLastError();
25513 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025514 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025517 printf(" %d", n_value);
25518 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025519 }
25520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025521 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025522#endif
25523
Daniel Veillard42595322004-11-08 10:52:06 +000025524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025525}
25526
25527
25528static int
25529test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025531
William M. Brack21e4ef22005-01-02 09:53:13 +000025532#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025533 int mem_base;
25534 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025535 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025536 int n_value;
25537
25538 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025540 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025541
William M. Brackf13f77f2004-11-12 16:03:48 +000025542 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025543 desret_int(ret_val);
25544 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025545 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025546 xmlResetLastError();
25547 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025548 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025550 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025551 printf(" %d", n_value);
25552 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025553 }
25554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025555 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025556#endif
25557
Daniel Veillard42595322004-11-08 10:52:06 +000025558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025559}
25560
25561
25562static int
25563test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025565
William M. Brack21e4ef22005-01-02 09:53:13 +000025566#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025567 int mem_base;
25568 int ret_val;
25569 xmlValidCtxtPtr ctxt; /* the validation context */
25570 int n_ctxt;
25571 xmlDocPtr doc; /* a document instance */
25572 int n_doc;
25573 xmlNotationPtr nota; /* a notation definition */
25574 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025575
Daniel Veillardce682bc2004-11-05 17:22:25 +000025576 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25577 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25578 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25579 mem_base = xmlMemBlocks();
25580 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25581 doc = gen_xmlDocPtr(n_doc, 1);
25582 nota = gen_xmlNotationPtr(n_nota, 2);
25583
25584 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25585 desret_int(ret_val);
25586 call_tests++;
25587 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25588 des_xmlDocPtr(n_doc, doc, 1);
25589 des_xmlNotationPtr(n_nota, nota, 2);
25590 xmlResetLastError();
25591 if (mem_base != xmlMemBlocks()) {
25592 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025594 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025595 printf(" %d", n_ctxt);
25596 printf(" %d", n_doc);
25597 printf(" %d", n_nota);
25598 printf("\n");
25599 }
25600 }
25601 }
25602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025603 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025604#endif
25605
Daniel Veillard42595322004-11-08 10:52:06 +000025606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025607}
25608
25609
25610static int
25611test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025613
William M. Brack21e4ef22005-01-02 09:53:13 +000025614#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025615 int mem_base;
25616 int ret_val;
25617 xmlValidCtxtPtr ctxt; /* the validation context */
25618 int n_ctxt;
25619 xmlDocPtr doc; /* the document */
25620 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025621 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025622 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025623
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025624 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25625 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25626 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025628 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25629 doc = gen_xmlDocPtr(n_doc, 1);
25630 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025631
William M. Brackf13f77f2004-11-12 16:03:48 +000025632 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025633 desret_int(ret_val);
25634 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025635 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25636 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025637 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025638 xmlResetLastError();
25639 if (mem_base != xmlMemBlocks()) {
25640 printf("Leak of %d blocks found in xmlValidateNotationUse",
25641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025642 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025643 printf(" %d", n_ctxt);
25644 printf(" %d", n_doc);
25645 printf(" %d", n_notationName);
25646 printf("\n");
25647 }
25648 }
25649 }
25650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025651 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025652#endif
25653
Daniel Veillard42595322004-11-08 10:52:06 +000025654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025655}
25656
25657
25658static int
25659test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025661
William M. Brack21e4ef22005-01-02 09:53:13 +000025662#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025663 int mem_base;
25664 int ret_val;
25665 xmlValidCtxtPtr ctxt; /* the validation context */
25666 int n_ctxt;
25667 xmlDocPtr doc; /* a document instance */
25668 int n_doc;
25669 xmlNodePtr elem; /* an element instance */
25670 int n_elem;
25671 xmlAttrPtr attr; /* an attribute instance */
25672 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025673 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025674 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025675
Daniel Veillardce244ad2004-11-05 10:03:46 +000025676 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25677 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25678 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25679 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25680 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25681 mem_base = xmlMemBlocks();
25682 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25683 doc = gen_xmlDocPtr(n_doc, 1);
25684 elem = gen_xmlNodePtr(n_elem, 2);
25685 attr = gen_xmlAttrPtr(n_attr, 3);
25686 value = gen_const_xmlChar_ptr(n_value, 4);
25687
William M. Brackf13f77f2004-11-12 16:03:48 +000025688 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025689 desret_int(ret_val);
25690 call_tests++;
25691 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25692 des_xmlDocPtr(n_doc, doc, 1);
25693 des_xmlNodePtr(n_elem, elem, 2);
25694 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025695 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025696 xmlResetLastError();
25697 if (mem_base != xmlMemBlocks()) {
25698 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025700 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025701 printf(" %d", n_ctxt);
25702 printf(" %d", n_doc);
25703 printf(" %d", n_elem);
25704 printf(" %d", n_attr);
25705 printf(" %d", n_value);
25706 printf("\n");
25707 }
25708 }
25709 }
25710 }
25711 }
25712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025713 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025714#endif
25715
Daniel Veillard42595322004-11-08 10:52:06 +000025716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025717}
25718
25719
25720static int
25721test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025723
William M. Brack21e4ef22005-01-02 09:53:13 +000025724#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025725 int mem_base;
25726 int ret_val;
25727 xmlValidCtxtPtr ctxt; /* the validation context */
25728 int n_ctxt;
25729 xmlDocPtr doc; /* a document instance */
25730 int n_doc;
25731 xmlNodePtr elem; /* an element instance */
25732 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025733
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025734 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25735 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25736 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025738 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25739 doc = gen_xmlDocPtr(n_doc, 1);
25740 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025741
25742 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25743 desret_int(ret_val);
25744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025745 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25746 des_xmlDocPtr(n_doc, doc, 1);
25747 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025748 xmlResetLastError();
25749 if (mem_base != xmlMemBlocks()) {
25750 printf("Leak of %d blocks found in xmlValidateOneElement",
25751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025752 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025753 printf(" %d", n_ctxt);
25754 printf(" %d", n_doc);
25755 printf(" %d", n_elem);
25756 printf("\n");
25757 }
25758 }
25759 }
25760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025761 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025762#endif
25763
Daniel Veillard42595322004-11-08 10:52:06 +000025764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025765}
25766
25767
25768static int
25769test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025771
William M. Brack21e4ef22005-01-02 09:53:13 +000025772#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025773 int mem_base;
25774 int ret_val;
25775 xmlValidCtxtPtr ctxt; /* the validation context */
25776 int n_ctxt;
25777 xmlDocPtr doc; /* a document instance */
25778 int n_doc;
25779 xmlNodePtr elem; /* an element instance */
25780 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025781 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025782 int n_prefix;
25783 xmlNsPtr ns; /* an namespace declaration instance */
25784 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025785 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025786 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025787
Daniel Veillard27f20102004-11-05 11:50:11 +000025788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25789 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25790 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25791 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25792 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25793 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25794 mem_base = xmlMemBlocks();
25795 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25796 doc = gen_xmlDocPtr(n_doc, 1);
25797 elem = gen_xmlNodePtr(n_elem, 2);
25798 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25799 ns = gen_xmlNsPtr(n_ns, 4);
25800 value = gen_const_xmlChar_ptr(n_value, 5);
25801
William M. Brackf13f77f2004-11-12 16:03:48 +000025802 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025803 desret_int(ret_val);
25804 call_tests++;
25805 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25806 des_xmlDocPtr(n_doc, doc, 1);
25807 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025808 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025809 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025810 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025811 xmlResetLastError();
25812 if (mem_base != xmlMemBlocks()) {
25813 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025815 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025816 printf(" %d", n_ctxt);
25817 printf(" %d", n_doc);
25818 printf(" %d", n_elem);
25819 printf(" %d", n_prefix);
25820 printf(" %d", n_ns);
25821 printf(" %d", n_value);
25822 printf("\n");
25823 }
25824 }
25825 }
25826 }
25827 }
25828 }
25829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025830 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025831#endif
25832
Daniel Veillard42595322004-11-08 10:52:06 +000025833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025834}
25835
25836
25837static int
25838test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025840
William M. Brack21e4ef22005-01-02 09:53:13 +000025841#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025842 int mem_base;
25843 int ret_val;
25844 xmlValidCtxtPtr ctxt; /* the validation context */
25845 int n_ctxt;
25846 xmlDocPtr doc; /* a document instance */
25847 int n_doc;
25848 xmlNodePtr elem; /* an element instance */
25849 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025850 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025851 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025852
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25854 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25855 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25856 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025858 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25859 doc = gen_xmlDocPtr(n_doc, 1);
25860 elem = gen_xmlNodePtr(n_elem, 2);
25861 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025862
William M. Brackf13f77f2004-11-12 16:03:48 +000025863 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025864 desret_int(ret_val);
25865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025866 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25867 des_xmlDocPtr(n_doc, doc, 1);
25868 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025869 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025870 xmlResetLastError();
25871 if (mem_base != xmlMemBlocks()) {
25872 printf("Leak of %d blocks found in xmlValidatePopElement",
25873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025874 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025875 printf(" %d", n_ctxt);
25876 printf(" %d", n_doc);
25877 printf(" %d", n_elem);
25878 printf(" %d", n_qname);
25879 printf("\n");
25880 }
25881 }
25882 }
25883 }
25884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025885 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025886#endif
25887
Daniel Veillard42595322004-11-08 10:52:06 +000025888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025889}
25890
25891
25892static int
25893test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025895
William M. Brack21e4ef22005-01-02 09:53:13 +000025896#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025897 int mem_base;
25898 int ret_val;
25899 xmlValidCtxtPtr ctxt; /* the validation context */
25900 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025901 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025902 int n_data;
25903 int len; /* the lenght of the data */
25904 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025905
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25907 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25908 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025910 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25911 data = gen_const_xmlChar_ptr(n_data, 1);
25912 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025913
William M. Brackf13f77f2004-11-12 16:03:48 +000025914 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025915 desret_int(ret_val);
25916 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025917 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025918 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025919 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025920 xmlResetLastError();
25921 if (mem_base != xmlMemBlocks()) {
25922 printf("Leak of %d blocks found in xmlValidatePushCData",
25923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025924 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025925 printf(" %d", n_ctxt);
25926 printf(" %d", n_data);
25927 printf(" %d", n_len);
25928 printf("\n");
25929 }
25930 }
25931 }
25932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025933 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025934#endif
25935
Daniel Veillard42595322004-11-08 10:52:06 +000025936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025937}
25938
25939
25940static int
25941test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025943
William M. Brack21e4ef22005-01-02 09:53:13 +000025944#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025945 int mem_base;
25946 int ret_val;
25947 xmlValidCtxtPtr ctxt; /* the validation context */
25948 int n_ctxt;
25949 xmlDocPtr doc; /* a document instance */
25950 int n_doc;
25951 xmlNodePtr elem; /* an element instance */
25952 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025953 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025954 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025955
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025956 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25957 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25958 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25959 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025961 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25962 doc = gen_xmlDocPtr(n_doc, 1);
25963 elem = gen_xmlNodePtr(n_elem, 2);
25964 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025965
William M. Brackf13f77f2004-11-12 16:03:48 +000025966 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025967 desret_int(ret_val);
25968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025969 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25970 des_xmlDocPtr(n_doc, doc, 1);
25971 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025972 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025973 xmlResetLastError();
25974 if (mem_base != xmlMemBlocks()) {
25975 printf("Leak of %d blocks found in xmlValidatePushElement",
25976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025977 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025978 printf(" %d", n_ctxt);
25979 printf(" %d", n_doc);
25980 printf(" %d", n_elem);
25981 printf(" %d", n_qname);
25982 printf("\n");
25983 }
25984 }
25985 }
25986 }
25987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025988 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025989#endif
25990
Daniel Veillard42595322004-11-08 10:52:06 +000025991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025992}
25993
25994
25995static int
25996test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025998
William M. Brack21e4ef22005-01-02 09:53:13 +000025999#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026000 int mem_base;
26001 int ret_val;
26002 xmlValidCtxtPtr ctxt; /* the validation context */
26003 int n_ctxt;
26004 xmlDocPtr doc; /* a document instance */
26005 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026006
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026007 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26008 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026010 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26011 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026012
26013 ret_val = xmlValidateRoot(ctxt, doc);
26014 desret_int(ret_val);
26015 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026016 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26017 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026018 xmlResetLastError();
26019 if (mem_base != xmlMemBlocks()) {
26020 printf("Leak of %d blocks found in xmlValidateRoot",
26021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026022 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026023 printf(" %d", n_ctxt);
26024 printf(" %d", n_doc);
26025 printf("\n");
26026 }
26027 }
26028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026029 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026030#endif
26031
Daniel Veillard42595322004-11-08 10:52:06 +000026032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026033}
26034
26035static int
26036test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026038
Daniel Veillard2ae13382005-01-25 23:45:06 +000026039 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026040 test_ret += test_xmlAddAttributeDecl();
26041 test_ret += test_xmlAddElementDecl();
26042 test_ret += test_xmlAddID();
26043 test_ret += test_xmlAddNotationDecl();
26044 test_ret += test_xmlAddRef();
26045 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026046 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026047 test_ret += test_xmlCopyElementContent();
26048 test_ret += test_xmlCopyElementTable();
26049 test_ret += test_xmlCopyEnumeration();
26050 test_ret += test_xmlCopyNotationTable();
26051 test_ret += test_xmlCreateEnumeration();
26052 test_ret += test_xmlDumpAttributeDecl();
26053 test_ret += test_xmlDumpAttributeTable();
26054 test_ret += test_xmlDumpElementDecl();
26055 test_ret += test_xmlDumpElementTable();
26056 test_ret += test_xmlDumpNotationDecl();
26057 test_ret += test_xmlDumpNotationTable();
26058 test_ret += test_xmlGetDtdAttrDesc();
26059 test_ret += test_xmlGetDtdElementDesc();
26060 test_ret += test_xmlGetDtdNotationDesc();
26061 test_ret += test_xmlGetDtdQAttrDesc();
26062 test_ret += test_xmlGetDtdQElementDesc();
26063 test_ret += test_xmlGetID();
26064 test_ret += test_xmlGetRefs();
26065 test_ret += test_xmlIsID();
26066 test_ret += test_xmlIsMixedElement();
26067 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026068 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026069 test_ret += test_xmlNewElementContent();
26070 test_ret += test_xmlNewValidCtxt();
26071 test_ret += test_xmlRemoveID();
26072 test_ret += test_xmlRemoveRef();
26073 test_ret += test_xmlSnprintfElementContent();
26074 test_ret += test_xmlSprintfElementContent();
26075 test_ret += test_xmlValidBuildContentModel();
26076 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26077 test_ret += test_xmlValidGetPotentialChildren();
26078 test_ret += test_xmlValidGetValidElements();
26079 test_ret += test_xmlValidNormalizeAttributeValue();
26080 test_ret += test_xmlValidateAttributeDecl();
26081 test_ret += test_xmlValidateAttributeValue();
26082 test_ret += test_xmlValidateDocument();
26083 test_ret += test_xmlValidateDocumentFinal();
26084 test_ret += test_xmlValidateDtd();
26085 test_ret += test_xmlValidateDtdFinal();
26086 test_ret += test_xmlValidateElement();
26087 test_ret += test_xmlValidateElementDecl();
26088 test_ret += test_xmlValidateNameValue();
26089 test_ret += test_xmlValidateNamesValue();
26090 test_ret += test_xmlValidateNmtokenValue();
26091 test_ret += test_xmlValidateNmtokensValue();
26092 test_ret += test_xmlValidateNotationDecl();
26093 test_ret += test_xmlValidateNotationUse();
26094 test_ret += test_xmlValidateOneAttribute();
26095 test_ret += test_xmlValidateOneElement();
26096 test_ret += test_xmlValidateOneNamespace();
26097 test_ret += test_xmlValidatePopElement();
26098 test_ret += test_xmlValidatePushCData();
26099 test_ret += test_xmlValidatePushElement();
26100 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026101
Daniel Veillard42595322004-11-08 10:52:06 +000026102 if (test_ret != 0)
26103 printf("Module valid: %d errors\n", test_ret);
26104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026105}
26106
26107static int
26108test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026110
26111
26112 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026114}
26115
26116
26117static int
26118test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026120
William M. Brack21e4ef22005-01-02 09:53:13 +000026121#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026122 int mem_base;
26123 int ret_val;
26124 xmlDocPtr doc; /* an XML document */
26125 int n_doc;
26126
26127 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026129 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026130
26131 ret_val = xmlXIncludeProcess(doc);
26132 desret_int(ret_val);
26133 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026134 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026135 xmlResetLastError();
26136 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026137 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026139 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026140 printf(" %d", n_doc);
26141 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026142 }
26143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026144 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026145#endif
26146
Daniel Veillard42595322004-11-08 10:52:06 +000026147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026148}
26149
26150
26151static int
26152test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026154
William M. Brack21e4ef22005-01-02 09:53:13 +000026155#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026156 int mem_base;
26157 int ret_val;
26158 xmlDocPtr doc; /* an XML document */
26159 int n_doc;
26160 int flags; /* a set of xmlParserOption used for parsing XML includes */
26161 int n_flags;
26162
26163 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26164 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026166 doc = gen_xmlDocPtr(n_doc, 0);
26167 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026168
26169 ret_val = xmlXIncludeProcessFlags(doc, flags);
26170 desret_int(ret_val);
26171 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026172 des_xmlDocPtr(n_doc, doc, 0);
26173 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026174 xmlResetLastError();
26175 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026176 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026178 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026179 printf(" %d", n_doc);
26180 printf(" %d", n_flags);
26181 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026182 }
26183 }
26184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026185 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026186#endif
26187
Daniel Veillard42595322004-11-08 10:52:06 +000026188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026189}
26190
Daniel Veillarda521d282004-11-09 14:59:59 +000026191#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026192
Daniel Veillardce682bc2004-11-05 17:22:25 +000026193#define gen_nb_xmlXIncludeCtxtPtr 1
26194static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26195 return(NULL);
26196}
26197static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26198}
Daniel Veillarda521d282004-11-09 14:59:59 +000026199#endif
26200
Daniel Veillardce682bc2004-11-05 17:22:25 +000026201
Daniel Veillardd93f6252004-11-02 15:53:51 +000026202static int
26203test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205
William M. Brack21e4ef22005-01-02 09:53:13 +000026206#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026207 int mem_base;
26208 int ret_val;
26209 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26210 int n_ctxt;
26211 xmlNodePtr node; /* a node in an XML document */
26212 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026213
Daniel Veillardce682bc2004-11-05 17:22:25 +000026214 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26215 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26216 mem_base = xmlMemBlocks();
26217 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26218 node = gen_xmlNodePtr(n_node, 1);
26219
26220 ret_val = xmlXIncludeProcessNode(ctxt, node);
26221 desret_int(ret_val);
26222 call_tests++;
26223 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26224 des_xmlNodePtr(n_node, node, 1);
26225 xmlResetLastError();
26226 if (mem_base != xmlMemBlocks()) {
26227 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026229 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026230 printf(" %d", n_ctxt);
26231 printf(" %d", n_node);
26232 printf("\n");
26233 }
26234 }
26235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026236 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026237#endif
26238
Daniel Veillard42595322004-11-08 10:52:06 +000026239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026240}
26241
26242
26243static int
26244test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026246
William M. Brack21e4ef22005-01-02 09:53:13 +000026247#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026248 int mem_base;
26249 int ret_val;
26250 xmlNodePtr tree; /* a node in an XML document */
26251 int n_tree;
26252
26253 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026255 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026256
26257 ret_val = xmlXIncludeProcessTree(tree);
26258 desret_int(ret_val);
26259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026260 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026261 xmlResetLastError();
26262 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026263 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026265 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf(" %d", n_tree);
26267 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026268 }
26269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026270 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026271#endif
26272
Daniel Veillard42595322004-11-08 10:52:06 +000026273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026274}
26275
26276
26277static int
26278test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026280
William M. Brack21e4ef22005-01-02 09:53:13 +000026281#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026282 int mem_base;
26283 int ret_val;
26284 xmlNodePtr tree; /* a node in an XML document */
26285 int n_tree;
26286 int flags; /* a set of xmlParserOption used for parsing XML includes */
26287 int n_flags;
26288
26289 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26290 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26291 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026292 tree = gen_xmlNodePtr(n_tree, 0);
26293 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026294
26295 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26296 desret_int(ret_val);
26297 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026298 des_xmlNodePtr(n_tree, tree, 0);
26299 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026300 xmlResetLastError();
26301 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026302 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026304 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026305 printf(" %d", n_tree);
26306 printf(" %d", n_flags);
26307 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026308 }
26309 }
26310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026311 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026312#endif
26313
Daniel Veillard42595322004-11-08 10:52:06 +000026314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026315}
26316
26317
26318static int
26319test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026321
William M. Brack21e4ef22005-01-02 09:53:13 +000026322#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026323 int mem_base;
26324 int ret_val;
26325 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26326 int n_ctxt;
26327 int flags; /* a set of xmlParserOption used for parsing XML includes */
26328 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026329
Daniel Veillardce682bc2004-11-05 17:22:25 +000026330 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26331 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26332 mem_base = xmlMemBlocks();
26333 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26334 flags = gen_int(n_flags, 1);
26335
26336 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26337 desret_int(ret_val);
26338 call_tests++;
26339 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26340 des_int(n_flags, flags, 1);
26341 xmlResetLastError();
26342 if (mem_base != xmlMemBlocks()) {
26343 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026345 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026346 printf(" %d", n_ctxt);
26347 printf(" %d", n_flags);
26348 printf("\n");
26349 }
26350 }
26351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026352 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026353#endif
26354
Daniel Veillard42595322004-11-08 10:52:06 +000026355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026356}
26357
26358static int
26359test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026361
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026362 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026363 test_ret += test_xmlXIncludeNewContext();
26364 test_ret += test_xmlXIncludeProcess();
26365 test_ret += test_xmlXIncludeProcessFlags();
26366 test_ret += test_xmlXIncludeProcessNode();
26367 test_ret += test_xmlXIncludeProcessTree();
26368 test_ret += test_xmlXIncludeProcessTreeFlags();
26369 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026370
Daniel Veillard42595322004-11-08 10:52:06 +000026371 if (test_ret != 0)
26372 printf("Module xinclude: %d errors\n", test_ret);
26373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374}
26375
26376static int
26377test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379
William M. Brack21e4ef22005-01-02 09:53:13 +000026380#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026381 int mem_base;
26382 xmlOutputBufferPtr ret_val;
26383 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26384 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026385
Daniel Veillard3d95c732004-11-06 22:25:14 +000026386 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26387 mem_base = xmlMemBlocks();
26388 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26389
26390 ret_val = xmlAllocOutputBuffer(encoder);
26391 desret_xmlOutputBufferPtr(ret_val);
26392 call_tests++;
26393 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26394 xmlResetLastError();
26395 if (mem_base != xmlMemBlocks()) {
26396 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026398 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026399 printf(" %d", n_encoder);
26400 printf("\n");
26401 }
26402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026403 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026404#endif
26405
Daniel Veillard42595322004-11-08 10:52:06 +000026406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026407}
26408
26409
26410static int
26411test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026413
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026414 int mem_base;
26415 xmlParserInputBufferPtr ret_val;
26416 xmlCharEncoding enc; /* the charset encoding if known */
26417 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026418
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026419 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26420 mem_base = xmlMemBlocks();
26421 enc = gen_xmlCharEncoding(n_enc, 0);
26422
26423 ret_val = xmlAllocParserInputBuffer(enc);
26424 desret_xmlParserInputBufferPtr(ret_val);
26425 call_tests++;
26426 des_xmlCharEncoding(n_enc, enc, 0);
26427 xmlResetLastError();
26428 if (mem_base != xmlMemBlocks()) {
26429 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026431 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026432 printf(" %d", n_enc);
26433 printf("\n");
26434 }
26435 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026437
Daniel Veillard42595322004-11-08 10:52:06 +000026438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026439}
26440
26441
26442static int
26443test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026445
26446 int mem_base;
26447 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026448 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026449 int n_path;
26450
26451 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026453 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026454
William M. Brackf13f77f2004-11-12 16:03:48 +000026455 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026456 desret_int(ret_val);
26457 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026458 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026459 xmlResetLastError();
26460 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026461 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026464 printf(" %d", n_path);
26465 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026466 }
26467 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026468 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026469
Daniel Veillard42595322004-11-08 10:52:06 +000026470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026471}
26472
26473
26474static int
26475test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026477
Daniel Veillard42595322004-11-08 10:52:06 +000026478 int mem_base;
26479 xmlParserInputPtr ret_val;
26480 xmlParserCtxtPtr ctxt; /* an XML parser context */
26481 int n_ctxt;
26482 xmlParserInputPtr ret; /* an XML parser input */
26483 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026484
Daniel Veillard42595322004-11-08 10:52:06 +000026485 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26486 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26487 mem_base = xmlMemBlocks();
26488 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26489 ret = gen_xmlParserInputPtr(n_ret, 1);
26490
26491 ret_val = xmlCheckHTTPInput(ctxt, ret);
26492 desret_xmlParserInputPtr(ret_val);
26493 call_tests++;
26494 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26495 des_xmlParserInputPtr(n_ret, ret, 1);
26496 xmlResetLastError();
26497 if (mem_base != xmlMemBlocks()) {
26498 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26499 xmlMemBlocks() - mem_base);
26500 test_ret++;
26501 printf(" %d", n_ctxt);
26502 printf(" %d", n_ret);
26503 printf("\n");
26504 }
26505 }
26506 }
Daniel Veillard42595322004-11-08 10:52:06 +000026507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026508
Daniel Veillard42595322004-11-08 10:52:06 +000026509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026510}
26511
26512
26513static int
26514test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026516
26517 int mem_base;
26518
26519 mem_base = xmlMemBlocks();
26520
26521 xmlCleanupInputCallbacks();
26522 call_tests++;
26523 xmlResetLastError();
26524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026525 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026529 }
Daniel Veillard3d97e662004-11-04 10:49:00 +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_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026539
William M. Brack21e4ef22005-01-02 09:53:13 +000026540#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026541 int mem_base;
26542
26543 mem_base = xmlMemBlocks();
26544
26545 xmlCleanupOutputCallbacks();
26546 call_tests++;
26547 xmlResetLastError();
26548 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026549 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026551 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026552 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026554 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026555#endif
26556
Daniel Veillard42595322004-11-08 10:52:06 +000026557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026558}
26559
26560
26561static int
26562test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026564
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026565 int mem_base;
26566 int ret_val;
26567 void * context; /* the I/O context */
26568 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026569
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026570 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026572 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026573
26574 ret_val = xmlFileClose(context);
26575 desret_int(ret_val);
26576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026577 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026578 xmlResetLastError();
26579 if (mem_base != xmlMemBlocks()) {
26580 printf("Leak of %d blocks found in xmlFileClose",
26581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026582 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026583 printf(" %d", n_context);
26584 printf("\n");
26585 }
26586 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026587 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026588
Daniel Veillard42595322004-11-08 10:52:06 +000026589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026590}
26591
26592
26593static int
26594test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026596
26597 int mem_base;
26598 int ret_val;
26599 const char * filename; /* the URI for matching */
26600 int n_filename;
26601
26602 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26603 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026604 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026605
26606 ret_val = xmlFileMatch(filename);
26607 desret_int(ret_val);
26608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026609 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026610 xmlResetLastError();
26611 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026612 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026614 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026615 printf(" %d", n_filename);
26616 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026617 }
26618 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026620
Daniel Veillard42595322004-11-08 10:52:06 +000026621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026622}
26623
26624
26625static int
26626test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026628
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026629 int mem_base;
26630 void * ret_val;
26631 const char * filename; /* the URI for matching */
26632 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026633
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026634 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026636 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026637
26638 ret_val = xmlFileOpen(filename);
26639 desret_void_ptr(ret_val);
26640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026641 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026642 xmlResetLastError();
26643 if (mem_base != xmlMemBlocks()) {
26644 printf("Leak of %d blocks found in xmlFileOpen",
26645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026646 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026647 printf(" %d", n_filename);
26648 printf("\n");
26649 }
26650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026652
Daniel Veillard42595322004-11-08 10:52:06 +000026653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026654}
26655
26656
26657static int
26658test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026660
Daniel Veillardce682bc2004-11-05 17:22:25 +000026661 int mem_base;
26662 int ret_val;
26663 void * context; /* the I/O context */
26664 int n_context;
26665 char * buffer; /* where to drop data */
26666 int n_buffer;
26667 int len; /* number of bytes to write */
26668 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026669
Daniel Veillardce682bc2004-11-05 17:22:25 +000026670 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26671 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26672 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26673 mem_base = xmlMemBlocks();
26674 context = gen_void_ptr(n_context, 0);
26675 buffer = gen_char_ptr(n_buffer, 1);
26676 len = gen_int(n_len, 2);
26677
26678 ret_val = xmlFileRead(context, buffer, len);
26679 desret_int(ret_val);
26680 call_tests++;
26681 des_void_ptr(n_context, context, 0);
26682 des_char_ptr(n_buffer, buffer, 1);
26683 des_int(n_len, len, 2);
26684 xmlResetLastError();
26685 if (mem_base != xmlMemBlocks()) {
26686 printf("Leak of %d blocks found in xmlFileRead",
26687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026688 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026689 printf(" %d", n_context);
26690 printf(" %d", n_buffer);
26691 printf(" %d", n_len);
26692 printf("\n");
26693 }
26694 }
26695 }
26696 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026698
Daniel Veillard42595322004-11-08 10:52:06 +000026699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026700}
26701
26702
26703static int
26704test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026706
William M. Brack21e4ef22005-01-02 09:53:13 +000026707#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026708 int mem_base;
26709 int ret_val;
26710 void * context; /* the I/O context */
26711 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026712
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026713 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026715 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026716
26717 ret_val = xmlIOFTPClose(context);
26718 desret_int(ret_val);
26719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026720 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026721 xmlResetLastError();
26722 if (mem_base != xmlMemBlocks()) {
26723 printf("Leak of %d blocks found in xmlIOFTPClose",
26724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026725 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026726 printf(" %d", n_context);
26727 printf("\n");
26728 }
26729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026730 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026731#endif
26732
Daniel Veillard42595322004-11-08 10:52:06 +000026733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026734}
26735
26736
26737static int
26738test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026740
William M. Brack21e4ef22005-01-02 09:53:13 +000026741#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026742 int mem_base;
26743 int ret_val;
26744 const char * filename; /* the URI for matching */
26745 int n_filename;
26746
26747 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026749 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026750
26751 ret_val = xmlIOFTPMatch(filename);
26752 desret_int(ret_val);
26753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026754 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026755 xmlResetLastError();
26756 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026757 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026759 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026760 printf(" %d", n_filename);
26761 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026762 }
26763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026764 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026765#endif
26766
Daniel Veillard42595322004-11-08 10:52:06 +000026767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026768}
26769
26770
26771static int
26772test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026774
William M. Brack21e4ef22005-01-02 09:53:13 +000026775#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026776 int mem_base;
26777 void * ret_val;
26778 const char * filename; /* the URI for matching */
26779 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026780
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026781 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026783 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026784
26785 ret_val = xmlIOFTPOpen(filename);
26786 desret_void_ptr(ret_val);
26787 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026788 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026789 xmlResetLastError();
26790 if (mem_base != xmlMemBlocks()) {
26791 printf("Leak of %d blocks found in xmlIOFTPOpen",
26792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026793 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026794 printf(" %d", n_filename);
26795 printf("\n");
26796 }
26797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026798 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026799#endif
26800
Daniel Veillard42595322004-11-08 10:52:06 +000026801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026802}
26803
26804
26805static int
26806test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
William M. Brack21e4ef22005-01-02 09:53:13 +000026809#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026810 int mem_base;
26811 int ret_val;
26812 void * context; /* the I/O context */
26813 int n_context;
26814 char * buffer; /* where to drop data */
26815 int n_buffer;
26816 int len; /* number of bytes to write */
26817 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026818
Daniel Veillardce682bc2004-11-05 17:22:25 +000026819 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26820 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26821 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26822 mem_base = xmlMemBlocks();
26823 context = gen_void_ptr(n_context, 0);
26824 buffer = gen_char_ptr(n_buffer, 1);
26825 len = gen_int(n_len, 2);
26826
26827 ret_val = xmlIOFTPRead(context, buffer, len);
26828 desret_int(ret_val);
26829 call_tests++;
26830 des_void_ptr(n_context, context, 0);
26831 des_char_ptr(n_buffer, buffer, 1);
26832 des_int(n_len, len, 2);
26833 xmlResetLastError();
26834 if (mem_base != xmlMemBlocks()) {
26835 printf("Leak of %d blocks found in xmlIOFTPRead",
26836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026837 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026838 printf(" %d", n_context);
26839 printf(" %d", n_buffer);
26840 printf(" %d", n_len);
26841 printf("\n");
26842 }
26843 }
26844 }
26845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026846 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026847#endif
26848
Daniel Veillard42595322004-11-08 10:52:06 +000026849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026850}
26851
26852
26853static int
26854test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026856
William M. Brack21e4ef22005-01-02 09:53:13 +000026857#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026858 int mem_base;
26859 int ret_val;
26860 void * context; /* the I/O context */
26861 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026862
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026863 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026865 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026866
26867 ret_val = xmlIOHTTPClose(context);
26868 desret_int(ret_val);
26869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026870 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026871 xmlResetLastError();
26872 if (mem_base != xmlMemBlocks()) {
26873 printf("Leak of %d blocks found in xmlIOHTTPClose",
26874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026875 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026876 printf(" %d", n_context);
26877 printf("\n");
26878 }
26879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026880 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026881#endif
26882
Daniel Veillard42595322004-11-08 10:52:06 +000026883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026884}
26885
26886
26887static int
26888test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026890
William M. Brack21e4ef22005-01-02 09:53:13 +000026891#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026892 int mem_base;
26893 int ret_val;
26894 const char * filename; /* the URI for matching */
26895 int n_filename;
26896
26897 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026899 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026900
26901 ret_val = xmlIOHTTPMatch(filename);
26902 desret_int(ret_val);
26903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026904 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026905 xmlResetLastError();
26906 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026907 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026909 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026910 printf(" %d", n_filename);
26911 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026912 }
26913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026914 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026915#endif
26916
Daniel Veillard42595322004-11-08 10:52:06 +000026917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026918}
26919
26920
26921static int
26922test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026924
William M. Brack21e4ef22005-01-02 09:53:13 +000026925#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026926 int mem_base;
26927 void * ret_val;
26928 const char * filename; /* the URI for matching */
26929 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026930
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026931 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026933 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026934
26935 ret_val = xmlIOHTTPOpen(filename);
William M. Brack015ccb22005-02-13 08:18:52 +000026936 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026938 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026939 xmlResetLastError();
26940 if (mem_base != xmlMemBlocks()) {
26941 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026943 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026944 printf(" %d", n_filename);
26945 printf("\n");
26946 }
26947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026948 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026949#endif
26950
Daniel Veillard42595322004-11-08 10:52:06 +000026951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026952}
26953
26954
26955static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000026956test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026958
William M. Brack21e4ef22005-01-02 09:53:13 +000026959#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026960 int mem_base;
26961 int ret_val;
26962 void * context; /* the I/O context */
26963 int n_context;
26964 char * buffer; /* where to drop data */
26965 int n_buffer;
26966 int len; /* number of bytes to write */
26967 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026968
Daniel Veillardce682bc2004-11-05 17:22:25 +000026969 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26970 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26971 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26972 mem_base = xmlMemBlocks();
26973 context = gen_void_ptr(n_context, 0);
26974 buffer = gen_char_ptr(n_buffer, 1);
26975 len = gen_int(n_len, 2);
26976
26977 ret_val = xmlIOHTTPRead(context, buffer, len);
26978 desret_int(ret_val);
26979 call_tests++;
26980 des_void_ptr(n_context, context, 0);
26981 des_char_ptr(n_buffer, buffer, 1);
26982 des_int(n_len, len, 2);
26983 xmlResetLastError();
26984 if (mem_base != xmlMemBlocks()) {
26985 printf("Leak of %d blocks found in xmlIOHTTPRead",
26986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026987 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026988 printf(" %d", n_context);
26989 printf(" %d", n_buffer);
26990 printf(" %d", n_len);
26991 printf("\n");
26992 }
26993 }
26994 }
26995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026996 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026997#endif
26998
Daniel Veillard42595322004-11-08 10:52:06 +000026999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027000}
27001
27002
27003static int
27004test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027006
Daniel Veillard42595322004-11-08 10:52:06 +000027007 int mem_base;
27008 xmlParserInputPtr ret_val;
27009 const char * URL; /* the URL for the entity to load */
27010 int n_URL;
27011 char * ID; /* the System ID for the entity to load */
27012 int n_ID;
27013 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
27014 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027015
Daniel Veillard42595322004-11-08 10:52:06 +000027016 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
27017 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
27018 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
27019 mem_base = xmlMemBlocks();
27020 URL = gen_filepath(n_URL, 0);
27021 ID = gen_const_char_ptr(n_ID, 1);
27022 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
27023
William M. Brackf13f77f2004-11-12 16:03:48 +000027024 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000027025 desret_xmlParserInputPtr(ret_val);
27026 call_tests++;
27027 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027028 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000027029 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
27030 xmlResetLastError();
27031 if (mem_base != xmlMemBlocks()) {
27032 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
27033 xmlMemBlocks() - mem_base);
27034 test_ret++;
27035 printf(" %d", n_URL);
27036 printf(" %d", n_ID);
27037 printf(" %d", n_ctxt);
27038 printf("\n");
27039 }
27040 }
27041 }
27042 }
Daniel Veillard42595322004-11-08 10:52:06 +000027043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027044
Daniel Veillard42595322004-11-08 10:52:06 +000027045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027046}
27047
27048
27049static int
27050test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027052
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027053 int mem_base;
27054 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027055 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027056 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027057
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027058 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
27059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027060 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027061
William M. Brackf13f77f2004-11-12 16:03:48 +000027062 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027063 desret_xmlChar_ptr(ret_val);
27064 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027065 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027066 xmlResetLastError();
27067 if (mem_base != xmlMemBlocks()) {
27068 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027070 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027071 printf(" %d", n_path);
27072 printf("\n");
27073 }
27074 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027076
Daniel Veillard42595322004-11-08 10:52:06 +000027077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027078}
27079
27080
27081static int
27082test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027084
William M. Brack21e4ef22005-01-02 09:53:13 +000027085#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027086 int mem_base;
27087 xmlOutputBufferPtr ret_val;
27088 int fd; /* a file descriptor number */
27089 int n_fd;
27090 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27091 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027092
Daniel Veillard3d95c732004-11-06 22:25:14 +000027093 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27094 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27095 mem_base = xmlMemBlocks();
27096 fd = gen_int(n_fd, 0);
27097 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27098
27099 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27100 desret_xmlOutputBufferPtr(ret_val);
27101 call_tests++;
27102 des_int(n_fd, fd, 0);
27103 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27104 xmlResetLastError();
27105 if (mem_base != xmlMemBlocks()) {
27106 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027108 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027109 printf(" %d", n_fd);
27110 printf(" %d", n_encoder);
27111 printf("\n");
27112 }
27113 }
27114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027115 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027116#endif
27117
Daniel Veillard42595322004-11-08 10:52:06 +000027118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027119}
27120
27121
27122static int
27123test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027125
William M. Brack21e4ef22005-01-02 09:53:13 +000027126#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027127 int mem_base;
27128 xmlOutputBufferPtr ret_val;
27129 FILE * file; /* a FILE* */
27130 int n_file;
27131 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27132 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027133
Daniel Veillard3d95c732004-11-06 22:25:14 +000027134 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27135 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27136 mem_base = xmlMemBlocks();
27137 file = gen_FILE_ptr(n_file, 0);
27138 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27139
27140 ret_val = xmlOutputBufferCreateFile(file, encoder);
27141 desret_xmlOutputBufferPtr(ret_val);
27142 call_tests++;
27143 des_FILE_ptr(n_file, file, 0);
27144 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27145 xmlResetLastError();
27146 if (mem_base != xmlMemBlocks()) {
27147 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027149 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027150 printf(" %d", n_file);
27151 printf(" %d", n_encoder);
27152 printf("\n");
27153 }
27154 }
27155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027156 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027157#endif
27158
Daniel Veillard42595322004-11-08 10:52:06 +000027159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027160}
27161
27162
27163static int
27164test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027166
William M. Brack21e4ef22005-01-02 09:53:13 +000027167#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027168 int mem_base;
27169 xmlOutputBufferPtr ret_val;
27170 const char * URI; /* a C string containing the URI or filename */
27171 int n_URI;
27172 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27173 int n_encoder;
27174 int compression; /* the compression ration (0 none, 9 max). */
27175 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027176
Daniel Veillard42595322004-11-08 10:52:06 +000027177 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027178 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27179 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27180 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027181 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027182 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27183 compression = gen_int(n_compression, 2);
27184
27185 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27186 desret_xmlOutputBufferPtr(ret_val);
27187 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027188 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027189 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27190 des_int(n_compression, compression, 2);
27191 xmlResetLastError();
27192 if (mem_base != xmlMemBlocks()) {
27193 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027195 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027196 printf(" %d", n_URI);
27197 printf(" %d", n_encoder);
27198 printf(" %d", n_compression);
27199 printf("\n");
27200 }
27201 }
27202 }
27203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027204 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027205#endif
27206
Daniel Veillard42595322004-11-08 10:52:06 +000027207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027208}
27209
27210
27211static int
27212test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027214
William M. Brack21e4ef22005-01-02 09:53:13 +000027215#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027216 int mem_base;
27217 int ret_val;
27218 xmlOutputBufferPtr out; /* a buffered output */
27219 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027220
Daniel Veillard3d97e662004-11-04 10:49:00 +000027221 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27222 mem_base = xmlMemBlocks();
27223 out = gen_xmlOutputBufferPtr(n_out, 0);
27224
27225 ret_val = xmlOutputBufferFlush(out);
27226 desret_int(ret_val);
27227 call_tests++;
27228 des_xmlOutputBufferPtr(n_out, out, 0);
27229 xmlResetLastError();
27230 if (mem_base != xmlMemBlocks()) {
27231 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027233 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027234 printf(" %d", n_out);
27235 printf("\n");
27236 }
27237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027238 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027239#endif
27240
Daniel Veillard42595322004-11-08 10:52:06 +000027241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027242}
27243
27244
27245static int
27246test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027248
William M. Brack21e4ef22005-01-02 09:53:13 +000027249#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027250 int mem_base;
27251 int ret_val;
27252 xmlOutputBufferPtr out; /* a buffered parser output */
27253 int n_out;
27254 int len; /* the size in bytes of the array. */
27255 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027256 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027257 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027258
Daniel Veillard3d97e662004-11-04 10:49:00 +000027259 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27260 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27261 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27262 mem_base = xmlMemBlocks();
27263 out = gen_xmlOutputBufferPtr(n_out, 0);
27264 len = gen_int(n_len, 1);
27265 buf = gen_const_char_ptr(n_buf, 2);
27266
William M. Brackf13f77f2004-11-12 16:03:48 +000027267 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027268 desret_int(ret_val);
27269 call_tests++;
27270 des_xmlOutputBufferPtr(n_out, out, 0);
27271 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027272 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027273 xmlResetLastError();
27274 if (mem_base != xmlMemBlocks()) {
27275 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027277 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027278 printf(" %d", n_out);
27279 printf(" %d", n_len);
27280 printf(" %d", n_buf);
27281 printf("\n");
27282 }
27283 }
27284 }
27285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027286 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027287#endif
27288
Daniel Veillard42595322004-11-08 10:52:06 +000027289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027290}
27291
27292
27293static int
27294test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027296
27297
27298 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027300}
27301
27302
27303static int
27304test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027306
William M. Brack21e4ef22005-01-02 09:53:13 +000027307#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027308 int mem_base;
27309 int ret_val;
27310 xmlOutputBufferPtr out; /* a buffered parser output */
27311 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027312 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027313 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027314
Daniel Veillard3d97e662004-11-04 10:49:00 +000027315 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27316 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27317 mem_base = xmlMemBlocks();
27318 out = gen_xmlOutputBufferPtr(n_out, 0);
27319 str = gen_const_char_ptr(n_str, 1);
27320
William M. Brackf13f77f2004-11-12 16:03:48 +000027321 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027322 desret_int(ret_val);
27323 call_tests++;
27324 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027325 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027326 xmlResetLastError();
27327 if (mem_base != xmlMemBlocks()) {
27328 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027330 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027331 printf(" %d", n_out);
27332 printf(" %d", n_str);
27333 printf("\n");
27334 }
27335 }
27336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027337 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027338#endif
27339
Daniel Veillard42595322004-11-08 10:52:06 +000027340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027341}
27342
27343
27344static int
27345test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027347
27348
27349 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027351}
27352
27353
27354static int
27355test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027357
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027358 int mem_base;
27359 xmlParserInputBufferPtr ret_val;
27360 int fd; /* a file descriptor number */
27361 int n_fd;
27362 xmlCharEncoding enc; /* the charset encoding if known */
27363 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027364
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027365 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27366 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27367 mem_base = xmlMemBlocks();
27368 fd = gen_int(n_fd, 0);
27369 enc = gen_xmlCharEncoding(n_enc, 1);
27370 if (fd >= 0) fd = -1;
27371
27372 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27373 desret_xmlParserInputBufferPtr(ret_val);
27374 call_tests++;
27375 des_int(n_fd, fd, 0);
27376 des_xmlCharEncoding(n_enc, enc, 1);
27377 xmlResetLastError();
27378 if (mem_base != xmlMemBlocks()) {
27379 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027381 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027382 printf(" %d", n_fd);
27383 printf(" %d", n_enc);
27384 printf("\n");
27385 }
27386 }
27387 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027389
Daniel Veillard42595322004-11-08 10:52:06 +000027390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027391}
27392
27393
27394static int
27395test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027397
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027398 int mem_base;
27399 xmlParserInputBufferPtr ret_val;
27400 FILE * file; /* a FILE* */
27401 int n_file;
27402 xmlCharEncoding enc; /* the charset encoding if known */
27403 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027404
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027405 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27406 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27407 mem_base = xmlMemBlocks();
27408 file = gen_FILE_ptr(n_file, 0);
27409 enc = gen_xmlCharEncoding(n_enc, 1);
27410
27411 ret_val = xmlParserInputBufferCreateFile(file, enc);
27412 desret_xmlParserInputBufferPtr(ret_val);
27413 call_tests++;
27414 des_FILE_ptr(n_file, file, 0);
27415 des_xmlCharEncoding(n_enc, enc, 1);
27416 xmlResetLastError();
27417 if (mem_base != xmlMemBlocks()) {
27418 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027420 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027421 printf(" %d", n_file);
27422 printf(" %d", n_enc);
27423 printf("\n");
27424 }
27425 }
27426 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027428
Daniel Veillard42595322004-11-08 10:52:06 +000027429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027430}
27431
27432
27433static int
27434test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027436
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027437 int mem_base;
27438 xmlParserInputBufferPtr ret_val;
27439 const char * URI; /* a C string containing the URI or filename */
27440 int n_URI;
27441 xmlCharEncoding enc; /* the charset encoding if known */
27442 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027443
Daniel Veillard42595322004-11-08 10:52:06 +000027444 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027445 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27446 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027447 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027448 enc = gen_xmlCharEncoding(n_enc, 1);
27449
27450 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27451 desret_xmlParserInputBufferPtr(ret_val);
27452 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027453 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027454 des_xmlCharEncoding(n_enc, enc, 1);
27455 xmlResetLastError();
27456 if (mem_base != xmlMemBlocks()) {
27457 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027459 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027460 printf(" %d", n_URI);
27461 printf(" %d", n_enc);
27462 printf("\n");
27463 }
27464 }
27465 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027466 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027467
Daniel Veillard42595322004-11-08 10:52:06 +000027468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027469}
27470
27471
27472static int
27473test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027475
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027476 int mem_base;
27477 xmlParserInputBufferPtr ret_val;
27478 char * mem; /* the memory input */
27479 int n_mem;
27480 int size; /* the length of the memory block */
27481 int n_size;
27482 xmlCharEncoding enc; /* the charset encoding if known */
27483 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027484
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027485 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27486 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27487 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27488 mem_base = xmlMemBlocks();
27489 mem = gen_const_char_ptr(n_mem, 0);
27490 size = gen_int(n_size, 1);
27491 enc = gen_xmlCharEncoding(n_enc, 2);
27492
William M. Brackf13f77f2004-11-12 16:03:48 +000027493 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027494 desret_xmlParserInputBufferPtr(ret_val);
27495 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027496 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027497 des_int(n_size, size, 1);
27498 des_xmlCharEncoding(n_enc, enc, 2);
27499 xmlResetLastError();
27500 if (mem_base != xmlMemBlocks()) {
27501 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027503 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027504 printf(" %d", n_mem);
27505 printf(" %d", n_size);
27506 printf(" %d", n_enc);
27507 printf("\n");
27508 }
27509 }
27510 }
27511 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027513
Daniel Veillard42595322004-11-08 10:52:06 +000027514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027515}
27516
27517
27518static int
27519test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027521
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027522 int mem_base;
27523 xmlParserInputBufferPtr ret_val;
27524 char * mem; /* the memory input */
27525 int n_mem;
27526 int size; /* the length of the memory block */
27527 int n_size;
27528 xmlCharEncoding enc; /* the charset encoding if known */
27529 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027530
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027531 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27532 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27533 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27534 mem_base = xmlMemBlocks();
27535 mem = gen_const_char_ptr(n_mem, 0);
27536 size = gen_int(n_size, 1);
27537 enc = gen_xmlCharEncoding(n_enc, 2);
27538
William M. Brackf13f77f2004-11-12 16:03:48 +000027539 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027540 desret_xmlParserInputBufferPtr(ret_val);
27541 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027542 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027543 des_int(n_size, size, 1);
27544 des_xmlCharEncoding(n_enc, enc, 2);
27545 xmlResetLastError();
27546 if (mem_base != xmlMemBlocks()) {
27547 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027549 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027550 printf(" %d", n_mem);
27551 printf(" %d", n_size);
27552 printf(" %d", n_enc);
27553 printf("\n");
27554 }
27555 }
27556 }
27557 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027558 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027559
Daniel Veillard42595322004-11-08 10:52:06 +000027560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027561}
27562
27563
27564static int
27565test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027567
Daniel Veillard34099b42004-11-04 17:34:35 +000027568 int mem_base;
27569 int ret_val;
27570 xmlParserInputBufferPtr in; /* a buffered parser input */
27571 int n_in;
27572 int len; /* indicative value of the amount of chars to read */
27573 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027574
Daniel Veillard34099b42004-11-04 17:34:35 +000027575 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27576 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27577 mem_base = xmlMemBlocks();
27578 in = gen_xmlParserInputBufferPtr(n_in, 0);
27579 len = gen_int(n_len, 1);
27580
27581 ret_val = xmlParserInputBufferGrow(in, len);
27582 desret_int(ret_val);
27583 call_tests++;
27584 des_xmlParserInputBufferPtr(n_in, in, 0);
27585 des_int(n_len, len, 1);
27586 xmlResetLastError();
27587 if (mem_base != xmlMemBlocks()) {
27588 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027590 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027591 printf(" %d", n_in);
27592 printf(" %d", n_len);
27593 printf("\n");
27594 }
27595 }
27596 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027597 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027598
Daniel Veillard42595322004-11-08 10:52:06 +000027599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027600}
27601
27602
27603static int
27604test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027606
Daniel Veillard34099b42004-11-04 17:34:35 +000027607 int mem_base;
27608 int ret_val;
27609 xmlParserInputBufferPtr in; /* a buffered parser input */
27610 int n_in;
27611 int len; /* the size in bytes of the array. */
27612 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027613 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027614 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027615
Daniel Veillard34099b42004-11-04 17:34:35 +000027616 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27617 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27618 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27619 mem_base = xmlMemBlocks();
27620 in = gen_xmlParserInputBufferPtr(n_in, 0);
27621 len = gen_int(n_len, 1);
27622 buf = gen_const_char_ptr(n_buf, 2);
27623
William M. Brackf13f77f2004-11-12 16:03:48 +000027624 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027625 desret_int(ret_val);
27626 call_tests++;
27627 des_xmlParserInputBufferPtr(n_in, in, 0);
27628 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027629 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027630 xmlResetLastError();
27631 if (mem_base != xmlMemBlocks()) {
27632 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027634 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027635 printf(" %d", n_in);
27636 printf(" %d", n_len);
27637 printf(" %d", n_buf);
27638 printf("\n");
27639 }
27640 }
27641 }
27642 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027644
Daniel Veillard42595322004-11-08 10:52:06 +000027645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027646}
27647
27648
27649static int
27650test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027652
Daniel Veillard34099b42004-11-04 17:34:35 +000027653 int mem_base;
27654 int ret_val;
27655 xmlParserInputBufferPtr in; /* a buffered parser input */
27656 int n_in;
27657 int len; /* indicative value of the amount of chars to read */
27658 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027659
Daniel Veillard34099b42004-11-04 17:34:35 +000027660 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27661 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27662 mem_base = xmlMemBlocks();
27663 in = gen_xmlParserInputBufferPtr(n_in, 0);
27664 len = gen_int(n_len, 1);
27665
27666 ret_val = xmlParserInputBufferRead(in, len);
27667 desret_int(ret_val);
27668 call_tests++;
27669 des_xmlParserInputBufferPtr(n_in, in, 0);
27670 des_int(n_len, len, 1);
27671 xmlResetLastError();
27672 if (mem_base != xmlMemBlocks()) {
27673 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027675 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027676 printf(" %d", n_in);
27677 printf(" %d", n_len);
27678 printf("\n");
27679 }
27680 }
27681 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027683
Daniel Veillard42595322004-11-08 10:52:06 +000027684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027685}
27686
27687
27688static int
27689test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027691
27692 int mem_base;
27693 int ret_val;
27694
27695 mem_base = xmlMemBlocks();
27696
27697 ret_val = xmlPopInputCallbacks();
27698 desret_int(ret_val);
27699 call_tests++;
27700 xmlResetLastError();
27701 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027702 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027705 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027708
Daniel Veillard42595322004-11-08 10:52:06 +000027709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027710}
27711
27712
27713static int
27714test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027716
27717 int mem_base;
27718
27719 mem_base = xmlMemBlocks();
27720
27721 xmlRegisterDefaultInputCallbacks();
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 xmlRegisterDefaultInputCallbacks",
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_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027739
William M. Brack21e4ef22005-01-02 09:53:13 +000027740#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027741 int mem_base;
27742
27743 mem_base = xmlMemBlocks();
27744
27745 xmlRegisterDefaultOutputCallbacks();
27746 call_tests++;
27747 xmlResetLastError();
27748 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027749 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027751 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027752 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027754 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027755#endif
27756
Daniel Veillard42595322004-11-08 10:52:06 +000027757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027758}
27759
27760
27761static int
27762test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027764
William M. Brack21e4ef22005-01-02 09:53:13 +000027765#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027766 int mem_base;
27767
27768 mem_base = xmlMemBlocks();
27769
27770 xmlRegisterHTTPPostCallbacks();
27771 call_tests++;
27772 xmlResetLastError();
27773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027774 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027777 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027779 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027780#endif
27781
Daniel Veillard42595322004-11-08 10:52:06 +000027782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027783}
27784
27785static int
27786test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027788
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027789 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027790 test_ret += test_xmlAllocOutputBuffer();
27791 test_ret += test_xmlAllocParserInputBuffer();
27792 test_ret += test_xmlCheckFilename();
27793 test_ret += test_xmlCheckHTTPInput();
27794 test_ret += test_xmlCleanupInputCallbacks();
27795 test_ret += test_xmlCleanupOutputCallbacks();
27796 test_ret += test_xmlFileClose();
27797 test_ret += test_xmlFileMatch();
27798 test_ret += test_xmlFileOpen();
27799 test_ret += test_xmlFileRead();
27800 test_ret += test_xmlIOFTPClose();
27801 test_ret += test_xmlIOFTPMatch();
27802 test_ret += test_xmlIOFTPOpen();
27803 test_ret += test_xmlIOFTPRead();
27804 test_ret += test_xmlIOHTTPClose();
27805 test_ret += test_xmlIOHTTPMatch();
27806 test_ret += test_xmlIOHTTPOpen();
Daniel Veillard42595322004-11-08 10:52:06 +000027807 test_ret += test_xmlIOHTTPRead();
27808 test_ret += test_xmlNoNetExternalEntityLoader();
27809 test_ret += test_xmlNormalizeWindowsPath();
27810 test_ret += test_xmlOutputBufferCreateFd();
27811 test_ret += test_xmlOutputBufferCreateFile();
27812 test_ret += test_xmlOutputBufferCreateFilename();
27813 test_ret += test_xmlOutputBufferFlush();
27814 test_ret += test_xmlOutputBufferWrite();
27815 test_ret += test_xmlOutputBufferWriteEscape();
27816 test_ret += test_xmlOutputBufferWriteString();
27817 test_ret += test_xmlParserGetDirectory();
27818 test_ret += test_xmlParserInputBufferCreateFd();
27819 test_ret += test_xmlParserInputBufferCreateFile();
27820 test_ret += test_xmlParserInputBufferCreateFilename();
27821 test_ret += test_xmlParserInputBufferCreateMem();
27822 test_ret += test_xmlParserInputBufferCreateStatic();
27823 test_ret += test_xmlParserInputBufferGrow();
27824 test_ret += test_xmlParserInputBufferPush();
27825 test_ret += test_xmlParserInputBufferRead();
27826 test_ret += test_xmlPopInputCallbacks();
27827 test_ret += test_xmlRegisterDefaultInputCallbacks();
27828 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27829 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027830
Daniel Veillard42595322004-11-08 10:52:06 +000027831 if (test_ret != 0)
27832 printf("Module xmlIO: %d errors\n", test_ret);
27833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027834}
Daniel Veillarda521d282004-11-09 14:59:59 +000027835#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027836
Daniel Veillarda82b1822004-11-08 16:24:57 +000027837#define gen_nb_xmlAutomataPtr 1
27838static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27839 return(NULL);
27840}
27841static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27842}
Daniel Veillarda521d282004-11-09 14:59:59 +000027843#endif
27844
Daniel Veillarda82b1822004-11-08 16:24:57 +000027845
27846static int
27847test_xmlAutomataCompile(void) {
27848 int test_ret = 0;
27849
27850
27851 /* missing type support */
27852 return(test_ret);
27853}
27854
27855
27856static int
27857test_xmlAutomataGetInitState(void) {
27858 int test_ret = 0;
27859
27860
27861 /* missing type support */
27862 return(test_ret);
27863}
27864
27865
27866static int
27867test_xmlAutomataIsDeterminist(void) {
27868 int test_ret = 0;
27869
William M. Brack21e4ef22005-01-02 09:53:13 +000027870#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027871 int mem_base;
27872 int ret_val;
27873 xmlAutomataPtr am; /* an automata */
27874 int n_am;
27875
27876 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27877 mem_base = xmlMemBlocks();
27878 am = gen_xmlAutomataPtr(n_am, 0);
27879
27880 ret_val = xmlAutomataIsDeterminist(am);
27881 desret_int(ret_val);
27882 call_tests++;
27883 des_xmlAutomataPtr(n_am, am, 0);
27884 xmlResetLastError();
27885 if (mem_base != xmlMemBlocks()) {
27886 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27887 xmlMemBlocks() - mem_base);
27888 test_ret++;
27889 printf(" %d", n_am);
27890 printf("\n");
27891 }
27892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027893 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027894#endif
27895
Daniel Veillarda82b1822004-11-08 16:24:57 +000027896 return(test_ret);
27897}
27898
Daniel Veillarda521d282004-11-09 14:59:59 +000027899#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027900
27901#define gen_nb_xmlAutomataStatePtr 1
27902static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27903 return(NULL);
27904}
27905static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27906}
Daniel Veillarda521d282004-11-09 14:59:59 +000027907#endif
27908
Daniel Veillarda82b1822004-11-08 16:24:57 +000027909
27910static int
27911test_xmlAutomataNewAllTrans(void) {
27912 int test_ret = 0;
27913
27914
27915 /* missing type support */
27916 return(test_ret);
27917}
27918
27919
27920static int
27921test_xmlAutomataNewCountTrans(void) {
27922 int test_ret = 0;
27923
27924
27925 /* missing type support */
27926 return(test_ret);
27927}
27928
27929
27930static int
27931test_xmlAutomataNewCountTrans2(void) {
27932 int test_ret = 0;
27933
27934
27935 /* missing type support */
27936 return(test_ret);
27937}
27938
27939
27940static int
27941test_xmlAutomataNewCountedTrans(void) {
27942 int test_ret = 0;
27943
27944
27945 /* missing type support */
27946 return(test_ret);
27947}
27948
27949
27950static int
27951test_xmlAutomataNewCounter(void) {
27952 int test_ret = 0;
27953
William M. Brack21e4ef22005-01-02 09:53:13 +000027954#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027955 int mem_base;
27956 int ret_val;
27957 xmlAutomataPtr am; /* an automata */
27958 int n_am;
27959 int min; /* the minimal value on the counter */
27960 int n_min;
27961 int max; /* the maximal value on the counter */
27962 int n_max;
27963
27964 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27965 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27966 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27967 mem_base = xmlMemBlocks();
27968 am = gen_xmlAutomataPtr(n_am, 0);
27969 min = gen_int(n_min, 1);
27970 max = gen_int(n_max, 2);
27971
27972 ret_val = xmlAutomataNewCounter(am, min, max);
27973 desret_int(ret_val);
27974 call_tests++;
27975 des_xmlAutomataPtr(n_am, am, 0);
27976 des_int(n_min, min, 1);
27977 des_int(n_max, max, 2);
27978 xmlResetLastError();
27979 if (mem_base != xmlMemBlocks()) {
27980 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27981 xmlMemBlocks() - mem_base);
27982 test_ret++;
27983 printf(" %d", n_am);
27984 printf(" %d", n_min);
27985 printf(" %d", n_max);
27986 printf("\n");
27987 }
27988 }
27989 }
27990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027991 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027992#endif
27993
Daniel Veillarda82b1822004-11-08 16:24:57 +000027994 return(test_ret);
27995}
27996
27997
27998static int
27999test_xmlAutomataNewCounterTrans(void) {
28000 int test_ret = 0;
28001
28002
28003 /* missing type support */
28004 return(test_ret);
28005}
28006
28007
28008static int
28009test_xmlAutomataNewEpsilon(void) {
28010 int test_ret = 0;
28011
28012
28013 /* missing type support */
28014 return(test_ret);
28015}
28016
28017
28018static int
28019test_xmlAutomataNewOnceTrans(void) {
28020 int test_ret = 0;
28021
28022
28023 /* missing type support */
28024 return(test_ret);
28025}
28026
28027
28028static int
28029test_xmlAutomataNewOnceTrans2(void) {
28030 int test_ret = 0;
28031
28032
28033 /* missing type support */
28034 return(test_ret);
28035}
28036
28037
28038static int
28039test_xmlAutomataNewState(void) {
28040 int test_ret = 0;
28041
28042
28043 /* missing type support */
28044 return(test_ret);
28045}
28046
28047
28048static int
28049test_xmlAutomataNewTransition(void) {
28050 int test_ret = 0;
28051
28052
28053 /* missing type support */
28054 return(test_ret);
28055}
28056
28057
28058static int
28059test_xmlAutomataNewTransition2(void) {
28060 int test_ret = 0;
28061
28062
28063 /* missing type support */
28064 return(test_ret);
28065}
28066
28067
28068static int
28069test_xmlAutomataSetFinalState(void) {
28070 int test_ret = 0;
28071
William M. Brack21e4ef22005-01-02 09:53:13 +000028072#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028073 int mem_base;
28074 int ret_val;
28075 xmlAutomataPtr am; /* an automata */
28076 int n_am;
28077 xmlAutomataStatePtr state; /* a state in this automata */
28078 int n_state;
28079
28080 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28081 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28082 mem_base = xmlMemBlocks();
28083 am = gen_xmlAutomataPtr(n_am, 0);
28084 state = gen_xmlAutomataStatePtr(n_state, 1);
28085
28086 ret_val = xmlAutomataSetFinalState(am, state);
28087 desret_int(ret_val);
28088 call_tests++;
28089 des_xmlAutomataPtr(n_am, am, 0);
28090 des_xmlAutomataStatePtr(n_state, state, 1);
28091 xmlResetLastError();
28092 if (mem_base != xmlMemBlocks()) {
28093 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28094 xmlMemBlocks() - mem_base);
28095 test_ret++;
28096 printf(" %d", n_am);
28097 printf(" %d", n_state);
28098 printf("\n");
28099 }
28100 }
28101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028102 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028103#endif
28104
Daniel Veillarda82b1822004-11-08 16:24:57 +000028105 return(test_ret);
28106}
28107
28108
28109static int
28110test_xmlNewAutomata(void) {
28111 int test_ret = 0;
28112
28113
28114 /* missing type support */
28115 return(test_ret);
28116}
28117
28118static int
28119test_xmlautomata(void) {
28120 int test_ret = 0;
28121
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028122 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028123 test_ret += test_xmlAutomataCompile();
28124 test_ret += test_xmlAutomataGetInitState();
28125 test_ret += test_xmlAutomataIsDeterminist();
28126 test_ret += test_xmlAutomataNewAllTrans();
28127 test_ret += test_xmlAutomataNewCountTrans();
28128 test_ret += test_xmlAutomataNewCountTrans2();
28129 test_ret += test_xmlAutomataNewCountedTrans();
28130 test_ret += test_xmlAutomataNewCounter();
28131 test_ret += test_xmlAutomataNewCounterTrans();
28132 test_ret += test_xmlAutomataNewEpsilon();
28133 test_ret += test_xmlAutomataNewOnceTrans();
28134 test_ret += test_xmlAutomataNewOnceTrans2();
28135 test_ret += test_xmlAutomataNewState();
28136 test_ret += test_xmlAutomataNewTransition();
28137 test_ret += test_xmlAutomataNewTransition2();
28138 test_ret += test_xmlAutomataSetFinalState();
28139 test_ret += test_xmlNewAutomata();
28140
28141 if (test_ret != 0)
28142 printf("Module xmlautomata: %d errors\n", test_ret);
28143 return(test_ret);
28144}
28145
Daniel Veillardce682bc2004-11-05 17:22:25 +000028146#define gen_nb_xmlGenericErrorFunc_ptr 1
28147static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28148 return(NULL);
28149}
28150static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28151}
28152
Daniel Veillardd93f6252004-11-02 15:53:51 +000028153static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028154test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028156
Daniel Veillardce682bc2004-11-05 17:22:25 +000028157 int mem_base;
28158 xmlGenericErrorFunc * handler; /* the handler */
28159 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028160
Daniel Veillardce682bc2004-11-05 17:22:25 +000028161 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28162 mem_base = xmlMemBlocks();
28163 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28164
28165 initGenericErrorDefaultFunc(handler);
28166 call_tests++;
28167 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28168 xmlResetLastError();
28169 if (mem_base != xmlMemBlocks()) {
28170 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028173 printf(" %d", n_handler);
28174 printf("\n");
28175 }
28176 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028178
Daniel Veillard42595322004-11-08 10:52:06 +000028179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028180}
28181
28182
Daniel Veillardce682bc2004-11-05 17:22:25 +000028183#define gen_nb_xmlErrorPtr 1
28184static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28185 return(NULL);
28186}
28187static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28188}
28189
Daniel Veillardd93f6252004-11-02 15:53:51 +000028190static int
28191test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193
Daniel Veillardce682bc2004-11-05 17:22:25 +000028194 int mem_base;
28195 int ret_val;
28196 xmlErrorPtr from; /* a source error */
28197 int n_from;
28198 xmlErrorPtr to; /* a target error */
28199 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028200
Daniel Veillardce682bc2004-11-05 17:22:25 +000028201 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28202 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28203 mem_base = xmlMemBlocks();
28204 from = gen_xmlErrorPtr(n_from, 0);
28205 to = gen_xmlErrorPtr(n_to, 1);
28206
28207 ret_val = xmlCopyError(from, to);
28208 desret_int(ret_val);
28209 call_tests++;
28210 des_xmlErrorPtr(n_from, from, 0);
28211 des_xmlErrorPtr(n_to, to, 1);
28212 xmlResetLastError();
28213 if (mem_base != xmlMemBlocks()) {
28214 printf("Leak of %d blocks found in xmlCopyError",
28215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028216 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028217 printf(" %d", n_from);
28218 printf(" %d", n_to);
28219 printf("\n");
28220 }
28221 }
28222 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028223 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028224
Daniel Veillard42595322004-11-08 10:52:06 +000028225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028226}
28227
28228
28229static int
28230test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028232
28233
28234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028236}
28237
28238
28239static int
28240test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028242
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028243 int mem_base;
28244 void * ctx; /* an XML parser context */
28245 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028246
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028247 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028249 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028250
28251 xmlCtxtResetLastError(ctx);
28252 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028253 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028254 xmlResetLastError();
28255 if (mem_base != xmlMemBlocks()) {
28256 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028258 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028259 printf(" %d", n_ctx);
28260 printf("\n");
28261 }
28262 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028264
Daniel Veillard42595322004-11-08 10:52:06 +000028265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028266}
28267
28268
28269static int
28270test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028272
28273
28274 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028276}
28277
28278
28279static int
28280test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028282
28283
28284 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028286}
28287
28288
28289static int
28290test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028292
Daniel Veillardce682bc2004-11-05 17:22:25 +000028293 int mem_base;
28294 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28295 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028296
Daniel Veillardce682bc2004-11-05 17:22:25 +000028297 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28298 mem_base = xmlMemBlocks();
28299 input = gen_xmlParserInputPtr(n_input, 0);
28300
28301 xmlParserPrintFileContext(input);
28302 call_tests++;
28303 des_xmlParserInputPtr(n_input, input, 0);
28304 xmlResetLastError();
28305 if (mem_base != xmlMemBlocks()) {
28306 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028308 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028309 printf(" %d", n_input);
28310 printf("\n");
28311 }
28312 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028313 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028314
Daniel Veillard42595322004-11-08 10:52:06 +000028315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028316}
28317
28318
28319static int
28320test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028322
Daniel Veillardce682bc2004-11-05 17:22:25 +000028323 int mem_base;
28324 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28325 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028326
Daniel Veillardce682bc2004-11-05 17:22:25 +000028327 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28328 mem_base = xmlMemBlocks();
28329 input = gen_xmlParserInputPtr(n_input, 0);
28330
28331 xmlParserPrintFileInfo(input);
28332 call_tests++;
28333 des_xmlParserInputPtr(n_input, input, 0);
28334 xmlResetLastError();
28335 if (mem_base != xmlMemBlocks()) {
28336 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028338 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028339 printf(" %d", n_input);
28340 printf("\n");
28341 }
28342 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028343 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028344
Daniel Veillard42595322004-11-08 10:52:06 +000028345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028346}
28347
28348
28349static int
28350test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028352
28353
28354 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028356}
28357
28358
28359static int
28360test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028362
28363
28364 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028366}
28367
28368
28369static int
28370test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028372
28373
28374 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028376}
28377
28378
28379static int
28380test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028382
Daniel Veillardce682bc2004-11-05 17:22:25 +000028383 int mem_base;
28384 xmlErrorPtr err; /* pointer to the error. */
28385 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028386
Daniel Veillardce682bc2004-11-05 17:22:25 +000028387 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28388 mem_base = xmlMemBlocks();
28389 err = gen_xmlErrorPtr(n_err, 0);
28390
28391 xmlResetError(err);
28392 call_tests++;
28393 des_xmlErrorPtr(n_err, err, 0);
28394 xmlResetLastError();
28395 if (mem_base != xmlMemBlocks()) {
28396 printf("Leak of %d blocks found in xmlResetError",
28397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028398 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028399 printf(" %d", n_err);
28400 printf("\n");
28401 }
28402 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028403 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028404
Daniel Veillard42595322004-11-08 10:52:06 +000028405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028406}
28407
28408
28409static int
28410test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028412
28413
28414
28415 xmlResetLastError();
28416 call_tests++;
28417 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028418 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028419
Daniel Veillard42595322004-11-08 10:52:06 +000028420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028421}
28422
28423
28424static int
28425test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028427
28428
28429 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028431}
28432
28433
28434static int
28435test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028437
28438
28439 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028441}
28442
28443static int
28444test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028446
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028447 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028448 test_ret += test_initGenericErrorDefaultFunc();
28449 test_ret += test_xmlCopyError();
28450 test_ret += test_xmlCtxtGetLastError();
28451 test_ret += test_xmlCtxtResetLastError();
28452 test_ret += test_xmlGetLastError();
28453 test_ret += test_xmlParserError();
28454 test_ret += test_xmlParserPrintFileContext();
28455 test_ret += test_xmlParserPrintFileInfo();
28456 test_ret += test_xmlParserValidityError();
28457 test_ret += test_xmlParserValidityWarning();
28458 test_ret += test_xmlParserWarning();
28459 test_ret += test_xmlResetError();
28460 test_ret += test_xmlResetLastError();
28461 test_ret += test_xmlSetGenericErrorFunc();
28462 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028463
Daniel Veillard42595322004-11-08 10:52:06 +000028464 if (test_ret != 0)
28465 printf("Module xmlerror: %d errors\n", test_ret);
28466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028467}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028468#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028469
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028470#define gen_nb_xmlModulePtr 1
28471static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28472 return(NULL);
28473}
28474static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28475}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028476#endif
28477
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028478
28479static int
28480test_xmlModuleClose(void) {
28481 int test_ret = 0;
28482
28483#if defined(LIBXML_MODULES_ENABLED)
28484 int mem_base;
28485 int ret_val;
28486 xmlModulePtr module; /* the module handle */
28487 int n_module;
28488
28489 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28490 mem_base = xmlMemBlocks();
28491 module = gen_xmlModulePtr(n_module, 0);
28492
28493 ret_val = xmlModuleClose(module);
28494 desret_int(ret_val);
28495 call_tests++;
28496 des_xmlModulePtr(n_module, module, 0);
28497 xmlResetLastError();
28498 if (mem_base != xmlMemBlocks()) {
28499 printf("Leak of %d blocks found in xmlModuleClose",
28500 xmlMemBlocks() - mem_base);
28501 test_ret++;
28502 printf(" %d", n_module);
28503 printf("\n");
28504 }
28505 }
28506 function_tests++;
28507#endif
28508
28509 return(test_ret);
28510}
28511
28512
28513static int
28514test_xmlModuleOpen(void) {
28515 int test_ret = 0;
28516
28517
28518 /* missing type support */
28519 return(test_ret);
28520}
28521
28522
28523static int
28524test_xmlModuleSymbol(void) {
28525 int test_ret = 0;
28526
28527#if defined(LIBXML_MODULES_ENABLED)
28528 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028529 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028530 xmlModulePtr module; /* the module */
28531 int n_module;
28532 char * name; /* the name of the symbol */
28533 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028534 void ** symbol; /* the resulting symbol address */
28535 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028536
28537 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28538 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028539 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028540 mem_base = xmlMemBlocks();
28541 module = gen_xmlModulePtr(n_module, 0);
28542 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028543 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028544
Daniel Veillardbe076e92005-01-04 20:18:14 +000028545 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28546 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028547 call_tests++;
28548 des_xmlModulePtr(n_module, module, 0);
28549 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028550 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028551 xmlResetLastError();
28552 if (mem_base != xmlMemBlocks()) {
28553 printf("Leak of %d blocks found in xmlModuleSymbol",
28554 xmlMemBlocks() - mem_base);
28555 test_ret++;
28556 printf(" %d", n_module);
28557 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028558 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028559 printf("\n");
28560 }
28561 }
28562 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028563 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028564 function_tests++;
28565#endif
28566
28567 return(test_ret);
28568}
28569
28570static int
28571test_xmlmodule(void) {
28572 int test_ret = 0;
28573
28574 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28575 test_ret += test_xmlModuleClose();
28576 test_ret += test_xmlModuleOpen();
28577 test_ret += test_xmlModuleSymbol();
28578
28579 if (test_ret != 0)
28580 printf("Module xmlmodule: %d errors\n", test_ret);
28581 return(test_ret);
28582}
28583
Daniel Veillardd93f6252004-11-02 15:53:51 +000028584static int
28585test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028587
William M. Brack21e4ef22005-01-02 09:53:13 +000028588#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028589 int mem_base;
28590 xmlTextReaderPtr ret_val;
28591 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28592 int n_input;
28593 const char * URI; /* the URI information for the source if available */
28594 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028595
Daniel Veillard34099b42004-11-04 17:34:35 +000028596 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28597 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28598 mem_base = xmlMemBlocks();
28599 input = gen_xmlParserInputBufferPtr(n_input, 0);
28600 URI = gen_filepath(n_URI, 1);
28601
28602 ret_val = xmlNewTextReader(input, URI);
28603 desret_xmlTextReaderPtr(ret_val);
28604 call_tests++;
28605 des_xmlParserInputBufferPtr(n_input, input, 0);
28606 des_filepath(n_URI, URI, 1);
28607 xmlResetLastError();
28608 if (mem_base != xmlMemBlocks()) {
28609 printf("Leak of %d blocks found in xmlNewTextReader",
28610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028611 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028612 printf(" %d", n_input);
28613 printf(" %d", n_URI);
28614 printf("\n");
28615 }
28616 }
28617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028618 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028619#endif
28620
Daniel Veillard42595322004-11-08 10:52:06 +000028621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028622}
28623
28624
28625static int
28626test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028628
William M. Brack21e4ef22005-01-02 09:53:13 +000028629#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028630 int mem_base;
28631 xmlTextReaderPtr ret_val;
28632 const char * URI; /* the URI of the resource to process */
28633 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028634
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028635 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28636 mem_base = xmlMemBlocks();
28637 URI = gen_filepath(n_URI, 0);
28638
28639 ret_val = xmlNewTextReaderFilename(URI);
28640 desret_xmlTextReaderPtr(ret_val);
28641 call_tests++;
28642 des_filepath(n_URI, URI, 0);
28643 xmlResetLastError();
28644 if (mem_base != xmlMemBlocks()) {
28645 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028647 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028648 printf(" %d", n_URI);
28649 printf("\n");
28650 }
28651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028652 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028653#endif
28654
Daniel Veillard42595322004-11-08 10:52:06 +000028655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028656}
28657
28658
28659static int
28660test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028662
William M. Brack21e4ef22005-01-02 09:53:13 +000028663#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028664 int mem_base;
28665 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028666 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028667 int n_cur;
28668 const char * URL; /* the base URL to use for the document */
28669 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028670 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028671 int n_encoding;
28672 int options; /* a combination of xmlParserOption */
28673 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028674
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028675 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28676 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28677 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028678 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028679 mem_base = xmlMemBlocks();
28680 cur = gen_const_xmlChar_ptr(n_cur, 0);
28681 URL = gen_filepath(n_URL, 1);
28682 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028683 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028684
William M. Brackf13f77f2004-11-12 16:03:48 +000028685 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028686 desret_xmlTextReaderPtr(ret_val);
28687 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028688 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028689 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028690 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028691 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028692 xmlResetLastError();
28693 if (mem_base != xmlMemBlocks()) {
28694 printf("Leak of %d blocks found in xmlReaderForDoc",
28695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028696 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028697 printf(" %d", n_cur);
28698 printf(" %d", n_URL);
28699 printf(" %d", n_encoding);
28700 printf(" %d", n_options);
28701 printf("\n");
28702 }
28703 }
28704 }
28705 }
28706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028707 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028708#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028709
Daniel Veillard42595322004-11-08 10:52:06 +000028710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028711}
28712
28713
28714static int
28715test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028717
William M. Brack21e4ef22005-01-02 09:53:13 +000028718#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028719 int mem_base;
28720 xmlTextReaderPtr ret_val;
28721 const char * filename; /* a file or URL */
28722 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028723 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028724 int n_encoding;
28725 int options; /* a combination of xmlParserOption */
28726 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028727
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028728 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28729 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028730 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028731 mem_base = xmlMemBlocks();
28732 filename = gen_filepath(n_filename, 0);
28733 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028734 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028735
William M. Brackf13f77f2004-11-12 16:03:48 +000028736 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028737 desret_xmlTextReaderPtr(ret_val);
28738 call_tests++;
28739 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028740 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028741 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028742 xmlResetLastError();
28743 if (mem_base != xmlMemBlocks()) {
28744 printf("Leak of %d blocks found in xmlReaderForFile",
28745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028746 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028747 printf(" %d", n_filename);
28748 printf(" %d", n_encoding);
28749 printf(" %d", n_options);
28750 printf("\n");
28751 }
28752 }
28753 }
28754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028755 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028756#endif
28757
Daniel Veillard42595322004-11-08 10:52:06 +000028758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028759}
28760
28761
28762static int
28763test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028765
William M. Brack21e4ef22005-01-02 09:53:13 +000028766#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028767 int mem_base;
28768 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028769 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028770 int n_buffer;
28771 int size; /* the size of the array */
28772 int n_size;
28773 const char * URL; /* the base URL to use for the document */
28774 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028775 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028776 int n_encoding;
28777 int options; /* a combination of xmlParserOption */
28778 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028779
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028780 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28781 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28782 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28783 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028784 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028785 mem_base = xmlMemBlocks();
28786 buffer = gen_const_char_ptr(n_buffer, 0);
28787 size = gen_int(n_size, 1);
28788 URL = gen_filepath(n_URL, 2);
28789 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028790 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028791
William M. Brackf13f77f2004-11-12 16:03:48 +000028792 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028793 desret_xmlTextReaderPtr(ret_val);
28794 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028795 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028796 des_int(n_size, size, 1);
28797 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028798 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028799 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028800 xmlResetLastError();
28801 if (mem_base != xmlMemBlocks()) {
28802 printf("Leak of %d blocks found in xmlReaderForMemory",
28803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028804 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028805 printf(" %d", n_buffer);
28806 printf(" %d", n_size);
28807 printf(" %d", n_URL);
28808 printf(" %d", n_encoding);
28809 printf(" %d", n_options);
28810 printf("\n");
28811 }
28812 }
28813 }
28814 }
28815 }
28816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028817 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028818#endif
28819
Daniel Veillard42595322004-11-08 10:52:06 +000028820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028821}
28822
28823
28824static int
28825test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028827
William M. Brack21e4ef22005-01-02 09:53:13 +000028828#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028829 int mem_base;
28830 int ret_val;
28831 xmlTextReaderPtr reader; /* an XML reader */
28832 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028833 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028834 int n_cur;
28835 const char * URL; /* the base URL to use for the document */
28836 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028837 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028838 int n_encoding;
28839 int options; /* a combination of xmlParserOption */
28840 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028841
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028842 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28843 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28844 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28845 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028846 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028848 reader = gen_xmlTextReaderPtr(n_reader, 0);
28849 cur = gen_const_xmlChar_ptr(n_cur, 1);
28850 URL = gen_filepath(n_URL, 2);
28851 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028852 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028853
William M. Brackf13f77f2004-11-12 16:03:48 +000028854 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028855 desret_int(ret_val);
28856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028857 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028858 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028859 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028860 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028861 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028862 xmlResetLastError();
28863 if (mem_base != xmlMemBlocks()) {
28864 printf("Leak of %d blocks found in xmlReaderNewDoc",
28865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028866 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028867 printf(" %d", n_reader);
28868 printf(" %d", n_cur);
28869 printf(" %d", n_URL);
28870 printf(" %d", n_encoding);
28871 printf(" %d", n_options);
28872 printf("\n");
28873 }
28874 }
28875 }
28876 }
28877 }
28878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028879 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028880#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028881
Daniel Veillard42595322004-11-08 10:52:06 +000028882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028883}
28884
28885
28886static int
28887test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028889
William M. Brack21e4ef22005-01-02 09:53:13 +000028890#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028891 int mem_base;
28892 int ret_val;
28893 xmlTextReaderPtr reader; /* an XML reader */
28894 int n_reader;
28895 const char * filename; /* a file or URL */
28896 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028897 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028898 int n_encoding;
28899 int options; /* a combination of xmlParserOption */
28900 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028901
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028902 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28903 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28904 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028905 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028907 reader = gen_xmlTextReaderPtr(n_reader, 0);
28908 filename = gen_filepath(n_filename, 1);
28909 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028910 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028911
William M. Brackf13f77f2004-11-12 16:03:48 +000028912 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913 desret_int(ret_val);
28914 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028915 des_xmlTextReaderPtr(n_reader, reader, 0);
28916 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028917 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028918 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028919 xmlResetLastError();
28920 if (mem_base != xmlMemBlocks()) {
28921 printf("Leak of %d blocks found in xmlReaderNewFile",
28922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028923 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028924 printf(" %d", n_reader);
28925 printf(" %d", n_filename);
28926 printf(" %d", n_encoding);
28927 printf(" %d", n_options);
28928 printf("\n");
28929 }
28930 }
28931 }
28932 }
28933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028934 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028935#endif
28936
Daniel Veillard42595322004-11-08 10:52:06 +000028937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028938}
28939
28940
28941static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028942test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028944
William M. Brack21e4ef22005-01-02 09:53:13 +000028945#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028946 int mem_base;
28947 int ret_val;
28948 xmlTextReaderPtr reader; /* an XML reader */
28949 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028950 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028951 int n_buffer;
28952 int size; /* the size of the array */
28953 int n_size;
28954 const char * URL; /* the base URL to use for the document */
28955 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028956 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028957 int n_encoding;
28958 int options; /* a combination of xmlParserOption */
28959 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028960
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028961 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28962 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28963 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28964 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28965 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028966 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028968 reader = gen_xmlTextReaderPtr(n_reader, 0);
28969 buffer = gen_const_char_ptr(n_buffer, 1);
28970 size = gen_int(n_size, 2);
28971 URL = gen_filepath(n_URL, 3);
28972 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028973 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028974
William M. Brackf13f77f2004-11-12 16:03:48 +000028975 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028976 desret_int(ret_val);
28977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028978 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028979 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028980 des_int(n_size, size, 2);
28981 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028982 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028983 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028984 xmlResetLastError();
28985 if (mem_base != xmlMemBlocks()) {
28986 printf("Leak of %d blocks found in xmlReaderNewMemory",
28987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028988 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028989 printf(" %d", n_reader);
28990 printf(" %d", n_buffer);
28991 printf(" %d", n_size);
28992 printf(" %d", n_URL);
28993 printf(" %d", n_encoding);
28994 printf(" %d", n_options);
28995 printf("\n");
28996 }
28997 }
28998 }
28999 }
29000 }
29001 }
29002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029003 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029004#endif
29005
Daniel Veillard42595322004-11-08 10:52:06 +000029006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029007}
29008
29009
29010static int
29011test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029013
William M. Brack21e4ef22005-01-02 09:53:13 +000029014#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029015 int mem_base;
29016 int ret_val;
29017 xmlTextReaderPtr reader; /* an XML reader */
29018 int n_reader;
29019 xmlDocPtr doc; /* a preparsed document */
29020 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029021
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029022 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29023 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29024 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029025 reader = gen_xmlTextReaderPtr(n_reader, 0);
29026 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029027
29028 ret_val = xmlReaderNewWalker(reader, doc);
29029 desret_int(ret_val);
29030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029031 des_xmlTextReaderPtr(n_reader, reader, 0);
29032 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029033 xmlResetLastError();
29034 if (mem_base != xmlMemBlocks()) {
29035 printf("Leak of %d blocks found in xmlReaderNewWalker",
29036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029037 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029038 printf(" %d", n_reader);
29039 printf(" %d", n_doc);
29040 printf("\n");
29041 }
29042 }
29043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029044 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029045#endif
29046
Daniel Veillard42595322004-11-08 10:52:06 +000029047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029048}
29049
29050
29051static int
29052test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029054
William M. Brack21e4ef22005-01-02 09:53:13 +000029055#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029056 int mem_base;
29057 xmlTextReaderPtr ret_val;
29058 xmlDocPtr doc; /* a preparsed document */
29059 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029060
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029061 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29062 mem_base = xmlMemBlocks();
29063 doc = gen_xmlDocPtr(n_doc, 0);
29064
29065 ret_val = xmlReaderWalker(doc);
29066 desret_xmlTextReaderPtr(ret_val);
29067 call_tests++;
29068 des_xmlDocPtr(n_doc, doc, 0);
29069 xmlResetLastError();
29070 if (mem_base != xmlMemBlocks()) {
29071 printf("Leak of %d blocks found in xmlReaderWalker",
29072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029073 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029074 printf(" %d", n_doc);
29075 printf("\n");
29076 }
29077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029078 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029079#endif
29080
Daniel Veillard42595322004-11-08 10:52:06 +000029081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029082}
29083
29084
29085static int
29086test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029088
William M. Brack21e4ef22005-01-02 09:53:13 +000029089#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029090 int mem_base;
29091 int ret_val;
29092 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29093 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029094
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029095 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29096 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029097 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029098
29099 ret_val = xmlTextReaderAttributeCount(reader);
29100 desret_int(ret_val);
29101 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029102 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029103 xmlResetLastError();
29104 if (mem_base != xmlMemBlocks()) {
29105 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
29106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029107 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029108 printf(" %d", n_reader);
29109 printf("\n");
29110 }
29111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029112 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029113#endif
29114
Daniel Veillard42595322004-11-08 10:52:06 +000029115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029116}
29117
29118
29119static int
29120test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029122
William M. Brack21e4ef22005-01-02 09:53:13 +000029123#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029124 int mem_base;
29125 xmlChar * ret_val;
29126 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29127 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029128
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029129 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29130 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029131 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029132
29133 ret_val = xmlTextReaderBaseUri(reader);
29134 desret_xmlChar_ptr(ret_val);
29135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029136 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029137 xmlResetLastError();
29138 if (mem_base != xmlMemBlocks()) {
29139 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029141 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029142 printf(" %d", n_reader);
29143 printf("\n");
29144 }
29145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029146 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029147#endif
29148
Daniel Veillard42595322004-11-08 10:52:06 +000029149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029150}
29151
29152
29153static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000029154test_xmlTextReaderByteConsumed(void) {
29155 int test_ret = 0;
29156
29157#if defined(LIBXML_READER_ENABLED)
29158 int mem_base;
29159 long ret_val;
29160 xmlTextReaderPtr reader; /* an XML reader */
29161 int n_reader;
29162
29163 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29164 mem_base = xmlMemBlocks();
29165 reader = gen_xmlTextReaderPtr(n_reader, 0);
29166
29167 ret_val = xmlTextReaderByteConsumed(reader);
29168 desret_long(ret_val);
29169 call_tests++;
29170 des_xmlTextReaderPtr(n_reader, reader, 0);
29171 xmlResetLastError();
29172 if (mem_base != xmlMemBlocks()) {
29173 printf("Leak of %d blocks found in xmlTextReaderByteConsumed",
29174 xmlMemBlocks() - mem_base);
29175 test_ret++;
29176 printf(" %d", n_reader);
29177 printf("\n");
29178 }
29179 }
29180 function_tests++;
29181#endif
29182
29183 return(test_ret);
29184}
29185
29186
29187static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029188test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029190
William M. Brack21e4ef22005-01-02 09:53:13 +000029191#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029192 int mem_base;
29193 int ret_val;
29194 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29195 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029196
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029197 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029199 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029200
29201 ret_val = xmlTextReaderClose(reader);
29202 desret_int(ret_val);
29203 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029204 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029205 xmlResetLastError();
29206 if (mem_base != xmlMemBlocks()) {
29207 printf("Leak of %d blocks found in xmlTextReaderClose",
29208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029209 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029210 printf(" %d", n_reader);
29211 printf("\n");
29212 }
29213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029214 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029215#endif
29216
Daniel Veillard42595322004-11-08 10:52:06 +000029217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029218}
29219
29220
29221static int
29222test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029224
William M. Brack21e4ef22005-01-02 09:53:13 +000029225#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029226 int mem_base;
29227 const xmlChar * ret_val;
29228 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29229 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029230
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029231 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29232 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029233 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029234
29235 ret_val = xmlTextReaderConstBaseUri(reader);
29236 desret_const_xmlChar_ptr(ret_val);
29237 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029238 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029239 xmlResetLastError();
29240 if (mem_base != xmlMemBlocks()) {
29241 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029243 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029244 printf(" %d", n_reader);
29245 printf("\n");
29246 }
29247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029248 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029249#endif
29250
Daniel Veillard42595322004-11-08 10:52:06 +000029251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029252}
29253
29254
29255static int
29256test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029258
William M. Brack21e4ef22005-01-02 09:53:13 +000029259#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260 int mem_base;
29261 const xmlChar * ret_val;
29262 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29263 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029264
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029265 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29266 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029267 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029268
29269 ret_val = xmlTextReaderConstEncoding(reader);
29270 desret_const_xmlChar_ptr(ret_val);
29271 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029272 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029273 xmlResetLastError();
29274 if (mem_base != xmlMemBlocks()) {
29275 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029277 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029278 printf(" %d", n_reader);
29279 printf("\n");
29280 }
29281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029282 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029283#endif
29284
Daniel Veillard42595322004-11-08 10:52:06 +000029285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029286}
29287
29288
29289static int
29290test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029292
William M. Brack21e4ef22005-01-02 09:53:13 +000029293#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029294 int mem_base;
29295 const xmlChar * ret_val;
29296 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29297 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029298
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029299 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029301 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029302
29303 ret_val = xmlTextReaderConstLocalName(reader);
29304 desret_const_xmlChar_ptr(ret_val);
29305 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029306 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029307 xmlResetLastError();
29308 if (mem_base != xmlMemBlocks()) {
29309 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029311 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029312 printf(" %d", n_reader);
29313 printf("\n");
29314 }
29315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029316 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029317#endif
29318
Daniel Veillard42595322004-11-08 10:52:06 +000029319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029320}
29321
29322
29323static int
29324test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029326
William M. Brack21e4ef22005-01-02 09:53:13 +000029327#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029328 int mem_base;
29329 const xmlChar * ret_val;
29330 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29331 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029332
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029333 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029335 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029336
29337 ret_val = xmlTextReaderConstName(reader);
29338 desret_const_xmlChar_ptr(ret_val);
29339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029340 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029341 xmlResetLastError();
29342 if (mem_base != xmlMemBlocks()) {
29343 printf("Leak of %d blocks found in xmlTextReaderConstName",
29344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029345 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029346 printf(" %d", n_reader);
29347 printf("\n");
29348 }
29349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029350 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029351#endif
29352
Daniel Veillard42595322004-11-08 10:52:06 +000029353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029354}
29355
29356
29357static int
29358test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029360
William M. Brack21e4ef22005-01-02 09:53:13 +000029361#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029362 int mem_base;
29363 const xmlChar * ret_val;
29364 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29365 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029366
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029367 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29368 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029369 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029370
29371 ret_val = xmlTextReaderConstNamespaceUri(reader);
29372 desret_const_xmlChar_ptr(ret_val);
29373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029374 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029375 xmlResetLastError();
29376 if (mem_base != xmlMemBlocks()) {
29377 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029379 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029380 printf(" %d", n_reader);
29381 printf("\n");
29382 }
29383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029384 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029385#endif
29386
Daniel Veillard42595322004-11-08 10:52:06 +000029387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029388}
29389
29390
29391static int
29392test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029394
William M. Brack21e4ef22005-01-02 09:53:13 +000029395#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029396 int mem_base;
29397 const xmlChar * ret_val;
29398 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29399 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029400
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029401 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029403 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029404
29405 ret_val = xmlTextReaderConstPrefix(reader);
29406 desret_const_xmlChar_ptr(ret_val);
29407 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029408 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029409 xmlResetLastError();
29410 if (mem_base != xmlMemBlocks()) {
29411 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029413 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029414 printf(" %d", n_reader);
29415 printf("\n");
29416 }
29417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029418 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029419#endif
29420
Daniel Veillard42595322004-11-08 10:52:06 +000029421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029422}
29423
29424
29425static int
29426test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029428
William M. Brack21e4ef22005-01-02 09:53:13 +000029429#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029430 int mem_base;
29431 const xmlChar * ret_val;
29432 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29433 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029434 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029435 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029436
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029437 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29438 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29439 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029440 reader = gen_xmlTextReaderPtr(n_reader, 0);
29441 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029442
William M. Brackf13f77f2004-11-12 16:03:48 +000029443 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029444 desret_const_xmlChar_ptr(ret_val);
29445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029446 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029447 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029448 xmlResetLastError();
29449 if (mem_base != xmlMemBlocks()) {
29450 printf("Leak of %d blocks found in xmlTextReaderConstString",
29451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029452 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029453 printf(" %d", n_reader);
29454 printf(" %d", n_str);
29455 printf("\n");
29456 }
29457 }
29458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029459 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029460#endif
29461
Daniel Veillard42595322004-11-08 10:52:06 +000029462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029463}
29464
29465
29466static int
29467test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029469
William M. Brack21e4ef22005-01-02 09:53:13 +000029470#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029471 int mem_base;
29472 const xmlChar * ret_val;
29473 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29474 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029475
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029476 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029478 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029479
29480 ret_val = xmlTextReaderConstValue(reader);
29481 desret_const_xmlChar_ptr(ret_val);
29482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029483 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029484 xmlResetLastError();
29485 if (mem_base != xmlMemBlocks()) {
29486 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029488 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029489 printf(" %d", n_reader);
29490 printf("\n");
29491 }
29492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029493 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029494#endif
29495
Daniel Veillard42595322004-11-08 10:52:06 +000029496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029497}
29498
29499
29500static int
29501test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029503
William M. Brack21e4ef22005-01-02 09:53:13 +000029504#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029505 int mem_base;
29506 const xmlChar * ret_val;
29507 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29508 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029509
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029510 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029512 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029513
29514 ret_val = xmlTextReaderConstXmlLang(reader);
29515 desret_const_xmlChar_ptr(ret_val);
29516 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029517 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029518 xmlResetLastError();
29519 if (mem_base != xmlMemBlocks()) {
29520 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029522 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029523 printf(" %d", n_reader);
29524 printf("\n");
29525 }
29526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029527 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029528#endif
29529
Daniel Veillard42595322004-11-08 10:52:06 +000029530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029531}
29532
29533
29534static int
29535test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029537
William M. Brack21e4ef22005-01-02 09:53:13 +000029538#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029539 int mem_base;
29540 const xmlChar * ret_val;
29541 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29542 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029543
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029544 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029546 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029547
29548 ret_val = xmlTextReaderConstXmlVersion(reader);
29549 desret_const_xmlChar_ptr(ret_val);
29550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029551 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029552 xmlResetLastError();
29553 if (mem_base != xmlMemBlocks()) {
29554 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029556 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029557 printf(" %d", n_reader);
29558 printf("\n");
29559 }
29560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029561 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029562#endif
29563
Daniel Veillard42595322004-11-08 10:52:06 +000029564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029565}
29566
29567
29568static int
29569test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029571
William M. Brack21e4ef22005-01-02 09:53:13 +000029572#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029573 int mem_base;
29574 xmlDocPtr ret_val;
29575 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29576 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029577
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029578 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029580 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029581
29582 ret_val = xmlTextReaderCurrentDoc(reader);
29583 desret_xmlDocPtr(ret_val);
29584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029585 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029586 xmlResetLastError();
29587 if (mem_base != xmlMemBlocks()) {
29588 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029590 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029591 printf(" %d", n_reader);
29592 printf("\n");
29593 }
29594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029595 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029596#endif
29597
Daniel Veillard42595322004-11-08 10:52:06 +000029598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029599}
29600
29601
29602static int
29603test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029605
William M. Brack21e4ef22005-01-02 09:53:13 +000029606#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029607 int mem_base;
29608 xmlNodePtr ret_val;
29609 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29610 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029611
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029612 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029614 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029615
29616 ret_val = xmlTextReaderCurrentNode(reader);
29617 desret_xmlNodePtr(ret_val);
29618 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029619 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029620 xmlResetLastError();
29621 if (mem_base != xmlMemBlocks()) {
29622 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029624 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029625 printf(" %d", n_reader);
29626 printf("\n");
29627 }
29628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029629 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029630#endif
29631
Daniel Veillard42595322004-11-08 10:52:06 +000029632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029633}
29634
29635
29636static int
29637test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029639
William M. Brack21e4ef22005-01-02 09:53:13 +000029640#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029641 int mem_base;
29642 int ret_val;
29643 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29644 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029645
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029646 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29647 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029648 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029649
29650 ret_val = xmlTextReaderDepth(reader);
29651 desret_int(ret_val);
29652 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029653 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029654 xmlResetLastError();
29655 if (mem_base != xmlMemBlocks()) {
29656 printf("Leak of %d blocks found in xmlTextReaderDepth",
29657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029658 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029659 printf(" %d", n_reader);
29660 printf("\n");
29661 }
29662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029663 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029664#endif
29665
Daniel Veillard42595322004-11-08 10:52:06 +000029666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029667}
29668
29669
29670static int
29671test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029673
William M. Brack21e4ef22005-01-02 09:53:13 +000029674#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029675 int mem_base;
29676 xmlNodePtr ret_val;
29677 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29678 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029679
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029680 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029682 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029683
29684 ret_val = xmlTextReaderExpand(reader);
29685 desret_xmlNodePtr(ret_val);
29686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029687 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029688 xmlResetLastError();
29689 if (mem_base != xmlMemBlocks()) {
29690 printf("Leak of %d blocks found in xmlTextReaderExpand",
29691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029692 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029693 printf(" %d", n_reader);
29694 printf("\n");
29695 }
29696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029697 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029698#endif
29699
Daniel Veillard42595322004-11-08 10:52:06 +000029700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029701}
29702
29703
29704static int
29705test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029707
William M. Brack21e4ef22005-01-02 09:53:13 +000029708#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029709 int mem_base;
29710 xmlChar * ret_val;
29711 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29712 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029713 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029714 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029715
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029716 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029719 reader = gen_xmlTextReaderPtr(n_reader, 0);
29720 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029721
William M. Brackf13f77f2004-11-12 16:03:48 +000029722 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029723 desret_xmlChar_ptr(ret_val);
29724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029725 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029726 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029727 xmlResetLastError();
29728 if (mem_base != xmlMemBlocks()) {
29729 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029731 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029732 printf(" %d", n_reader);
29733 printf(" %d", n_name);
29734 printf("\n");
29735 }
29736 }
29737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029738 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029739#endif
29740
Daniel Veillard42595322004-11-08 10:52:06 +000029741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029742}
29743
29744
29745static int
29746test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029748
William M. Brack21e4ef22005-01-02 09:53:13 +000029749#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029750 int mem_base;
29751 xmlChar * ret_val;
29752 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29753 int n_reader;
29754 int no; /* the zero-based index of the attribute relative to the containing element */
29755 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029756
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029757 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29758 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029760 reader = gen_xmlTextReaderPtr(n_reader, 0);
29761 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029762
29763 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29764 desret_xmlChar_ptr(ret_val);
29765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029766 des_xmlTextReaderPtr(n_reader, reader, 0);
29767 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029768 xmlResetLastError();
29769 if (mem_base != xmlMemBlocks()) {
29770 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029772 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029773 printf(" %d", n_reader);
29774 printf(" %d", n_no);
29775 printf("\n");
29776 }
29777 }
29778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029779 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029780#endif
29781
Daniel Veillard42595322004-11-08 10:52:06 +000029782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029783}
29784
29785
29786static int
29787test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789
William M. Brack21e4ef22005-01-02 09:53:13 +000029790#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029791 int mem_base;
29792 xmlChar * ret_val;
29793 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29794 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029795 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029796 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029797 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029799
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029800 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29801 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29802 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029804 reader = gen_xmlTextReaderPtr(n_reader, 0);
29805 localName = gen_const_xmlChar_ptr(n_localName, 1);
29806 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029807
William M. Brackf13f77f2004-11-12 16:03:48 +000029808 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029809 desret_xmlChar_ptr(ret_val);
29810 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029811 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029812 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29813 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029814 xmlResetLastError();
29815 if (mem_base != xmlMemBlocks()) {
29816 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029818 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029819 printf(" %d", n_reader);
29820 printf(" %d", n_localName);
29821 printf(" %d", n_namespaceURI);
29822 printf("\n");
29823 }
29824 }
29825 }
29826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029827 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029828#endif
29829
Daniel Veillard42595322004-11-08 10:52:06 +000029830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029831}
29832
Daniel Veillarda521d282004-11-09 14:59:59 +000029833#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029834
Daniel Veillardce682bc2004-11-05 17:22:25 +000029835#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29836static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29837 return(NULL);
29838}
29839static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29840}
Daniel Veillarda521d282004-11-09 14:59:59 +000029841#endif
29842
Daniel Veillardce682bc2004-11-05 17:22:25 +000029843
Daniel Veillardd93f6252004-11-02 15:53:51 +000029844static int
29845test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029847
William M. Brack21e4ef22005-01-02 09:53:13 +000029848#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029849 int mem_base;
29850 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29851 int n_reader;
29852 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29853 int n_f;
29854 void ** arg; /* a user argument */
29855 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029856
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029857 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29858 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29859 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29860 mem_base = xmlMemBlocks();
29861 reader = gen_xmlTextReaderPtr(n_reader, 0);
29862 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29863 arg = gen_void_ptr_ptr(n_arg, 2);
29864
29865 xmlTextReaderGetErrorHandler(reader, f, arg);
29866 call_tests++;
29867 des_xmlTextReaderPtr(n_reader, reader, 0);
29868 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29869 des_void_ptr_ptr(n_arg, arg, 2);
29870 xmlResetLastError();
29871 if (mem_base != xmlMemBlocks()) {
29872 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029874 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029875 printf(" %d", n_reader);
29876 printf(" %d", n_f);
29877 printf(" %d", n_arg);
29878 printf("\n");
29879 }
29880 }
29881 }
29882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029883 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029884#endif
29885
Daniel Veillard42595322004-11-08 10:52:06 +000029886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029887}
29888
29889
29890static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029891test_xmlTextReaderGetParserColumnNumber(void) {
29892 int test_ret = 0;
29893
29894#if defined(LIBXML_READER_ENABLED)
29895 int mem_base;
29896 int ret_val;
29897 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29898 int n_reader;
29899
29900 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29901 mem_base = xmlMemBlocks();
29902 reader = gen_xmlTextReaderPtr(n_reader, 0);
29903
29904 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29905 desret_int(ret_val);
29906 call_tests++;
29907 des_xmlTextReaderPtr(n_reader, reader, 0);
29908 xmlResetLastError();
29909 if (mem_base != xmlMemBlocks()) {
29910 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29911 xmlMemBlocks() - mem_base);
29912 test_ret++;
29913 printf(" %d", n_reader);
29914 printf("\n");
29915 }
29916 }
29917 function_tests++;
29918#endif
29919
29920 return(test_ret);
29921}
29922
29923
29924static int
29925test_xmlTextReaderGetParserLineNumber(void) {
29926 int test_ret = 0;
29927
29928#if defined(LIBXML_READER_ENABLED)
29929 int mem_base;
29930 int ret_val;
29931 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29932 int n_reader;
29933
29934 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29935 mem_base = xmlMemBlocks();
29936 reader = gen_xmlTextReaderPtr(n_reader, 0);
29937
29938 ret_val = xmlTextReaderGetParserLineNumber(reader);
29939 desret_int(ret_val);
29940 call_tests++;
29941 des_xmlTextReaderPtr(n_reader, reader, 0);
29942 xmlResetLastError();
29943 if (mem_base != xmlMemBlocks()) {
29944 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29945 xmlMemBlocks() - mem_base);
29946 test_ret++;
29947 printf(" %d", n_reader);
29948 printf("\n");
29949 }
29950 }
29951 function_tests++;
29952#endif
29953
29954 return(test_ret);
29955}
29956
29957
29958static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029959test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029961
William M. Brack21e4ef22005-01-02 09:53:13 +000029962#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029963 int mem_base;
29964 int ret_val;
29965 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29966 int n_reader;
29967 int prop; /* the xmlParserProperties to get */
29968 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029969
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029970 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29971 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29972 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029973 reader = gen_xmlTextReaderPtr(n_reader, 0);
29974 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029975
29976 ret_val = xmlTextReaderGetParserProp(reader, prop);
29977 desret_int(ret_val);
29978 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029979 des_xmlTextReaderPtr(n_reader, reader, 0);
29980 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029981 xmlResetLastError();
29982 if (mem_base != xmlMemBlocks()) {
29983 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029985 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029986 printf(" %d", n_reader);
29987 printf(" %d", n_prop);
29988 printf("\n");
29989 }
29990 }
29991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029992 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029993#endif
29994
Daniel Veillard42595322004-11-08 10:52:06 +000029995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029996}
29997
29998
29999static int
30000test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030002
William M. Brack21e4ef22005-01-02 09:53:13 +000030003#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030004 int mem_base;
30005 xmlParserInputBufferPtr ret_val;
30006 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30007 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030008
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030009 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30010 mem_base = xmlMemBlocks();
30011 reader = gen_xmlTextReaderPtr(n_reader, 0);
30012
30013 ret_val = xmlTextReaderGetRemainder(reader);
30014 desret_xmlParserInputBufferPtr(ret_val);
30015 call_tests++;
30016 des_xmlTextReaderPtr(n_reader, reader, 0);
30017 xmlResetLastError();
30018 if (mem_base != xmlMemBlocks()) {
30019 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
30020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030021 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030022 printf(" %d", n_reader);
30023 printf("\n");
30024 }
30025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030026 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030027#endif
30028
Daniel Veillard42595322004-11-08 10:52:06 +000030029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030030}
30031
30032
30033static int
30034test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030036
William M. Brack21e4ef22005-01-02 09:53:13 +000030037#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038 int mem_base;
30039 int ret_val;
30040 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30041 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030042
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030043 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30044 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030045 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030046
30047 ret_val = xmlTextReaderHasAttributes(reader);
30048 desret_int(ret_val);
30049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030050 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030051 xmlResetLastError();
30052 if (mem_base != xmlMemBlocks()) {
30053 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
30054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030055 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030056 printf(" %d", n_reader);
30057 printf("\n");
30058 }
30059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030060 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030061#endif
30062
Daniel Veillard42595322004-11-08 10:52:06 +000030063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030064}
30065
30066
30067static int
30068test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030070
William M. Brack21e4ef22005-01-02 09:53:13 +000030071#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072 int mem_base;
30073 int ret_val;
30074 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30075 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030076
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030077 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030079 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080
30081 ret_val = xmlTextReaderHasValue(reader);
30082 desret_int(ret_val);
30083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030084 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085 xmlResetLastError();
30086 if (mem_base != xmlMemBlocks()) {
30087 printf("Leak of %d blocks found in xmlTextReaderHasValue",
30088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030089 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030090 printf(" %d", n_reader);
30091 printf("\n");
30092 }
30093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030094 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030095#endif
30096
Daniel Veillard42595322004-11-08 10:52:06 +000030097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030098}
30099
30100
30101static int
30102test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030104
William M. Brack21e4ef22005-01-02 09:53:13 +000030105#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106 int mem_base;
30107 int ret_val;
30108 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30109 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030110
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030111 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030113 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114
30115 ret_val = xmlTextReaderIsDefault(reader);
30116 desret_int(ret_val);
30117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030118 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030119 xmlResetLastError();
30120 if (mem_base != xmlMemBlocks()) {
30121 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
30122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030123 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030124 printf(" %d", n_reader);
30125 printf("\n");
30126 }
30127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030128 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030129#endif
30130
Daniel Veillard42595322004-11-08 10:52:06 +000030131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030132}
30133
30134
30135static int
30136test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030138
William M. Brack21e4ef22005-01-02 09:53:13 +000030139#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030140 int mem_base;
30141 int ret_val;
30142 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30143 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030144
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030145 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030147 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148
30149 ret_val = xmlTextReaderIsEmptyElement(reader);
30150 desret_int(ret_val);
30151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030152 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030153 xmlResetLastError();
30154 if (mem_base != xmlMemBlocks()) {
30155 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
30156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030157 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030158 printf(" %d", n_reader);
30159 printf("\n");
30160 }
30161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030162 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030163#endif
30164
Daniel Veillard42595322004-11-08 10:52:06 +000030165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030166}
30167
30168
30169static int
30170test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030172
William M. Brack21e4ef22005-01-02 09:53:13 +000030173#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174 int mem_base;
30175 int ret_val;
30176 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30177 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030178
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030179 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030181 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182
30183 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30184 desret_int(ret_val);
30185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030186 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030187 xmlResetLastError();
30188 if (mem_base != xmlMemBlocks()) {
30189 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030191 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030192 printf(" %d", n_reader);
30193 printf("\n");
30194 }
30195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030196 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030197#endif
30198
Daniel Veillard42595322004-11-08 10:52:06 +000030199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030200}
30201
30202
30203static int
30204test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030206
William M. Brack21e4ef22005-01-02 09:53:13 +000030207#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208 int mem_base;
30209 int ret_val;
30210 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30211 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030212
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030215 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030216
30217 ret_val = xmlTextReaderIsValid(reader);
30218 desret_int(ret_val);
30219 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030220 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030221 xmlResetLastError();
30222 if (mem_base != xmlMemBlocks()) {
30223 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030225 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030226 printf(" %d", n_reader);
30227 printf("\n");
30228 }
30229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030230 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030231#endif
30232
Daniel Veillard42595322004-11-08 10:52:06 +000030233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030234}
30235
30236
30237static int
30238test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030240
William M. Brack21e4ef22005-01-02 09:53:13 +000030241#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030242 int mem_base;
30243 xmlChar * ret_val;
30244 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30245 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030246
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030247 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030249 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250
30251 ret_val = xmlTextReaderLocalName(reader);
30252 desret_xmlChar_ptr(ret_val);
30253 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030254 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030255 xmlResetLastError();
30256 if (mem_base != xmlMemBlocks()) {
30257 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030259 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030260 printf(" %d", n_reader);
30261 printf("\n");
30262 }
30263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030264 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030265#endif
30266
Daniel Veillard42595322004-11-08 10:52:06 +000030267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030268}
30269
Daniel Veillarda521d282004-11-09 14:59:59 +000030270#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030271
Daniel Veillardce682bc2004-11-05 17:22:25 +000030272#define gen_nb_xmlTextReaderLocatorPtr 1
30273static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30274 return(NULL);
30275}
30276static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30277}
Daniel Veillarda521d282004-11-09 14:59:59 +000030278#endif
30279
Daniel Veillardce682bc2004-11-05 17:22:25 +000030280
Daniel Veillardd93f6252004-11-02 15:53:51 +000030281static int
30282test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030284
William M. Brack21e4ef22005-01-02 09:53:13 +000030285#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030286 int mem_base;
30287 xmlChar * ret_val;
30288 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30289 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030290
Daniel Veillardce682bc2004-11-05 17:22:25 +000030291 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30292 mem_base = xmlMemBlocks();
30293 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30294
30295 ret_val = xmlTextReaderLocatorBaseURI(locator);
30296 desret_xmlChar_ptr(ret_val);
30297 call_tests++;
30298 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30299 xmlResetLastError();
30300 if (mem_base != xmlMemBlocks()) {
30301 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030303 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030304 printf(" %d", n_locator);
30305 printf("\n");
30306 }
30307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030308 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030309#endif
30310
Daniel Veillard42595322004-11-08 10:52:06 +000030311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030312}
30313
30314
30315static int
30316test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030318
William M. Brack21e4ef22005-01-02 09:53:13 +000030319#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030320 int mem_base;
30321 int ret_val;
30322 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30323 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030324
Daniel Veillardce682bc2004-11-05 17:22:25 +000030325 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30326 mem_base = xmlMemBlocks();
30327 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30328
30329 ret_val = xmlTextReaderLocatorLineNumber(locator);
30330 desret_int(ret_val);
30331 call_tests++;
30332 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30333 xmlResetLastError();
30334 if (mem_base != xmlMemBlocks()) {
30335 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030337 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030338 printf(" %d", n_locator);
30339 printf("\n");
30340 }
30341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030342 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030343#endif
30344
Daniel Veillard42595322004-11-08 10:52:06 +000030345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030346}
30347
30348
30349static int
30350test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030352
William M. Brack21e4ef22005-01-02 09:53:13 +000030353#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030354 int mem_base;
30355 xmlChar * ret_val;
30356 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30357 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030358 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 +000030359 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030360
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030361 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30362 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30363 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030364 reader = gen_xmlTextReaderPtr(n_reader, 0);
30365 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030366
William M. Brackf13f77f2004-11-12 16:03:48 +000030367 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030368 desret_xmlChar_ptr(ret_val);
30369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030370 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030371 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030372 xmlResetLastError();
30373 if (mem_base != xmlMemBlocks()) {
30374 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030376 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030377 printf(" %d", n_reader);
30378 printf(" %d", n_prefix);
30379 printf("\n");
30380 }
30381 }
30382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030383 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030384#endif
30385
Daniel Veillard42595322004-11-08 10:52:06 +000030386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030387}
30388
30389
30390static int
30391test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030393
William M. Brack21e4ef22005-01-02 09:53:13 +000030394#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030395 int mem_base;
30396 int ret_val;
30397 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30398 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030399 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030400 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030401
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030402 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30403 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030405 reader = gen_xmlTextReaderPtr(n_reader, 0);
30406 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030407
William M. Brackf13f77f2004-11-12 16:03:48 +000030408 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030409 desret_int(ret_val);
30410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030411 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030412 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413 xmlResetLastError();
30414 if (mem_base != xmlMemBlocks()) {
30415 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030417 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030418 printf(" %d", n_reader);
30419 printf(" %d", n_name);
30420 printf("\n");
30421 }
30422 }
30423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030424 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030425#endif
30426
Daniel Veillard42595322004-11-08 10:52:06 +000030427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030428}
30429
30430
30431static int
30432test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030434
William M. Brack21e4ef22005-01-02 09:53:13 +000030435#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030436 int mem_base;
30437 int ret_val;
30438 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30439 int n_reader;
30440 int no; /* the zero-based index of the attribute relative to the containing element. */
30441 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030442
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030443 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30444 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030446 reader = gen_xmlTextReaderPtr(n_reader, 0);
30447 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030448
30449 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30450 desret_int(ret_val);
30451 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030452 des_xmlTextReaderPtr(n_reader, reader, 0);
30453 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030454 xmlResetLastError();
30455 if (mem_base != xmlMemBlocks()) {
30456 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030458 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030459 printf(" %d", n_reader);
30460 printf(" %d", n_no);
30461 printf("\n");
30462 }
30463 }
30464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030465 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030466#endif
30467
Daniel Veillard42595322004-11-08 10:52:06 +000030468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030469}
30470
30471
30472static int
30473test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030475
William M. Brack21e4ef22005-01-02 09:53:13 +000030476#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030477 int mem_base;
30478 int ret_val;
30479 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30480 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030481 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030482 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030483 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030484 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030485
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030486 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30487 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30488 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030490 reader = gen_xmlTextReaderPtr(n_reader, 0);
30491 localName = gen_const_xmlChar_ptr(n_localName, 1);
30492 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030493
William M. Brackf13f77f2004-11-12 16:03:48 +000030494 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030495 desret_int(ret_val);
30496 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030497 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030498 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30499 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030500 xmlResetLastError();
30501 if (mem_base != xmlMemBlocks()) {
30502 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030504 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030505 printf(" %d", n_reader);
30506 printf(" %d", n_localName);
30507 printf(" %d", n_namespaceURI);
30508 printf("\n");
30509 }
30510 }
30511 }
30512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030513 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030514#endif
30515
Daniel Veillard42595322004-11-08 10:52:06 +000030516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030517}
30518
30519
30520static int
30521test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030523
William M. Brack21e4ef22005-01-02 09:53:13 +000030524#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030525 int mem_base;
30526 int ret_val;
30527 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30528 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030529
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030530 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030532 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030533
30534 ret_val = xmlTextReaderMoveToElement(reader);
30535 desret_int(ret_val);
30536 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030537 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030538 xmlResetLastError();
30539 if (mem_base != xmlMemBlocks()) {
30540 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030542 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030543 printf(" %d", n_reader);
30544 printf("\n");
30545 }
30546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030547 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030548#endif
30549
Daniel Veillard42595322004-11-08 10:52:06 +000030550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030551}
30552
30553
30554static int
30555test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030557
William M. Brack21e4ef22005-01-02 09:53:13 +000030558#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030559 int mem_base;
30560 int ret_val;
30561 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30562 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030563
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030564 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030566 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030567
30568 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30569 desret_int(ret_val);
30570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030571 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030572 xmlResetLastError();
30573 if (mem_base != xmlMemBlocks()) {
30574 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030576 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030577 printf(" %d", n_reader);
30578 printf("\n");
30579 }
30580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030581 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030582#endif
30583
Daniel Veillard42595322004-11-08 10:52:06 +000030584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030585}
30586
30587
30588static int
30589test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030591
William M. Brack21e4ef22005-01-02 09:53:13 +000030592#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030593 int mem_base;
30594 int ret_val;
30595 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30596 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030597
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030598 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030600 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030601
30602 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30603 desret_int(ret_val);
30604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030605 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030606 xmlResetLastError();
30607 if (mem_base != xmlMemBlocks()) {
30608 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030610 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030611 printf(" %d", n_reader);
30612 printf("\n");
30613 }
30614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030615 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030616#endif
30617
Daniel Veillard42595322004-11-08 10:52:06 +000030618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030619}
30620
30621
30622static int
30623test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030625
William M. Brack21e4ef22005-01-02 09:53:13 +000030626#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030627 int mem_base;
30628 xmlChar * ret_val;
30629 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30630 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030631
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030632 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030634 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030635
30636 ret_val = xmlTextReaderName(reader);
30637 desret_xmlChar_ptr(ret_val);
30638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030639 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030640 xmlResetLastError();
30641 if (mem_base != xmlMemBlocks()) {
30642 printf("Leak of %d blocks found in xmlTextReaderName",
30643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030644 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030645 printf(" %d", n_reader);
30646 printf("\n");
30647 }
30648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030649 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030650#endif
30651
Daniel Veillard42595322004-11-08 10:52:06 +000030652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030653}
30654
30655
30656static int
30657test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030659
William M. Brack21e4ef22005-01-02 09:53:13 +000030660#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030661 int mem_base;
30662 xmlChar * ret_val;
30663 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30664 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030665
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030666 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30667 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030668 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030669
30670 ret_val = xmlTextReaderNamespaceUri(reader);
30671 desret_xmlChar_ptr(ret_val);
30672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030673 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030674 xmlResetLastError();
30675 if (mem_base != xmlMemBlocks()) {
30676 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030678 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030679 printf(" %d", n_reader);
30680 printf("\n");
30681 }
30682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030683 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030684#endif
30685
Daniel Veillard42595322004-11-08 10:52:06 +000030686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030687}
30688
30689
30690static int
30691test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030693
William M. Brack21e4ef22005-01-02 09:53:13 +000030694#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030695 int mem_base;
30696 int ret_val;
30697 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30698 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030699
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030700 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030702 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030703
30704 ret_val = xmlTextReaderNext(reader);
30705 desret_int(ret_val);
30706 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030707 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030708 xmlResetLastError();
30709 if (mem_base != xmlMemBlocks()) {
30710 printf("Leak of %d blocks found in xmlTextReaderNext",
30711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030712 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030713 printf(" %d", n_reader);
30714 printf("\n");
30715 }
30716 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030717 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030718#endif
30719
Daniel Veillard42595322004-11-08 10:52:06 +000030720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030721}
30722
30723
30724static int
30725test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030727
William M. Brack21e4ef22005-01-02 09:53:13 +000030728#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030729 int mem_base;
30730 int ret_val;
30731 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30732 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030733
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030734 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30735 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030736 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737
30738 ret_val = xmlTextReaderNextSibling(reader);
30739 desret_int(ret_val);
30740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030741 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030742 xmlResetLastError();
30743 if (mem_base != xmlMemBlocks()) {
30744 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030746 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030747 printf(" %d", n_reader);
30748 printf("\n");
30749 }
30750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030751 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030752#endif
30753
Daniel Veillard42595322004-11-08 10:52:06 +000030754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030755}
30756
30757
30758static int
30759test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030761
William M. Brack21e4ef22005-01-02 09:53:13 +000030762#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030763 int mem_base;
30764 int ret_val;
30765 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30766 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030767
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030768 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030770 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030771
30772 ret_val = xmlTextReaderNodeType(reader);
30773 desret_int(ret_val);
30774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030775 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030776 xmlResetLastError();
30777 if (mem_base != xmlMemBlocks()) {
30778 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030780 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030781 printf(" %d", n_reader);
30782 printf("\n");
30783 }
30784 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030785 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030786#endif
30787
Daniel Veillard42595322004-11-08 10:52:06 +000030788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030789}
30790
30791
30792static int
30793test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030795
William M. Brack21e4ef22005-01-02 09:53:13 +000030796#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030797 int mem_base;
30798 int ret_val;
30799 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30800 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030801
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030802 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030804 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030805
30806 ret_val = xmlTextReaderNormalization(reader);
30807 desret_int(ret_val);
30808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030809 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030810 xmlResetLastError();
30811 if (mem_base != xmlMemBlocks()) {
30812 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030814 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030815 printf(" %d", n_reader);
30816 printf("\n");
30817 }
30818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030819 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030820#endif
30821
Daniel Veillard42595322004-11-08 10:52:06 +000030822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030823}
30824
30825
30826static int
30827test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030829
William M. Brack21e4ef22005-01-02 09:53:13 +000030830#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030831 int mem_base;
30832 xmlChar * ret_val;
30833 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30834 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030835
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030836 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030838 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030839
30840 ret_val = xmlTextReaderPrefix(reader);
30841 desret_xmlChar_ptr(ret_val);
30842 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030843 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030844 xmlResetLastError();
30845 if (mem_base != xmlMemBlocks()) {
30846 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030848 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030849 printf(" %d", n_reader);
30850 printf("\n");
30851 }
30852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030853 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030854#endif
30855
Daniel Veillard42595322004-11-08 10:52:06 +000030856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030857}
30858
30859
30860static int
30861test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030863
William M. Brack21e4ef22005-01-02 09:53:13 +000030864#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030865 int mem_base;
30866 xmlNodePtr ret_val;
30867 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30868 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030869
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030870 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030872 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030873
30874 ret_val = xmlTextReaderPreserve(reader);
30875 desret_xmlNodePtr(ret_val);
30876 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030877 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030878 xmlResetLastError();
30879 if (mem_base != xmlMemBlocks()) {
30880 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030882 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030883 printf(" %d", n_reader);
30884 printf("\n");
30885 }
30886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030887 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030888#endif
30889
Daniel Veillard42595322004-11-08 10:52:06 +000030890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030891}
30892
30893
30894static int
30895test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030897
William M. Brack21e4ef22005-01-02 09:53:13 +000030898#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030899#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030900 int mem_base;
30901 int ret_val;
30902 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30903 int n_reader;
30904 xmlChar * pattern; /* an XPath subset pattern */
30905 int n_pattern;
30906 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30907 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030908
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030909 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30910 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30911 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30912 mem_base = xmlMemBlocks();
30913 reader = gen_xmlTextReaderPtr(n_reader, 0);
30914 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30915 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30916
William M. Brackf13f77f2004-11-12 16:03:48 +000030917 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030918 desret_int(ret_val);
30919 call_tests++;
30920 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030921 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30922 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030923 xmlResetLastError();
30924 if (mem_base != xmlMemBlocks()) {
30925 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030927 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030928 printf(" %d", n_reader);
30929 printf(" %d", n_pattern);
30930 printf(" %d", n_namespaces);
30931 printf("\n");
30932 }
30933 }
30934 }
30935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030936 function_tests++;
30937#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030938#endif
30939
Daniel Veillard42595322004-11-08 10:52:06 +000030940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030941}
30942
30943
30944static int
30945test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030947
William M. Brack21e4ef22005-01-02 09:53:13 +000030948#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030949 int mem_base;
30950 int ret_val;
30951 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30952 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030953
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030954 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030956 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030957
30958 ret_val = xmlTextReaderQuoteChar(reader);
30959 desret_int(ret_val);
30960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030961 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030962 xmlResetLastError();
30963 if (mem_base != xmlMemBlocks()) {
30964 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030966 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030967 printf(" %d", n_reader);
30968 printf("\n");
30969 }
30970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030971 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030972#endif
30973
Daniel Veillard42595322004-11-08 10:52:06 +000030974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030975}
30976
30977
30978static int
30979test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030981
William M. Brack21e4ef22005-01-02 09:53:13 +000030982#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030983 int mem_base;
30984 int ret_val;
30985 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30986 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030987
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030988 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30989 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030990 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030991
30992 ret_val = xmlTextReaderRead(reader);
30993 desret_int(ret_val);
30994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030995 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030996 xmlResetLastError();
30997 if (mem_base != xmlMemBlocks()) {
30998 printf("Leak of %d blocks found in xmlTextReaderRead",
30999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031000 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031001 printf(" %d", n_reader);
31002 printf("\n");
31003 }
31004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031005 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031006#endif
31007
Daniel Veillard42595322004-11-08 10:52:06 +000031008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031009}
31010
31011
31012static int
31013test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031015
William M. Brack21e4ef22005-01-02 09:53:13 +000031016#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031017 int mem_base;
31018 int ret_val;
31019 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31020 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031021
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031022 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31023 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031024 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031025
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031026 ret_val = xmlTextReaderReadAttributeValue(reader);
31027 desret_int(ret_val);
31028 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031029 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031030 xmlResetLastError();
31031 if (mem_base != xmlMemBlocks()) {
31032 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
31033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031034 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031035 printf(" %d", n_reader);
31036 printf("\n");
31037 }
31038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031039 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031040#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031041
Daniel Veillard42595322004-11-08 10:52:06 +000031042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031043}
31044
31045
31046static int
31047test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031049
William M. Brack21e4ef22005-01-02 09:53:13 +000031050#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031051 int mem_base;
31052 int ret_val;
31053 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31054 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031055
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031056 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31057 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031058 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031059
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031060 ret_val = xmlTextReaderReadState(reader);
31061 desret_int(ret_val);
31062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031063 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031064 xmlResetLastError();
31065 if (mem_base != xmlMemBlocks()) {
31066 printf("Leak of %d blocks found in xmlTextReaderReadState",
31067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031068 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031069 printf(" %d", n_reader);
31070 printf("\n");
31071 }
31072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031073 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031074#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031075
Daniel Veillard42595322004-11-08 10:52:06 +000031076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031077}
31078
31079
31080static int
31081test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031083
William M. Brack21e4ef22005-01-02 09:53:13 +000031084#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031085 int mem_base;
31086 int ret_val;
31087 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31088 int n_reader;
31089 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
31090 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031091
Daniel Veillardce682bc2004-11-05 17:22:25 +000031092 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31093 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
31094 mem_base = xmlMemBlocks();
31095 reader = gen_xmlTextReaderPtr(n_reader, 0);
31096 schema = gen_xmlRelaxNGPtr(n_schema, 1);
31097
31098 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
31099 desret_int(ret_val);
31100 call_tests++;
31101 des_xmlTextReaderPtr(n_reader, reader, 0);
31102 des_xmlRelaxNGPtr(n_schema, schema, 1);
31103 xmlResetLastError();
31104 if (mem_base != xmlMemBlocks()) {
31105 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
31106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031107 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031108 printf(" %d", n_reader);
31109 printf(" %d", n_schema);
31110 printf("\n");
31111 }
31112 }
31113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031114 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031115#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031116
Daniel Veillard42595322004-11-08 10:52:06 +000031117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031118}
31119
31120
31121static int
31122test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031124
William M. Brack21e4ef22005-01-02 09:53:13 +000031125#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031126 int mem_base;
31127 int ret_val;
31128 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31129 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031130 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031131 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031132
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031133 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31134 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
31135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031136 reader = gen_xmlTextReaderPtr(n_reader, 0);
31137 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031138
William M. Brackf13f77f2004-11-12 16:03:48 +000031139 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031140 desret_int(ret_val);
31141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031142 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031143 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031144 xmlResetLastError();
31145 if (mem_base != xmlMemBlocks()) {
31146 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
31147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031148 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031149 printf(" %d", n_reader);
31150 printf(" %d", n_rng);
31151 printf("\n");
31152 }
31153 }
31154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031155 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031156#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031157
Daniel Veillard42595322004-11-08 10:52:06 +000031158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031159}
31160
31161
31162static int
31163test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031165
31166
31167 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031169}
31170
31171
31172static int
31173test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031175
William M. Brack21e4ef22005-01-02 09:53:13 +000031176#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031177 int mem_base;
31178 int ret_val;
31179 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31180 int n_reader;
31181 int prop; /* the xmlParserProperties to set */
31182 int n_prop;
31183 int value; /* usually 0 or 1 to (de)activate it */
31184 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031185
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031186 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31187 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31188 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31189 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031190 reader = gen_xmlTextReaderPtr(n_reader, 0);
31191 prop = gen_int(n_prop, 1);
31192 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031193
31194 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31195 desret_int(ret_val);
31196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031197 des_xmlTextReaderPtr(n_reader, reader, 0);
31198 des_int(n_prop, prop, 1);
31199 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031200 xmlResetLastError();
31201 if (mem_base != xmlMemBlocks()) {
31202 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031204 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031205 printf(" %d", n_reader);
31206 printf(" %d", n_prop);
31207 printf(" %d", n_value);
31208 printf("\n");
31209 }
31210 }
31211 }
31212 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031213 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031214#endif
31215
Daniel Veillard42595322004-11-08 10:52:06 +000031216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031217}
31218
31219
31220static int
31221test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031223
31224
31225 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031227}
31228
31229
31230static int
31231test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031233
William M. Brack21e4ef22005-01-02 09:53:13 +000031234#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031235 int mem_base;
31236 int ret_val;
31237 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31238 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031239
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031240 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31241 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031242 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031243
31244 ret_val = xmlTextReaderStandalone(reader);
31245 desret_int(ret_val);
31246 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031247 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031248 xmlResetLastError();
31249 if (mem_base != xmlMemBlocks()) {
31250 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031252 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031253 printf(" %d", n_reader);
31254 printf("\n");
31255 }
31256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031257 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031258#endif
31259
Daniel Veillard42595322004-11-08 10:52:06 +000031260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031261}
31262
31263
31264static int
31265test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031267
William M. Brack21e4ef22005-01-02 09:53:13 +000031268#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031269 int mem_base;
31270 xmlChar * ret_val;
31271 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31272 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031273
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031274 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31275 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031276 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031277
31278 ret_val = xmlTextReaderValue(reader);
31279 desret_xmlChar_ptr(ret_val);
31280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031281 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031282 xmlResetLastError();
31283 if (mem_base != xmlMemBlocks()) {
31284 printf("Leak of %d blocks found in xmlTextReaderValue",
31285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031286 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031287 printf(" %d", n_reader);
31288 printf("\n");
31289 }
31290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031291 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031292#endif
31293
Daniel Veillard42595322004-11-08 10:52:06 +000031294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031295}
31296
31297
31298static int
31299test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031301
William M. Brack21e4ef22005-01-02 09:53:13 +000031302#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031303 int mem_base;
31304 xmlChar * ret_val;
31305 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31306 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031307
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031308 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31309 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031310 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031311
31312 ret_val = xmlTextReaderXmlLang(reader);
31313 desret_xmlChar_ptr(ret_val);
31314 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031315 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031316 xmlResetLastError();
31317 if (mem_base != xmlMemBlocks()) {
31318 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031320 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031321 printf(" %d", n_reader);
31322 printf("\n");
31323 }
31324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031325 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031326#endif
31327
Daniel Veillard42595322004-11-08 10:52:06 +000031328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031329}
31330
31331static int
31332test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031334
Daniel Veillardb5839c32005-02-19 18:27:14 +000031335 if (quiet == 0) printf("Testing xmlreader : 71 of 81 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031336 test_ret += test_xmlNewTextReader();
31337 test_ret += test_xmlNewTextReaderFilename();
31338 test_ret += test_xmlReaderForDoc();
31339 test_ret += test_xmlReaderForFile();
31340 test_ret += test_xmlReaderForMemory();
31341 test_ret += test_xmlReaderNewDoc();
31342 test_ret += test_xmlReaderNewFile();
31343 test_ret += test_xmlReaderNewMemory();
31344 test_ret += test_xmlReaderNewWalker();
31345 test_ret += test_xmlReaderWalker();
31346 test_ret += test_xmlTextReaderAttributeCount();
31347 test_ret += test_xmlTextReaderBaseUri();
Daniel Veillardb5839c32005-02-19 18:27:14 +000031348 test_ret += test_xmlTextReaderByteConsumed();
Daniel Veillard42595322004-11-08 10:52:06 +000031349 test_ret += test_xmlTextReaderClose();
31350 test_ret += test_xmlTextReaderConstBaseUri();
31351 test_ret += test_xmlTextReaderConstEncoding();
31352 test_ret += test_xmlTextReaderConstLocalName();
31353 test_ret += test_xmlTextReaderConstName();
31354 test_ret += test_xmlTextReaderConstNamespaceUri();
31355 test_ret += test_xmlTextReaderConstPrefix();
31356 test_ret += test_xmlTextReaderConstString();
31357 test_ret += test_xmlTextReaderConstValue();
31358 test_ret += test_xmlTextReaderConstXmlLang();
31359 test_ret += test_xmlTextReaderConstXmlVersion();
31360 test_ret += test_xmlTextReaderCurrentDoc();
31361 test_ret += test_xmlTextReaderCurrentNode();
31362 test_ret += test_xmlTextReaderDepth();
31363 test_ret += test_xmlTextReaderExpand();
31364 test_ret += test_xmlTextReaderGetAttribute();
31365 test_ret += test_xmlTextReaderGetAttributeNo();
31366 test_ret += test_xmlTextReaderGetAttributeNs();
31367 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031368 test_ret += test_xmlTextReaderGetParserColumnNumber();
31369 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031370 test_ret += test_xmlTextReaderGetParserProp();
31371 test_ret += test_xmlTextReaderGetRemainder();
31372 test_ret += test_xmlTextReaderHasAttributes();
31373 test_ret += test_xmlTextReaderHasValue();
31374 test_ret += test_xmlTextReaderIsDefault();
31375 test_ret += test_xmlTextReaderIsEmptyElement();
31376 test_ret += test_xmlTextReaderIsNamespaceDecl();
31377 test_ret += test_xmlTextReaderIsValid();
31378 test_ret += test_xmlTextReaderLocalName();
31379 test_ret += test_xmlTextReaderLocatorBaseURI();
31380 test_ret += test_xmlTextReaderLocatorLineNumber();
31381 test_ret += test_xmlTextReaderLookupNamespace();
31382 test_ret += test_xmlTextReaderMoveToAttribute();
31383 test_ret += test_xmlTextReaderMoveToAttributeNo();
31384 test_ret += test_xmlTextReaderMoveToAttributeNs();
31385 test_ret += test_xmlTextReaderMoveToElement();
31386 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31387 test_ret += test_xmlTextReaderMoveToNextAttribute();
31388 test_ret += test_xmlTextReaderName();
31389 test_ret += test_xmlTextReaderNamespaceUri();
31390 test_ret += test_xmlTextReaderNext();
31391 test_ret += test_xmlTextReaderNextSibling();
31392 test_ret += test_xmlTextReaderNodeType();
31393 test_ret += test_xmlTextReaderNormalization();
31394 test_ret += test_xmlTextReaderPrefix();
31395 test_ret += test_xmlTextReaderPreserve();
31396 test_ret += test_xmlTextReaderPreservePattern();
31397 test_ret += test_xmlTextReaderQuoteChar();
31398 test_ret += test_xmlTextReaderRead();
31399 test_ret += test_xmlTextReaderReadAttributeValue();
31400 test_ret += test_xmlTextReaderReadState();
31401 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31402 test_ret += test_xmlTextReaderRelaxNGValidate();
31403 test_ret += test_xmlTextReaderSetErrorHandler();
31404 test_ret += test_xmlTextReaderSetParserProp();
31405 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31406 test_ret += test_xmlTextReaderStandalone();
31407 test_ret += test_xmlTextReaderValue();
31408 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031409
Daniel Veillard42595322004-11-08 10:52:06 +000031410 if (test_ret != 0)
31411 printf("Module xmlreader: %d errors\n", test_ret);
31412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031413}
Daniel Veillarda521d282004-11-09 14:59:59 +000031414#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031415
Daniel Veillarda82b1822004-11-08 16:24:57 +000031416#define gen_nb_xmlRegExecCtxtPtr 1
31417static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31418 return(NULL);
31419}
31420static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31421}
Daniel Veillarda521d282004-11-09 14:59:59 +000031422#endif
31423
Daniel Veillarda82b1822004-11-08 16:24:57 +000031424
31425static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031426test_xmlRegExecErrInfo(void) {
31427 int test_ret = 0;
31428
31429#if defined(LIBXML_REGEXP_ENABLED)
31430 int mem_base;
31431 int ret_val;
31432 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31433 int n_exec;
31434 xmlChar ** string; /* return value for the error string */
31435 int n_string;
31436 int * nbval; /* pointer to the number of accepted values IN/OUT */
31437 int n_nbval;
31438 int * nbneg; /* return number of negative transitions */
31439 int n_nbneg;
31440 xmlChar ** values; /* pointer to the array of acceptable values */
31441 int n_values;
31442 int * terminal; /* return value if this was a terminal state */
31443 int n_terminal;
31444
31445 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31446 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31447 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31448 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31449 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31450 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31451 mem_base = xmlMemBlocks();
31452 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31453 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31454 nbval = gen_int_ptr(n_nbval, 2);
31455 nbneg = gen_int_ptr(n_nbneg, 3);
31456 values = gen_xmlChar_ptr_ptr(n_values, 4);
31457 terminal = gen_int_ptr(n_terminal, 5);
31458
31459 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31460 desret_int(ret_val);
31461 call_tests++;
31462 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31463 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31464 des_int_ptr(n_nbval, nbval, 2);
31465 des_int_ptr(n_nbneg, nbneg, 3);
31466 des_xmlChar_ptr_ptr(n_values, values, 4);
31467 des_int_ptr(n_terminal, terminal, 5);
31468 xmlResetLastError();
31469 if (mem_base != xmlMemBlocks()) {
31470 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31471 xmlMemBlocks() - mem_base);
31472 test_ret++;
31473 printf(" %d", n_exec);
31474 printf(" %d", n_string);
31475 printf(" %d", n_nbval);
31476 printf(" %d", n_nbneg);
31477 printf(" %d", n_values);
31478 printf(" %d", n_terminal);
31479 printf("\n");
31480 }
31481 }
31482 }
31483 }
31484 }
31485 }
31486 }
31487 function_tests++;
31488#endif
31489
31490 return(test_ret);
31491}
31492
31493
31494static int
31495test_xmlRegExecNextValues(void) {
31496 int test_ret = 0;
31497
31498#if defined(LIBXML_REGEXP_ENABLED)
31499 int mem_base;
31500 int ret_val;
31501 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31502 int n_exec;
31503 int * nbval; /* pointer to the number of accepted values IN/OUT */
31504 int n_nbval;
31505 int * nbneg; /* return number of negative transitions */
31506 int n_nbneg;
31507 xmlChar ** values; /* pointer to the array of acceptable values */
31508 int n_values;
31509 int * terminal; /* return value if this was a terminal state */
31510 int n_terminal;
31511
31512 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31513 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31514 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31515 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31516 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31517 mem_base = xmlMemBlocks();
31518 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31519 nbval = gen_int_ptr(n_nbval, 1);
31520 nbneg = gen_int_ptr(n_nbneg, 2);
31521 values = gen_xmlChar_ptr_ptr(n_values, 3);
31522 terminal = gen_int_ptr(n_terminal, 4);
31523
31524 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31525 desret_int(ret_val);
31526 call_tests++;
31527 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31528 des_int_ptr(n_nbval, nbval, 1);
31529 des_int_ptr(n_nbneg, nbneg, 2);
31530 des_xmlChar_ptr_ptr(n_values, values, 3);
31531 des_int_ptr(n_terminal, terminal, 4);
31532 xmlResetLastError();
31533 if (mem_base != xmlMemBlocks()) {
31534 printf("Leak of %d blocks found in xmlRegExecNextValues",
31535 xmlMemBlocks() - mem_base);
31536 test_ret++;
31537 printf(" %d", n_exec);
31538 printf(" %d", n_nbval);
31539 printf(" %d", n_nbneg);
31540 printf(" %d", n_values);
31541 printf(" %d", n_terminal);
31542 printf("\n");
31543 }
31544 }
31545 }
31546 }
31547 }
31548 }
31549 function_tests++;
31550#endif
31551
31552 return(test_ret);
31553}
31554
31555
31556static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031557test_xmlRegExecPushString(void) {
31558 int test_ret = 0;
31559
William M. Brack21e4ef22005-01-02 09:53:13 +000031560#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031561 int mem_base;
31562 int ret_val;
31563 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31564 int n_exec;
31565 xmlChar * value; /* a string token input */
31566 int n_value;
31567 void * data; /* data associated to the token to reuse in callbacks */
31568 int n_data;
31569
31570 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31571 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31572 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31573 mem_base = xmlMemBlocks();
31574 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31575 value = gen_const_xmlChar_ptr(n_value, 1);
31576 data = gen_userdata(n_data, 2);
31577
William M. Brackf13f77f2004-11-12 16:03:48 +000031578 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031579 desret_int(ret_val);
31580 call_tests++;
31581 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031582 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031583 des_userdata(n_data, data, 2);
31584 xmlResetLastError();
31585 if (mem_base != xmlMemBlocks()) {
31586 printf("Leak of %d blocks found in xmlRegExecPushString",
31587 xmlMemBlocks() - mem_base);
31588 test_ret++;
31589 printf(" %d", n_exec);
31590 printf(" %d", n_value);
31591 printf(" %d", n_data);
31592 printf("\n");
31593 }
31594 }
31595 }
31596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031597 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031598#endif
31599
Daniel Veillarda82b1822004-11-08 16:24:57 +000031600 return(test_ret);
31601}
31602
31603
31604static int
31605test_xmlRegExecPushString2(void) {
31606 int test_ret = 0;
31607
William M. Brack21e4ef22005-01-02 09:53:13 +000031608#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031609 int mem_base;
31610 int ret_val;
31611 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31612 int n_exec;
31613 xmlChar * value; /* the first string token input */
31614 int n_value;
31615 xmlChar * value2; /* the second string token input */
31616 int n_value2;
31617 void * data; /* data associated to the token to reuse in callbacks */
31618 int n_data;
31619
31620 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31621 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31622 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31623 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31624 mem_base = xmlMemBlocks();
31625 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31626 value = gen_const_xmlChar_ptr(n_value, 1);
31627 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31628 data = gen_userdata(n_data, 3);
31629
William M. Brackf13f77f2004-11-12 16:03:48 +000031630 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031631 desret_int(ret_val);
31632 call_tests++;
31633 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031634 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31635 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031636 des_userdata(n_data, data, 3);
31637 xmlResetLastError();
31638 if (mem_base != xmlMemBlocks()) {
31639 printf("Leak of %d blocks found in xmlRegExecPushString2",
31640 xmlMemBlocks() - mem_base);
31641 test_ret++;
31642 printf(" %d", n_exec);
31643 printf(" %d", n_value);
31644 printf(" %d", n_value2);
31645 printf(" %d", n_data);
31646 printf("\n");
31647 }
31648 }
31649 }
31650 }
31651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031652 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031653#endif
31654
Daniel Veillarda82b1822004-11-08 16:24:57 +000031655 return(test_ret);
31656}
31657
Daniel Veillarda521d282004-11-09 14:59:59 +000031658#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031659
31660#define gen_nb_xmlRegexpPtr 1
31661static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31662 return(NULL);
31663}
31664static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31665}
Daniel Veillarda521d282004-11-09 14:59:59 +000031666#endif
31667
Daniel Veillarda82b1822004-11-08 16:24:57 +000031668
31669static int
31670test_xmlRegNewExecCtxt(void) {
31671 int test_ret = 0;
31672
31673
31674 /* missing type support */
31675 return(test_ret);
31676}
31677
31678
31679static int
31680test_xmlRegexpCompile(void) {
31681 int test_ret = 0;
31682
31683
31684 /* missing type support */
31685 return(test_ret);
31686}
31687
31688
31689static int
31690test_xmlRegexpExec(void) {
31691 int test_ret = 0;
31692
William M. Brack21e4ef22005-01-02 09:53:13 +000031693#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031694 int mem_base;
31695 int ret_val;
31696 xmlRegexpPtr comp; /* the compiled regular expression */
31697 int n_comp;
31698 xmlChar * content; /* the value to check against the regular expression */
31699 int n_content;
31700
31701 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31702 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31703 mem_base = xmlMemBlocks();
31704 comp = gen_xmlRegexpPtr(n_comp, 0);
31705 content = gen_const_xmlChar_ptr(n_content, 1);
31706
William M. Brackf13f77f2004-11-12 16:03:48 +000031707 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031708 desret_int(ret_val);
31709 call_tests++;
31710 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031711 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031712 xmlResetLastError();
31713 if (mem_base != xmlMemBlocks()) {
31714 printf("Leak of %d blocks found in xmlRegexpExec",
31715 xmlMemBlocks() - mem_base);
31716 test_ret++;
31717 printf(" %d", n_comp);
31718 printf(" %d", n_content);
31719 printf("\n");
31720 }
31721 }
31722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031723 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031724#endif
31725
Daniel Veillarda82b1822004-11-08 16:24:57 +000031726 return(test_ret);
31727}
31728
31729
31730static int
31731test_xmlRegexpIsDeterminist(void) {
31732 int test_ret = 0;
31733
William M. Brack21e4ef22005-01-02 09:53:13 +000031734#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031735 int mem_base;
31736 int ret_val;
31737 xmlRegexpPtr comp; /* the compiled regular expression */
31738 int n_comp;
31739
31740 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31741 mem_base = xmlMemBlocks();
31742 comp = gen_xmlRegexpPtr(n_comp, 0);
31743
31744 ret_val = xmlRegexpIsDeterminist(comp);
31745 desret_int(ret_val);
31746 call_tests++;
31747 des_xmlRegexpPtr(n_comp, comp, 0);
31748 xmlResetLastError();
31749 if (mem_base != xmlMemBlocks()) {
31750 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31751 xmlMemBlocks() - mem_base);
31752 test_ret++;
31753 printf(" %d", n_comp);
31754 printf("\n");
31755 }
31756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031757 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031758#endif
31759
Daniel Veillarda82b1822004-11-08 16:24:57 +000031760 return(test_ret);
31761}
31762
31763
31764static int
31765test_xmlRegexpPrint(void) {
31766 int test_ret = 0;
31767
William M. Brack21e4ef22005-01-02 09:53:13 +000031768#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031769 int mem_base;
31770 FILE * output; /* the file for the output debug */
31771 int n_output;
31772 xmlRegexpPtr regexp; /* the compiled regexp */
31773 int n_regexp;
31774
31775 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31776 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31777 mem_base = xmlMemBlocks();
31778 output = gen_FILE_ptr(n_output, 0);
31779 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31780
31781 xmlRegexpPrint(output, regexp);
31782 call_tests++;
31783 des_FILE_ptr(n_output, output, 0);
31784 des_xmlRegexpPtr(n_regexp, regexp, 1);
31785 xmlResetLastError();
31786 if (mem_base != xmlMemBlocks()) {
31787 printf("Leak of %d blocks found in xmlRegexpPrint",
31788 xmlMemBlocks() - mem_base);
31789 test_ret++;
31790 printf(" %d", n_output);
31791 printf(" %d", n_regexp);
31792 printf("\n");
31793 }
31794 }
31795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031796 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031797#endif
31798
Daniel Veillarda82b1822004-11-08 16:24:57 +000031799 return(test_ret);
31800}
31801
31802static int
31803test_xmlregexp(void) {
31804 int test_ret = 0;
31805
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031806 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31807 test_ret += test_xmlRegExecErrInfo();
31808 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031809 test_ret += test_xmlRegExecPushString();
31810 test_ret += test_xmlRegExecPushString2();
31811 test_ret += test_xmlRegNewExecCtxt();
31812 test_ret += test_xmlRegexpCompile();
31813 test_ret += test_xmlRegexpExec();
31814 test_ret += test_xmlRegexpIsDeterminist();
31815 test_ret += test_xmlRegexpPrint();
31816
31817 if (test_ret != 0)
31818 printf("Module xmlregexp: %d errors\n", test_ret);
31819 return(test_ret);
31820}
Daniel Veillarda521d282004-11-09 14:59:59 +000031821#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031822
Daniel Veillardce682bc2004-11-05 17:22:25 +000031823#define gen_nb_xmlSaveCtxtPtr 1
31824static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31825 return(NULL);
31826}
31827static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31828}
Daniel Veillarda521d282004-11-09 14:59:59 +000031829#endif
31830
Daniel Veillardce682bc2004-11-05 17:22:25 +000031831
Daniel Veillardd93f6252004-11-02 15:53:51 +000031832static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031833test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031835
William M. Brack21e4ef22005-01-02 09:53:13 +000031836#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031837 int mem_base;
31838 int ret_val;
31839 xmlSaveCtxtPtr ctxt; /* a document saving context */
31840 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031841
Daniel Veillardce682bc2004-11-05 17:22:25 +000031842 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31843 mem_base = xmlMemBlocks();
31844 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31845
31846 ret_val = xmlSaveClose(ctxt);
31847 desret_int(ret_val);
31848 call_tests++;
31849 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31850 xmlResetLastError();
31851 if (mem_base != xmlMemBlocks()) {
31852 printf("Leak of %d blocks found in xmlSaveClose",
31853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031854 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031855 printf(" %d", n_ctxt);
31856 printf("\n");
31857 }
31858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031859 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031860#endif
31861
Daniel Veillard42595322004-11-08 10:52:06 +000031862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031863}
31864
31865
31866static int
31867test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031869
William M. Brack21e4ef22005-01-02 09:53:13 +000031870#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031871 int mem_base;
31872 long ret_val;
31873 xmlSaveCtxtPtr ctxt; /* a document saving context */
31874 int n_ctxt;
31875 xmlDocPtr doc; /* a document */
31876 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031877
Daniel Veillardce682bc2004-11-05 17:22:25 +000031878 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31879 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31880 mem_base = xmlMemBlocks();
31881 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31882 doc = gen_xmlDocPtr(n_doc, 1);
31883
31884 ret_val = xmlSaveDoc(ctxt, doc);
31885 desret_long(ret_val);
31886 call_tests++;
31887 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31888 des_xmlDocPtr(n_doc, doc, 1);
31889 xmlResetLastError();
31890 if (mem_base != xmlMemBlocks()) {
31891 printf("Leak of %d blocks found in xmlSaveDoc",
31892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031893 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031894 printf(" %d", n_ctxt);
31895 printf(" %d", n_doc);
31896 printf("\n");
31897 }
31898 }
31899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031900 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031901#endif
31902
Daniel Veillard42595322004-11-08 10:52:06 +000031903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031904}
31905
31906
31907static int
31908test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031910
William M. Brack21e4ef22005-01-02 09:53:13 +000031911#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031912 int mem_base;
31913 int ret_val;
31914 xmlSaveCtxtPtr ctxt; /* a document saving context */
31915 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031916
Daniel Veillardce682bc2004-11-05 17:22:25 +000031917 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31918 mem_base = xmlMemBlocks();
31919 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31920
31921 ret_val = xmlSaveFlush(ctxt);
31922 desret_int(ret_val);
31923 call_tests++;
31924 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31925 xmlResetLastError();
31926 if (mem_base != xmlMemBlocks()) {
31927 printf("Leak of %d blocks found in xmlSaveFlush",
31928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031929 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031930 printf(" %d", n_ctxt);
31931 printf("\n");
31932 }
31933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031934 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031935#endif
31936
Daniel Veillard42595322004-11-08 10:52:06 +000031937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031938}
31939
31940
31941static int
31942test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031944
31945
31946 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031948}
31949
31950
31951static int
31952test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031954
31955
31956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031958}
31959
31960
31961static int
31962test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031964
31965
31966 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031968}
31969
31970
31971static int
31972test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031974
31975
31976 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031978}
31979
31980
31981static int
31982test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031984
William M. Brack21e4ef22005-01-02 09:53:13 +000031985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031986 int mem_base;
31987 long ret_val;
31988 xmlSaveCtxtPtr ctxt; /* a document saving context */
31989 int n_ctxt;
31990 xmlNodePtr node; /* a document */
31991 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031992
Daniel Veillardce682bc2004-11-05 17:22:25 +000031993 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31994 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31995 mem_base = xmlMemBlocks();
31996 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31997 node = gen_xmlNodePtr(n_node, 1);
31998
31999 ret_val = xmlSaveTree(ctxt, node);
32000 desret_long(ret_val);
32001 call_tests++;
32002 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32003 des_xmlNodePtr(n_node, node, 1);
32004 xmlResetLastError();
32005 if (mem_base != xmlMemBlocks()) {
32006 printf("Leak of %d blocks found in xmlSaveTree",
32007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032008 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032009 printf(" %d", n_ctxt);
32010 printf(" %d", n_node);
32011 printf("\n");
32012 }
32013 }
32014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032015 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032016#endif
32017
Daniel Veillard42595322004-11-08 10:52:06 +000032018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032019}
32020
32021static int
32022test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032024
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032025 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032026 test_ret += test_xmlSaveClose();
32027 test_ret += test_xmlSaveDoc();
32028 test_ret += test_xmlSaveFlush();
32029 test_ret += test_xmlSaveSetAttrEscape();
32030 test_ret += test_xmlSaveSetEscape();
32031 test_ret += test_xmlSaveToFd();
32032 test_ret += test_xmlSaveToFilename();
32033 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032034
Daniel Veillard42595322004-11-08 10:52:06 +000032035 if (test_ret != 0)
32036 printf("Module xmlsave: %d errors\n", test_ret);
32037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032038}
Daniel Veillarda521d282004-11-09 14:59:59 +000032039#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032040
Daniel Veillardce682bc2004-11-05 17:22:25 +000032041#define gen_nb_xmlSchemaPtr 1
32042static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32043 return(NULL);
32044}
32045static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32046}
Daniel Veillarda521d282004-11-09 14:59:59 +000032047#endif
32048
Daniel Veillardce682bc2004-11-05 17:22:25 +000032049
Daniel Veillardd93f6252004-11-02 15:53:51 +000032050static int
32051test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032053
William M. Brack21e4ef22005-01-02 09:53:13 +000032054#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032055 int mem_base;
32056 FILE * output; /* the file output */
32057 int n_output;
32058 xmlSchemaPtr schema; /* a schema structure */
32059 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032060
Daniel Veillardce682bc2004-11-05 17:22:25 +000032061 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
32062 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
32063 mem_base = xmlMemBlocks();
32064 output = gen_FILE_ptr(n_output, 0);
32065 schema = gen_xmlSchemaPtr(n_schema, 1);
32066
32067 xmlSchemaDump(output, schema);
32068 call_tests++;
32069 des_FILE_ptr(n_output, output, 0);
32070 des_xmlSchemaPtr(n_schema, schema, 1);
32071 xmlResetLastError();
32072 if (mem_base != xmlMemBlocks()) {
32073 printf("Leak of %d blocks found in xmlSchemaDump",
32074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032075 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032076 printf(" %d", n_output);
32077 printf(" %d", n_schema);
32078 printf("\n");
32079 }
32080 }
32081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032082 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032083#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000032084
Daniel Veillard42595322004-11-08 10:52:06 +000032085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032086}
32087
Daniel Veillarda521d282004-11-09 14:59:59 +000032088#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089
Daniel Veillardce682bc2004-11-05 17:22:25 +000032090#define gen_nb_xmlSchemaParserCtxtPtr 1
32091static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32092 return(NULL);
32093}
32094static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32095}
Daniel Veillarda521d282004-11-09 14:59:59 +000032096#endif
32097
32098#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032099
32100#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
32101static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32102 return(NULL);
32103}
32104static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32105}
Daniel Veillarda521d282004-11-09 14:59:59 +000032106#endif
32107
32108#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032109
32110#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
32111static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32112 return(NULL);
32113}
32114static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32115}
Daniel Veillarda521d282004-11-09 14:59:59 +000032116#endif
32117
Daniel Veillardce682bc2004-11-05 17:22:25 +000032118
Daniel Veillardd93f6252004-11-02 15:53:51 +000032119static int
32120test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122
William M. Brack21e4ef22005-01-02 09:53:13 +000032123#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032124 int mem_base;
32125 int ret_val;
32126 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
32127 int n_ctxt;
32128 xmlSchemaValidityErrorFunc * err; /* the error callback result */
32129 int n_err;
32130 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
32131 int n_warn;
32132 void ** ctx; /* contextual data for the callbacks result */
32133 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032134
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32136 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32137 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32138 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32139 mem_base = xmlMemBlocks();
32140 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
32141 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32142 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32143 ctx = gen_void_ptr_ptr(n_ctx, 3);
32144
32145 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
32146 desret_int(ret_val);
32147 call_tests++;
32148 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
32149 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32150 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32151 des_void_ptr_ptr(n_ctx, ctx, 3);
32152 xmlResetLastError();
32153 if (mem_base != xmlMemBlocks()) {
32154 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
32155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032156 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032157 printf(" %d", n_ctxt);
32158 printf(" %d", n_err);
32159 printf(" %d", n_warn);
32160 printf(" %d", n_ctx);
32161 printf("\n");
32162 }
32163 }
32164 }
32165 }
32166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032167 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032168#endif
32169
Daniel Veillard42595322004-11-08 10:52:06 +000032170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032171}
32172
Daniel Veillarda521d282004-11-09 14:59:59 +000032173#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032174
Daniel Veillardce682bc2004-11-05 17:22:25 +000032175#define gen_nb_xmlSchemaValidCtxtPtr 1
32176static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32177 return(NULL);
32178}
32179static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32180}
Daniel Veillarda521d282004-11-09 14:59:59 +000032181#endif
32182
Daniel Veillardce682bc2004-11-05 17:22:25 +000032183
Daniel Veillardd93f6252004-11-02 15:53:51 +000032184static int
32185test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032187
William M. Brack21e4ef22005-01-02 09:53:13 +000032188#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032189 int mem_base;
32190 int ret_val;
32191 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32192 int n_ctxt;
32193 xmlSchemaValidityErrorFunc * err; /* the error function result */
32194 int n_err;
32195 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32196 int n_warn;
32197 void ** ctx; /* the functions context result */
32198 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032199
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032200 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32201 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32202 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32203 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32204 mem_base = xmlMemBlocks();
32205 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32206 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32207 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32208 ctx = gen_void_ptr_ptr(n_ctx, 3);
32209
32210 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32211 desret_int(ret_val);
32212 call_tests++;
32213 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32214 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32215 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32216 des_void_ptr_ptr(n_ctx, ctx, 3);
32217 xmlResetLastError();
32218 if (mem_base != xmlMemBlocks()) {
32219 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032221 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032222 printf(" %d", n_ctxt);
32223 printf(" %d", n_err);
32224 printf(" %d", n_warn);
32225 printf(" %d", n_ctx);
32226 printf("\n");
32227 }
32228 }
32229 }
32230 }
32231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032232 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032233#endif
32234
Daniel Veillard42595322004-11-08 10:52:06 +000032235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032236}
32237
32238
32239static int
32240test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032242
William M. Brack21e4ef22005-01-02 09:53:13 +000032243#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032244 int mem_base;
32245 xmlSchemaParserCtxtPtr ret_val;
32246 xmlDocPtr doc; /* a preparsed document tree */
32247 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032248
Daniel Veillard42595322004-11-08 10:52:06 +000032249 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32250 mem_base = xmlMemBlocks();
32251 doc = gen_xmlDocPtr(n_doc, 0);
32252
32253 ret_val = xmlSchemaNewDocParserCtxt(doc);
32254 desret_xmlSchemaParserCtxtPtr(ret_val);
32255 call_tests++;
32256 des_xmlDocPtr(n_doc, doc, 0);
32257 xmlResetLastError();
32258 if (mem_base != xmlMemBlocks()) {
32259 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32260 xmlMemBlocks() - mem_base);
32261 test_ret++;
32262 printf(" %d", n_doc);
32263 printf("\n");
32264 }
32265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032266 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032267#endif
32268
Daniel Veillard42595322004-11-08 10:52:06 +000032269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032270}
32271
32272
32273static int
32274test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032276
William M. Brack21e4ef22005-01-02 09:53:13 +000032277#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032278 int mem_base;
32279 xmlSchemaParserCtxtPtr ret_val;
32280 char * buffer; /* a pointer to a char array containing the schemas */
32281 int n_buffer;
32282 int size; /* the size of the array */
32283 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032284
Daniel Veillard42595322004-11-08 10:52:06 +000032285 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32286 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32287 mem_base = xmlMemBlocks();
32288 buffer = gen_const_char_ptr(n_buffer, 0);
32289 size = gen_int(n_size, 1);
32290
William M. Brackf13f77f2004-11-12 16:03:48 +000032291 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032292 desret_xmlSchemaParserCtxtPtr(ret_val);
32293 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032294 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032295 des_int(n_size, size, 1);
32296 xmlResetLastError();
32297 if (mem_base != xmlMemBlocks()) {
32298 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32299 xmlMemBlocks() - mem_base);
32300 test_ret++;
32301 printf(" %d", n_buffer);
32302 printf(" %d", n_size);
32303 printf("\n");
32304 }
32305 }
32306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032307 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032308#endif
32309
Daniel Veillard42595322004-11-08 10:52:06 +000032310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032311}
32312
32313
32314static int
32315test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032317
William M. Brack21e4ef22005-01-02 09:53:13 +000032318#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032319 int mem_base;
32320 xmlSchemaParserCtxtPtr ret_val;
32321 char * URL; /* the location of the schema */
32322 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032323
Daniel Veillard42595322004-11-08 10:52:06 +000032324 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32325 mem_base = xmlMemBlocks();
32326 URL = gen_const_char_ptr(n_URL, 0);
32327
William M. Brackf13f77f2004-11-12 16:03:48 +000032328 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032329 desret_xmlSchemaParserCtxtPtr(ret_val);
32330 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032331 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032332 xmlResetLastError();
32333 if (mem_base != xmlMemBlocks()) {
32334 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32335 xmlMemBlocks() - mem_base);
32336 test_ret++;
32337 printf(" %d", n_URL);
32338 printf("\n");
32339 }
32340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032341 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032342#endif
32343
Daniel Veillard42595322004-11-08 10:52:06 +000032344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032345}
32346
32347
32348static int
32349test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032351
32352
32353 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032355}
32356
32357
32358static int
32359test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032361
32362
32363 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032365}
32366
32367
32368static int
32369test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032371
32372
32373 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032375}
32376
32377
32378static int
32379test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032381
32382
32383 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032385}
32386
32387
32388static int
32389test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032391
William M. Brack21e4ef22005-01-02 09:53:13 +000032392#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032393 int mem_base;
32394 int ret_val;
32395 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32396 int n_ctxt;
32397 int options; /* a combination of xmlSchemaValidOption */
32398 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032399
Daniel Veillardce682bc2004-11-05 17:22:25 +000032400 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32401 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32402 mem_base = xmlMemBlocks();
32403 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32404 options = gen_int(n_options, 1);
32405
32406 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32407 desret_int(ret_val);
32408 call_tests++;
32409 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32410 des_int(n_options, options, 1);
32411 xmlResetLastError();
32412 if (mem_base != xmlMemBlocks()) {
32413 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032415 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032416 printf(" %d", n_ctxt);
32417 printf(" %d", n_options);
32418 printf("\n");
32419 }
32420 }
32421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032422 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032423#endif
32424
Daniel Veillard42595322004-11-08 10:52:06 +000032425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032426}
32427
32428
32429static int
32430test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032432
William M. Brack21e4ef22005-01-02 09:53:13 +000032433#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032434 int mem_base;
32435 int ret_val;
32436 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32437 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032438
Daniel Veillardce682bc2004-11-05 17:22:25 +000032439 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32440 mem_base = xmlMemBlocks();
32441 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32442
32443 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32444 desret_int(ret_val);
32445 call_tests++;
32446 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32447 xmlResetLastError();
32448 if (mem_base != xmlMemBlocks()) {
32449 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032451 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032452 printf(" %d", n_ctxt);
32453 printf("\n");
32454 }
32455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032456 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032457#endif
32458
Daniel Veillard42595322004-11-08 10:52:06 +000032459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032460}
32461
32462
32463static int
32464test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032466
William M. Brack21e4ef22005-01-02 09:53:13 +000032467#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032468 int mem_base;
32469 int ret_val;
32470 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32471 int n_ctxt;
32472 xmlDocPtr doc; /* a parsed document tree */
32473 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032474
Daniel Veillardce682bc2004-11-05 17:22:25 +000032475 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32476 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32477 mem_base = xmlMemBlocks();
32478 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32479 doc = gen_xmlDocPtr(n_doc, 1);
32480
32481 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32482 desret_int(ret_val);
32483 call_tests++;
32484 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32485 des_xmlDocPtr(n_doc, doc, 1);
32486 xmlResetLastError();
32487 if (mem_base != xmlMemBlocks()) {
32488 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032490 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032491 printf(" %d", n_ctxt);
32492 printf(" %d", n_doc);
32493 printf("\n");
32494 }
32495 }
32496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032497 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032498#endif
32499
Daniel Veillard42595322004-11-08 10:52:06 +000032500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032501}
32502
32503
32504static int
32505test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032507
William M. Brack21e4ef22005-01-02 09:53:13 +000032508#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032509 int mem_base;
32510 int ret_val;
32511 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32512 int n_ctxt;
32513 xmlNodePtr elem; /* an element node */
32514 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032515
Daniel Veillardce682bc2004-11-05 17:22:25 +000032516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32517 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32518 mem_base = xmlMemBlocks();
32519 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32520 elem = gen_xmlNodePtr(n_elem, 1);
32521
32522 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32523 desret_int(ret_val);
32524 call_tests++;
32525 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32526 des_xmlNodePtr(n_elem, elem, 1);
32527 xmlResetLastError();
32528 if (mem_base != xmlMemBlocks()) {
32529 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032531 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032532 printf(" %d", n_ctxt);
32533 printf(" %d", n_elem);
32534 printf("\n");
32535 }
32536 }
32537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032538 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032539#endif
32540
Daniel Veillard42595322004-11-08 10:52:06 +000032541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032542}
32543
32544
32545static int
32546test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032548
William M. Brack21e4ef22005-01-02 09:53:13 +000032549#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032550 int mem_base;
32551 int ret_val;
32552 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32553 int n_ctxt;
32554 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32555 int n_input;
32556 xmlCharEncoding enc; /* an optional encoding information */
32557 int n_enc;
32558 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32559 int n_sax;
32560 void * user_data; /* the context to provide to the SAX handler. */
32561 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032562
Daniel Veillardce682bc2004-11-05 17:22:25 +000032563 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32564 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32565 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32566 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32567 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32568 mem_base = xmlMemBlocks();
32569 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32570 input = gen_xmlParserInputBufferPtr(n_input, 1);
32571 enc = gen_xmlCharEncoding(n_enc, 2);
32572 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32573 user_data = gen_userdata(n_user_data, 4);
32574
32575 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32576 desret_int(ret_val);
32577 call_tests++;
32578 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32579 des_xmlParserInputBufferPtr(n_input, input, 1);
32580 des_xmlCharEncoding(n_enc, enc, 2);
32581 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32582 des_userdata(n_user_data, user_data, 4);
32583 xmlResetLastError();
32584 if (mem_base != xmlMemBlocks()) {
32585 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032587 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032588 printf(" %d", n_ctxt);
32589 printf(" %d", n_input);
32590 printf(" %d", n_enc);
32591 printf(" %d", n_sax);
32592 printf(" %d", n_user_data);
32593 printf("\n");
32594 }
32595 }
32596 }
32597 }
32598 }
32599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032600 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032601#endif
32602
Daniel Veillard42595322004-11-08 10:52:06 +000032603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032604}
32605
32606static int
32607test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032609
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032610 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032611 test_ret += test_xmlSchemaDump();
32612 test_ret += test_xmlSchemaGetParserErrors();
32613 test_ret += test_xmlSchemaGetValidErrors();
32614 test_ret += test_xmlSchemaNewDocParserCtxt();
32615 test_ret += test_xmlSchemaNewMemParserCtxt();
32616 test_ret += test_xmlSchemaNewParserCtxt();
32617 test_ret += test_xmlSchemaNewValidCtxt();
32618 test_ret += test_xmlSchemaParse();
32619 test_ret += test_xmlSchemaSetParserErrors();
32620 test_ret += test_xmlSchemaSetValidErrors();
32621 test_ret += test_xmlSchemaSetValidOptions();
32622 test_ret += test_xmlSchemaValidCtxtGetOptions();
32623 test_ret += test_xmlSchemaValidateDoc();
32624 test_ret += test_xmlSchemaValidateOneElement();
32625 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032626
Daniel Veillard42595322004-11-08 10:52:06 +000032627 if (test_ret != 0)
32628 printf("Module xmlschemas: %d errors\n", test_ret);
32629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032630}
Daniel Veillarda521d282004-11-09 14:59:59 +000032631#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032632
Daniel Veillardce682bc2004-11-05 17:22:25 +000032633#define gen_nb_xmlSchemaFacetPtr 1
32634static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32635 return(NULL);
32636}
32637static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32638}
Daniel Veillarda521d282004-11-09 14:59:59 +000032639#endif
32640
32641#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032642
32643#define gen_nb_xmlSchemaTypePtr 1
32644static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32645 return(NULL);
32646}
32647static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32648}
Daniel Veillarda521d282004-11-09 14:59:59 +000032649#endif
32650
Daniel Veillardce682bc2004-11-05 17:22:25 +000032651
Daniel Veillardd93f6252004-11-02 15:53:51 +000032652static int
32653test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032655
William M. Brack21e4ef22005-01-02 09:53:13 +000032656#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032657 int mem_base;
32658 int ret_val;
32659 xmlSchemaFacetPtr facet; /* the facet */
32660 int n_facet;
32661 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32662 int n_typeDecl;
32663 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32664 int n_ctxt;
32665 xmlChar * name; /* name of the type */
32666 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032667
Daniel Veillardce682bc2004-11-05 17:22:25 +000032668 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32669 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32670 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32671 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32672 mem_base = xmlMemBlocks();
32673 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32674 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32675 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32676 name = gen_const_xmlChar_ptr(n_name, 3);
32677
William M. Brackf13f77f2004-11-12 16:03:48 +000032678 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032679 desret_int(ret_val);
32680 call_tests++;
32681 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32682 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32683 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032684 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032685 xmlResetLastError();
32686 if (mem_base != xmlMemBlocks()) {
32687 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032690 printf(" %d", n_facet);
32691 printf(" %d", n_typeDecl);
32692 printf(" %d", n_ctxt);
32693 printf(" %d", n_name);
32694 printf("\n");
32695 }
32696 }
32697 }
32698 }
32699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032700 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032701#endif
32702
Daniel Veillard42595322004-11-08 10:52:06 +000032703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032704}
32705
32706
32707static int
32708test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032710
William M. Brack21e4ef22005-01-02 09:53:13 +000032711#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032712 int mem_base;
32713
32714 mem_base = xmlMemBlocks();
32715
32716 xmlSchemaCleanupTypes();
32717 call_tests++;
32718 xmlResetLastError();
32719 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032720 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032722 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032723 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032725 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032726#endif
32727
Daniel Veillard42595322004-11-08 10:52:06 +000032728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032729}
32730
32731
32732static int
32733test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032735
William M. Brack21e4ef22005-01-02 09:53:13 +000032736#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032737 int mem_base;
32738 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032739 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032740 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032741
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032742 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32743 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032744 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032745
William M. Brackf13f77f2004-11-12 16:03:48 +000032746 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032747 desret_xmlChar_ptr(ret_val);
32748 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032749 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032750 xmlResetLastError();
32751 if (mem_base != xmlMemBlocks()) {
32752 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032754 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032755 printf(" %d", n_value);
32756 printf("\n");
32757 }
32758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032759 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032760#endif
32761
Daniel Veillard42595322004-11-08 10:52:06 +000032762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032763}
32764
Daniel Veillarda521d282004-11-09 14:59:59 +000032765#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032766
Daniel Veillardce682bc2004-11-05 17:22:25 +000032767#define gen_nb_xmlSchemaValPtr 1
32768static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32769 return(NULL);
32770}
32771static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32772}
Daniel Veillarda521d282004-11-09 14:59:59 +000032773#endif
32774
Daniel Veillardce682bc2004-11-05 17:22:25 +000032775
Daniel Veillardd93f6252004-11-02 15:53:51 +000032776static int
32777test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032779
William M. Brack21e4ef22005-01-02 09:53:13 +000032780#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032781 int mem_base;
32782 int ret_val;
32783 xmlSchemaValPtr x; /* a first value */
32784 int n_x;
32785 xmlSchemaValPtr y; /* a second value */
32786 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032787
Daniel Veillardce682bc2004-11-05 17:22:25 +000032788 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32789 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32790 mem_base = xmlMemBlocks();
32791 x = gen_xmlSchemaValPtr(n_x, 0);
32792 y = gen_xmlSchemaValPtr(n_y, 1);
32793
32794 ret_val = xmlSchemaCompareValues(x, y);
32795 desret_int(ret_val);
32796 call_tests++;
32797 des_xmlSchemaValPtr(n_x, x, 0);
32798 des_xmlSchemaValPtr(n_y, y, 1);
32799 xmlResetLastError();
32800 if (mem_base != xmlMemBlocks()) {
32801 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032803 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032804 printf(" %d", n_x);
32805 printf(" %d", n_y);
32806 printf("\n");
32807 }
32808 }
32809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032810 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032811#endif
32812
Daniel Veillard42595322004-11-08 10:52:06 +000032813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032814}
32815
32816
32817static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032818test_xmlSchemaCompareValuesWhtsp(void) {
32819 int test_ret = 0;
32820
32821#if defined(LIBXML_SCHEMAS_ENABLED)
32822 int mem_base;
32823 int ret_val;
32824 xmlSchemaValPtr x; /* a first value */
32825 int n_x;
32826 xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */
32827 int n_xws;
32828 xmlSchemaValPtr y; /* a second value */
32829 int n_y;
32830 xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */
32831 int n_yws;
32832
32833 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32834 for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) {
32835 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32836 for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) {
32837 mem_base = xmlMemBlocks();
32838 x = gen_xmlSchemaValPtr(n_x, 0);
32839 xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1);
32840 y = gen_xmlSchemaValPtr(n_y, 2);
32841 yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3);
32842
32843 ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws);
32844 desret_int(ret_val);
32845 call_tests++;
32846 des_xmlSchemaValPtr(n_x, x, 0);
32847 des_xmlSchemaWhitespaceValueType(n_xws, xws, 1);
32848 des_xmlSchemaValPtr(n_y, y, 2);
32849 des_xmlSchemaWhitespaceValueType(n_yws, yws, 3);
32850 xmlResetLastError();
32851 if (mem_base != xmlMemBlocks()) {
32852 printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp",
32853 xmlMemBlocks() - mem_base);
32854 test_ret++;
32855 printf(" %d", n_x);
32856 printf(" %d", n_xws);
32857 printf(" %d", n_y);
32858 printf(" %d", n_yws);
32859 printf("\n");
32860 }
32861 }
32862 }
32863 }
32864 }
32865 function_tests++;
32866#endif
32867
32868 return(test_ret);
32869}
32870
32871
32872static int
Daniel Veillard57c000e2005-03-13 18:34:29 +000032873test_xmlSchemaCopyValue(void) {
32874 int test_ret = 0;
32875
32876
32877 /* missing type support */
32878 return(test_ret);
32879}
32880
32881
32882static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032883test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032885
William M. Brack21e4ef22005-01-02 09:53:13 +000032886#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032887 int mem_base;
32888 xmlSchemaTypePtr ret_val;
32889 xmlSchemaTypePtr type; /* the built-in simple type. */
32890 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032891
Daniel Veillard42595322004-11-08 10:52:06 +000032892 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32893 mem_base = xmlMemBlocks();
32894 type = gen_xmlSchemaTypePtr(n_type, 0);
32895
32896 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32897 desret_xmlSchemaTypePtr(ret_val);
32898 call_tests++;
32899 des_xmlSchemaTypePtr(n_type, type, 0);
32900 xmlResetLastError();
32901 if (mem_base != xmlMemBlocks()) {
32902 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32903 xmlMemBlocks() - mem_base);
32904 test_ret++;
32905 printf(" %d", n_type);
32906 printf("\n");
32907 }
32908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032909 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032910#endif
32911
Daniel Veillard42595322004-11-08 10:52:06 +000032912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032913}
32914
32915
32916static int
32917test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032919
William M. Brack21e4ef22005-01-02 09:53:13 +000032920#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032921 xmlSchemaTypePtr ret_val;
32922 xmlSchemaValType type; /* the type of the built in type */
32923 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032924
Daniel Veillard42595322004-11-08 10:52:06 +000032925 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32926 type = gen_xmlSchemaValType(n_type, 0);
32927
32928 ret_val = xmlSchemaGetBuiltInType(type);
32929 desret_xmlSchemaTypePtr(ret_val);
32930 call_tests++;
32931 des_xmlSchemaValType(n_type, type, 0);
32932 xmlResetLastError();
32933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032934 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032935#endif
32936
Daniel Veillard42595322004-11-08 10:52:06 +000032937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032938}
32939
32940
32941static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032942test_xmlSchemaGetCanonValue(void) {
32943 int test_ret = 0;
32944
32945#if defined(LIBXML_SCHEMAS_ENABLED)
32946 int mem_base;
32947 int ret_val;
32948 xmlSchemaValPtr val; /* the precomputed value */
32949 int n_val;
32950 xmlChar ** retValue; /* the returned value */
32951 int n_retValue;
32952
32953 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32954 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
32955 mem_base = xmlMemBlocks();
32956 val = gen_xmlSchemaValPtr(n_val, 0);
32957 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
32958
32959 ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue);
32960 desret_int(ret_val);
32961 call_tests++;
32962 des_xmlSchemaValPtr(n_val, val, 0);
32963 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
32964 xmlResetLastError();
32965 if (mem_base != xmlMemBlocks()) {
32966 printf("Leak of %d blocks found in xmlSchemaGetCanonValue",
32967 xmlMemBlocks() - mem_base);
32968 test_ret++;
32969 printf(" %d", n_val);
32970 printf(" %d", n_retValue);
32971 printf("\n");
32972 }
32973 }
32974 }
32975 function_tests++;
32976#endif
32977
32978 return(test_ret);
32979}
32980
32981
32982static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032983test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032985
William M. Brack21e4ef22005-01-02 09:53:13 +000032986#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032987 int mem_base;
32988 unsigned long ret_val;
32989 xmlSchemaFacetPtr facet; /* an schemas type facet */
32990 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032991
William M. Brack094dd862004-11-14 14:28:34 +000032992 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32993 mem_base = xmlMemBlocks();
32994 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32995
32996 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32997 desret_unsigned_long(ret_val);
32998 call_tests++;
32999 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33000 xmlResetLastError();
33001 if (mem_base != xmlMemBlocks()) {
33002 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
33003 xmlMemBlocks() - mem_base);
33004 test_ret++;
33005 printf(" %d", n_facet);
33006 printf("\n");
33007 }
33008 }
33009 function_tests++;
33010#endif
33011
Daniel Veillard42595322004-11-08 10:52:06 +000033012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033013}
33014
33015
33016static int
33017test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033019
William M. Brack21e4ef22005-01-02 09:53:13 +000033020#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033021 int mem_base;
33022 xmlSchemaTypePtr ret_val;
33023 xmlChar * name; /* the type name */
33024 int n_name;
33025 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
33026 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033027
Daniel Veillard42595322004-11-08 10:52:06 +000033028 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33029 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
33030 mem_base = xmlMemBlocks();
33031 name = gen_const_xmlChar_ptr(n_name, 0);
33032 ns = gen_const_xmlChar_ptr(n_ns, 1);
33033
William M. Brackf13f77f2004-11-12 16:03:48 +000033034 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000033035 desret_xmlSchemaTypePtr(ret_val);
33036 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033037 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
33038 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000033039 xmlResetLastError();
33040 if (mem_base != xmlMemBlocks()) {
33041 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
33042 xmlMemBlocks() - mem_base);
33043 test_ret++;
33044 printf(" %d", n_name);
33045 printf(" %d", n_ns);
33046 printf("\n");
33047 }
33048 }
33049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033051#endif
33052
Daniel Veillard42595322004-11-08 10:52:06 +000033053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033054}
33055
33056
33057static int
33058test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033060
William M. Brack21e4ef22005-01-02 09:53:13 +000033061#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000033062
33063
33064 xmlSchemaInitTypes();
33065 call_tests++;
33066 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033067 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033068#endif
33069
Daniel Veillard42595322004-11-08 10:52:06 +000033070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033071}
33072
33073
33074static int
33075test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033077
William M. Brack21e4ef22005-01-02 09:53:13 +000033078#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033079 int mem_base;
33080 int ret_val;
33081 xmlSchemaTypePtr type; /* the built-in type */
33082 int n_type;
33083 int facetType; /* the facet type */
33084 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033085
Daniel Veillardce682bc2004-11-05 17:22:25 +000033086 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33087 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
33088 mem_base = xmlMemBlocks();
33089 type = gen_xmlSchemaTypePtr(n_type, 0);
33090 facetType = gen_int(n_facetType, 1);
33091
33092 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
33093 desret_int(ret_val);
33094 call_tests++;
33095 des_xmlSchemaTypePtr(n_type, type, 0);
33096 des_int(n_facetType, facetType, 1);
33097 xmlResetLastError();
33098 if (mem_base != xmlMemBlocks()) {
33099 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
33100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033101 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033102 printf(" %d", n_type);
33103 printf(" %d", n_facetType);
33104 printf("\n");
33105 }
33106 }
33107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033108 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033109#endif
33110
Daniel Veillard42595322004-11-08 10:52:06 +000033111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033112}
33113
33114
33115static int
33116test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033118
33119
33120 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033122}
33123
Daniel Veillardb5839c32005-02-19 18:27:14 +000033124
33125static int
33126test_xmlSchemaNewNOTATIONValue(void) {
33127 int test_ret = 0;
33128
33129
33130 /* missing type support */
33131 return(test_ret);
33132}
33133
33134
33135static int
33136test_xmlSchemaNewStringValue(void) {
33137 int test_ret = 0;
33138
33139
33140 /* missing type support */
33141 return(test_ret);
33142}
33143
Daniel Veillarda521d282004-11-09 14:59:59 +000033144#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000033145
Daniel Veillardce682bc2004-11-05 17:22:25 +000033146#define gen_nb_xmlSchemaValPtr_ptr 1
33147static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33148 return(NULL);
33149}
33150static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33151}
Daniel Veillarda521d282004-11-09 14:59:59 +000033152#endif
33153
Daniel Veillardce682bc2004-11-05 17:22:25 +000033154
Daniel Veillardd93f6252004-11-02 15:53:51 +000033155static int
33156test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033158
William M. Brack21e4ef22005-01-02 09:53:13 +000033159#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033160 int mem_base;
33161 int ret_val;
33162 xmlSchemaTypePtr type; /* the predefined type */
33163 int n_type;
33164 xmlChar * value; /* the value to check */
33165 int n_value;
33166 xmlSchemaValPtr * val; /* the return computed value */
33167 int n_val;
33168 xmlNodePtr node; /* the node containing the value */
33169 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033170
Daniel Veillardce682bc2004-11-05 17:22:25 +000033171 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33172 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33173 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33174 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33175 mem_base = xmlMemBlocks();
33176 type = gen_xmlSchemaTypePtr(n_type, 0);
33177 value = gen_const_xmlChar_ptr(n_value, 1);
33178 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33179 node = gen_xmlNodePtr(n_node, 3);
33180
William M. Brackf13f77f2004-11-12 16:03:48 +000033181 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033182 desret_int(ret_val);
33183 call_tests++;
33184 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033185 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033186 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33187 des_xmlNodePtr(n_node, node, 3);
33188 xmlResetLastError();
33189 if (mem_base != xmlMemBlocks()) {
33190 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
33191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033192 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033193 printf(" %d", n_type);
33194 printf(" %d", n_value);
33195 printf(" %d", n_val);
33196 printf(" %d", n_node);
33197 printf("\n");
33198 }
33199 }
33200 }
33201 }
33202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033203 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033204#endif
33205
Daniel Veillard42595322004-11-08 10:52:06 +000033206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033207}
33208
33209
33210static int
33211test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033213
William M. Brack21e4ef22005-01-02 09:53:13 +000033214#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033215 int mem_base;
33216 int ret_val;
33217 xmlSchemaTypePtr type; /* the predefined type */
33218 int n_type;
33219 xmlChar * value; /* the value to check */
33220 int n_value;
33221 xmlSchemaValPtr * val; /* the return computed value */
33222 int n_val;
33223 xmlNodePtr node; /* the node containing the value */
33224 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033225
Daniel Veillardce682bc2004-11-05 17:22:25 +000033226 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33227 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33228 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33229 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33230 mem_base = xmlMemBlocks();
33231 type = gen_xmlSchemaTypePtr(n_type, 0);
33232 value = gen_const_xmlChar_ptr(n_value, 1);
33233 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33234 node = gen_xmlNodePtr(n_node, 3);
33235
William M. Brackf13f77f2004-11-12 16:03:48 +000033236 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033237 desret_int(ret_val);
33238 call_tests++;
33239 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033240 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033241 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33242 des_xmlNodePtr(n_node, node, 3);
33243 xmlResetLastError();
33244 if (mem_base != xmlMemBlocks()) {
33245 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
33246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033247 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033248 printf(" %d", n_type);
33249 printf(" %d", n_value);
33250 printf(" %d", n_val);
33251 printf(" %d", n_node);
33252 printf("\n");
33253 }
33254 }
33255 }
33256 }
33257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033258 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033259#endif
33260
Daniel Veillard42595322004-11-08 10:52:06 +000033261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033262}
33263
33264
33265static int
33266test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033268
William M. Brack21e4ef22005-01-02 09:53:13 +000033269#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033270 int mem_base;
33271 int ret_val;
33272 xmlSchemaTypePtr base; /* the base type */
33273 int n_base;
33274 xmlSchemaFacetPtr facet; /* the facet to check */
33275 int n_facet;
33276 xmlChar * value; /* the lexical repr of the value to validate */
33277 int n_value;
33278 xmlSchemaValPtr val; /* the precomputed value */
33279 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033280
Daniel Veillardce682bc2004-11-05 17:22:25 +000033281 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
33282 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33283 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33284 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33285 mem_base = xmlMemBlocks();
33286 base = gen_xmlSchemaTypePtr(n_base, 0);
33287 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33288 value = gen_const_xmlChar_ptr(n_value, 2);
33289 val = gen_xmlSchemaValPtr(n_val, 3);
33290
William M. Brackf13f77f2004-11-12 16:03:48 +000033291 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033292 desret_int(ret_val);
33293 call_tests++;
33294 des_xmlSchemaTypePtr(n_base, base, 0);
33295 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033296 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033297 des_xmlSchemaValPtr(n_val, val, 3);
33298 xmlResetLastError();
33299 if (mem_base != xmlMemBlocks()) {
33300 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033302 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033303 printf(" %d", n_base);
33304 printf(" %d", n_facet);
33305 printf(" %d", n_value);
33306 printf(" %d", n_val);
33307 printf("\n");
33308 }
33309 }
33310 }
33311 }
33312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033313 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033314#endif
33315
Daniel Veillard42595322004-11-08 10:52:06 +000033316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033317}
33318
33319
33320static int
33321test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033323
William M. Brack21e4ef22005-01-02 09:53:13 +000033324#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033325 int mem_base;
33326 int ret_val;
33327 xmlSchemaTypePtr type; /* the built-in type */
33328 int n_type;
33329 xmlSchemaFacetPtr facet; /* the facet to check */
33330 int n_facet;
33331 xmlChar * value; /* the lexical repr. of the value to be validated */
33332 int n_value;
33333 xmlSchemaValPtr val; /* the precomputed value */
33334 int n_val;
33335 unsigned long * length; /* the actual length of the value */
33336 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033337
Daniel Veillardce682bc2004-11-05 17:22:25 +000033338 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33339 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33340 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33341 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33342 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33343 mem_base = xmlMemBlocks();
33344 type = gen_xmlSchemaTypePtr(n_type, 0);
33345 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33346 value = gen_const_xmlChar_ptr(n_value, 2);
33347 val = gen_xmlSchemaValPtr(n_val, 3);
33348 length = gen_unsigned_long_ptr(n_length, 4);
33349
William M. Brackf13f77f2004-11-12 16:03:48 +000033350 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033351 desret_int(ret_val);
33352 call_tests++;
33353 des_xmlSchemaTypePtr(n_type, type, 0);
33354 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033355 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033356 des_xmlSchemaValPtr(n_val, val, 3);
33357 des_unsigned_long_ptr(n_length, length, 4);
33358 xmlResetLastError();
33359 if (mem_base != xmlMemBlocks()) {
33360 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033362 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033363 printf(" %d", n_type);
33364 printf(" %d", n_facet);
33365 printf(" %d", n_value);
33366 printf(" %d", n_val);
33367 printf(" %d", n_length);
33368 printf("\n");
33369 }
33370 }
33371 }
33372 }
33373 }
33374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033375 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033376#endif
33377
Daniel Veillard42595322004-11-08 10:52:06 +000033378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033379}
33380
33381
33382static int
33383test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033385
William M. Brack21e4ef22005-01-02 09:53:13 +000033386#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033387 int mem_base;
33388 int ret_val;
33389 xmlSchemaFacetPtr facet; /* the facet to check */
33390 int n_facet;
33391 xmlChar * value; /* the lexical repr of the value to validate */
33392 int n_value;
33393 unsigned long actualLen; /* the number of list items */
33394 int n_actualLen;
33395 unsigned long * expectedLen; /* the resulting expected number of list items */
33396 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033397
Daniel Veillardce682bc2004-11-05 17:22:25 +000033398 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33399 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33400 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33401 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33402 mem_base = xmlMemBlocks();
33403 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33404 value = gen_const_xmlChar_ptr(n_value, 1);
33405 actualLen = gen_unsigned_long(n_actualLen, 2);
33406 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33407
William M. Brackf13f77f2004-11-12 16:03:48 +000033408 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033409 desret_int(ret_val);
33410 call_tests++;
33411 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033412 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033413 des_unsigned_long(n_actualLen, actualLen, 2);
33414 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33415 xmlResetLastError();
33416 if (mem_base != xmlMemBlocks()) {
33417 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033419 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033420 printf(" %d", n_facet);
33421 printf(" %d", n_value);
33422 printf(" %d", n_actualLen);
33423 printf(" %d", n_expectedLen);
33424 printf("\n");
33425 }
33426 }
33427 }
33428 }
33429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033430 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033431#endif
33432
Daniel Veillard42595322004-11-08 10:52:06 +000033433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033434}
33435
33436
33437static int
33438test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033440
William M. Brack21e4ef22005-01-02 09:53:13 +000033441#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033442 int mem_base;
33443 int ret_val;
33444 xmlSchemaTypePtr type; /* the predefined type */
33445 int n_type;
33446 xmlChar * value; /* the value to check */
33447 int n_value;
33448 xmlSchemaValPtr * val; /* the return computed value */
33449 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033450
Daniel Veillardce682bc2004-11-05 17:22:25 +000033451 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33452 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33453 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33454 mem_base = xmlMemBlocks();
33455 type = gen_xmlSchemaTypePtr(n_type, 0);
33456 value = gen_const_xmlChar_ptr(n_value, 1);
33457 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33458
William M. Brackf13f77f2004-11-12 16:03:48 +000033459 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033460 desret_int(ret_val);
33461 call_tests++;
33462 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033463 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033464 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33465 xmlResetLastError();
33466 if (mem_base != xmlMemBlocks()) {
33467 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033469 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033470 printf(" %d", n_type);
33471 printf(" %d", n_value);
33472 printf(" %d", n_val);
33473 printf("\n");
33474 }
33475 }
33476 }
33477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033478 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033479#endif
33480
Daniel Veillard42595322004-11-08 10:52:06 +000033481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033482}
33483
Daniel Veillard91b955c2004-12-10 10:26:42 +000033484
33485static int
33486test_xmlSchemaWhiteSpaceReplace(void) {
33487 int test_ret = 0;
33488
William M. Brack21e4ef22005-01-02 09:53:13 +000033489#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033490 int mem_base;
33491 xmlChar * ret_val;
33492 xmlChar * value; /* a value */
33493 int n_value;
33494
33495 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33496 mem_base = xmlMemBlocks();
33497 value = gen_const_xmlChar_ptr(n_value, 0);
33498
33499 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33500 desret_xmlChar_ptr(ret_val);
33501 call_tests++;
33502 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33503 xmlResetLastError();
33504 if (mem_base != xmlMemBlocks()) {
33505 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33506 xmlMemBlocks() - mem_base);
33507 test_ret++;
33508 printf(" %d", n_value);
33509 printf("\n");
33510 }
33511 }
33512 function_tests++;
33513#endif
33514
33515 return(test_ret);
33516}
33517
Daniel Veillardd93f6252004-11-02 15:53:51 +000033518static int
33519test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033521
Daniel Veillard57c000e2005-03-13 18:34:29 +000033522 if (quiet == 0) printf("Testing xmlschemastypes : 19 of 25 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033523 test_ret += test_xmlSchemaCheckFacet();
33524 test_ret += test_xmlSchemaCleanupTypes();
33525 test_ret += test_xmlSchemaCollapseString();
33526 test_ret += test_xmlSchemaCompareValues();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033527 test_ret += test_xmlSchemaCompareValuesWhtsp();
Daniel Veillard57c000e2005-03-13 18:34:29 +000033528 test_ret += test_xmlSchemaCopyValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033529 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33530 test_ret += test_xmlSchemaGetBuiltInType();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033531 test_ret += test_xmlSchemaGetCanonValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033532 test_ret += test_xmlSchemaGetFacetValueAsULong();
33533 test_ret += test_xmlSchemaGetPredefinedType();
33534 test_ret += test_xmlSchemaInitTypes();
33535 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33536 test_ret += test_xmlSchemaNewFacet();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033537 test_ret += test_xmlSchemaNewNOTATIONValue();
33538 test_ret += test_xmlSchemaNewStringValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033539 test_ret += test_xmlSchemaValPredefTypeNode();
33540 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33541 test_ret += test_xmlSchemaValidateFacet();
33542 test_ret += test_xmlSchemaValidateLengthFacet();
33543 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33544 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033545 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033546
Daniel Veillard42595322004-11-08 10:52:06 +000033547 if (test_ret != 0)
33548 printf("Module xmlschemastypes: %d errors\n", test_ret);
33549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033550}
33551
33552static int
33553test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033555
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033556 int mem_base;
33557 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033558 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033559 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033560
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033561 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33562 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033563 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033564
William M. Brackf13f77f2004-11-12 16:03:48 +000033565 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033566 desret_xmlChar_ptr(ret_val);
33567 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033568 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033569 xmlResetLastError();
33570 if (mem_base != xmlMemBlocks()) {
33571 printf("Leak of %d blocks found in xmlCharStrdup",
33572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033573 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033574 printf(" %d", n_cur);
33575 printf("\n");
33576 }
33577 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033578 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033579
Daniel Veillard42595322004-11-08 10:52:06 +000033580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033581}
33582
33583
33584static int
33585test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033587
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033588 int mem_base;
33589 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033590 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033591 int n_cur;
33592 int len; /* the len of @cur */
33593 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033594
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033595 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33596 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33597 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033598 cur = gen_const_char_ptr(n_cur, 0);
33599 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033600
William M. Brackf13f77f2004-11-12 16:03:48 +000033601 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033602 desret_xmlChar_ptr(ret_val);
33603 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033604 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033605 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033606 xmlResetLastError();
33607 if (mem_base != xmlMemBlocks()) {
33608 printf("Leak of %d blocks found in xmlCharStrndup",
33609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033610 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033611 printf(" %d", n_cur);
33612 printf(" %d", n_len);
33613 printf("\n");
33614 }
33615 }
33616 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033618
Daniel Veillard42595322004-11-08 10:52:06 +000033619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033620}
33621
33622
33623static int
33624test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033626
Daniel Veillardce682bc2004-11-05 17:22:25 +000033627 int mem_base;
33628 int ret_val;
33629 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33630 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033631
Daniel Veillardce682bc2004-11-05 17:22:25 +000033632 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33633 mem_base = xmlMemBlocks();
33634 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33635
William M. Brackf13f77f2004-11-12 16:03:48 +000033636 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033637 desret_int(ret_val);
33638 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033639 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033640 xmlResetLastError();
33641 if (mem_base != xmlMemBlocks()) {
33642 printf("Leak of %d blocks found in xmlCheckUTF8",
33643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033644 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033645 printf(" %d", n_utf);
33646 printf("\n");
33647 }
33648 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033649 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033650
Daniel Veillard42595322004-11-08 10:52:06 +000033651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033652}
33653
33654
33655static int
33656test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033658
Daniel Veillardce682bc2004-11-05 17:22:25 +000033659 int mem_base;
33660 int ret_val;
33661 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33662 int n_utf;
33663 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. */
33664 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033665
Daniel Veillardce682bc2004-11-05 17:22:25 +000033666 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33667 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33668 mem_base = xmlMemBlocks();
33669 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33670 len = gen_int_ptr(n_len, 1);
33671
William M. Brackf13f77f2004-11-12 16:03:48 +000033672 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033673 desret_int(ret_val);
33674 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033675 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033676 des_int_ptr(n_len, len, 1);
33677 xmlResetLastError();
33678 if (mem_base != xmlMemBlocks()) {
33679 printf("Leak of %d blocks found in xmlGetUTF8Char",
33680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033681 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033682 printf(" %d", n_utf);
33683 printf(" %d", n_len);
33684 printf("\n");
33685 }
33686 }
33687 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033688 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033689
Daniel Veillard42595322004-11-08 10:52:06 +000033690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033691}
33692
33693
33694static int
33695test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033697
33698 int mem_base;
33699 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033700 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033701 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033702 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033703 int n_str2;
33704
33705 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33706 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33707 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033708 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33709 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033710
William M. Brackf13f77f2004-11-12 16:03:48 +000033711 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033712 desret_int(ret_val);
33713 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033714 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33715 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033716 xmlResetLastError();
33717 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033718 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033720 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033721 printf(" %d", n_str1);
33722 printf(" %d", n_str2);
33723 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033724 }
33725 }
33726 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033727 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033728
Daniel Veillard42595322004-11-08 10:52:06 +000033729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033730}
33731
33732
33733static int
33734test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033736
33737
33738 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033740}
33741
33742
33743static int
33744test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033746
33747 int mem_base;
33748 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033749 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033750 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033751 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033752 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033753 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033754 int n_str;
33755
33756 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33757 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33758 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033760 pref = gen_const_xmlChar_ptr(n_pref, 0);
33761 name = gen_const_xmlChar_ptr(n_name, 1);
33762 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033763
William M. Brackf13f77f2004-11-12 16:03:48 +000033764 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033765 desret_int(ret_val);
33766 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033767 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33768 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33769 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033770 xmlResetLastError();
33771 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033772 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033774 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033775 printf(" %d", n_pref);
33776 printf(" %d", n_name);
33777 printf(" %d", n_str);
33778 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033779 }
33780 }
33781 }
33782 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033783 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033784
Daniel Veillard42595322004-11-08 10:52:06 +000033785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033786}
33787
33788
33789static int
33790test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033792
33793
33794 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033796}
33797
33798
33799static int
33800test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033802
33803 int mem_base;
33804 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033805 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033806 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033807 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033808 int n_str2;
33809
33810 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33811 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033813 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33814 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033815
William M. Brackf13f77f2004-11-12 16:03:48 +000033816 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033817 desret_int(ret_val);
33818 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033819 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33820 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033821 xmlResetLastError();
33822 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033823 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033825 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033826 printf(" %d", n_str1);
33827 printf(" %d", n_str2);
33828 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033829 }
33830 }
33831 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033833
Daniel Veillard42595322004-11-08 10:52:06 +000033834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033835}
33836
33837
33838static int
33839test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033841
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033842 int mem_base;
33843 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033844 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033845 int n_str;
33846 xmlChar * val; /* the xmlChar to search (needle) */
33847 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033848
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033849 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33850 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033852 str = gen_const_xmlChar_ptr(n_str, 0);
33853 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033854
William M. Brackf13f77f2004-11-12 16:03:48 +000033855 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033856 desret_const_xmlChar_ptr(ret_val);
33857 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033858 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033859 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033860 xmlResetLastError();
33861 if (mem_base != xmlMemBlocks()) {
33862 printf("Leak of %d blocks found in xmlStrcasestr",
33863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033864 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033865 printf(" %d", n_str);
33866 printf(" %d", n_val);
33867 printf("\n");
33868 }
33869 }
33870 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033871 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033872
Daniel Veillard42595322004-11-08 10:52:06 +000033873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033874}
33875
33876
33877static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033878test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033880
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033881 int mem_base;
33882 const xmlChar * ret_val;
33883 xmlChar * str; /* the xmlChar * array */
33884 int n_str;
33885 xmlChar val; /* the xmlChar to search */
33886 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033887
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033888 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33889 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33890 mem_base = xmlMemBlocks();
33891 str = gen_const_xmlChar_ptr(n_str, 0);
33892 val = gen_xmlChar(n_val, 1);
33893
William M. Brackf13f77f2004-11-12 16:03:48 +000033894 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033895 desret_const_xmlChar_ptr(ret_val);
33896 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033897 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033898 des_xmlChar(n_val, val, 1);
33899 xmlResetLastError();
33900 if (mem_base != xmlMemBlocks()) {
33901 printf("Leak of %d blocks found in xmlStrchr",
33902 xmlMemBlocks() - mem_base);
33903 test_ret++;
33904 printf(" %d", n_str);
33905 printf(" %d", n_val);
33906 printf("\n");
33907 }
33908 }
33909 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033910 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033911
Daniel Veillard42595322004-11-08 10:52:06 +000033912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033913}
33914
33915
33916static int
33917test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033919
33920 int mem_base;
33921 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033922 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033923 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033924 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033925 int n_str2;
33926
33927 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33928 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033930 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33931 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033932
William M. Brackf13f77f2004-11-12 16:03:48 +000033933 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033934 desret_int(ret_val);
33935 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033936 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33937 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033938 xmlResetLastError();
33939 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033940 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033942 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033943 printf(" %d", n_str1);
33944 printf(" %d", n_str2);
33945 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033946 }
33947 }
33948 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033950
Daniel Veillard42595322004-11-08 10:52:06 +000033951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033952}
33953
33954
33955static int
33956test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033958
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033959 int mem_base;
33960 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033961 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033962 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033963
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033964 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33965 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033966 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033967
William M. Brackf13f77f2004-11-12 16:03:48 +000033968 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033969 desret_xmlChar_ptr(ret_val);
33970 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033971 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033972 xmlResetLastError();
33973 if (mem_base != xmlMemBlocks()) {
33974 printf("Leak of %d blocks found in xmlStrdup",
33975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033976 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033977 printf(" %d", n_cur);
33978 printf("\n");
33979 }
33980 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033981 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033982
Daniel Veillard42595322004-11-08 10:52:06 +000033983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033984}
33985
33986
33987static int
33988test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033990
33991 int mem_base;
33992 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033993 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033994 int n_str;
33995
33996 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33997 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033998 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033999
William M. Brackf13f77f2004-11-12 16:03:48 +000034000 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034001 desret_int(ret_val);
34002 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034003 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034004 xmlResetLastError();
34005 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034006 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034008 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034009 printf(" %d", n_str);
34010 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034011 }
34012 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034013 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034014
Daniel Veillard42595322004-11-08 10:52:06 +000034015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034016}
34017
34018
34019static int
34020test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034022
34023 int mem_base;
34024 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034025 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034026 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034027 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034028 int n_str2;
34029 int len; /* the max comparison length */
34030 int n_len;
34031
34032 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34033 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34034 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34035 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034036 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34037 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34038 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034039
William M. Brackf13f77f2004-11-12 16:03:48 +000034040 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034041 desret_int(ret_val);
34042 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034043 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34044 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034045 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034046 xmlResetLastError();
34047 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034048 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034050 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034051 printf(" %d", n_str1);
34052 printf(" %d", n_str2);
34053 printf(" %d", n_len);
34054 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034055 }
34056 }
34057 }
34058 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034059 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034060
Daniel Veillard42595322004-11-08 10:52:06 +000034061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034062}
34063
34064
34065static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034066test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034068
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034069 int mem_base;
34070 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034071 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034072 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034073 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034074 int n_str2;
34075 int len; /* the len of @str2 */
34076 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034077
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034078 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34079 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34080 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034082 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34083 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34084 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034085
William M. Brackf13f77f2004-11-12 16:03:48 +000034086 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034087 desret_xmlChar_ptr(ret_val);
34088 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034089 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34090 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034091 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034092 xmlResetLastError();
34093 if (mem_base != xmlMemBlocks()) {
34094 printf("Leak of %d blocks found in xmlStrncatNew",
34095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034096 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034097 printf(" %d", n_str1);
34098 printf(" %d", n_str2);
34099 printf(" %d", n_len);
34100 printf("\n");
34101 }
34102 }
34103 }
34104 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034106
Daniel Veillard42595322004-11-08 10:52:06 +000034107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034108}
34109
34110
34111static int
34112test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034114
34115 int mem_base;
34116 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034117 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034118 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034119 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034120 int n_str2;
34121 int len; /* the max comparison length */
34122 int n_len;
34123
34124 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34125 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34126 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034128 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34129 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34130 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034131
William M. Brackf13f77f2004-11-12 16:03:48 +000034132 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034133 desret_int(ret_val);
34134 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034135 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34136 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034137 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034138 xmlResetLastError();
34139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034140 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034143 printf(" %d", n_str1);
34144 printf(" %d", n_str2);
34145 printf(" %d", n_len);
34146 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034147 }
34148 }
34149 }
34150 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034151 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034152
Daniel Veillard42595322004-11-08 10:52:06 +000034153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034154}
34155
34156
34157static int
34158test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034160
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034161 int mem_base;
34162 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034163 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034164 int n_cur;
34165 int len; /* the len of @cur */
34166 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034167
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034168 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34169 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34170 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034171 cur = gen_const_xmlChar_ptr(n_cur, 0);
34172 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034173
William M. Brackf13f77f2004-11-12 16:03:48 +000034174 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034175 desret_xmlChar_ptr(ret_val);
34176 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034177 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034178 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034179 xmlResetLastError();
34180 if (mem_base != xmlMemBlocks()) {
34181 printf("Leak of %d blocks found in xmlStrndup",
34182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034183 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034184 printf(" %d", n_cur);
34185 printf(" %d", n_len);
34186 printf("\n");
34187 }
34188 }
34189 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034190 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034191
Daniel Veillard42595322004-11-08 10:52:06 +000034192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034193}
34194
34195
34196static int
34197test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034199
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034200 int mem_base;
34201 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034202 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034203 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034204 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034205 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034206
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034207 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34208 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
34209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034210 str = gen_const_xmlChar_ptr(n_str, 0);
34211 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034212
William M. Brackf13f77f2004-11-12 16:03:48 +000034213 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034214 desret_const_xmlChar_ptr(ret_val);
34215 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034216 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
34217 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034218 xmlResetLastError();
34219 if (mem_base != xmlMemBlocks()) {
34220 printf("Leak of %d blocks found in xmlStrstr",
34221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034222 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034223 printf(" %d", n_str);
34224 printf(" %d", n_val);
34225 printf("\n");
34226 }
34227 }
34228 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034229 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034230
Daniel Veillard42595322004-11-08 10:52:06 +000034231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034232}
34233
34234
34235static int
34236test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034238
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034239 int mem_base;
34240 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034241 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034242 int n_str;
34243 int start; /* the index of the first char (zero based) */
34244 int n_start;
34245 int len; /* the length of the substring */
34246 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034247
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034248 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34249 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34250 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034252 str = gen_const_xmlChar_ptr(n_str, 0);
34253 start = gen_int(n_start, 1);
34254 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034255
William M. Brackf13f77f2004-11-12 16:03:48 +000034256 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034257 desret_xmlChar_ptr(ret_val);
34258 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034259 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034260 des_int(n_start, start, 1);
34261 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034262 xmlResetLastError();
34263 if (mem_base != xmlMemBlocks()) {
34264 printf("Leak of %d blocks found in xmlStrsub",
34265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034266 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034267 printf(" %d", n_str);
34268 printf(" %d", n_start);
34269 printf(" %d", n_len);
34270 printf("\n");
34271 }
34272 }
34273 }
34274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034276
Daniel Veillard42595322004-11-08 10:52:06 +000034277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034278}
34279
34280
34281static int
34282test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034284
34285 int mem_base;
34286 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034287 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034288 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034289 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034290 int n_utf2;
34291
34292 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34293 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034295 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34296 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034297
William M. Brackf13f77f2004-11-12 16:03:48 +000034298 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034299 desret_int(ret_val);
34300 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034301 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34302 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034303 xmlResetLastError();
34304 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034305 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034307 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034308 printf(" %d", n_utf1);
34309 printf(" %d", n_utf2);
34310 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034311 }
34312 }
34313 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034315
Daniel Veillard42595322004-11-08 10:52:06 +000034316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034317}
34318
34319
34320static int
34321test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034323
34324 int mem_base;
34325 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034326 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034327 int n_utf;
34328
34329 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34330 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034331 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034332
William M. Brackf13f77f2004-11-12 16:03:48 +000034333 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034334 desret_int(ret_val);
34335 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034336 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034337 xmlResetLastError();
34338 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034339 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034341 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034342 printf(" %d", n_utf);
34343 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034344 }
34345 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034347
Daniel Veillard42595322004-11-08 10:52:06 +000034348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034349}
34350
34351
34352static int
34353test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034355
34356 int mem_base;
34357 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034358 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034359 int n_utf;
34360
34361 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034363 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034364
William M. Brackf13f77f2004-11-12 16:03:48 +000034365 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034366 desret_int(ret_val);
34367 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034368 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034369 xmlResetLastError();
34370 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034371 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034373 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034374 printf(" %d", n_utf);
34375 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034376 }
34377 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034378 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034379
Daniel Veillard42595322004-11-08 10:52:06 +000034380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034381}
34382
34383
34384static int
34385test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034387
34388 int mem_base;
34389 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034390 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034391 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034392 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034393 int n_utfchar;
34394
34395 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34396 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34397 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034398 utf = gen_const_xmlChar_ptr(n_utf, 0);
34399 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034400
William M. Brackf13f77f2004-11-12 16:03:48 +000034401 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034402 desret_int(ret_val);
34403 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034404 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34405 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034406 xmlResetLastError();
34407 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034408 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034410 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034411 printf(" %d", n_utf);
34412 printf(" %d", n_utfchar);
34413 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034414 }
34415 }
34416 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034418
Daniel Veillard42595322004-11-08 10:52:06 +000034419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034420}
34421
34422
34423static int
34424test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034426
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034427 int mem_base;
34428 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034429 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034430 int n_utf;
34431 int len; /* the len of @utf (in chars) */
34432 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034433
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034434 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34435 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34436 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034437 utf = gen_const_xmlChar_ptr(n_utf, 0);
34438 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034439
William M. Brackf13f77f2004-11-12 16:03:48 +000034440 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034441 desret_xmlChar_ptr(ret_val);
34442 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034443 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034444 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034445 xmlResetLastError();
34446 if (mem_base != xmlMemBlocks()) {
34447 printf("Leak of %d blocks found in xmlUTF8Strndup",
34448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034449 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034450 printf(" %d", n_utf);
34451 printf(" %d", n_len);
34452 printf("\n");
34453 }
34454 }
34455 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034456 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034457
Daniel Veillard42595322004-11-08 10:52:06 +000034458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034459}
34460
34461
34462static int
34463test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034465
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034466 int mem_base;
34467 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034468 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034469 int n_utf;
34470 int pos; /* the position of the desired UTF8 char (in chars) */
34471 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034472
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034473 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34474 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34475 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034476 utf = gen_const_xmlChar_ptr(n_utf, 0);
34477 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034478
William M. Brackf13f77f2004-11-12 16:03:48 +000034479 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034480 desret_const_xmlChar_ptr(ret_val);
34481 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034482 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034483 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034484 xmlResetLastError();
34485 if (mem_base != xmlMemBlocks()) {
34486 printf("Leak of %d blocks found in xmlUTF8Strpos",
34487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034488 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034489 printf(" %d", n_utf);
34490 printf(" %d", n_pos);
34491 printf("\n");
34492 }
34493 }
34494 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034495 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034496
Daniel Veillard42595322004-11-08 10:52:06 +000034497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034498}
34499
34500
34501static int
34502test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034504
34505 int mem_base;
34506 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034507 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034508 int n_utf;
34509 int len; /* the number of characters in the array */
34510 int n_len;
34511
34512 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34513 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034515 utf = gen_const_xmlChar_ptr(n_utf, 0);
34516 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034517
William M. Brackf13f77f2004-11-12 16:03:48 +000034518 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034519 desret_int(ret_val);
34520 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034521 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034522 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034523 xmlResetLastError();
34524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034525 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034528 printf(" %d", n_utf);
34529 printf(" %d", n_len);
34530 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034531 }
34532 }
34533 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034534 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034535
Daniel Veillard42595322004-11-08 10:52:06 +000034536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034537}
34538
34539
34540static int
34541test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034543
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034544 int mem_base;
34545 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034546 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034547 int n_utf;
34548 int start; /* relative pos of first char */
34549 int n_start;
34550 int len; /* total number to copy */
34551 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034552
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034553 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34554 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34555 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034557 utf = gen_const_xmlChar_ptr(n_utf, 0);
34558 start = gen_int(n_start, 1);
34559 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034560
William M. Brackf13f77f2004-11-12 16:03:48 +000034561 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034562 desret_xmlChar_ptr(ret_val);
34563 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034564 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034565 des_int(n_start, start, 1);
34566 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034567 xmlResetLastError();
34568 if (mem_base != xmlMemBlocks()) {
34569 printf("Leak of %d blocks found in xmlUTF8Strsub",
34570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034571 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034572 printf(" %d", n_utf);
34573 printf(" %d", n_start);
34574 printf(" %d", n_len);
34575 printf("\n");
34576 }
34577 }
34578 }
34579 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034581
Daniel Veillard42595322004-11-08 10:52:06 +000034582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034583}
34584
34585static int
34586test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034588
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034589 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034590 test_ret += test_xmlCharStrdup();
34591 test_ret += test_xmlCharStrndup();
34592 test_ret += test_xmlCheckUTF8();
34593 test_ret += test_xmlGetUTF8Char();
34594 test_ret += test_xmlStrEqual();
34595 test_ret += test_xmlStrPrintf();
34596 test_ret += test_xmlStrQEqual();
34597 test_ret += test_xmlStrVPrintf();
34598 test_ret += test_xmlStrcasecmp();
34599 test_ret += test_xmlStrcasestr();
34600 test_ret += test_xmlStrchr();
34601 test_ret += test_xmlStrcmp();
34602 test_ret += test_xmlStrdup();
34603 test_ret += test_xmlStrlen();
34604 test_ret += test_xmlStrncasecmp();
34605 test_ret += test_xmlStrncatNew();
34606 test_ret += test_xmlStrncmp();
34607 test_ret += test_xmlStrndup();
34608 test_ret += test_xmlStrstr();
34609 test_ret += test_xmlStrsub();
34610 test_ret += test_xmlUTF8Charcmp();
34611 test_ret += test_xmlUTF8Size();
34612 test_ret += test_xmlUTF8Strlen();
34613 test_ret += test_xmlUTF8Strloc();
34614 test_ret += test_xmlUTF8Strndup();
34615 test_ret += test_xmlUTF8Strpos();
34616 test_ret += test_xmlUTF8Strsize();
34617 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034618
Daniel Veillard42595322004-11-08 10:52:06 +000034619 if (test_ret != 0)
34620 printf("Module xmlstring: %d errors\n", test_ret);
34621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034622}
34623
34624static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034625test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034627
William M. Brack21e4ef22005-01-02 09:53:13 +000034628#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034629 int mem_base;
34630 int ret_val;
34631 int code; /* UCS code point */
34632 int n_code;
34633
34634 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34635 mem_base = xmlMemBlocks();
34636 code = gen_int(n_code, 0);
34637
34638 ret_val = xmlUCSIsAegeanNumbers(code);
34639 desret_int(ret_val);
34640 call_tests++;
34641 des_int(n_code, code, 0);
34642 xmlResetLastError();
34643 if (mem_base != xmlMemBlocks()) {
34644 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034646 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034647 printf(" %d", n_code);
34648 printf("\n");
34649 }
34650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034651 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034652#endif
34653
Daniel Veillard42595322004-11-08 10:52:06 +000034654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034655}
34656
34657
34658static int
34659test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034661
William M. Brack21e4ef22005-01-02 09:53:13 +000034662#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034663 int mem_base;
34664 int ret_val;
34665 int code; /* UCS code point */
34666 int n_code;
34667
34668 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34669 mem_base = xmlMemBlocks();
34670 code = gen_int(n_code, 0);
34671
34672 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34673 desret_int(ret_val);
34674 call_tests++;
34675 des_int(n_code, code, 0);
34676 xmlResetLastError();
34677 if (mem_base != xmlMemBlocks()) {
34678 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034680 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034681 printf(" %d", n_code);
34682 printf("\n");
34683 }
34684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034685 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034686#endif
34687
Daniel Veillard42595322004-11-08 10:52:06 +000034688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034689}
34690
34691
34692static int
34693test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034695
William M. Brack21e4ef22005-01-02 09:53:13 +000034696#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034697 int mem_base;
34698 int ret_val;
34699 int code; /* UCS code point */
34700 int n_code;
34701
34702 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34703 mem_base = xmlMemBlocks();
34704 code = gen_int(n_code, 0);
34705
34706 ret_val = xmlUCSIsArabic(code);
34707 desret_int(ret_val);
34708 call_tests++;
34709 des_int(n_code, code, 0);
34710 xmlResetLastError();
34711 if (mem_base != xmlMemBlocks()) {
34712 printf("Leak of %d blocks found in xmlUCSIsArabic",
34713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034714 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034715 printf(" %d", n_code);
34716 printf("\n");
34717 }
34718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034719 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034720#endif
34721
Daniel Veillard42595322004-11-08 10:52:06 +000034722 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034723}
34724
34725
34726static int
34727test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034728 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034729
William M. Brack21e4ef22005-01-02 09:53:13 +000034730#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034731 int mem_base;
34732 int ret_val;
34733 int code; /* UCS code point */
34734 int n_code;
34735
34736 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34737 mem_base = xmlMemBlocks();
34738 code = gen_int(n_code, 0);
34739
34740 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34741 desret_int(ret_val);
34742 call_tests++;
34743 des_int(n_code, code, 0);
34744 xmlResetLastError();
34745 if (mem_base != xmlMemBlocks()) {
34746 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034748 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034749 printf(" %d", n_code);
34750 printf("\n");
34751 }
34752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034753 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034754#endif
34755
Daniel Veillard42595322004-11-08 10:52:06 +000034756 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034757}
34758
34759
34760static int
34761test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034762 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034763
William M. Brack21e4ef22005-01-02 09:53:13 +000034764#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034765 int mem_base;
34766 int ret_val;
34767 int code; /* UCS code point */
34768 int n_code;
34769
34770 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34771 mem_base = xmlMemBlocks();
34772 code = gen_int(n_code, 0);
34773
34774 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34775 desret_int(ret_val);
34776 call_tests++;
34777 des_int(n_code, code, 0);
34778 xmlResetLastError();
34779 if (mem_base != xmlMemBlocks()) {
34780 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034782 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034783 printf(" %d", n_code);
34784 printf("\n");
34785 }
34786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034787 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034788#endif
34789
Daniel Veillard42595322004-11-08 10:52:06 +000034790 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034791}
34792
34793
34794static int
34795test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034796 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034797
William M. Brack21e4ef22005-01-02 09:53:13 +000034798#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034799 int mem_base;
34800 int ret_val;
34801 int code; /* UCS code point */
34802 int n_code;
34803
34804 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34805 mem_base = xmlMemBlocks();
34806 code = gen_int(n_code, 0);
34807
34808 ret_val = xmlUCSIsArmenian(code);
34809 desret_int(ret_val);
34810 call_tests++;
34811 des_int(n_code, code, 0);
34812 xmlResetLastError();
34813 if (mem_base != xmlMemBlocks()) {
34814 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034816 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034817 printf(" %d", n_code);
34818 printf("\n");
34819 }
34820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034821 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034822#endif
34823
Daniel Veillard42595322004-11-08 10:52:06 +000034824 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034825}
34826
34827
34828static int
34829test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034830 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034831
William M. Brack21e4ef22005-01-02 09:53:13 +000034832#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034833 int mem_base;
34834 int ret_val;
34835 int code; /* UCS code point */
34836 int n_code;
34837
34838 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34839 mem_base = xmlMemBlocks();
34840 code = gen_int(n_code, 0);
34841
34842 ret_val = xmlUCSIsArrows(code);
34843 desret_int(ret_val);
34844 call_tests++;
34845 des_int(n_code, code, 0);
34846 xmlResetLastError();
34847 if (mem_base != xmlMemBlocks()) {
34848 printf("Leak of %d blocks found in xmlUCSIsArrows",
34849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034850 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034851 printf(" %d", n_code);
34852 printf("\n");
34853 }
34854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034855 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034856#endif
34857
Daniel Veillard42595322004-11-08 10:52:06 +000034858 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034859}
34860
34861
34862static int
34863test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034864 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034865
William M. Brack21e4ef22005-01-02 09:53:13 +000034866#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034867 int mem_base;
34868 int ret_val;
34869 int code; /* UCS code point */
34870 int n_code;
34871
34872 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34873 mem_base = xmlMemBlocks();
34874 code = gen_int(n_code, 0);
34875
34876 ret_val = xmlUCSIsBasicLatin(code);
34877 desret_int(ret_val);
34878 call_tests++;
34879 des_int(n_code, code, 0);
34880 xmlResetLastError();
34881 if (mem_base != xmlMemBlocks()) {
34882 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034884 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034885 printf(" %d", n_code);
34886 printf("\n");
34887 }
34888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034889 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034890#endif
34891
Daniel Veillard42595322004-11-08 10:52:06 +000034892 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034893}
34894
34895
34896static int
34897test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034898 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034899
William M. Brack21e4ef22005-01-02 09:53:13 +000034900#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034901 int mem_base;
34902 int ret_val;
34903 int code; /* UCS code point */
34904 int n_code;
34905
34906 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34907 mem_base = xmlMemBlocks();
34908 code = gen_int(n_code, 0);
34909
34910 ret_val = xmlUCSIsBengali(code);
34911 desret_int(ret_val);
34912 call_tests++;
34913 des_int(n_code, code, 0);
34914 xmlResetLastError();
34915 if (mem_base != xmlMemBlocks()) {
34916 printf("Leak of %d blocks found in xmlUCSIsBengali",
34917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034918 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034919 printf(" %d", n_code);
34920 printf("\n");
34921 }
34922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034923 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034924#endif
34925
Daniel Veillard42595322004-11-08 10:52:06 +000034926 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034927}
34928
34929
34930static int
34931test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034932 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034933
William M. Brack21e4ef22005-01-02 09:53:13 +000034934#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034935 int mem_base;
34936 int ret_val;
34937 int code; /* UCS code point */
34938 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034939 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034940 int n_block;
34941
34942 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34943 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34944 mem_base = xmlMemBlocks();
34945 code = gen_int(n_code, 0);
34946 block = gen_const_char_ptr(n_block, 1);
34947
William M. Brackf13f77f2004-11-12 16:03:48 +000034948 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034949 desret_int(ret_val);
34950 call_tests++;
34951 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034952 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034953 xmlResetLastError();
34954 if (mem_base != xmlMemBlocks()) {
34955 printf("Leak of %d blocks found in xmlUCSIsBlock",
34956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034957 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034958 printf(" %d", n_code);
34959 printf(" %d", n_block);
34960 printf("\n");
34961 }
34962 }
34963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034964 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034965#endif
34966
Daniel Veillard42595322004-11-08 10:52:06 +000034967 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034968}
34969
34970
34971static int
34972test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034973 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034974
William M. Brack21e4ef22005-01-02 09:53:13 +000034975#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034976 int mem_base;
34977 int ret_val;
34978 int code; /* UCS code point */
34979 int n_code;
34980
34981 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34982 mem_base = xmlMemBlocks();
34983 code = gen_int(n_code, 0);
34984
34985 ret_val = xmlUCSIsBlockElements(code);
34986 desret_int(ret_val);
34987 call_tests++;
34988 des_int(n_code, code, 0);
34989 xmlResetLastError();
34990 if (mem_base != xmlMemBlocks()) {
34991 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034993 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034994 printf(" %d", n_code);
34995 printf("\n");
34996 }
34997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034998 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034999#endif
35000
Daniel Veillard42595322004-11-08 10:52:06 +000035001 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035002}
35003
35004
35005static int
35006test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035007 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035008
William M. Brack21e4ef22005-01-02 09:53:13 +000035009#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035010 int mem_base;
35011 int ret_val;
35012 int code; /* UCS code point */
35013 int n_code;
35014
35015 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35016 mem_base = xmlMemBlocks();
35017 code = gen_int(n_code, 0);
35018
35019 ret_val = xmlUCSIsBopomofo(code);
35020 desret_int(ret_val);
35021 call_tests++;
35022 des_int(n_code, code, 0);
35023 xmlResetLastError();
35024 if (mem_base != xmlMemBlocks()) {
35025 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
35026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035027 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035028 printf(" %d", n_code);
35029 printf("\n");
35030 }
35031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035032 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035033#endif
35034
Daniel Veillard42595322004-11-08 10:52:06 +000035035 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035036}
35037
35038
35039static int
35040test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035041 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035042
William M. Brack21e4ef22005-01-02 09:53:13 +000035043#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035044 int mem_base;
35045 int ret_val;
35046 int code; /* UCS code point */
35047 int n_code;
35048
35049 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35050 mem_base = xmlMemBlocks();
35051 code = gen_int(n_code, 0);
35052
35053 ret_val = xmlUCSIsBopomofoExtended(code);
35054 desret_int(ret_val);
35055 call_tests++;
35056 des_int(n_code, code, 0);
35057 xmlResetLastError();
35058 if (mem_base != xmlMemBlocks()) {
35059 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
35060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035061 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035062 printf(" %d", n_code);
35063 printf("\n");
35064 }
35065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035066 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035067#endif
35068
Daniel Veillard42595322004-11-08 10:52:06 +000035069 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035070}
35071
35072
35073static int
35074test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035075 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035076
William M. Brack21e4ef22005-01-02 09:53:13 +000035077#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035078 int mem_base;
35079 int ret_val;
35080 int code; /* UCS code point */
35081 int n_code;
35082
35083 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35084 mem_base = xmlMemBlocks();
35085 code = gen_int(n_code, 0);
35086
35087 ret_val = xmlUCSIsBoxDrawing(code);
35088 desret_int(ret_val);
35089 call_tests++;
35090 des_int(n_code, code, 0);
35091 xmlResetLastError();
35092 if (mem_base != xmlMemBlocks()) {
35093 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
35094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035095 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035096 printf(" %d", n_code);
35097 printf("\n");
35098 }
35099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035100 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035101#endif
35102
Daniel Veillard42595322004-11-08 10:52:06 +000035103 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035104}
35105
35106
35107static int
35108test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035109 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035110
William M. Brack21e4ef22005-01-02 09:53:13 +000035111#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035112 int mem_base;
35113 int ret_val;
35114 int code; /* UCS code point */
35115 int n_code;
35116
35117 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35118 mem_base = xmlMemBlocks();
35119 code = gen_int(n_code, 0);
35120
35121 ret_val = xmlUCSIsBraillePatterns(code);
35122 desret_int(ret_val);
35123 call_tests++;
35124 des_int(n_code, code, 0);
35125 xmlResetLastError();
35126 if (mem_base != xmlMemBlocks()) {
35127 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
35128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035129 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035130 printf(" %d", n_code);
35131 printf("\n");
35132 }
35133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035134 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035135#endif
35136
Daniel Veillard42595322004-11-08 10:52:06 +000035137 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035138}
35139
35140
35141static int
35142test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035143 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035144
William M. Brack21e4ef22005-01-02 09:53:13 +000035145#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035146 int mem_base;
35147 int ret_val;
35148 int code; /* UCS code point */
35149 int n_code;
35150
35151 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35152 mem_base = xmlMemBlocks();
35153 code = gen_int(n_code, 0);
35154
35155 ret_val = xmlUCSIsBuhid(code);
35156 desret_int(ret_val);
35157 call_tests++;
35158 des_int(n_code, code, 0);
35159 xmlResetLastError();
35160 if (mem_base != xmlMemBlocks()) {
35161 printf("Leak of %d blocks found in xmlUCSIsBuhid",
35162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035163 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035164 printf(" %d", n_code);
35165 printf("\n");
35166 }
35167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035168 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035169#endif
35170
Daniel Veillard42595322004-11-08 10:52:06 +000035171 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035172}
35173
35174
35175static int
35176test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035177 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035178
William M. Brack21e4ef22005-01-02 09:53:13 +000035179#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035180 int mem_base;
35181 int ret_val;
35182 int code; /* UCS code point */
35183 int n_code;
35184
35185 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35186 mem_base = xmlMemBlocks();
35187 code = gen_int(n_code, 0);
35188
35189 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
35190 desret_int(ret_val);
35191 call_tests++;
35192 des_int(n_code, code, 0);
35193 xmlResetLastError();
35194 if (mem_base != xmlMemBlocks()) {
35195 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
35196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035197 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035198 printf(" %d", n_code);
35199 printf("\n");
35200 }
35201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035202 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035203#endif
35204
Daniel Veillard42595322004-11-08 10:52:06 +000035205 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035206}
35207
35208
35209static int
35210test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035211 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035212
William M. Brack21e4ef22005-01-02 09:53:13 +000035213#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035214 int mem_base;
35215 int ret_val;
35216 int code; /* UCS code point */
35217 int n_code;
35218
35219 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35220 mem_base = xmlMemBlocks();
35221 code = gen_int(n_code, 0);
35222
35223 ret_val = xmlUCSIsCJKCompatibility(code);
35224 desret_int(ret_val);
35225 call_tests++;
35226 des_int(n_code, code, 0);
35227 xmlResetLastError();
35228 if (mem_base != xmlMemBlocks()) {
35229 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
35230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035231 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035232 printf(" %d", n_code);
35233 printf("\n");
35234 }
35235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035236 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035237#endif
35238
Daniel Veillard42595322004-11-08 10:52:06 +000035239 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035240}
35241
35242
35243static int
35244test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035246
William M. Brack21e4ef22005-01-02 09:53:13 +000035247#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035248 int mem_base;
35249 int ret_val;
35250 int code; /* UCS code point */
35251 int n_code;
35252
35253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35254 mem_base = xmlMemBlocks();
35255 code = gen_int(n_code, 0);
35256
35257 ret_val = xmlUCSIsCJKCompatibilityForms(code);
35258 desret_int(ret_val);
35259 call_tests++;
35260 des_int(n_code, code, 0);
35261 xmlResetLastError();
35262 if (mem_base != xmlMemBlocks()) {
35263 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
35264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035266 printf(" %d", n_code);
35267 printf("\n");
35268 }
35269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035271#endif
35272
Daniel Veillard42595322004-11-08 10:52:06 +000035273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035274}
35275
35276
35277static int
35278test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035280
William M. Brack21e4ef22005-01-02 09:53:13 +000035281#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035282 int mem_base;
35283 int ret_val;
35284 int code; /* UCS code point */
35285 int n_code;
35286
35287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35288 mem_base = xmlMemBlocks();
35289 code = gen_int(n_code, 0);
35290
35291 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
35292 desret_int(ret_val);
35293 call_tests++;
35294 des_int(n_code, code, 0);
35295 xmlResetLastError();
35296 if (mem_base != xmlMemBlocks()) {
35297 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
35298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035300 printf(" %d", n_code);
35301 printf("\n");
35302 }
35303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035305#endif
35306
Daniel Veillard42595322004-11-08 10:52:06 +000035307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035308}
35309
35310
35311static int
35312test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035314
William M. Brack21e4ef22005-01-02 09:53:13 +000035315#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035316 int mem_base;
35317 int ret_val;
35318 int code; /* UCS code point */
35319 int n_code;
35320
35321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35322 mem_base = xmlMemBlocks();
35323 code = gen_int(n_code, 0);
35324
35325 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
35326 desret_int(ret_val);
35327 call_tests++;
35328 des_int(n_code, code, 0);
35329 xmlResetLastError();
35330 if (mem_base != xmlMemBlocks()) {
35331 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
35332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035334 printf(" %d", n_code);
35335 printf("\n");
35336 }
35337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035339#endif
35340
Daniel Veillard42595322004-11-08 10:52:06 +000035341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035342}
35343
35344
35345static int
35346test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035348
William M. Brack21e4ef22005-01-02 09:53:13 +000035349#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035350 int mem_base;
35351 int ret_val;
35352 int code; /* UCS code point */
35353 int n_code;
35354
35355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35356 mem_base = xmlMemBlocks();
35357 code = gen_int(n_code, 0);
35358
35359 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35360 desret_int(ret_val);
35361 call_tests++;
35362 des_int(n_code, code, 0);
35363 xmlResetLastError();
35364 if (mem_base != xmlMemBlocks()) {
35365 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035368 printf(" %d", n_code);
35369 printf("\n");
35370 }
35371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035373#endif
35374
Daniel Veillard42595322004-11-08 10:52:06 +000035375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035376}
35377
35378
35379static int
35380test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035382
William M. Brack21e4ef22005-01-02 09:53:13 +000035383#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035384 int mem_base;
35385 int ret_val;
35386 int code; /* UCS code point */
35387 int n_code;
35388
35389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35390 mem_base = xmlMemBlocks();
35391 code = gen_int(n_code, 0);
35392
35393 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35394 desret_int(ret_val);
35395 call_tests++;
35396 des_int(n_code, code, 0);
35397 xmlResetLastError();
35398 if (mem_base != xmlMemBlocks()) {
35399 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035402 printf(" %d", n_code);
35403 printf("\n");
35404 }
35405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035407#endif
35408
Daniel Veillard42595322004-11-08 10:52:06 +000035409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035410}
35411
35412
35413static int
35414test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035416
William M. Brack21e4ef22005-01-02 09:53:13 +000035417#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035418 int mem_base;
35419 int ret_val;
35420 int code; /* UCS code point */
35421 int n_code;
35422
35423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35424 mem_base = xmlMemBlocks();
35425 code = gen_int(n_code, 0);
35426
35427 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35428 desret_int(ret_val);
35429 call_tests++;
35430 des_int(n_code, code, 0);
35431 xmlResetLastError();
35432 if (mem_base != xmlMemBlocks()) {
35433 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035436 printf(" %d", n_code);
35437 printf("\n");
35438 }
35439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035441#endif
35442
Daniel Veillard42595322004-11-08 10:52:06 +000035443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035444}
35445
35446
35447static int
35448test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035450
William M. Brack21e4ef22005-01-02 09:53:13 +000035451#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035452 int mem_base;
35453 int ret_val;
35454 int code; /* UCS code point */
35455 int n_code;
35456
35457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35458 mem_base = xmlMemBlocks();
35459 code = gen_int(n_code, 0);
35460
35461 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35462 desret_int(ret_val);
35463 call_tests++;
35464 des_int(n_code, code, 0);
35465 xmlResetLastError();
35466 if (mem_base != xmlMemBlocks()) {
35467 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035470 printf(" %d", n_code);
35471 printf("\n");
35472 }
35473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035475#endif
35476
Daniel Veillard42595322004-11-08 10:52:06 +000035477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035478}
35479
35480
35481static int
35482test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035484
William M. Brack21e4ef22005-01-02 09:53:13 +000035485#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035486 int mem_base;
35487 int ret_val;
35488 int code; /* UCS code point */
35489 int n_code;
35490
35491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35492 mem_base = xmlMemBlocks();
35493 code = gen_int(n_code, 0);
35494
35495 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35496 desret_int(ret_val);
35497 call_tests++;
35498 des_int(n_code, code, 0);
35499 xmlResetLastError();
35500 if (mem_base != xmlMemBlocks()) {
35501 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035504 printf(" %d", n_code);
35505 printf("\n");
35506 }
35507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035509#endif
35510
Daniel Veillard42595322004-11-08 10:52:06 +000035511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035512}
35513
35514
35515static int
35516test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035518
William M. Brack21e4ef22005-01-02 09:53:13 +000035519#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035520 int mem_base;
35521 int ret_val;
35522 int code; /* UCS code point */
35523 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035524 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035525 int n_cat;
35526
35527 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35528 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35529 mem_base = xmlMemBlocks();
35530 code = gen_int(n_code, 0);
35531 cat = gen_const_char_ptr(n_cat, 1);
35532
William M. Brackf13f77f2004-11-12 16:03:48 +000035533 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035534 desret_int(ret_val);
35535 call_tests++;
35536 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035537 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035538 xmlResetLastError();
35539 if (mem_base != xmlMemBlocks()) {
35540 printf("Leak of %d blocks found in xmlUCSIsCat",
35541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035542 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035543 printf(" %d", n_code);
35544 printf(" %d", n_cat);
35545 printf("\n");
35546 }
35547 }
35548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035549 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035550#endif
35551
Daniel Veillard42595322004-11-08 10:52:06 +000035552 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035553}
35554
35555
35556static int
35557test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035558 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035559
William M. Brack21e4ef22005-01-02 09:53:13 +000035560#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035561 int mem_base;
35562 int ret_val;
35563 int code; /* UCS code point */
35564 int n_code;
35565
35566 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35567 mem_base = xmlMemBlocks();
35568 code = gen_int(n_code, 0);
35569
35570 ret_val = xmlUCSIsCatC(code);
35571 desret_int(ret_val);
35572 call_tests++;
35573 des_int(n_code, code, 0);
35574 xmlResetLastError();
35575 if (mem_base != xmlMemBlocks()) {
35576 printf("Leak of %d blocks found in xmlUCSIsCatC",
35577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035578 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035579 printf(" %d", n_code);
35580 printf("\n");
35581 }
35582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035583 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035584#endif
35585
Daniel Veillard42595322004-11-08 10:52:06 +000035586 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035587}
35588
35589
35590static int
35591test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035592 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035593
William M. Brack21e4ef22005-01-02 09:53:13 +000035594#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035595 int mem_base;
35596 int ret_val;
35597 int code; /* UCS code point */
35598 int n_code;
35599
35600 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35601 mem_base = xmlMemBlocks();
35602 code = gen_int(n_code, 0);
35603
35604 ret_val = xmlUCSIsCatCc(code);
35605 desret_int(ret_val);
35606 call_tests++;
35607 des_int(n_code, code, 0);
35608 xmlResetLastError();
35609 if (mem_base != xmlMemBlocks()) {
35610 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035612 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035613 printf(" %d", n_code);
35614 printf("\n");
35615 }
35616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035617 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035618#endif
35619
Daniel Veillard42595322004-11-08 10:52:06 +000035620 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035621}
35622
35623
35624static int
35625test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035627
William M. Brack21e4ef22005-01-02 09:53:13 +000035628#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035629 int mem_base;
35630 int ret_val;
35631 int code; /* UCS code point */
35632 int n_code;
35633
35634 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35635 mem_base = xmlMemBlocks();
35636 code = gen_int(n_code, 0);
35637
35638 ret_val = xmlUCSIsCatCf(code);
35639 desret_int(ret_val);
35640 call_tests++;
35641 des_int(n_code, code, 0);
35642 xmlResetLastError();
35643 if (mem_base != xmlMemBlocks()) {
35644 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035646 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035647 printf(" %d", n_code);
35648 printf("\n");
35649 }
35650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035651 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035652#endif
35653
Daniel Veillard42595322004-11-08 10:52:06 +000035654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035655}
35656
35657
35658static int
35659test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035661
William M. Brack21e4ef22005-01-02 09:53:13 +000035662#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035663 int mem_base;
35664 int ret_val;
35665 int code; /* UCS code point */
35666 int n_code;
35667
35668 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35669 mem_base = xmlMemBlocks();
35670 code = gen_int(n_code, 0);
35671
35672 ret_val = xmlUCSIsCatCo(code);
35673 desret_int(ret_val);
35674 call_tests++;
35675 des_int(n_code, code, 0);
35676 xmlResetLastError();
35677 if (mem_base != xmlMemBlocks()) {
35678 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035680 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035681 printf(" %d", n_code);
35682 printf("\n");
35683 }
35684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035685 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035686#endif
35687
Daniel Veillard42595322004-11-08 10:52:06 +000035688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035689}
35690
35691
35692static int
35693test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035695
William M. Brack21e4ef22005-01-02 09:53:13 +000035696#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035697 int mem_base;
35698 int ret_val;
35699 int code; /* UCS code point */
35700 int n_code;
35701
35702 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35703 mem_base = xmlMemBlocks();
35704 code = gen_int(n_code, 0);
35705
35706 ret_val = xmlUCSIsCatCs(code);
35707 desret_int(ret_val);
35708 call_tests++;
35709 des_int(n_code, code, 0);
35710 xmlResetLastError();
35711 if (mem_base != xmlMemBlocks()) {
35712 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035714 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035715 printf(" %d", n_code);
35716 printf("\n");
35717 }
35718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035719 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035720#endif
35721
Daniel Veillard42595322004-11-08 10:52:06 +000035722 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035723}
35724
35725
35726static int
35727test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035728 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035729
William M. Brack21e4ef22005-01-02 09:53:13 +000035730#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035731 int mem_base;
35732 int ret_val;
35733 int code; /* UCS code point */
35734 int n_code;
35735
35736 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35737 mem_base = xmlMemBlocks();
35738 code = gen_int(n_code, 0);
35739
35740 ret_val = xmlUCSIsCatL(code);
35741 desret_int(ret_val);
35742 call_tests++;
35743 des_int(n_code, code, 0);
35744 xmlResetLastError();
35745 if (mem_base != xmlMemBlocks()) {
35746 printf("Leak of %d blocks found in xmlUCSIsCatL",
35747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035748 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035749 printf(" %d", n_code);
35750 printf("\n");
35751 }
35752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035753 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035754#endif
35755
Daniel Veillard42595322004-11-08 10:52:06 +000035756 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035757}
35758
35759
35760static int
35761test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035762 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035763
William M. Brack21e4ef22005-01-02 09:53:13 +000035764#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035765 int mem_base;
35766 int ret_val;
35767 int code; /* UCS code point */
35768 int n_code;
35769
35770 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35771 mem_base = xmlMemBlocks();
35772 code = gen_int(n_code, 0);
35773
35774 ret_val = xmlUCSIsCatLl(code);
35775 desret_int(ret_val);
35776 call_tests++;
35777 des_int(n_code, code, 0);
35778 xmlResetLastError();
35779 if (mem_base != xmlMemBlocks()) {
35780 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035782 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035783 printf(" %d", n_code);
35784 printf("\n");
35785 }
35786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035787 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035788#endif
35789
Daniel Veillard42595322004-11-08 10:52:06 +000035790 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035791}
35792
35793
35794static int
35795test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035796 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035797
William M. Brack21e4ef22005-01-02 09:53:13 +000035798#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035799 int mem_base;
35800 int ret_val;
35801 int code; /* UCS code point */
35802 int n_code;
35803
35804 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35805 mem_base = xmlMemBlocks();
35806 code = gen_int(n_code, 0);
35807
35808 ret_val = xmlUCSIsCatLm(code);
35809 desret_int(ret_val);
35810 call_tests++;
35811 des_int(n_code, code, 0);
35812 xmlResetLastError();
35813 if (mem_base != xmlMemBlocks()) {
35814 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035816 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035817 printf(" %d", n_code);
35818 printf("\n");
35819 }
35820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035821 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035822#endif
35823
Daniel Veillard42595322004-11-08 10:52:06 +000035824 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035825}
35826
35827
35828static int
35829test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035830 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035831
William M. Brack21e4ef22005-01-02 09:53:13 +000035832#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035833 int mem_base;
35834 int ret_val;
35835 int code; /* UCS code point */
35836 int n_code;
35837
35838 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35839 mem_base = xmlMemBlocks();
35840 code = gen_int(n_code, 0);
35841
35842 ret_val = xmlUCSIsCatLo(code);
35843 desret_int(ret_val);
35844 call_tests++;
35845 des_int(n_code, code, 0);
35846 xmlResetLastError();
35847 if (mem_base != xmlMemBlocks()) {
35848 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035850 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035851 printf(" %d", n_code);
35852 printf("\n");
35853 }
35854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035855 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035856#endif
35857
Daniel Veillard42595322004-11-08 10:52:06 +000035858 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035859}
35860
35861
35862static int
35863test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035864 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035865
William M. Brack21e4ef22005-01-02 09:53:13 +000035866#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035867 int mem_base;
35868 int ret_val;
35869 int code; /* UCS code point */
35870 int n_code;
35871
35872 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35873 mem_base = xmlMemBlocks();
35874 code = gen_int(n_code, 0);
35875
35876 ret_val = xmlUCSIsCatLt(code);
35877 desret_int(ret_val);
35878 call_tests++;
35879 des_int(n_code, code, 0);
35880 xmlResetLastError();
35881 if (mem_base != xmlMemBlocks()) {
35882 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035884 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035885 printf(" %d", n_code);
35886 printf("\n");
35887 }
35888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035889 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035890#endif
35891
Daniel Veillard42595322004-11-08 10:52:06 +000035892 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035893}
35894
35895
35896static int
35897test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035898 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035899
William M. Brack21e4ef22005-01-02 09:53:13 +000035900#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035901 int mem_base;
35902 int ret_val;
35903 int code; /* UCS code point */
35904 int n_code;
35905
35906 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35907 mem_base = xmlMemBlocks();
35908 code = gen_int(n_code, 0);
35909
35910 ret_val = xmlUCSIsCatLu(code);
35911 desret_int(ret_val);
35912 call_tests++;
35913 des_int(n_code, code, 0);
35914 xmlResetLastError();
35915 if (mem_base != xmlMemBlocks()) {
35916 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035918 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035919 printf(" %d", n_code);
35920 printf("\n");
35921 }
35922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035923 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035924#endif
35925
Daniel Veillard42595322004-11-08 10:52:06 +000035926 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035927}
35928
35929
35930static int
35931test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035932 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035933
William M. Brack21e4ef22005-01-02 09:53:13 +000035934#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035935 int mem_base;
35936 int ret_val;
35937 int code; /* UCS code point */
35938 int n_code;
35939
35940 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35941 mem_base = xmlMemBlocks();
35942 code = gen_int(n_code, 0);
35943
35944 ret_val = xmlUCSIsCatM(code);
35945 desret_int(ret_val);
35946 call_tests++;
35947 des_int(n_code, code, 0);
35948 xmlResetLastError();
35949 if (mem_base != xmlMemBlocks()) {
35950 printf("Leak of %d blocks found in xmlUCSIsCatM",
35951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035952 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035953 printf(" %d", n_code);
35954 printf("\n");
35955 }
35956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035957 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035958#endif
35959
Daniel Veillard42595322004-11-08 10:52:06 +000035960 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035961}
35962
35963
35964static int
35965test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035966 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035967
William M. Brack21e4ef22005-01-02 09:53:13 +000035968#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035969 int mem_base;
35970 int ret_val;
35971 int code; /* UCS code point */
35972 int n_code;
35973
35974 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35975 mem_base = xmlMemBlocks();
35976 code = gen_int(n_code, 0);
35977
35978 ret_val = xmlUCSIsCatMc(code);
35979 desret_int(ret_val);
35980 call_tests++;
35981 des_int(n_code, code, 0);
35982 xmlResetLastError();
35983 if (mem_base != xmlMemBlocks()) {
35984 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035986 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035987 printf(" %d", n_code);
35988 printf("\n");
35989 }
35990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035991 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035992#endif
35993
Daniel Veillard42595322004-11-08 10:52:06 +000035994 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035995}
35996
35997
35998static int
35999test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036000 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036001
William M. Brack21e4ef22005-01-02 09:53:13 +000036002#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036003 int mem_base;
36004 int ret_val;
36005 int code; /* UCS code point */
36006 int n_code;
36007
36008 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36009 mem_base = xmlMemBlocks();
36010 code = gen_int(n_code, 0);
36011
36012 ret_val = xmlUCSIsCatMe(code);
36013 desret_int(ret_val);
36014 call_tests++;
36015 des_int(n_code, code, 0);
36016 xmlResetLastError();
36017 if (mem_base != xmlMemBlocks()) {
36018 printf("Leak of %d blocks found in xmlUCSIsCatMe",
36019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036020 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036021 printf(" %d", n_code);
36022 printf("\n");
36023 }
36024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036025 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036026#endif
36027
Daniel Veillard42595322004-11-08 10:52:06 +000036028 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036029}
36030
36031
36032static int
36033test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036034 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036035
William M. Brack21e4ef22005-01-02 09:53:13 +000036036#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036037 int mem_base;
36038 int ret_val;
36039 int code; /* UCS code point */
36040 int n_code;
36041
36042 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36043 mem_base = xmlMemBlocks();
36044 code = gen_int(n_code, 0);
36045
36046 ret_val = xmlUCSIsCatMn(code);
36047 desret_int(ret_val);
36048 call_tests++;
36049 des_int(n_code, code, 0);
36050 xmlResetLastError();
36051 if (mem_base != xmlMemBlocks()) {
36052 printf("Leak of %d blocks found in xmlUCSIsCatMn",
36053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036054 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036055 printf(" %d", n_code);
36056 printf("\n");
36057 }
36058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036059 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036060#endif
36061
Daniel Veillard42595322004-11-08 10:52:06 +000036062 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036063}
36064
36065
36066static int
36067test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036068 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036069
William M. Brack21e4ef22005-01-02 09:53:13 +000036070#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036071 int mem_base;
36072 int ret_val;
36073 int code; /* UCS code point */
36074 int n_code;
36075
36076 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36077 mem_base = xmlMemBlocks();
36078 code = gen_int(n_code, 0);
36079
36080 ret_val = xmlUCSIsCatN(code);
36081 desret_int(ret_val);
36082 call_tests++;
36083 des_int(n_code, code, 0);
36084 xmlResetLastError();
36085 if (mem_base != xmlMemBlocks()) {
36086 printf("Leak of %d blocks found in xmlUCSIsCatN",
36087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036088 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036089 printf(" %d", n_code);
36090 printf("\n");
36091 }
36092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036093 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036094#endif
36095
Daniel Veillard42595322004-11-08 10:52:06 +000036096 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036097}
36098
36099
36100static int
36101test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036102 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036103
William M. Brack21e4ef22005-01-02 09:53:13 +000036104#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036105 int mem_base;
36106 int ret_val;
36107 int code; /* UCS code point */
36108 int n_code;
36109
36110 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36111 mem_base = xmlMemBlocks();
36112 code = gen_int(n_code, 0);
36113
36114 ret_val = xmlUCSIsCatNd(code);
36115 desret_int(ret_val);
36116 call_tests++;
36117 des_int(n_code, code, 0);
36118 xmlResetLastError();
36119 if (mem_base != xmlMemBlocks()) {
36120 printf("Leak of %d blocks found in xmlUCSIsCatNd",
36121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036122 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036123 printf(" %d", n_code);
36124 printf("\n");
36125 }
36126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036127 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036128#endif
36129
Daniel Veillard42595322004-11-08 10:52:06 +000036130 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036131}
36132
36133
36134static int
36135test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036136 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036137
William M. Brack21e4ef22005-01-02 09:53:13 +000036138#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036139 int mem_base;
36140 int ret_val;
36141 int code; /* UCS code point */
36142 int n_code;
36143
36144 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36145 mem_base = xmlMemBlocks();
36146 code = gen_int(n_code, 0);
36147
36148 ret_val = xmlUCSIsCatNl(code);
36149 desret_int(ret_val);
36150 call_tests++;
36151 des_int(n_code, code, 0);
36152 xmlResetLastError();
36153 if (mem_base != xmlMemBlocks()) {
36154 printf("Leak of %d blocks found in xmlUCSIsCatNl",
36155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036156 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036157 printf(" %d", n_code);
36158 printf("\n");
36159 }
36160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036161 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036162#endif
36163
Daniel Veillard42595322004-11-08 10:52:06 +000036164 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036165}
36166
36167
36168static int
36169test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036170 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036171
William M. Brack21e4ef22005-01-02 09:53:13 +000036172#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036173 int mem_base;
36174 int ret_val;
36175 int code; /* UCS code point */
36176 int n_code;
36177
36178 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36179 mem_base = xmlMemBlocks();
36180 code = gen_int(n_code, 0);
36181
36182 ret_val = xmlUCSIsCatNo(code);
36183 desret_int(ret_val);
36184 call_tests++;
36185 des_int(n_code, code, 0);
36186 xmlResetLastError();
36187 if (mem_base != xmlMemBlocks()) {
36188 printf("Leak of %d blocks found in xmlUCSIsCatNo",
36189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036190 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036191 printf(" %d", n_code);
36192 printf("\n");
36193 }
36194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036195 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036196#endif
36197
Daniel Veillard42595322004-11-08 10:52:06 +000036198 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036199}
36200
36201
36202static int
36203test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036204 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036205
William M. Brack21e4ef22005-01-02 09:53:13 +000036206#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036207 int mem_base;
36208 int ret_val;
36209 int code; /* UCS code point */
36210 int n_code;
36211
36212 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36213 mem_base = xmlMemBlocks();
36214 code = gen_int(n_code, 0);
36215
36216 ret_val = xmlUCSIsCatP(code);
36217 desret_int(ret_val);
36218 call_tests++;
36219 des_int(n_code, code, 0);
36220 xmlResetLastError();
36221 if (mem_base != xmlMemBlocks()) {
36222 printf("Leak of %d blocks found in xmlUCSIsCatP",
36223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036224 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036225 printf(" %d", n_code);
36226 printf("\n");
36227 }
36228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036229 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036230#endif
36231
Daniel Veillard42595322004-11-08 10:52:06 +000036232 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036233}
36234
36235
36236static int
36237test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036238 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036239
William M. Brack21e4ef22005-01-02 09:53:13 +000036240#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036241 int mem_base;
36242 int ret_val;
36243 int code; /* UCS code point */
36244 int n_code;
36245
36246 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36247 mem_base = xmlMemBlocks();
36248 code = gen_int(n_code, 0);
36249
36250 ret_val = xmlUCSIsCatPc(code);
36251 desret_int(ret_val);
36252 call_tests++;
36253 des_int(n_code, code, 0);
36254 xmlResetLastError();
36255 if (mem_base != xmlMemBlocks()) {
36256 printf("Leak of %d blocks found in xmlUCSIsCatPc",
36257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036258 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036259 printf(" %d", n_code);
36260 printf("\n");
36261 }
36262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036263 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036264#endif
36265
Daniel Veillard42595322004-11-08 10:52:06 +000036266 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036267}
36268
36269
36270static int
36271test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036272 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036273
William M. Brack21e4ef22005-01-02 09:53:13 +000036274#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036275 int mem_base;
36276 int ret_val;
36277 int code; /* UCS code point */
36278 int n_code;
36279
36280 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36281 mem_base = xmlMemBlocks();
36282 code = gen_int(n_code, 0);
36283
36284 ret_val = xmlUCSIsCatPd(code);
36285 desret_int(ret_val);
36286 call_tests++;
36287 des_int(n_code, code, 0);
36288 xmlResetLastError();
36289 if (mem_base != xmlMemBlocks()) {
36290 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036292 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036293 printf(" %d", n_code);
36294 printf("\n");
36295 }
36296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036297 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036298#endif
36299
Daniel Veillard42595322004-11-08 10:52:06 +000036300 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036301}
36302
36303
36304static int
36305test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036306 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036307
William M. Brack21e4ef22005-01-02 09:53:13 +000036308#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036309 int mem_base;
36310 int ret_val;
36311 int code; /* UCS code point */
36312 int n_code;
36313
36314 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36315 mem_base = xmlMemBlocks();
36316 code = gen_int(n_code, 0);
36317
36318 ret_val = xmlUCSIsCatPe(code);
36319 desret_int(ret_val);
36320 call_tests++;
36321 des_int(n_code, code, 0);
36322 xmlResetLastError();
36323 if (mem_base != xmlMemBlocks()) {
36324 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036326 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036327 printf(" %d", n_code);
36328 printf("\n");
36329 }
36330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036331 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036332#endif
36333
Daniel Veillard42595322004-11-08 10:52:06 +000036334 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036335}
36336
36337
36338static int
36339test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036340 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036341
William M. Brack21e4ef22005-01-02 09:53:13 +000036342#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036343 int mem_base;
36344 int ret_val;
36345 int code; /* UCS code point */
36346 int n_code;
36347
36348 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36349 mem_base = xmlMemBlocks();
36350 code = gen_int(n_code, 0);
36351
36352 ret_val = xmlUCSIsCatPf(code);
36353 desret_int(ret_val);
36354 call_tests++;
36355 des_int(n_code, code, 0);
36356 xmlResetLastError();
36357 if (mem_base != xmlMemBlocks()) {
36358 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036360 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036361 printf(" %d", n_code);
36362 printf("\n");
36363 }
36364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036365 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036366#endif
36367
Daniel Veillard42595322004-11-08 10:52:06 +000036368 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036369}
36370
36371
36372static int
36373test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036374 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036375
William M. Brack21e4ef22005-01-02 09:53:13 +000036376#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036377 int mem_base;
36378 int ret_val;
36379 int code; /* UCS code point */
36380 int n_code;
36381
36382 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36383 mem_base = xmlMemBlocks();
36384 code = gen_int(n_code, 0);
36385
36386 ret_val = xmlUCSIsCatPi(code);
36387 desret_int(ret_val);
36388 call_tests++;
36389 des_int(n_code, code, 0);
36390 xmlResetLastError();
36391 if (mem_base != xmlMemBlocks()) {
36392 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036394 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036395 printf(" %d", n_code);
36396 printf("\n");
36397 }
36398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036399 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036400#endif
36401
Daniel Veillard42595322004-11-08 10:52:06 +000036402 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036403}
36404
36405
36406static int
36407test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036408 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036409
William M. Brack21e4ef22005-01-02 09:53:13 +000036410#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036411 int mem_base;
36412 int ret_val;
36413 int code; /* UCS code point */
36414 int n_code;
36415
36416 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36417 mem_base = xmlMemBlocks();
36418 code = gen_int(n_code, 0);
36419
36420 ret_val = xmlUCSIsCatPo(code);
36421 desret_int(ret_val);
36422 call_tests++;
36423 des_int(n_code, code, 0);
36424 xmlResetLastError();
36425 if (mem_base != xmlMemBlocks()) {
36426 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036428 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036429 printf(" %d", n_code);
36430 printf("\n");
36431 }
36432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036433 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036434#endif
36435
Daniel Veillard42595322004-11-08 10:52:06 +000036436 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036437}
36438
36439
36440static int
36441test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036442 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036443
William M. Brack21e4ef22005-01-02 09:53:13 +000036444#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036445 int mem_base;
36446 int ret_val;
36447 int code; /* UCS code point */
36448 int n_code;
36449
36450 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36451 mem_base = xmlMemBlocks();
36452 code = gen_int(n_code, 0);
36453
36454 ret_val = xmlUCSIsCatPs(code);
36455 desret_int(ret_val);
36456 call_tests++;
36457 des_int(n_code, code, 0);
36458 xmlResetLastError();
36459 if (mem_base != xmlMemBlocks()) {
36460 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036462 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036463 printf(" %d", n_code);
36464 printf("\n");
36465 }
36466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036467 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036468#endif
36469
Daniel Veillard42595322004-11-08 10:52:06 +000036470 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036471}
36472
36473
36474static int
36475test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036476 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036477
William M. Brack21e4ef22005-01-02 09:53:13 +000036478#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036479 int mem_base;
36480 int ret_val;
36481 int code; /* UCS code point */
36482 int n_code;
36483
36484 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36485 mem_base = xmlMemBlocks();
36486 code = gen_int(n_code, 0);
36487
36488 ret_val = xmlUCSIsCatS(code);
36489 desret_int(ret_val);
36490 call_tests++;
36491 des_int(n_code, code, 0);
36492 xmlResetLastError();
36493 if (mem_base != xmlMemBlocks()) {
36494 printf("Leak of %d blocks found in xmlUCSIsCatS",
36495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036496 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036497 printf(" %d", n_code);
36498 printf("\n");
36499 }
36500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036501 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036502#endif
36503
Daniel Veillard42595322004-11-08 10:52:06 +000036504 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036505}
36506
36507
36508static int
36509test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036510 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036511
William M. Brack21e4ef22005-01-02 09:53:13 +000036512#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036513 int mem_base;
36514 int ret_val;
36515 int code; /* UCS code point */
36516 int n_code;
36517
36518 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36519 mem_base = xmlMemBlocks();
36520 code = gen_int(n_code, 0);
36521
36522 ret_val = xmlUCSIsCatSc(code);
36523 desret_int(ret_val);
36524 call_tests++;
36525 des_int(n_code, code, 0);
36526 xmlResetLastError();
36527 if (mem_base != xmlMemBlocks()) {
36528 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036530 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036531 printf(" %d", n_code);
36532 printf("\n");
36533 }
36534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036535 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036536#endif
36537
Daniel Veillard42595322004-11-08 10:52:06 +000036538 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036539}
36540
36541
36542static int
36543test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036544 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036545
William M. Brack21e4ef22005-01-02 09:53:13 +000036546#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036547 int mem_base;
36548 int ret_val;
36549 int code; /* UCS code point */
36550 int n_code;
36551
36552 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36553 mem_base = xmlMemBlocks();
36554 code = gen_int(n_code, 0);
36555
36556 ret_val = xmlUCSIsCatSk(code);
36557 desret_int(ret_val);
36558 call_tests++;
36559 des_int(n_code, code, 0);
36560 xmlResetLastError();
36561 if (mem_base != xmlMemBlocks()) {
36562 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036564 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036565 printf(" %d", n_code);
36566 printf("\n");
36567 }
36568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036569 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036570#endif
36571
Daniel Veillard42595322004-11-08 10:52:06 +000036572 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036573}
36574
36575
36576static int
36577test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036578 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036579
William M. Brack21e4ef22005-01-02 09:53:13 +000036580#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036581 int mem_base;
36582 int ret_val;
36583 int code; /* UCS code point */
36584 int n_code;
36585
36586 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36587 mem_base = xmlMemBlocks();
36588 code = gen_int(n_code, 0);
36589
36590 ret_val = xmlUCSIsCatSm(code);
36591 desret_int(ret_val);
36592 call_tests++;
36593 des_int(n_code, code, 0);
36594 xmlResetLastError();
36595 if (mem_base != xmlMemBlocks()) {
36596 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036598 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036599 printf(" %d", n_code);
36600 printf("\n");
36601 }
36602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036603 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036604#endif
36605
Daniel Veillard42595322004-11-08 10:52:06 +000036606 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036607}
36608
36609
36610static int
36611test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036612 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036613
William M. Brack21e4ef22005-01-02 09:53:13 +000036614#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036615 int mem_base;
36616 int ret_val;
36617 int code; /* UCS code point */
36618 int n_code;
36619
36620 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36621 mem_base = xmlMemBlocks();
36622 code = gen_int(n_code, 0);
36623
36624 ret_val = xmlUCSIsCatSo(code);
36625 desret_int(ret_val);
36626 call_tests++;
36627 des_int(n_code, code, 0);
36628 xmlResetLastError();
36629 if (mem_base != xmlMemBlocks()) {
36630 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036632 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036633 printf(" %d", n_code);
36634 printf("\n");
36635 }
36636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036637 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036638#endif
36639
Daniel Veillard42595322004-11-08 10:52:06 +000036640 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036641}
36642
36643
36644static int
36645test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036646 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036647
William M. Brack21e4ef22005-01-02 09:53:13 +000036648#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036649 int mem_base;
36650 int ret_val;
36651 int code; /* UCS code point */
36652 int n_code;
36653
36654 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36655 mem_base = xmlMemBlocks();
36656 code = gen_int(n_code, 0);
36657
36658 ret_val = xmlUCSIsCatZ(code);
36659 desret_int(ret_val);
36660 call_tests++;
36661 des_int(n_code, code, 0);
36662 xmlResetLastError();
36663 if (mem_base != xmlMemBlocks()) {
36664 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036666 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036667 printf(" %d", n_code);
36668 printf("\n");
36669 }
36670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036671 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036672#endif
36673
Daniel Veillard42595322004-11-08 10:52:06 +000036674 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036675}
36676
36677
36678static int
36679test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036680 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036681
William M. Brack21e4ef22005-01-02 09:53:13 +000036682#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036683 int mem_base;
36684 int ret_val;
36685 int code; /* UCS code point */
36686 int n_code;
36687
36688 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36689 mem_base = xmlMemBlocks();
36690 code = gen_int(n_code, 0);
36691
36692 ret_val = xmlUCSIsCatZl(code);
36693 desret_int(ret_val);
36694 call_tests++;
36695 des_int(n_code, code, 0);
36696 xmlResetLastError();
36697 if (mem_base != xmlMemBlocks()) {
36698 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036700 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036701 printf(" %d", n_code);
36702 printf("\n");
36703 }
36704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036705 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036706#endif
36707
Daniel Veillard42595322004-11-08 10:52:06 +000036708 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036709}
36710
36711
36712static int
36713test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036714 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036715
William M. Brack21e4ef22005-01-02 09:53:13 +000036716#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036717 int mem_base;
36718 int ret_val;
36719 int code; /* UCS code point */
36720 int n_code;
36721
36722 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36723 mem_base = xmlMemBlocks();
36724 code = gen_int(n_code, 0);
36725
36726 ret_val = xmlUCSIsCatZp(code);
36727 desret_int(ret_val);
36728 call_tests++;
36729 des_int(n_code, code, 0);
36730 xmlResetLastError();
36731 if (mem_base != xmlMemBlocks()) {
36732 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036734 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036735 printf(" %d", n_code);
36736 printf("\n");
36737 }
36738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036739 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036740#endif
36741
Daniel Veillard42595322004-11-08 10:52:06 +000036742 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036743}
36744
36745
36746static int
36747test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036748 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036749
William M. Brack21e4ef22005-01-02 09:53:13 +000036750#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036751 int mem_base;
36752 int ret_val;
36753 int code; /* UCS code point */
36754 int n_code;
36755
36756 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36757 mem_base = xmlMemBlocks();
36758 code = gen_int(n_code, 0);
36759
36760 ret_val = xmlUCSIsCatZs(code);
36761 desret_int(ret_val);
36762 call_tests++;
36763 des_int(n_code, code, 0);
36764 xmlResetLastError();
36765 if (mem_base != xmlMemBlocks()) {
36766 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036768 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036769 printf(" %d", n_code);
36770 printf("\n");
36771 }
36772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036773 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036774#endif
36775
Daniel Veillard42595322004-11-08 10:52:06 +000036776 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036777}
36778
36779
36780static int
36781test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036782 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036783
William M. Brack21e4ef22005-01-02 09:53:13 +000036784#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036785 int mem_base;
36786 int ret_val;
36787 int code; /* UCS code point */
36788 int n_code;
36789
36790 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36791 mem_base = xmlMemBlocks();
36792 code = gen_int(n_code, 0);
36793
36794 ret_val = xmlUCSIsCherokee(code);
36795 desret_int(ret_val);
36796 call_tests++;
36797 des_int(n_code, code, 0);
36798 xmlResetLastError();
36799 if (mem_base != xmlMemBlocks()) {
36800 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036802 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036803 printf(" %d", n_code);
36804 printf("\n");
36805 }
36806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036807 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036808#endif
36809
Daniel Veillard42595322004-11-08 10:52:06 +000036810 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036811}
36812
36813
36814static int
36815test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036816 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036817
William M. Brack21e4ef22005-01-02 09:53:13 +000036818#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036819 int mem_base;
36820 int ret_val;
36821 int code; /* UCS code point */
36822 int n_code;
36823
36824 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36825 mem_base = xmlMemBlocks();
36826 code = gen_int(n_code, 0);
36827
36828 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36829 desret_int(ret_val);
36830 call_tests++;
36831 des_int(n_code, code, 0);
36832 xmlResetLastError();
36833 if (mem_base != xmlMemBlocks()) {
36834 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036836 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036837 printf(" %d", n_code);
36838 printf("\n");
36839 }
36840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036841 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036842#endif
36843
Daniel Veillard42595322004-11-08 10:52:06 +000036844 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036845}
36846
36847
36848static int
36849test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036850 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036851
William M. Brack21e4ef22005-01-02 09:53:13 +000036852#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036853 int mem_base;
36854 int ret_val;
36855 int code; /* UCS code point */
36856 int n_code;
36857
36858 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36859 mem_base = xmlMemBlocks();
36860 code = gen_int(n_code, 0);
36861
36862 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36863 desret_int(ret_val);
36864 call_tests++;
36865 des_int(n_code, code, 0);
36866 xmlResetLastError();
36867 if (mem_base != xmlMemBlocks()) {
36868 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036870 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036871 printf(" %d", n_code);
36872 printf("\n");
36873 }
36874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036875 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036876#endif
36877
Daniel Veillard42595322004-11-08 10:52:06 +000036878 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036879}
36880
36881
36882static int
36883test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036884 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036885
William M. Brack21e4ef22005-01-02 09:53:13 +000036886#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036887 int mem_base;
36888 int ret_val;
36889 int code; /* UCS code point */
36890 int n_code;
36891
36892 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36893 mem_base = xmlMemBlocks();
36894 code = gen_int(n_code, 0);
36895
36896 ret_val = xmlUCSIsCombiningHalfMarks(code);
36897 desret_int(ret_val);
36898 call_tests++;
36899 des_int(n_code, code, 0);
36900 xmlResetLastError();
36901 if (mem_base != xmlMemBlocks()) {
36902 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036904 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036905 printf(" %d", n_code);
36906 printf("\n");
36907 }
36908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036909 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036910#endif
36911
Daniel Veillard42595322004-11-08 10:52:06 +000036912 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036913}
36914
36915
36916static int
36917test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036918 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036919
William M. Brack21e4ef22005-01-02 09:53:13 +000036920#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036921 int mem_base;
36922 int ret_val;
36923 int code; /* UCS code point */
36924 int n_code;
36925
36926 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36927 mem_base = xmlMemBlocks();
36928 code = gen_int(n_code, 0);
36929
36930 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36931 desret_int(ret_val);
36932 call_tests++;
36933 des_int(n_code, code, 0);
36934 xmlResetLastError();
36935 if (mem_base != xmlMemBlocks()) {
36936 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036938 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036939 printf(" %d", n_code);
36940 printf("\n");
36941 }
36942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036943 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036944#endif
36945
Daniel Veillard42595322004-11-08 10:52:06 +000036946 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036947}
36948
36949
36950static int
36951test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036952 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036953
William M. Brack21e4ef22005-01-02 09:53:13 +000036954#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036955 int mem_base;
36956 int ret_val;
36957 int code; /* UCS code point */
36958 int n_code;
36959
36960 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36961 mem_base = xmlMemBlocks();
36962 code = gen_int(n_code, 0);
36963
36964 ret_val = xmlUCSIsControlPictures(code);
36965 desret_int(ret_val);
36966 call_tests++;
36967 des_int(n_code, code, 0);
36968 xmlResetLastError();
36969 if (mem_base != xmlMemBlocks()) {
36970 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036972 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036973 printf(" %d", n_code);
36974 printf("\n");
36975 }
36976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036977 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036978#endif
36979
Daniel Veillard42595322004-11-08 10:52:06 +000036980 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036981}
36982
36983
36984static int
36985test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036986 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036987
William M. Brack21e4ef22005-01-02 09:53:13 +000036988#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036989 int mem_base;
36990 int ret_val;
36991 int code; /* UCS code point */
36992 int n_code;
36993
36994 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36995 mem_base = xmlMemBlocks();
36996 code = gen_int(n_code, 0);
36997
36998 ret_val = xmlUCSIsCurrencySymbols(code);
36999 desret_int(ret_val);
37000 call_tests++;
37001 des_int(n_code, code, 0);
37002 xmlResetLastError();
37003 if (mem_base != xmlMemBlocks()) {
37004 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
37005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037006 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037007 printf(" %d", n_code);
37008 printf("\n");
37009 }
37010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037011 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037012#endif
37013
Daniel Veillard42595322004-11-08 10:52:06 +000037014 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037015}
37016
37017
37018static int
37019test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037020 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037021
William M. Brack21e4ef22005-01-02 09:53:13 +000037022#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037023 int mem_base;
37024 int ret_val;
37025 int code; /* UCS code point */
37026 int n_code;
37027
37028 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37029 mem_base = xmlMemBlocks();
37030 code = gen_int(n_code, 0);
37031
37032 ret_val = xmlUCSIsCypriotSyllabary(code);
37033 desret_int(ret_val);
37034 call_tests++;
37035 des_int(n_code, code, 0);
37036 xmlResetLastError();
37037 if (mem_base != xmlMemBlocks()) {
37038 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
37039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037040 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037041 printf(" %d", n_code);
37042 printf("\n");
37043 }
37044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037045 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037046#endif
37047
Daniel Veillard42595322004-11-08 10:52:06 +000037048 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037049}
37050
37051
37052static int
37053test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037054 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037055
William M. Brack21e4ef22005-01-02 09:53:13 +000037056#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037057 int mem_base;
37058 int ret_val;
37059 int code; /* UCS code point */
37060 int n_code;
37061
37062 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37063 mem_base = xmlMemBlocks();
37064 code = gen_int(n_code, 0);
37065
37066 ret_val = xmlUCSIsCyrillic(code);
37067 desret_int(ret_val);
37068 call_tests++;
37069 des_int(n_code, code, 0);
37070 xmlResetLastError();
37071 if (mem_base != xmlMemBlocks()) {
37072 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
37073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037074 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037075 printf(" %d", n_code);
37076 printf("\n");
37077 }
37078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037079 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037080#endif
37081
Daniel Veillard42595322004-11-08 10:52:06 +000037082 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037083}
37084
37085
37086static int
37087test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037088 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037089
William M. Brack21e4ef22005-01-02 09:53:13 +000037090#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037091 int mem_base;
37092 int ret_val;
37093 int code; /* UCS code point */
37094 int n_code;
37095
37096 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37097 mem_base = xmlMemBlocks();
37098 code = gen_int(n_code, 0);
37099
37100 ret_val = xmlUCSIsCyrillicSupplement(code);
37101 desret_int(ret_val);
37102 call_tests++;
37103 des_int(n_code, code, 0);
37104 xmlResetLastError();
37105 if (mem_base != xmlMemBlocks()) {
37106 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
37107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037108 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037109 printf(" %d", n_code);
37110 printf("\n");
37111 }
37112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037113 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037114#endif
37115
Daniel Veillard42595322004-11-08 10:52:06 +000037116 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037117}
37118
37119
37120static int
37121test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037122 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037123
William M. Brack21e4ef22005-01-02 09:53:13 +000037124#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037125 int mem_base;
37126 int ret_val;
37127 int code; /* UCS code point */
37128 int n_code;
37129
37130 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37131 mem_base = xmlMemBlocks();
37132 code = gen_int(n_code, 0);
37133
37134 ret_val = xmlUCSIsDeseret(code);
37135 desret_int(ret_val);
37136 call_tests++;
37137 des_int(n_code, code, 0);
37138 xmlResetLastError();
37139 if (mem_base != xmlMemBlocks()) {
37140 printf("Leak of %d blocks found in xmlUCSIsDeseret",
37141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037142 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037143 printf(" %d", n_code);
37144 printf("\n");
37145 }
37146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037147 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037148#endif
37149
Daniel Veillard42595322004-11-08 10:52:06 +000037150 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037151}
37152
37153
37154static int
37155test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037156 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037157
William M. Brack21e4ef22005-01-02 09:53:13 +000037158#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037159 int mem_base;
37160 int ret_val;
37161 int code; /* UCS code point */
37162 int n_code;
37163
37164 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37165 mem_base = xmlMemBlocks();
37166 code = gen_int(n_code, 0);
37167
37168 ret_val = xmlUCSIsDevanagari(code);
37169 desret_int(ret_val);
37170 call_tests++;
37171 des_int(n_code, code, 0);
37172 xmlResetLastError();
37173 if (mem_base != xmlMemBlocks()) {
37174 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
37175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037176 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037177 printf(" %d", n_code);
37178 printf("\n");
37179 }
37180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037181 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037182#endif
37183
Daniel Veillard42595322004-11-08 10:52:06 +000037184 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037185}
37186
37187
37188static int
37189test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037190 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037191
William M. Brack21e4ef22005-01-02 09:53:13 +000037192#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037193 int mem_base;
37194 int ret_val;
37195 int code; /* UCS code point */
37196 int n_code;
37197
37198 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37199 mem_base = xmlMemBlocks();
37200 code = gen_int(n_code, 0);
37201
37202 ret_val = xmlUCSIsDingbats(code);
37203 desret_int(ret_val);
37204 call_tests++;
37205 des_int(n_code, code, 0);
37206 xmlResetLastError();
37207 if (mem_base != xmlMemBlocks()) {
37208 printf("Leak of %d blocks found in xmlUCSIsDingbats",
37209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037210 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037211 printf(" %d", n_code);
37212 printf("\n");
37213 }
37214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037215 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037216#endif
37217
Daniel Veillard42595322004-11-08 10:52:06 +000037218 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037219}
37220
37221
37222static int
37223test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037224 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037225
William M. Brack21e4ef22005-01-02 09:53:13 +000037226#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037227 int mem_base;
37228 int ret_val;
37229 int code; /* UCS code point */
37230 int n_code;
37231
37232 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37233 mem_base = xmlMemBlocks();
37234 code = gen_int(n_code, 0);
37235
37236 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
37237 desret_int(ret_val);
37238 call_tests++;
37239 des_int(n_code, code, 0);
37240 xmlResetLastError();
37241 if (mem_base != xmlMemBlocks()) {
37242 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
37243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037244 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037245 printf(" %d", n_code);
37246 printf("\n");
37247 }
37248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037249 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037250#endif
37251
Daniel Veillard42595322004-11-08 10:52:06 +000037252 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037253}
37254
37255
37256static int
37257test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037258 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037259
William M. Brack21e4ef22005-01-02 09:53:13 +000037260#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037261 int mem_base;
37262 int ret_val;
37263 int code; /* UCS code point */
37264 int n_code;
37265
37266 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37267 mem_base = xmlMemBlocks();
37268 code = gen_int(n_code, 0);
37269
37270 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
37271 desret_int(ret_val);
37272 call_tests++;
37273 des_int(n_code, code, 0);
37274 xmlResetLastError();
37275 if (mem_base != xmlMemBlocks()) {
37276 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
37277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037278 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037279 printf(" %d", n_code);
37280 printf("\n");
37281 }
37282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037283 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037284#endif
37285
Daniel Veillard42595322004-11-08 10:52:06 +000037286 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037287}
37288
37289
37290static int
37291test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037292 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037293
William M. Brack21e4ef22005-01-02 09:53:13 +000037294#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037295 int mem_base;
37296 int ret_val;
37297 int code; /* UCS code point */
37298 int n_code;
37299
37300 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37301 mem_base = xmlMemBlocks();
37302 code = gen_int(n_code, 0);
37303
37304 ret_val = xmlUCSIsEthiopic(code);
37305 desret_int(ret_val);
37306 call_tests++;
37307 des_int(n_code, code, 0);
37308 xmlResetLastError();
37309 if (mem_base != xmlMemBlocks()) {
37310 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037312 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037313 printf(" %d", n_code);
37314 printf("\n");
37315 }
37316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037317 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037318#endif
37319
Daniel Veillard42595322004-11-08 10:52:06 +000037320 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037321}
37322
37323
37324static int
37325test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037326 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037327
William M. Brack21e4ef22005-01-02 09:53:13 +000037328#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037329 int mem_base;
37330 int ret_val;
37331 int code; /* UCS code point */
37332 int n_code;
37333
37334 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37335 mem_base = xmlMemBlocks();
37336 code = gen_int(n_code, 0);
37337
37338 ret_val = xmlUCSIsGeneralPunctuation(code);
37339 desret_int(ret_val);
37340 call_tests++;
37341 des_int(n_code, code, 0);
37342 xmlResetLastError();
37343 if (mem_base != xmlMemBlocks()) {
37344 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037346 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037347 printf(" %d", n_code);
37348 printf("\n");
37349 }
37350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037351 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037352#endif
37353
Daniel Veillard42595322004-11-08 10:52:06 +000037354 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037355}
37356
37357
37358static int
37359test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037360 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037361
William M. Brack21e4ef22005-01-02 09:53:13 +000037362#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037363 int mem_base;
37364 int ret_val;
37365 int code; /* UCS code point */
37366 int n_code;
37367
37368 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37369 mem_base = xmlMemBlocks();
37370 code = gen_int(n_code, 0);
37371
37372 ret_val = xmlUCSIsGeometricShapes(code);
37373 desret_int(ret_val);
37374 call_tests++;
37375 des_int(n_code, code, 0);
37376 xmlResetLastError();
37377 if (mem_base != xmlMemBlocks()) {
37378 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037380 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037381 printf(" %d", n_code);
37382 printf("\n");
37383 }
37384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037385 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037386#endif
37387
Daniel Veillard42595322004-11-08 10:52:06 +000037388 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037389}
37390
37391
37392static int
37393test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037394 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037395
William M. Brack21e4ef22005-01-02 09:53:13 +000037396#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037397 int mem_base;
37398 int ret_val;
37399 int code; /* UCS code point */
37400 int n_code;
37401
37402 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37403 mem_base = xmlMemBlocks();
37404 code = gen_int(n_code, 0);
37405
37406 ret_val = xmlUCSIsGeorgian(code);
37407 desret_int(ret_val);
37408 call_tests++;
37409 des_int(n_code, code, 0);
37410 xmlResetLastError();
37411 if (mem_base != xmlMemBlocks()) {
37412 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037414 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037415 printf(" %d", n_code);
37416 printf("\n");
37417 }
37418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037419 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037420#endif
37421
Daniel Veillard42595322004-11-08 10:52:06 +000037422 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037423}
37424
37425
37426static int
37427test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037428 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037429
William M. Brack21e4ef22005-01-02 09:53:13 +000037430#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037431 int mem_base;
37432 int ret_val;
37433 int code; /* UCS code point */
37434 int n_code;
37435
37436 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37437 mem_base = xmlMemBlocks();
37438 code = gen_int(n_code, 0);
37439
37440 ret_val = xmlUCSIsGothic(code);
37441 desret_int(ret_val);
37442 call_tests++;
37443 des_int(n_code, code, 0);
37444 xmlResetLastError();
37445 if (mem_base != xmlMemBlocks()) {
37446 printf("Leak of %d blocks found in xmlUCSIsGothic",
37447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037448 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037449 printf(" %d", n_code);
37450 printf("\n");
37451 }
37452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037453 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037454#endif
37455
Daniel Veillard42595322004-11-08 10:52:06 +000037456 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037457}
37458
37459
37460static int
37461test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037462 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037463
William M. Brack21e4ef22005-01-02 09:53:13 +000037464#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037465 int mem_base;
37466 int ret_val;
37467 int code; /* UCS code point */
37468 int n_code;
37469
37470 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37471 mem_base = xmlMemBlocks();
37472 code = gen_int(n_code, 0);
37473
37474 ret_val = xmlUCSIsGreek(code);
37475 desret_int(ret_val);
37476 call_tests++;
37477 des_int(n_code, code, 0);
37478 xmlResetLastError();
37479 if (mem_base != xmlMemBlocks()) {
37480 printf("Leak of %d blocks found in xmlUCSIsGreek",
37481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037482 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037483 printf(" %d", n_code);
37484 printf("\n");
37485 }
37486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037487 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037488#endif
37489
Daniel Veillard42595322004-11-08 10:52:06 +000037490 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037491}
37492
37493
37494static int
37495test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037496 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037497
William M. Brack21e4ef22005-01-02 09:53:13 +000037498#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037499 int mem_base;
37500 int ret_val;
37501 int code; /* UCS code point */
37502 int n_code;
37503
37504 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37505 mem_base = xmlMemBlocks();
37506 code = gen_int(n_code, 0);
37507
37508 ret_val = xmlUCSIsGreekExtended(code);
37509 desret_int(ret_val);
37510 call_tests++;
37511 des_int(n_code, code, 0);
37512 xmlResetLastError();
37513 if (mem_base != xmlMemBlocks()) {
37514 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037516 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037517 printf(" %d", n_code);
37518 printf("\n");
37519 }
37520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037521 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037522#endif
37523
Daniel Veillard42595322004-11-08 10:52:06 +000037524 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037525}
37526
37527
37528static int
37529test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037530 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037531
William M. Brack21e4ef22005-01-02 09:53:13 +000037532#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037533 int mem_base;
37534 int ret_val;
37535 int code; /* UCS code point */
37536 int n_code;
37537
37538 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37539 mem_base = xmlMemBlocks();
37540 code = gen_int(n_code, 0);
37541
37542 ret_val = xmlUCSIsGreekandCoptic(code);
37543 desret_int(ret_val);
37544 call_tests++;
37545 des_int(n_code, code, 0);
37546 xmlResetLastError();
37547 if (mem_base != xmlMemBlocks()) {
37548 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037550 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037551 printf(" %d", n_code);
37552 printf("\n");
37553 }
37554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037555 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037556#endif
37557
Daniel Veillard42595322004-11-08 10:52:06 +000037558 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037559}
37560
37561
37562static int
37563test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037564 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037565
William M. Brack21e4ef22005-01-02 09:53:13 +000037566#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037567 int mem_base;
37568 int ret_val;
37569 int code; /* UCS code point */
37570 int n_code;
37571
37572 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37573 mem_base = xmlMemBlocks();
37574 code = gen_int(n_code, 0);
37575
37576 ret_val = xmlUCSIsGujarati(code);
37577 desret_int(ret_val);
37578 call_tests++;
37579 des_int(n_code, code, 0);
37580 xmlResetLastError();
37581 if (mem_base != xmlMemBlocks()) {
37582 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037584 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037585 printf(" %d", n_code);
37586 printf("\n");
37587 }
37588 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037589 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037590#endif
37591
Daniel Veillard42595322004-11-08 10:52:06 +000037592 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037593}
37594
37595
37596static int
37597test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037598 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037599
William M. Brack21e4ef22005-01-02 09:53:13 +000037600#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037601 int mem_base;
37602 int ret_val;
37603 int code; /* UCS code point */
37604 int n_code;
37605
37606 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37607 mem_base = xmlMemBlocks();
37608 code = gen_int(n_code, 0);
37609
37610 ret_val = xmlUCSIsGurmukhi(code);
37611 desret_int(ret_val);
37612 call_tests++;
37613 des_int(n_code, code, 0);
37614 xmlResetLastError();
37615 if (mem_base != xmlMemBlocks()) {
37616 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037618 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037619 printf(" %d", n_code);
37620 printf("\n");
37621 }
37622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037623 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037624#endif
37625
Daniel Veillard42595322004-11-08 10:52:06 +000037626 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037627}
37628
37629
37630static int
37631test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037632 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037633
William M. Brack21e4ef22005-01-02 09:53:13 +000037634#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037635 int mem_base;
37636 int ret_val;
37637 int code; /* UCS code point */
37638 int n_code;
37639
37640 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37641 mem_base = xmlMemBlocks();
37642 code = gen_int(n_code, 0);
37643
37644 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37645 desret_int(ret_val);
37646 call_tests++;
37647 des_int(n_code, code, 0);
37648 xmlResetLastError();
37649 if (mem_base != xmlMemBlocks()) {
37650 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037652 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037653 printf(" %d", n_code);
37654 printf("\n");
37655 }
37656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037657 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037658#endif
37659
Daniel Veillard42595322004-11-08 10:52:06 +000037660 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037661}
37662
37663
37664static int
37665test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037666 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037667
William M. Brack21e4ef22005-01-02 09:53:13 +000037668#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037669 int mem_base;
37670 int ret_val;
37671 int code; /* UCS code point */
37672 int n_code;
37673
37674 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37675 mem_base = xmlMemBlocks();
37676 code = gen_int(n_code, 0);
37677
37678 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37679 desret_int(ret_val);
37680 call_tests++;
37681 des_int(n_code, code, 0);
37682 xmlResetLastError();
37683 if (mem_base != xmlMemBlocks()) {
37684 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037686 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037687 printf(" %d", n_code);
37688 printf("\n");
37689 }
37690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037691 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037692#endif
37693
Daniel Veillard42595322004-11-08 10:52:06 +000037694 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037695}
37696
37697
37698static int
37699test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037700 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037701
William M. Brack21e4ef22005-01-02 09:53:13 +000037702#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037703 int mem_base;
37704 int ret_val;
37705 int code; /* UCS code point */
37706 int n_code;
37707
37708 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37709 mem_base = xmlMemBlocks();
37710 code = gen_int(n_code, 0);
37711
37712 ret_val = xmlUCSIsHangulJamo(code);
37713 desret_int(ret_val);
37714 call_tests++;
37715 des_int(n_code, code, 0);
37716 xmlResetLastError();
37717 if (mem_base != xmlMemBlocks()) {
37718 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037720 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037721 printf(" %d", n_code);
37722 printf("\n");
37723 }
37724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037725 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037726#endif
37727
Daniel Veillard42595322004-11-08 10:52:06 +000037728 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037729}
37730
37731
37732static int
37733test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037734 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037735
William M. Brack21e4ef22005-01-02 09:53:13 +000037736#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037737 int mem_base;
37738 int ret_val;
37739 int code; /* UCS code point */
37740 int n_code;
37741
37742 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37743 mem_base = xmlMemBlocks();
37744 code = gen_int(n_code, 0);
37745
37746 ret_val = xmlUCSIsHangulSyllables(code);
37747 desret_int(ret_val);
37748 call_tests++;
37749 des_int(n_code, code, 0);
37750 xmlResetLastError();
37751 if (mem_base != xmlMemBlocks()) {
37752 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037754 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037755 printf(" %d", n_code);
37756 printf("\n");
37757 }
37758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037759 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037760#endif
37761
Daniel Veillard42595322004-11-08 10:52:06 +000037762 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037763}
37764
37765
37766static int
37767test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037768 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037769
William M. Brack21e4ef22005-01-02 09:53:13 +000037770#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037771 int mem_base;
37772 int ret_val;
37773 int code; /* UCS code point */
37774 int n_code;
37775
37776 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37777 mem_base = xmlMemBlocks();
37778 code = gen_int(n_code, 0);
37779
37780 ret_val = xmlUCSIsHanunoo(code);
37781 desret_int(ret_val);
37782 call_tests++;
37783 des_int(n_code, code, 0);
37784 xmlResetLastError();
37785 if (mem_base != xmlMemBlocks()) {
37786 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037788 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037789 printf(" %d", n_code);
37790 printf("\n");
37791 }
37792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037793 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037794#endif
37795
Daniel Veillard42595322004-11-08 10:52:06 +000037796 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037797}
37798
37799
37800static int
37801test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037802 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037803
William M. Brack21e4ef22005-01-02 09:53:13 +000037804#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037805 int mem_base;
37806 int ret_val;
37807 int code; /* UCS code point */
37808 int n_code;
37809
37810 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37811 mem_base = xmlMemBlocks();
37812 code = gen_int(n_code, 0);
37813
37814 ret_val = xmlUCSIsHebrew(code);
37815 desret_int(ret_val);
37816 call_tests++;
37817 des_int(n_code, code, 0);
37818 xmlResetLastError();
37819 if (mem_base != xmlMemBlocks()) {
37820 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037822 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037823 printf(" %d", n_code);
37824 printf("\n");
37825 }
37826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037827 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037828#endif
37829
Daniel Veillard42595322004-11-08 10:52:06 +000037830 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037831}
37832
37833
37834static int
37835test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037836 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037837
William M. Brack21e4ef22005-01-02 09:53:13 +000037838#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037839 int mem_base;
37840 int ret_val;
37841 int code; /* UCS code point */
37842 int n_code;
37843
37844 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37845 mem_base = xmlMemBlocks();
37846 code = gen_int(n_code, 0);
37847
37848 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37849 desret_int(ret_val);
37850 call_tests++;
37851 des_int(n_code, code, 0);
37852 xmlResetLastError();
37853 if (mem_base != xmlMemBlocks()) {
37854 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037856 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037857 printf(" %d", n_code);
37858 printf("\n");
37859 }
37860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037861 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037862#endif
37863
Daniel Veillard42595322004-11-08 10:52:06 +000037864 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037865}
37866
37867
37868static int
37869test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037870 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037871
William M. Brack21e4ef22005-01-02 09:53:13 +000037872#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037873 int mem_base;
37874 int ret_val;
37875 int code; /* UCS code point */
37876 int n_code;
37877
37878 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37879 mem_base = xmlMemBlocks();
37880 code = gen_int(n_code, 0);
37881
37882 ret_val = xmlUCSIsHighSurrogates(code);
37883 desret_int(ret_val);
37884 call_tests++;
37885 des_int(n_code, code, 0);
37886 xmlResetLastError();
37887 if (mem_base != xmlMemBlocks()) {
37888 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037890 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037891 printf(" %d", n_code);
37892 printf("\n");
37893 }
37894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037895 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037896#endif
37897
Daniel Veillard42595322004-11-08 10:52:06 +000037898 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037899}
37900
37901
37902static int
37903test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037904 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037905
William M. Brack21e4ef22005-01-02 09:53:13 +000037906#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037907 int mem_base;
37908 int ret_val;
37909 int code; /* UCS code point */
37910 int n_code;
37911
37912 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37913 mem_base = xmlMemBlocks();
37914 code = gen_int(n_code, 0);
37915
37916 ret_val = xmlUCSIsHiragana(code);
37917 desret_int(ret_val);
37918 call_tests++;
37919 des_int(n_code, code, 0);
37920 xmlResetLastError();
37921 if (mem_base != xmlMemBlocks()) {
37922 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037924 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037925 printf(" %d", n_code);
37926 printf("\n");
37927 }
37928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037929 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037930#endif
37931
Daniel Veillard42595322004-11-08 10:52:06 +000037932 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037933}
37934
37935
37936static int
37937test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037938 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037939
William M. Brack21e4ef22005-01-02 09:53:13 +000037940#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037941 int mem_base;
37942 int ret_val;
37943 int code; /* UCS code point */
37944 int n_code;
37945
37946 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37947 mem_base = xmlMemBlocks();
37948 code = gen_int(n_code, 0);
37949
37950 ret_val = xmlUCSIsIPAExtensions(code);
37951 desret_int(ret_val);
37952 call_tests++;
37953 des_int(n_code, code, 0);
37954 xmlResetLastError();
37955 if (mem_base != xmlMemBlocks()) {
37956 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037958 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037959 printf(" %d", n_code);
37960 printf("\n");
37961 }
37962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037963 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037964#endif
37965
Daniel Veillard42595322004-11-08 10:52:06 +000037966 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037967}
37968
37969
37970static int
37971test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037972 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037973
William M. Brack21e4ef22005-01-02 09:53:13 +000037974#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037975 int mem_base;
37976 int ret_val;
37977 int code; /* UCS code point */
37978 int n_code;
37979
37980 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37981 mem_base = xmlMemBlocks();
37982 code = gen_int(n_code, 0);
37983
37984 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37985 desret_int(ret_val);
37986 call_tests++;
37987 des_int(n_code, code, 0);
37988 xmlResetLastError();
37989 if (mem_base != xmlMemBlocks()) {
37990 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037992 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037993 printf(" %d", n_code);
37994 printf("\n");
37995 }
37996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037997 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037998#endif
37999
Daniel Veillard42595322004-11-08 10:52:06 +000038000 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038001}
38002
38003
38004static int
38005test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038006 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038007
William M. Brack21e4ef22005-01-02 09:53:13 +000038008#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038009 int mem_base;
38010 int ret_val;
38011 int code; /* UCS code point */
38012 int n_code;
38013
38014 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38015 mem_base = xmlMemBlocks();
38016 code = gen_int(n_code, 0);
38017
38018 ret_val = xmlUCSIsKanbun(code);
38019 desret_int(ret_val);
38020 call_tests++;
38021 des_int(n_code, code, 0);
38022 xmlResetLastError();
38023 if (mem_base != xmlMemBlocks()) {
38024 printf("Leak of %d blocks found in xmlUCSIsKanbun",
38025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038026 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038027 printf(" %d", n_code);
38028 printf("\n");
38029 }
38030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038031 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038032#endif
38033
Daniel Veillard42595322004-11-08 10:52:06 +000038034 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038035}
38036
38037
38038static int
38039test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038040 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038041
William M. Brack21e4ef22005-01-02 09:53:13 +000038042#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038043 int mem_base;
38044 int ret_val;
38045 int code; /* UCS code point */
38046 int n_code;
38047
38048 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38049 mem_base = xmlMemBlocks();
38050 code = gen_int(n_code, 0);
38051
38052 ret_val = xmlUCSIsKangxiRadicals(code);
38053 desret_int(ret_val);
38054 call_tests++;
38055 des_int(n_code, code, 0);
38056 xmlResetLastError();
38057 if (mem_base != xmlMemBlocks()) {
38058 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
38059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038060 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038061 printf(" %d", n_code);
38062 printf("\n");
38063 }
38064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038065 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038066#endif
38067
Daniel Veillard42595322004-11-08 10:52:06 +000038068 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038069}
38070
38071
38072static int
38073test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038074 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038075
William M. Brack21e4ef22005-01-02 09:53:13 +000038076#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038077 int mem_base;
38078 int ret_val;
38079 int code; /* UCS code point */
38080 int n_code;
38081
38082 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38083 mem_base = xmlMemBlocks();
38084 code = gen_int(n_code, 0);
38085
38086 ret_val = xmlUCSIsKannada(code);
38087 desret_int(ret_val);
38088 call_tests++;
38089 des_int(n_code, code, 0);
38090 xmlResetLastError();
38091 if (mem_base != xmlMemBlocks()) {
38092 printf("Leak of %d blocks found in xmlUCSIsKannada",
38093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038094 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038095 printf(" %d", n_code);
38096 printf("\n");
38097 }
38098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038099 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038100#endif
38101
Daniel Veillard42595322004-11-08 10:52:06 +000038102 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038103}
38104
38105
38106static int
38107test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038108 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038109
William M. Brack21e4ef22005-01-02 09:53:13 +000038110#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038111 int mem_base;
38112 int ret_val;
38113 int code; /* UCS code point */
38114 int n_code;
38115
38116 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38117 mem_base = xmlMemBlocks();
38118 code = gen_int(n_code, 0);
38119
38120 ret_val = xmlUCSIsKatakana(code);
38121 desret_int(ret_val);
38122 call_tests++;
38123 des_int(n_code, code, 0);
38124 xmlResetLastError();
38125 if (mem_base != xmlMemBlocks()) {
38126 printf("Leak of %d blocks found in xmlUCSIsKatakana",
38127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038128 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038129 printf(" %d", n_code);
38130 printf("\n");
38131 }
38132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038133 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038134#endif
38135
Daniel Veillard42595322004-11-08 10:52:06 +000038136 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038137}
38138
38139
38140static int
38141test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038142 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038143
William M. Brack21e4ef22005-01-02 09:53:13 +000038144#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038145 int mem_base;
38146 int ret_val;
38147 int code; /* UCS code point */
38148 int n_code;
38149
38150 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38151 mem_base = xmlMemBlocks();
38152 code = gen_int(n_code, 0);
38153
38154 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
38155 desret_int(ret_val);
38156 call_tests++;
38157 des_int(n_code, code, 0);
38158 xmlResetLastError();
38159 if (mem_base != xmlMemBlocks()) {
38160 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
38161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038162 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038163 printf(" %d", n_code);
38164 printf("\n");
38165 }
38166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038167 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038168#endif
38169
Daniel Veillard42595322004-11-08 10:52:06 +000038170 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038171}
38172
38173
38174static int
38175test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038176 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038177
William M. Brack21e4ef22005-01-02 09:53:13 +000038178#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038179 int mem_base;
38180 int ret_val;
38181 int code; /* UCS code point */
38182 int n_code;
38183
38184 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38185 mem_base = xmlMemBlocks();
38186 code = gen_int(n_code, 0);
38187
38188 ret_val = xmlUCSIsKhmer(code);
38189 desret_int(ret_val);
38190 call_tests++;
38191 des_int(n_code, code, 0);
38192 xmlResetLastError();
38193 if (mem_base != xmlMemBlocks()) {
38194 printf("Leak of %d blocks found in xmlUCSIsKhmer",
38195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038196 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038197 printf(" %d", n_code);
38198 printf("\n");
38199 }
38200 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038201 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038202#endif
38203
Daniel Veillard42595322004-11-08 10:52:06 +000038204 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038205}
38206
38207
38208static int
38209test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038210 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038211
William M. Brack21e4ef22005-01-02 09:53:13 +000038212#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038213 int mem_base;
38214 int ret_val;
38215 int code; /* UCS code point */
38216 int n_code;
38217
38218 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38219 mem_base = xmlMemBlocks();
38220 code = gen_int(n_code, 0);
38221
38222 ret_val = xmlUCSIsKhmerSymbols(code);
38223 desret_int(ret_val);
38224 call_tests++;
38225 des_int(n_code, code, 0);
38226 xmlResetLastError();
38227 if (mem_base != xmlMemBlocks()) {
38228 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
38229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038230 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038231 printf(" %d", n_code);
38232 printf("\n");
38233 }
38234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038235 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038236#endif
38237
Daniel Veillard42595322004-11-08 10:52:06 +000038238 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038239}
38240
38241
38242static int
38243test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038244 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038245
William M. Brack21e4ef22005-01-02 09:53:13 +000038246#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038247 int mem_base;
38248 int ret_val;
38249 int code; /* UCS code point */
38250 int n_code;
38251
38252 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38253 mem_base = xmlMemBlocks();
38254 code = gen_int(n_code, 0);
38255
38256 ret_val = xmlUCSIsLao(code);
38257 desret_int(ret_val);
38258 call_tests++;
38259 des_int(n_code, code, 0);
38260 xmlResetLastError();
38261 if (mem_base != xmlMemBlocks()) {
38262 printf("Leak of %d blocks found in xmlUCSIsLao",
38263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038264 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038265 printf(" %d", n_code);
38266 printf("\n");
38267 }
38268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038269 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038270#endif
38271
Daniel Veillard42595322004-11-08 10:52:06 +000038272 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038273}
38274
38275
38276static int
38277test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038278 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038279
William M. Brack21e4ef22005-01-02 09:53:13 +000038280#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038281 int mem_base;
38282 int ret_val;
38283 int code; /* UCS code point */
38284 int n_code;
38285
38286 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38287 mem_base = xmlMemBlocks();
38288 code = gen_int(n_code, 0);
38289
38290 ret_val = xmlUCSIsLatin1Supplement(code);
38291 desret_int(ret_val);
38292 call_tests++;
38293 des_int(n_code, code, 0);
38294 xmlResetLastError();
38295 if (mem_base != xmlMemBlocks()) {
38296 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038298 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038299 printf(" %d", n_code);
38300 printf("\n");
38301 }
38302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038303 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038304#endif
38305
Daniel Veillard42595322004-11-08 10:52:06 +000038306 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038307}
38308
38309
38310static int
38311test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038312 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038313
William M. Brack21e4ef22005-01-02 09:53:13 +000038314#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038315 int mem_base;
38316 int ret_val;
38317 int code; /* UCS code point */
38318 int n_code;
38319
38320 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38321 mem_base = xmlMemBlocks();
38322 code = gen_int(n_code, 0);
38323
38324 ret_val = xmlUCSIsLatinExtendedA(code);
38325 desret_int(ret_val);
38326 call_tests++;
38327 des_int(n_code, code, 0);
38328 xmlResetLastError();
38329 if (mem_base != xmlMemBlocks()) {
38330 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038332 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038333 printf(" %d", n_code);
38334 printf("\n");
38335 }
38336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038337 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038338#endif
38339
Daniel Veillard42595322004-11-08 10:52:06 +000038340 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038341}
38342
38343
38344static int
38345test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038346 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038347
William M. Brack21e4ef22005-01-02 09:53:13 +000038348#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038349 int mem_base;
38350 int ret_val;
38351 int code; /* UCS code point */
38352 int n_code;
38353
38354 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38355 mem_base = xmlMemBlocks();
38356 code = gen_int(n_code, 0);
38357
38358 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38359 desret_int(ret_val);
38360 call_tests++;
38361 des_int(n_code, code, 0);
38362 xmlResetLastError();
38363 if (mem_base != xmlMemBlocks()) {
38364 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038366 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038367 printf(" %d", n_code);
38368 printf("\n");
38369 }
38370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038371 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038372#endif
38373
Daniel Veillard42595322004-11-08 10:52:06 +000038374 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038375}
38376
38377
38378static int
38379test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038380 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038381
William M. Brack21e4ef22005-01-02 09:53:13 +000038382#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038383 int mem_base;
38384 int ret_val;
38385 int code; /* UCS code point */
38386 int n_code;
38387
38388 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38389 mem_base = xmlMemBlocks();
38390 code = gen_int(n_code, 0);
38391
38392 ret_val = xmlUCSIsLatinExtendedB(code);
38393 desret_int(ret_val);
38394 call_tests++;
38395 des_int(n_code, code, 0);
38396 xmlResetLastError();
38397 if (mem_base != xmlMemBlocks()) {
38398 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038400 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038401 printf(" %d", n_code);
38402 printf("\n");
38403 }
38404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038405 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038406#endif
38407
Daniel Veillard42595322004-11-08 10:52:06 +000038408 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038409}
38410
38411
38412static int
38413test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038414 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038415
William M. Brack21e4ef22005-01-02 09:53:13 +000038416#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038417 int mem_base;
38418 int ret_val;
38419 int code; /* UCS code point */
38420 int n_code;
38421
38422 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38423 mem_base = xmlMemBlocks();
38424 code = gen_int(n_code, 0);
38425
38426 ret_val = xmlUCSIsLetterlikeSymbols(code);
38427 desret_int(ret_val);
38428 call_tests++;
38429 des_int(n_code, code, 0);
38430 xmlResetLastError();
38431 if (mem_base != xmlMemBlocks()) {
38432 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038434 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038435 printf(" %d", n_code);
38436 printf("\n");
38437 }
38438 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038439 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038440#endif
38441
Daniel Veillard42595322004-11-08 10:52:06 +000038442 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038443}
38444
38445
38446static int
38447test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038448 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038449
William M. Brack21e4ef22005-01-02 09:53:13 +000038450#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038451 int mem_base;
38452 int ret_val;
38453 int code; /* UCS code point */
38454 int n_code;
38455
38456 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38457 mem_base = xmlMemBlocks();
38458 code = gen_int(n_code, 0);
38459
38460 ret_val = xmlUCSIsLimbu(code);
38461 desret_int(ret_val);
38462 call_tests++;
38463 des_int(n_code, code, 0);
38464 xmlResetLastError();
38465 if (mem_base != xmlMemBlocks()) {
38466 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038468 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038469 printf(" %d", n_code);
38470 printf("\n");
38471 }
38472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038473 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038474#endif
38475
Daniel Veillard42595322004-11-08 10:52:06 +000038476 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038477}
38478
38479
38480static int
38481test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038482 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038483
William M. Brack21e4ef22005-01-02 09:53:13 +000038484#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038485 int mem_base;
38486 int ret_val;
38487 int code; /* UCS code point */
38488 int n_code;
38489
38490 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38491 mem_base = xmlMemBlocks();
38492 code = gen_int(n_code, 0);
38493
38494 ret_val = xmlUCSIsLinearBIdeograms(code);
38495 desret_int(ret_val);
38496 call_tests++;
38497 des_int(n_code, code, 0);
38498 xmlResetLastError();
38499 if (mem_base != xmlMemBlocks()) {
38500 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038502 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038503 printf(" %d", n_code);
38504 printf("\n");
38505 }
38506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038507 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038508#endif
38509
Daniel Veillard42595322004-11-08 10:52:06 +000038510 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038511}
38512
38513
38514static int
38515test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038516 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038517
William M. Brack21e4ef22005-01-02 09:53:13 +000038518#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038519 int mem_base;
38520 int ret_val;
38521 int code; /* UCS code point */
38522 int n_code;
38523
38524 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38525 mem_base = xmlMemBlocks();
38526 code = gen_int(n_code, 0);
38527
38528 ret_val = xmlUCSIsLinearBSyllabary(code);
38529 desret_int(ret_val);
38530 call_tests++;
38531 des_int(n_code, code, 0);
38532 xmlResetLastError();
38533 if (mem_base != xmlMemBlocks()) {
38534 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038536 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038537 printf(" %d", n_code);
38538 printf("\n");
38539 }
38540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038541 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038542#endif
38543
Daniel Veillard42595322004-11-08 10:52:06 +000038544 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038545}
38546
38547
38548static int
38549test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038550 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038551
William M. Brack21e4ef22005-01-02 09:53:13 +000038552#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038553 int mem_base;
38554 int ret_val;
38555 int code; /* UCS code point */
38556 int n_code;
38557
38558 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38559 mem_base = xmlMemBlocks();
38560 code = gen_int(n_code, 0);
38561
38562 ret_val = xmlUCSIsLowSurrogates(code);
38563 desret_int(ret_val);
38564 call_tests++;
38565 des_int(n_code, code, 0);
38566 xmlResetLastError();
38567 if (mem_base != xmlMemBlocks()) {
38568 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038570 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038571 printf(" %d", n_code);
38572 printf("\n");
38573 }
38574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038575 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038576#endif
38577
Daniel Veillard42595322004-11-08 10:52:06 +000038578 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038579}
38580
38581
38582static int
38583test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038584 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038585
William M. Brack21e4ef22005-01-02 09:53:13 +000038586#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038587 int mem_base;
38588 int ret_val;
38589 int code; /* UCS code point */
38590 int n_code;
38591
38592 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38593 mem_base = xmlMemBlocks();
38594 code = gen_int(n_code, 0);
38595
38596 ret_val = xmlUCSIsMalayalam(code);
38597 desret_int(ret_val);
38598 call_tests++;
38599 des_int(n_code, code, 0);
38600 xmlResetLastError();
38601 if (mem_base != xmlMemBlocks()) {
38602 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038604 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038605 printf(" %d", n_code);
38606 printf("\n");
38607 }
38608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038609 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038610#endif
38611
Daniel Veillard42595322004-11-08 10:52:06 +000038612 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038613}
38614
38615
38616static int
38617test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038618 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038619
William M. Brack21e4ef22005-01-02 09:53:13 +000038620#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038621 int mem_base;
38622 int ret_val;
38623 int code; /* UCS code point */
38624 int n_code;
38625
38626 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38627 mem_base = xmlMemBlocks();
38628 code = gen_int(n_code, 0);
38629
38630 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38631 desret_int(ret_val);
38632 call_tests++;
38633 des_int(n_code, code, 0);
38634 xmlResetLastError();
38635 if (mem_base != xmlMemBlocks()) {
38636 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038638 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038639 printf(" %d", n_code);
38640 printf("\n");
38641 }
38642 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038643 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038644#endif
38645
Daniel Veillard42595322004-11-08 10:52:06 +000038646 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038647}
38648
38649
38650static int
38651test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038652 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038653
William M. Brack21e4ef22005-01-02 09:53:13 +000038654#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038655 int mem_base;
38656 int ret_val;
38657 int code; /* UCS code point */
38658 int n_code;
38659
38660 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38661 mem_base = xmlMemBlocks();
38662 code = gen_int(n_code, 0);
38663
38664 ret_val = xmlUCSIsMathematicalOperators(code);
38665 desret_int(ret_val);
38666 call_tests++;
38667 des_int(n_code, code, 0);
38668 xmlResetLastError();
38669 if (mem_base != xmlMemBlocks()) {
38670 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038672 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038673 printf(" %d", n_code);
38674 printf("\n");
38675 }
38676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038677 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038678#endif
38679
Daniel Veillard42595322004-11-08 10:52:06 +000038680 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038681}
38682
38683
38684static int
38685test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038686 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038687
William M. Brack21e4ef22005-01-02 09:53:13 +000038688#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038689 int mem_base;
38690 int ret_val;
38691 int code; /* UCS code point */
38692 int n_code;
38693
38694 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38695 mem_base = xmlMemBlocks();
38696 code = gen_int(n_code, 0);
38697
38698 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38699 desret_int(ret_val);
38700 call_tests++;
38701 des_int(n_code, code, 0);
38702 xmlResetLastError();
38703 if (mem_base != xmlMemBlocks()) {
38704 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038706 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038707 printf(" %d", n_code);
38708 printf("\n");
38709 }
38710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038711 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038712#endif
38713
Daniel Veillard42595322004-11-08 10:52:06 +000038714 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038715}
38716
38717
38718static int
38719test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038720 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038721
William M. Brack21e4ef22005-01-02 09:53:13 +000038722#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038723 int mem_base;
38724 int ret_val;
38725 int code; /* UCS code point */
38726 int n_code;
38727
38728 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38729 mem_base = xmlMemBlocks();
38730 code = gen_int(n_code, 0);
38731
38732 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38733 desret_int(ret_val);
38734 call_tests++;
38735 des_int(n_code, code, 0);
38736 xmlResetLastError();
38737 if (mem_base != xmlMemBlocks()) {
38738 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038740 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038741 printf(" %d", n_code);
38742 printf("\n");
38743 }
38744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038745 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038746#endif
38747
Daniel Veillard42595322004-11-08 10:52:06 +000038748 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038749}
38750
38751
38752static int
38753test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038754 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038755
William M. Brack21e4ef22005-01-02 09:53:13 +000038756#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038757 int mem_base;
38758 int ret_val;
38759 int code; /* UCS code point */
38760 int n_code;
38761
38762 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38763 mem_base = xmlMemBlocks();
38764 code = gen_int(n_code, 0);
38765
38766 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38767 desret_int(ret_val);
38768 call_tests++;
38769 des_int(n_code, code, 0);
38770 xmlResetLastError();
38771 if (mem_base != xmlMemBlocks()) {
38772 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038774 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038775 printf(" %d", n_code);
38776 printf("\n");
38777 }
38778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038779 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038780#endif
38781
Daniel Veillard42595322004-11-08 10:52:06 +000038782 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038783}
38784
38785
38786static int
38787test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038788 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038789
William M. Brack21e4ef22005-01-02 09:53:13 +000038790#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038791 int mem_base;
38792 int ret_val;
38793 int code; /* UCS code point */
38794 int n_code;
38795
38796 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38797 mem_base = xmlMemBlocks();
38798 code = gen_int(n_code, 0);
38799
38800 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38801 desret_int(ret_val);
38802 call_tests++;
38803 des_int(n_code, code, 0);
38804 xmlResetLastError();
38805 if (mem_base != xmlMemBlocks()) {
38806 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038808 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038809 printf(" %d", n_code);
38810 printf("\n");
38811 }
38812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038813 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038814#endif
38815
Daniel Veillard42595322004-11-08 10:52:06 +000038816 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038817}
38818
38819
38820static int
38821test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038822 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038823
William M. Brack21e4ef22005-01-02 09:53:13 +000038824#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038825 int mem_base;
38826 int ret_val;
38827 int code; /* UCS code point */
38828 int n_code;
38829
38830 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38831 mem_base = xmlMemBlocks();
38832 code = gen_int(n_code, 0);
38833
38834 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38835 desret_int(ret_val);
38836 call_tests++;
38837 des_int(n_code, code, 0);
38838 xmlResetLastError();
38839 if (mem_base != xmlMemBlocks()) {
38840 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038842 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038843 printf(" %d", n_code);
38844 printf("\n");
38845 }
38846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038847 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038848#endif
38849
Daniel Veillard42595322004-11-08 10:52:06 +000038850 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038851}
38852
38853
38854static int
38855test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038856 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038857
William M. Brack21e4ef22005-01-02 09:53:13 +000038858#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038859 int mem_base;
38860 int ret_val;
38861 int code; /* UCS code point */
38862 int n_code;
38863
38864 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38865 mem_base = xmlMemBlocks();
38866 code = gen_int(n_code, 0);
38867
38868 ret_val = xmlUCSIsMongolian(code);
38869 desret_int(ret_val);
38870 call_tests++;
38871 des_int(n_code, code, 0);
38872 xmlResetLastError();
38873 if (mem_base != xmlMemBlocks()) {
38874 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038876 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038877 printf(" %d", n_code);
38878 printf("\n");
38879 }
38880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038881 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038882#endif
38883
Daniel Veillard42595322004-11-08 10:52:06 +000038884 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038885}
38886
38887
38888static int
38889test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038890 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038891
William M. Brack21e4ef22005-01-02 09:53:13 +000038892#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038893 int mem_base;
38894 int ret_val;
38895 int code; /* UCS code point */
38896 int n_code;
38897
38898 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38899 mem_base = xmlMemBlocks();
38900 code = gen_int(n_code, 0);
38901
38902 ret_val = xmlUCSIsMusicalSymbols(code);
38903 desret_int(ret_val);
38904 call_tests++;
38905 des_int(n_code, code, 0);
38906 xmlResetLastError();
38907 if (mem_base != xmlMemBlocks()) {
38908 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038910 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038911 printf(" %d", n_code);
38912 printf("\n");
38913 }
38914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038915 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038916#endif
38917
Daniel Veillard42595322004-11-08 10:52:06 +000038918 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038919}
38920
38921
38922static int
38923test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038924 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038925
William M. Brack21e4ef22005-01-02 09:53:13 +000038926#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038927 int mem_base;
38928 int ret_val;
38929 int code; /* UCS code point */
38930 int n_code;
38931
38932 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38933 mem_base = xmlMemBlocks();
38934 code = gen_int(n_code, 0);
38935
38936 ret_val = xmlUCSIsMyanmar(code);
38937 desret_int(ret_val);
38938 call_tests++;
38939 des_int(n_code, code, 0);
38940 xmlResetLastError();
38941 if (mem_base != xmlMemBlocks()) {
38942 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038944 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038945 printf(" %d", n_code);
38946 printf("\n");
38947 }
38948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038949 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038950#endif
38951
Daniel Veillard42595322004-11-08 10:52:06 +000038952 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038953}
38954
38955
38956static int
38957test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038958 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038959
William M. Brack21e4ef22005-01-02 09:53:13 +000038960#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038961 int mem_base;
38962 int ret_val;
38963 int code; /* UCS code point */
38964 int n_code;
38965
38966 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38967 mem_base = xmlMemBlocks();
38968 code = gen_int(n_code, 0);
38969
38970 ret_val = xmlUCSIsNumberForms(code);
38971 desret_int(ret_val);
38972 call_tests++;
38973 des_int(n_code, code, 0);
38974 xmlResetLastError();
38975 if (mem_base != xmlMemBlocks()) {
38976 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038978 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038979 printf(" %d", n_code);
38980 printf("\n");
38981 }
38982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038983 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038984#endif
38985
Daniel Veillard42595322004-11-08 10:52:06 +000038986 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038987}
38988
38989
38990static int
38991test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038992 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038993
William M. Brack21e4ef22005-01-02 09:53:13 +000038994#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038995 int mem_base;
38996 int ret_val;
38997 int code; /* UCS code point */
38998 int n_code;
38999
39000 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39001 mem_base = xmlMemBlocks();
39002 code = gen_int(n_code, 0);
39003
39004 ret_val = xmlUCSIsOgham(code);
39005 desret_int(ret_val);
39006 call_tests++;
39007 des_int(n_code, code, 0);
39008 xmlResetLastError();
39009 if (mem_base != xmlMemBlocks()) {
39010 printf("Leak of %d blocks found in xmlUCSIsOgham",
39011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039012 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039013 printf(" %d", n_code);
39014 printf("\n");
39015 }
39016 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039017 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039018#endif
39019
Daniel Veillard42595322004-11-08 10:52:06 +000039020 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039021}
39022
39023
39024static int
39025test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039026 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039027
William M. Brack21e4ef22005-01-02 09:53:13 +000039028#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039029 int mem_base;
39030 int ret_val;
39031 int code; /* UCS code point */
39032 int n_code;
39033
39034 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39035 mem_base = xmlMemBlocks();
39036 code = gen_int(n_code, 0);
39037
39038 ret_val = xmlUCSIsOldItalic(code);
39039 desret_int(ret_val);
39040 call_tests++;
39041 des_int(n_code, code, 0);
39042 xmlResetLastError();
39043 if (mem_base != xmlMemBlocks()) {
39044 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
39045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039046 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039047 printf(" %d", n_code);
39048 printf("\n");
39049 }
39050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039051 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039052#endif
39053
Daniel Veillard42595322004-11-08 10:52:06 +000039054 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039055}
39056
39057
39058static int
39059test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039060 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039061
William M. Brack21e4ef22005-01-02 09:53:13 +000039062#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039063 int mem_base;
39064 int ret_val;
39065 int code; /* UCS code point */
39066 int n_code;
39067
39068 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39069 mem_base = xmlMemBlocks();
39070 code = gen_int(n_code, 0);
39071
39072 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
39073 desret_int(ret_val);
39074 call_tests++;
39075 des_int(n_code, code, 0);
39076 xmlResetLastError();
39077 if (mem_base != xmlMemBlocks()) {
39078 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
39079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039080 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039081 printf(" %d", n_code);
39082 printf("\n");
39083 }
39084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039085 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039086#endif
39087
Daniel Veillard42595322004-11-08 10:52:06 +000039088 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039089}
39090
39091
39092static int
39093test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039094 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039095
William M. Brack21e4ef22005-01-02 09:53:13 +000039096#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039097 int mem_base;
39098 int ret_val;
39099 int code; /* UCS code point */
39100 int n_code;
39101
39102 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39103 mem_base = xmlMemBlocks();
39104 code = gen_int(n_code, 0);
39105
39106 ret_val = xmlUCSIsOriya(code);
39107 desret_int(ret_val);
39108 call_tests++;
39109 des_int(n_code, code, 0);
39110 xmlResetLastError();
39111 if (mem_base != xmlMemBlocks()) {
39112 printf("Leak of %d blocks found in xmlUCSIsOriya",
39113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039114 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039115 printf(" %d", n_code);
39116 printf("\n");
39117 }
39118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039119 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039120#endif
39121
Daniel Veillard42595322004-11-08 10:52:06 +000039122 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039123}
39124
39125
39126static int
39127test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039128 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039129
William M. Brack21e4ef22005-01-02 09:53:13 +000039130#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039131 int mem_base;
39132 int ret_val;
39133 int code; /* UCS code point */
39134 int n_code;
39135
39136 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39137 mem_base = xmlMemBlocks();
39138 code = gen_int(n_code, 0);
39139
39140 ret_val = xmlUCSIsOsmanya(code);
39141 desret_int(ret_val);
39142 call_tests++;
39143 des_int(n_code, code, 0);
39144 xmlResetLastError();
39145 if (mem_base != xmlMemBlocks()) {
39146 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
39147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039148 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039149 printf(" %d", n_code);
39150 printf("\n");
39151 }
39152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039153 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039154#endif
39155
Daniel Veillard42595322004-11-08 10:52:06 +000039156 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039157}
39158
39159
39160static int
39161test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039162 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039163
William M. Brack21e4ef22005-01-02 09:53:13 +000039164#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039165 int mem_base;
39166 int ret_val;
39167 int code; /* UCS code point */
39168 int n_code;
39169
39170 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39171 mem_base = xmlMemBlocks();
39172 code = gen_int(n_code, 0);
39173
39174 ret_val = xmlUCSIsPhoneticExtensions(code);
39175 desret_int(ret_val);
39176 call_tests++;
39177 des_int(n_code, code, 0);
39178 xmlResetLastError();
39179 if (mem_base != xmlMemBlocks()) {
39180 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
39181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039182 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039183 printf(" %d", n_code);
39184 printf("\n");
39185 }
39186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039187 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039188#endif
39189
Daniel Veillard42595322004-11-08 10:52:06 +000039190 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039191}
39192
39193
39194static int
39195test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039196 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039197
William M. Brack21e4ef22005-01-02 09:53:13 +000039198#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039199 int mem_base;
39200 int ret_val;
39201 int code; /* UCS code point */
39202 int n_code;
39203
39204 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39205 mem_base = xmlMemBlocks();
39206 code = gen_int(n_code, 0);
39207
39208 ret_val = xmlUCSIsPrivateUse(code);
39209 desret_int(ret_val);
39210 call_tests++;
39211 des_int(n_code, code, 0);
39212 xmlResetLastError();
39213 if (mem_base != xmlMemBlocks()) {
39214 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
39215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039216 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039217 printf(" %d", n_code);
39218 printf("\n");
39219 }
39220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039221 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039222#endif
39223
Daniel Veillard42595322004-11-08 10:52:06 +000039224 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039225}
39226
39227
39228static int
39229test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039230 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039231
William M. Brack21e4ef22005-01-02 09:53:13 +000039232#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039233 int mem_base;
39234 int ret_val;
39235 int code; /* UCS code point */
39236 int n_code;
39237
39238 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39239 mem_base = xmlMemBlocks();
39240 code = gen_int(n_code, 0);
39241
39242 ret_val = xmlUCSIsPrivateUseArea(code);
39243 desret_int(ret_val);
39244 call_tests++;
39245 des_int(n_code, code, 0);
39246 xmlResetLastError();
39247 if (mem_base != xmlMemBlocks()) {
39248 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
39249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039250 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039251 printf(" %d", n_code);
39252 printf("\n");
39253 }
39254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039255 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039256#endif
39257
Daniel Veillard42595322004-11-08 10:52:06 +000039258 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039259}
39260
39261
39262static int
39263test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039264 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039265
William M. Brack21e4ef22005-01-02 09:53:13 +000039266#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039267 int mem_base;
39268 int ret_val;
39269 int code; /* UCS code point */
39270 int n_code;
39271
39272 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39273 mem_base = xmlMemBlocks();
39274 code = gen_int(n_code, 0);
39275
39276 ret_val = xmlUCSIsRunic(code);
39277 desret_int(ret_val);
39278 call_tests++;
39279 des_int(n_code, code, 0);
39280 xmlResetLastError();
39281 if (mem_base != xmlMemBlocks()) {
39282 printf("Leak of %d blocks found in xmlUCSIsRunic",
39283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039284 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039285 printf(" %d", n_code);
39286 printf("\n");
39287 }
39288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039289 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039290#endif
39291
Daniel Veillard42595322004-11-08 10:52:06 +000039292 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039293}
39294
39295
39296static int
39297test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039298 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039299
William M. Brack21e4ef22005-01-02 09:53:13 +000039300#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039301 int mem_base;
39302 int ret_val;
39303 int code; /* UCS code point */
39304 int n_code;
39305
39306 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39307 mem_base = xmlMemBlocks();
39308 code = gen_int(n_code, 0);
39309
39310 ret_val = xmlUCSIsShavian(code);
39311 desret_int(ret_val);
39312 call_tests++;
39313 des_int(n_code, code, 0);
39314 xmlResetLastError();
39315 if (mem_base != xmlMemBlocks()) {
39316 printf("Leak of %d blocks found in xmlUCSIsShavian",
39317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039318 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039319 printf(" %d", n_code);
39320 printf("\n");
39321 }
39322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039323 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039324#endif
39325
Daniel Veillard42595322004-11-08 10:52:06 +000039326 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039327}
39328
39329
39330static int
39331test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039332 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039333
William M. Brack21e4ef22005-01-02 09:53:13 +000039334#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039335 int mem_base;
39336 int ret_val;
39337 int code; /* UCS code point */
39338 int n_code;
39339
39340 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39341 mem_base = xmlMemBlocks();
39342 code = gen_int(n_code, 0);
39343
39344 ret_val = xmlUCSIsSinhala(code);
39345 desret_int(ret_val);
39346 call_tests++;
39347 des_int(n_code, code, 0);
39348 xmlResetLastError();
39349 if (mem_base != xmlMemBlocks()) {
39350 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039352 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039353 printf(" %d", n_code);
39354 printf("\n");
39355 }
39356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039357 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039358#endif
39359
Daniel Veillard42595322004-11-08 10:52:06 +000039360 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039361}
39362
39363
39364static int
39365test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039366 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039367
William M. Brack21e4ef22005-01-02 09:53:13 +000039368#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039369 int mem_base;
39370 int ret_val;
39371 int code; /* UCS code point */
39372 int n_code;
39373
39374 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39375 mem_base = xmlMemBlocks();
39376 code = gen_int(n_code, 0);
39377
39378 ret_val = xmlUCSIsSmallFormVariants(code);
39379 desret_int(ret_val);
39380 call_tests++;
39381 des_int(n_code, code, 0);
39382 xmlResetLastError();
39383 if (mem_base != xmlMemBlocks()) {
39384 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039386 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039387 printf(" %d", n_code);
39388 printf("\n");
39389 }
39390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039391 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039392#endif
39393
Daniel Veillard42595322004-11-08 10:52:06 +000039394 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039395}
39396
39397
39398static int
39399test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039400 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039401
William M. Brack21e4ef22005-01-02 09:53:13 +000039402#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039403 int mem_base;
39404 int ret_val;
39405 int code; /* UCS code point */
39406 int n_code;
39407
39408 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39409 mem_base = xmlMemBlocks();
39410 code = gen_int(n_code, 0);
39411
39412 ret_val = xmlUCSIsSpacingModifierLetters(code);
39413 desret_int(ret_val);
39414 call_tests++;
39415 des_int(n_code, code, 0);
39416 xmlResetLastError();
39417 if (mem_base != xmlMemBlocks()) {
39418 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039420 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039421 printf(" %d", n_code);
39422 printf("\n");
39423 }
39424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039425 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039426#endif
39427
Daniel Veillard42595322004-11-08 10:52:06 +000039428 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039429}
39430
39431
39432static int
39433test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039434 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039435
William M. Brack21e4ef22005-01-02 09:53:13 +000039436#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039437 int mem_base;
39438 int ret_val;
39439 int code; /* UCS code point */
39440 int n_code;
39441
39442 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39443 mem_base = xmlMemBlocks();
39444 code = gen_int(n_code, 0);
39445
39446 ret_val = xmlUCSIsSpecials(code);
39447 desret_int(ret_val);
39448 call_tests++;
39449 des_int(n_code, code, 0);
39450 xmlResetLastError();
39451 if (mem_base != xmlMemBlocks()) {
39452 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039454 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039455 printf(" %d", n_code);
39456 printf("\n");
39457 }
39458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039459 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039460#endif
39461
Daniel Veillard42595322004-11-08 10:52:06 +000039462 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039463}
39464
39465
39466static int
39467test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039468 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039469
William M. Brack21e4ef22005-01-02 09:53:13 +000039470#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039471 int mem_base;
39472 int ret_val;
39473 int code; /* UCS code point */
39474 int n_code;
39475
39476 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39477 mem_base = xmlMemBlocks();
39478 code = gen_int(n_code, 0);
39479
39480 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39481 desret_int(ret_val);
39482 call_tests++;
39483 des_int(n_code, code, 0);
39484 xmlResetLastError();
39485 if (mem_base != xmlMemBlocks()) {
39486 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039488 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039489 printf(" %d", n_code);
39490 printf("\n");
39491 }
39492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039493 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039494#endif
39495
Daniel Veillard42595322004-11-08 10:52:06 +000039496 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039497}
39498
39499
39500static int
39501test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039502 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039503
William M. Brack21e4ef22005-01-02 09:53:13 +000039504#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039505 int mem_base;
39506 int ret_val;
39507 int code; /* UCS code point */
39508 int n_code;
39509
39510 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39511 mem_base = xmlMemBlocks();
39512 code = gen_int(n_code, 0);
39513
39514 ret_val = xmlUCSIsSupplementalArrowsA(code);
39515 desret_int(ret_val);
39516 call_tests++;
39517 des_int(n_code, code, 0);
39518 xmlResetLastError();
39519 if (mem_base != xmlMemBlocks()) {
39520 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039522 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039523 printf(" %d", n_code);
39524 printf("\n");
39525 }
39526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039527 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039528#endif
39529
Daniel Veillard42595322004-11-08 10:52:06 +000039530 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039531}
39532
39533
39534static int
39535test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039536 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039537
William M. Brack21e4ef22005-01-02 09:53:13 +000039538#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039539 int mem_base;
39540 int ret_val;
39541 int code; /* UCS code point */
39542 int n_code;
39543
39544 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39545 mem_base = xmlMemBlocks();
39546 code = gen_int(n_code, 0);
39547
39548 ret_val = xmlUCSIsSupplementalArrowsB(code);
39549 desret_int(ret_val);
39550 call_tests++;
39551 des_int(n_code, code, 0);
39552 xmlResetLastError();
39553 if (mem_base != xmlMemBlocks()) {
39554 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039556 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039557 printf(" %d", n_code);
39558 printf("\n");
39559 }
39560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039561 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039562#endif
39563
Daniel Veillard42595322004-11-08 10:52:06 +000039564 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039565}
39566
39567
39568static int
39569test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039570 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039571
William M. Brack21e4ef22005-01-02 09:53:13 +000039572#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039573 int mem_base;
39574 int ret_val;
39575 int code; /* UCS code point */
39576 int n_code;
39577
39578 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39579 mem_base = xmlMemBlocks();
39580 code = gen_int(n_code, 0);
39581
39582 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39583 desret_int(ret_val);
39584 call_tests++;
39585 des_int(n_code, code, 0);
39586 xmlResetLastError();
39587 if (mem_base != xmlMemBlocks()) {
39588 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039590 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039591 printf(" %d", n_code);
39592 printf("\n");
39593 }
39594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039595 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039596#endif
39597
Daniel Veillard42595322004-11-08 10:52:06 +000039598 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039599}
39600
39601
39602static int
39603test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039604 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039605
William M. Brack21e4ef22005-01-02 09:53:13 +000039606#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039607 int mem_base;
39608 int ret_val;
39609 int code; /* UCS code point */
39610 int n_code;
39611
39612 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39613 mem_base = xmlMemBlocks();
39614 code = gen_int(n_code, 0);
39615
39616 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39617 desret_int(ret_val);
39618 call_tests++;
39619 des_int(n_code, code, 0);
39620 xmlResetLastError();
39621 if (mem_base != xmlMemBlocks()) {
39622 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039624 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039625 printf(" %d", n_code);
39626 printf("\n");
39627 }
39628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039629 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039630#endif
39631
Daniel Veillard42595322004-11-08 10:52:06 +000039632 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039633}
39634
39635
39636static int
39637test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039638 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039639
William M. Brack21e4ef22005-01-02 09:53:13 +000039640#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039641 int mem_base;
39642 int ret_val;
39643 int code; /* UCS code point */
39644 int n_code;
39645
39646 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39647 mem_base = xmlMemBlocks();
39648 code = gen_int(n_code, 0);
39649
39650 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39651 desret_int(ret_val);
39652 call_tests++;
39653 des_int(n_code, code, 0);
39654 xmlResetLastError();
39655 if (mem_base != xmlMemBlocks()) {
39656 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039658 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039659 printf(" %d", n_code);
39660 printf("\n");
39661 }
39662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039663 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039664#endif
39665
Daniel Veillard42595322004-11-08 10:52:06 +000039666 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039667}
39668
39669
39670static int
39671test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039672 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039673
William M. Brack21e4ef22005-01-02 09:53:13 +000039674#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039675 int mem_base;
39676 int ret_val;
39677 int code; /* UCS code point */
39678 int n_code;
39679
39680 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39681 mem_base = xmlMemBlocks();
39682 code = gen_int(n_code, 0);
39683
39684 ret_val = xmlUCSIsSyriac(code);
39685 desret_int(ret_val);
39686 call_tests++;
39687 des_int(n_code, code, 0);
39688 xmlResetLastError();
39689 if (mem_base != xmlMemBlocks()) {
39690 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039692 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039693 printf(" %d", n_code);
39694 printf("\n");
39695 }
39696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039697 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039698#endif
39699
Daniel Veillard42595322004-11-08 10:52:06 +000039700 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039701}
39702
39703
39704static int
39705test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039706 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039707
William M. Brack21e4ef22005-01-02 09:53:13 +000039708#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039709 int mem_base;
39710 int ret_val;
39711 int code; /* UCS code point */
39712 int n_code;
39713
39714 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39715 mem_base = xmlMemBlocks();
39716 code = gen_int(n_code, 0);
39717
39718 ret_val = xmlUCSIsTagalog(code);
39719 desret_int(ret_val);
39720 call_tests++;
39721 des_int(n_code, code, 0);
39722 xmlResetLastError();
39723 if (mem_base != xmlMemBlocks()) {
39724 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039726 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039727 printf(" %d", n_code);
39728 printf("\n");
39729 }
39730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039731 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039732#endif
39733
Daniel Veillard42595322004-11-08 10:52:06 +000039734 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039735}
39736
39737
39738static int
39739test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039740 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039741
William M. Brack21e4ef22005-01-02 09:53:13 +000039742#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039743 int mem_base;
39744 int ret_val;
39745 int code; /* UCS code point */
39746 int n_code;
39747
39748 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39749 mem_base = xmlMemBlocks();
39750 code = gen_int(n_code, 0);
39751
39752 ret_val = xmlUCSIsTagbanwa(code);
39753 desret_int(ret_val);
39754 call_tests++;
39755 des_int(n_code, code, 0);
39756 xmlResetLastError();
39757 if (mem_base != xmlMemBlocks()) {
39758 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039760 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039761 printf(" %d", n_code);
39762 printf("\n");
39763 }
39764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039765 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039766#endif
39767
Daniel Veillard42595322004-11-08 10:52:06 +000039768 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039769}
39770
39771
39772static int
39773test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039774 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039775
William M. Brack21e4ef22005-01-02 09:53:13 +000039776#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039777 int mem_base;
39778 int ret_val;
39779 int code; /* UCS code point */
39780 int n_code;
39781
39782 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39783 mem_base = xmlMemBlocks();
39784 code = gen_int(n_code, 0);
39785
39786 ret_val = xmlUCSIsTags(code);
39787 desret_int(ret_val);
39788 call_tests++;
39789 des_int(n_code, code, 0);
39790 xmlResetLastError();
39791 if (mem_base != xmlMemBlocks()) {
39792 printf("Leak of %d blocks found in xmlUCSIsTags",
39793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039794 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039795 printf(" %d", n_code);
39796 printf("\n");
39797 }
39798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039799 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039800#endif
39801
Daniel Veillard42595322004-11-08 10:52:06 +000039802 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039803}
39804
39805
39806static int
39807test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039808 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039809
William M. Brack21e4ef22005-01-02 09:53:13 +000039810#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039811 int mem_base;
39812 int ret_val;
39813 int code; /* UCS code point */
39814 int n_code;
39815
39816 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39817 mem_base = xmlMemBlocks();
39818 code = gen_int(n_code, 0);
39819
39820 ret_val = xmlUCSIsTaiLe(code);
39821 desret_int(ret_val);
39822 call_tests++;
39823 des_int(n_code, code, 0);
39824 xmlResetLastError();
39825 if (mem_base != xmlMemBlocks()) {
39826 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039828 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039829 printf(" %d", n_code);
39830 printf("\n");
39831 }
39832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039833 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039834#endif
39835
Daniel Veillard42595322004-11-08 10:52:06 +000039836 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039837}
39838
39839
39840static int
39841test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039842 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039843
William M. Brack21e4ef22005-01-02 09:53:13 +000039844#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039845 int mem_base;
39846 int ret_val;
39847 int code; /* UCS code point */
39848 int n_code;
39849
39850 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39851 mem_base = xmlMemBlocks();
39852 code = gen_int(n_code, 0);
39853
39854 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39855 desret_int(ret_val);
39856 call_tests++;
39857 des_int(n_code, code, 0);
39858 xmlResetLastError();
39859 if (mem_base != xmlMemBlocks()) {
39860 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039862 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039863 printf(" %d", n_code);
39864 printf("\n");
39865 }
39866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039867 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039868#endif
39869
Daniel Veillard42595322004-11-08 10:52:06 +000039870 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039871}
39872
39873
39874static int
39875test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039876 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039877
William M. Brack21e4ef22005-01-02 09:53:13 +000039878#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039879 int mem_base;
39880 int ret_val;
39881 int code; /* UCS code point */
39882 int n_code;
39883
39884 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39885 mem_base = xmlMemBlocks();
39886 code = gen_int(n_code, 0);
39887
39888 ret_val = xmlUCSIsTamil(code);
39889 desret_int(ret_val);
39890 call_tests++;
39891 des_int(n_code, code, 0);
39892 xmlResetLastError();
39893 if (mem_base != xmlMemBlocks()) {
39894 printf("Leak of %d blocks found in xmlUCSIsTamil",
39895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039896 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039897 printf(" %d", n_code);
39898 printf("\n");
39899 }
39900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039901 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039902#endif
39903
Daniel Veillard42595322004-11-08 10:52:06 +000039904 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039905}
39906
39907
39908static int
39909test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039910 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039911
William M. Brack21e4ef22005-01-02 09:53:13 +000039912#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039913 int mem_base;
39914 int ret_val;
39915 int code; /* UCS code point */
39916 int n_code;
39917
39918 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39919 mem_base = xmlMemBlocks();
39920 code = gen_int(n_code, 0);
39921
39922 ret_val = xmlUCSIsTelugu(code);
39923 desret_int(ret_val);
39924 call_tests++;
39925 des_int(n_code, code, 0);
39926 xmlResetLastError();
39927 if (mem_base != xmlMemBlocks()) {
39928 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039930 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039931 printf(" %d", n_code);
39932 printf("\n");
39933 }
39934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039935 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039936#endif
39937
Daniel Veillard42595322004-11-08 10:52:06 +000039938 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039939}
39940
39941
39942static int
39943test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039944 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039945
William M. Brack21e4ef22005-01-02 09:53:13 +000039946#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039947 int mem_base;
39948 int ret_val;
39949 int code; /* UCS code point */
39950 int n_code;
39951
39952 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39953 mem_base = xmlMemBlocks();
39954 code = gen_int(n_code, 0);
39955
39956 ret_val = xmlUCSIsThaana(code);
39957 desret_int(ret_val);
39958 call_tests++;
39959 des_int(n_code, code, 0);
39960 xmlResetLastError();
39961 if (mem_base != xmlMemBlocks()) {
39962 printf("Leak of %d blocks found in xmlUCSIsThaana",
39963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039964 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039965 printf(" %d", n_code);
39966 printf("\n");
39967 }
39968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039969 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039970#endif
39971
Daniel Veillard42595322004-11-08 10:52:06 +000039972 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039973}
39974
39975
39976static int
39977test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039978 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039979
William M. Brack21e4ef22005-01-02 09:53:13 +000039980#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039981 int mem_base;
39982 int ret_val;
39983 int code; /* UCS code point */
39984 int n_code;
39985
39986 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39987 mem_base = xmlMemBlocks();
39988 code = gen_int(n_code, 0);
39989
39990 ret_val = xmlUCSIsThai(code);
39991 desret_int(ret_val);
39992 call_tests++;
39993 des_int(n_code, code, 0);
39994 xmlResetLastError();
39995 if (mem_base != xmlMemBlocks()) {
39996 printf("Leak of %d blocks found in xmlUCSIsThai",
39997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039998 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039999 printf(" %d", n_code);
40000 printf("\n");
40001 }
40002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040003 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040004#endif
40005
Daniel Veillard42595322004-11-08 10:52:06 +000040006 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040007}
40008
40009
40010static int
40011test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040012 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040013
William M. Brack21e4ef22005-01-02 09:53:13 +000040014#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040015 int mem_base;
40016 int ret_val;
40017 int code; /* UCS code point */
40018 int n_code;
40019
40020 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40021 mem_base = xmlMemBlocks();
40022 code = gen_int(n_code, 0);
40023
40024 ret_val = xmlUCSIsTibetan(code);
40025 desret_int(ret_val);
40026 call_tests++;
40027 des_int(n_code, code, 0);
40028 xmlResetLastError();
40029 if (mem_base != xmlMemBlocks()) {
40030 printf("Leak of %d blocks found in xmlUCSIsTibetan",
40031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040032 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040033 printf(" %d", n_code);
40034 printf("\n");
40035 }
40036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040037 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040038#endif
40039
Daniel Veillard42595322004-11-08 10:52:06 +000040040 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040041}
40042
40043
40044static int
40045test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040046 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040047
William M. Brack21e4ef22005-01-02 09:53:13 +000040048#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040049 int mem_base;
40050 int ret_val;
40051 int code; /* UCS code point */
40052 int n_code;
40053
40054 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40055 mem_base = xmlMemBlocks();
40056 code = gen_int(n_code, 0);
40057
40058 ret_val = xmlUCSIsUgaritic(code);
40059 desret_int(ret_val);
40060 call_tests++;
40061 des_int(n_code, code, 0);
40062 xmlResetLastError();
40063 if (mem_base != xmlMemBlocks()) {
40064 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
40065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040066 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040067 printf(" %d", n_code);
40068 printf("\n");
40069 }
40070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040071 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040072#endif
40073
Daniel Veillard42595322004-11-08 10:52:06 +000040074 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040075}
40076
40077
40078static int
40079test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040080 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040081
William M. Brack21e4ef22005-01-02 09:53:13 +000040082#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040083 int mem_base;
40084 int ret_val;
40085 int code; /* UCS code point */
40086 int n_code;
40087
40088 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40089 mem_base = xmlMemBlocks();
40090 code = gen_int(n_code, 0);
40091
40092 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
40093 desret_int(ret_val);
40094 call_tests++;
40095 des_int(n_code, code, 0);
40096 xmlResetLastError();
40097 if (mem_base != xmlMemBlocks()) {
40098 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
40099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040100 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040101 printf(" %d", n_code);
40102 printf("\n");
40103 }
40104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040105 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040106#endif
40107
Daniel Veillard42595322004-11-08 10:52:06 +000040108 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040109}
40110
40111
40112static int
40113test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040114 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040115
William M. Brack21e4ef22005-01-02 09:53:13 +000040116#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040117 int mem_base;
40118 int ret_val;
40119 int code; /* UCS code point */
40120 int n_code;
40121
40122 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40123 mem_base = xmlMemBlocks();
40124 code = gen_int(n_code, 0);
40125
40126 ret_val = xmlUCSIsVariationSelectors(code);
40127 desret_int(ret_val);
40128 call_tests++;
40129 des_int(n_code, code, 0);
40130 xmlResetLastError();
40131 if (mem_base != xmlMemBlocks()) {
40132 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
40133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040134 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040135 printf(" %d", n_code);
40136 printf("\n");
40137 }
40138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040139 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040140#endif
40141
Daniel Veillard42595322004-11-08 10:52:06 +000040142 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040143}
40144
40145
40146static int
40147test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040148 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040149
William M. Brack21e4ef22005-01-02 09:53:13 +000040150#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040151 int mem_base;
40152 int ret_val;
40153 int code; /* UCS code point */
40154 int n_code;
40155
40156 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40157 mem_base = xmlMemBlocks();
40158 code = gen_int(n_code, 0);
40159
40160 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
40161 desret_int(ret_val);
40162 call_tests++;
40163 des_int(n_code, code, 0);
40164 xmlResetLastError();
40165 if (mem_base != xmlMemBlocks()) {
40166 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
40167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040168 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040169 printf(" %d", n_code);
40170 printf("\n");
40171 }
40172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040173 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040174#endif
40175
Daniel Veillard42595322004-11-08 10:52:06 +000040176 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040177}
40178
40179
40180static int
40181test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040182 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040183
William M. Brack21e4ef22005-01-02 09:53:13 +000040184#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040185 int mem_base;
40186 int ret_val;
40187 int code; /* UCS code point */
40188 int n_code;
40189
40190 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40191 mem_base = xmlMemBlocks();
40192 code = gen_int(n_code, 0);
40193
40194 ret_val = xmlUCSIsYiRadicals(code);
40195 desret_int(ret_val);
40196 call_tests++;
40197 des_int(n_code, code, 0);
40198 xmlResetLastError();
40199 if (mem_base != xmlMemBlocks()) {
40200 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
40201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040202 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040203 printf(" %d", n_code);
40204 printf("\n");
40205 }
40206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040207 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040208#endif
40209
Daniel Veillard42595322004-11-08 10:52:06 +000040210 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040211}
40212
40213
40214static int
40215test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040216 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040217
William M. Brack21e4ef22005-01-02 09:53:13 +000040218#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040219 int mem_base;
40220 int ret_val;
40221 int code; /* UCS code point */
40222 int n_code;
40223
40224 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40225 mem_base = xmlMemBlocks();
40226 code = gen_int(n_code, 0);
40227
40228 ret_val = xmlUCSIsYiSyllables(code);
40229 desret_int(ret_val);
40230 call_tests++;
40231 des_int(n_code, code, 0);
40232 xmlResetLastError();
40233 if (mem_base != xmlMemBlocks()) {
40234 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
40235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040236 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040237 printf(" %d", n_code);
40238 printf("\n");
40239 }
40240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040241 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040242#endif
40243
Daniel Veillard42595322004-11-08 10:52:06 +000040244 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040245}
40246
40247
40248static int
40249test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040250 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040251
William M. Brack21e4ef22005-01-02 09:53:13 +000040252#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040253 int mem_base;
40254 int ret_val;
40255 int code; /* UCS code point */
40256 int n_code;
40257
40258 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40259 mem_base = xmlMemBlocks();
40260 code = gen_int(n_code, 0);
40261
40262 ret_val = xmlUCSIsYijingHexagramSymbols(code);
40263 desret_int(ret_val);
40264 call_tests++;
40265 des_int(n_code, code, 0);
40266 xmlResetLastError();
40267 if (mem_base != xmlMemBlocks()) {
40268 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
40269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040270 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040271 printf(" %d", n_code);
40272 printf("\n");
40273 }
40274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040275 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040276#endif
40277
Daniel Veillard42595322004-11-08 10:52:06 +000040278 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040279}
40280
40281static int
40282test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040283 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040284
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040285 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000040286 test_ret += test_xmlUCSIsAegeanNumbers();
40287 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
40288 test_ret += test_xmlUCSIsArabic();
40289 test_ret += test_xmlUCSIsArabicPresentationFormsA();
40290 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40291 test_ret += test_xmlUCSIsArmenian();
40292 test_ret += test_xmlUCSIsArrows();
40293 test_ret += test_xmlUCSIsBasicLatin();
40294 test_ret += test_xmlUCSIsBengali();
40295 test_ret += test_xmlUCSIsBlock();
40296 test_ret += test_xmlUCSIsBlockElements();
40297 test_ret += test_xmlUCSIsBopomofo();
40298 test_ret += test_xmlUCSIsBopomofoExtended();
40299 test_ret += test_xmlUCSIsBoxDrawing();
40300 test_ret += test_xmlUCSIsBraillePatterns();
40301 test_ret += test_xmlUCSIsBuhid();
40302 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40303 test_ret += test_xmlUCSIsCJKCompatibility();
40304 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40305 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40306 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40307 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40308 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40309 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40310 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40311 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40312 test_ret += test_xmlUCSIsCat();
40313 test_ret += test_xmlUCSIsCatC();
40314 test_ret += test_xmlUCSIsCatCc();
40315 test_ret += test_xmlUCSIsCatCf();
40316 test_ret += test_xmlUCSIsCatCo();
40317 test_ret += test_xmlUCSIsCatCs();
40318 test_ret += test_xmlUCSIsCatL();
40319 test_ret += test_xmlUCSIsCatLl();
40320 test_ret += test_xmlUCSIsCatLm();
40321 test_ret += test_xmlUCSIsCatLo();
40322 test_ret += test_xmlUCSIsCatLt();
40323 test_ret += test_xmlUCSIsCatLu();
40324 test_ret += test_xmlUCSIsCatM();
40325 test_ret += test_xmlUCSIsCatMc();
40326 test_ret += test_xmlUCSIsCatMe();
40327 test_ret += test_xmlUCSIsCatMn();
40328 test_ret += test_xmlUCSIsCatN();
40329 test_ret += test_xmlUCSIsCatNd();
40330 test_ret += test_xmlUCSIsCatNl();
40331 test_ret += test_xmlUCSIsCatNo();
40332 test_ret += test_xmlUCSIsCatP();
40333 test_ret += test_xmlUCSIsCatPc();
40334 test_ret += test_xmlUCSIsCatPd();
40335 test_ret += test_xmlUCSIsCatPe();
40336 test_ret += test_xmlUCSIsCatPf();
40337 test_ret += test_xmlUCSIsCatPi();
40338 test_ret += test_xmlUCSIsCatPo();
40339 test_ret += test_xmlUCSIsCatPs();
40340 test_ret += test_xmlUCSIsCatS();
40341 test_ret += test_xmlUCSIsCatSc();
40342 test_ret += test_xmlUCSIsCatSk();
40343 test_ret += test_xmlUCSIsCatSm();
40344 test_ret += test_xmlUCSIsCatSo();
40345 test_ret += test_xmlUCSIsCatZ();
40346 test_ret += test_xmlUCSIsCatZl();
40347 test_ret += test_xmlUCSIsCatZp();
40348 test_ret += test_xmlUCSIsCatZs();
40349 test_ret += test_xmlUCSIsCherokee();
40350 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40351 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40352 test_ret += test_xmlUCSIsCombiningHalfMarks();
40353 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40354 test_ret += test_xmlUCSIsControlPictures();
40355 test_ret += test_xmlUCSIsCurrencySymbols();
40356 test_ret += test_xmlUCSIsCypriotSyllabary();
40357 test_ret += test_xmlUCSIsCyrillic();
40358 test_ret += test_xmlUCSIsCyrillicSupplement();
40359 test_ret += test_xmlUCSIsDeseret();
40360 test_ret += test_xmlUCSIsDevanagari();
40361 test_ret += test_xmlUCSIsDingbats();
40362 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40363 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40364 test_ret += test_xmlUCSIsEthiopic();
40365 test_ret += test_xmlUCSIsGeneralPunctuation();
40366 test_ret += test_xmlUCSIsGeometricShapes();
40367 test_ret += test_xmlUCSIsGeorgian();
40368 test_ret += test_xmlUCSIsGothic();
40369 test_ret += test_xmlUCSIsGreek();
40370 test_ret += test_xmlUCSIsGreekExtended();
40371 test_ret += test_xmlUCSIsGreekandCoptic();
40372 test_ret += test_xmlUCSIsGujarati();
40373 test_ret += test_xmlUCSIsGurmukhi();
40374 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40375 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40376 test_ret += test_xmlUCSIsHangulJamo();
40377 test_ret += test_xmlUCSIsHangulSyllables();
40378 test_ret += test_xmlUCSIsHanunoo();
40379 test_ret += test_xmlUCSIsHebrew();
40380 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40381 test_ret += test_xmlUCSIsHighSurrogates();
40382 test_ret += test_xmlUCSIsHiragana();
40383 test_ret += test_xmlUCSIsIPAExtensions();
40384 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40385 test_ret += test_xmlUCSIsKanbun();
40386 test_ret += test_xmlUCSIsKangxiRadicals();
40387 test_ret += test_xmlUCSIsKannada();
40388 test_ret += test_xmlUCSIsKatakana();
40389 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40390 test_ret += test_xmlUCSIsKhmer();
40391 test_ret += test_xmlUCSIsKhmerSymbols();
40392 test_ret += test_xmlUCSIsLao();
40393 test_ret += test_xmlUCSIsLatin1Supplement();
40394 test_ret += test_xmlUCSIsLatinExtendedA();
40395 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40396 test_ret += test_xmlUCSIsLatinExtendedB();
40397 test_ret += test_xmlUCSIsLetterlikeSymbols();
40398 test_ret += test_xmlUCSIsLimbu();
40399 test_ret += test_xmlUCSIsLinearBIdeograms();
40400 test_ret += test_xmlUCSIsLinearBSyllabary();
40401 test_ret += test_xmlUCSIsLowSurrogates();
40402 test_ret += test_xmlUCSIsMalayalam();
40403 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40404 test_ret += test_xmlUCSIsMathematicalOperators();
40405 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40406 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40407 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40408 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40409 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40410 test_ret += test_xmlUCSIsMongolian();
40411 test_ret += test_xmlUCSIsMusicalSymbols();
40412 test_ret += test_xmlUCSIsMyanmar();
40413 test_ret += test_xmlUCSIsNumberForms();
40414 test_ret += test_xmlUCSIsOgham();
40415 test_ret += test_xmlUCSIsOldItalic();
40416 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40417 test_ret += test_xmlUCSIsOriya();
40418 test_ret += test_xmlUCSIsOsmanya();
40419 test_ret += test_xmlUCSIsPhoneticExtensions();
40420 test_ret += test_xmlUCSIsPrivateUse();
40421 test_ret += test_xmlUCSIsPrivateUseArea();
40422 test_ret += test_xmlUCSIsRunic();
40423 test_ret += test_xmlUCSIsShavian();
40424 test_ret += test_xmlUCSIsSinhala();
40425 test_ret += test_xmlUCSIsSmallFormVariants();
40426 test_ret += test_xmlUCSIsSpacingModifierLetters();
40427 test_ret += test_xmlUCSIsSpecials();
40428 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40429 test_ret += test_xmlUCSIsSupplementalArrowsA();
40430 test_ret += test_xmlUCSIsSupplementalArrowsB();
40431 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40432 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40433 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40434 test_ret += test_xmlUCSIsSyriac();
40435 test_ret += test_xmlUCSIsTagalog();
40436 test_ret += test_xmlUCSIsTagbanwa();
40437 test_ret += test_xmlUCSIsTags();
40438 test_ret += test_xmlUCSIsTaiLe();
40439 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40440 test_ret += test_xmlUCSIsTamil();
40441 test_ret += test_xmlUCSIsTelugu();
40442 test_ret += test_xmlUCSIsThaana();
40443 test_ret += test_xmlUCSIsThai();
40444 test_ret += test_xmlUCSIsTibetan();
40445 test_ret += test_xmlUCSIsUgaritic();
40446 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40447 test_ret += test_xmlUCSIsVariationSelectors();
40448 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40449 test_ret += test_xmlUCSIsYiRadicals();
40450 test_ret += test_xmlUCSIsYiSyllables();
40451 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040452
Daniel Veillard42595322004-11-08 10:52:06 +000040453 if (test_ret != 0)
40454 printf("Module xmlunicode: %d errors\n", test_ret);
40455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040456}
40457
40458static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040459test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040461
William M. Brack21e4ef22005-01-02 09:53:13 +000040462#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040463 int mem_base;
40464 xmlTextWriterPtr ret_val;
40465 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40466 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040467
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040468 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40469 mem_base = xmlMemBlocks();
40470 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040471
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040472 ret_val = xmlNewTextWriter(out);
40473 if (ret_val != NULL) out = NULL;
40474 desret_xmlTextWriterPtr(ret_val);
40475 call_tests++;
40476 des_xmlOutputBufferPtr(n_out, out, 0);
40477 xmlResetLastError();
40478 if (mem_base != xmlMemBlocks()) {
40479 printf("Leak of %d blocks found in xmlNewTextWriter",
40480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040481 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040482 printf(" %d", n_out);
40483 printf("\n");
40484 }
40485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040486 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040487#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040488
Daniel Veillard42595322004-11-08 10:52:06 +000040489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040490}
40491
40492
40493static int
40494test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040496
William M. Brack21e4ef22005-01-02 09:53:13 +000040497#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040498 int mem_base;
40499 xmlTextWriterPtr ret_val;
40500 const char * uri; /* the URI of the resource for the output */
40501 int n_uri;
40502 int compression; /* compress the output? */
40503 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040504
Daniel Veillard42595322004-11-08 10:52:06 +000040505 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040506 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40507 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040508 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040509 compression = gen_int(n_compression, 1);
40510
40511 ret_val = xmlNewTextWriterFilename(uri, compression);
40512 desret_xmlTextWriterPtr(ret_val);
40513 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040514 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040515 des_int(n_compression, compression, 1);
40516 xmlResetLastError();
40517 if (mem_base != xmlMemBlocks()) {
40518 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040520 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040521 printf(" %d", n_uri);
40522 printf(" %d", n_compression);
40523 printf("\n");
40524 }
40525 }
40526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040527 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040528#endif
40529
Daniel Veillard42595322004-11-08 10:52:06 +000040530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040531}
40532
40533
40534static int
40535test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040537
William M. Brack21e4ef22005-01-02 09:53:13 +000040538#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040539 int mem_base;
40540 xmlTextWriterPtr ret_val;
40541 xmlBufferPtr buf; /* xmlBufferPtr */
40542 int n_buf;
40543 int compression; /* compress the output? */
40544 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040545
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040546 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40547 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40548 mem_base = xmlMemBlocks();
40549 buf = gen_xmlBufferPtr(n_buf, 0);
40550 compression = gen_int(n_compression, 1);
40551
40552 ret_val = xmlNewTextWriterMemory(buf, compression);
40553 desret_xmlTextWriterPtr(ret_val);
40554 call_tests++;
40555 des_xmlBufferPtr(n_buf, buf, 0);
40556 des_int(n_compression, compression, 1);
40557 xmlResetLastError();
40558 if (mem_base != xmlMemBlocks()) {
40559 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040561 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040562 printf(" %d", n_buf);
40563 printf(" %d", n_compression);
40564 printf("\n");
40565 }
40566 }
40567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040568 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040569#endif
40570
Daniel Veillard42595322004-11-08 10:52:06 +000040571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040572}
40573
40574
40575static int
40576test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040578
William M. Brack21e4ef22005-01-02 09:53:13 +000040579#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040580 int mem_base;
40581 xmlTextWriterPtr ret_val;
40582 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40583 int n_ctxt;
40584 int compression; /* compress the output? */
40585 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040586
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40588 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40589 mem_base = xmlMemBlocks();
40590 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40591 compression = gen_int(n_compression, 1);
40592
40593 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040594 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040595 desret_xmlTextWriterPtr(ret_val);
40596 call_tests++;
40597 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40598 des_int(n_compression, compression, 1);
40599 xmlResetLastError();
40600 if (mem_base != xmlMemBlocks()) {
40601 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040603 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040604 printf(" %d", n_ctxt);
40605 printf(" %d", n_compression);
40606 printf("\n");
40607 }
40608 }
40609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040610 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040611#endif
40612
Daniel Veillard42595322004-11-08 10:52:06 +000040613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040614}
40615
40616
40617static int
40618test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040620
William M. Brack21e4ef22005-01-02 09:53:13 +000040621#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040622 int mem_base;
40623 xmlTextWriterPtr ret_val;
40624 xmlDocPtr doc; /* xmlDocPtr */
40625 int n_doc;
40626 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40627 int n_node;
40628 int compression; /* compress the output? */
40629 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040630
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040631 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40632 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40633 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40634 mem_base = xmlMemBlocks();
40635 doc = gen_xmlDocPtr(n_doc, 0);
40636 node = gen_xmlNodePtr(n_node, 1);
40637 compression = gen_int(n_compression, 2);
40638
40639 ret_val = xmlNewTextWriterTree(doc, node, compression);
40640 desret_xmlTextWriterPtr(ret_val);
40641 call_tests++;
40642 des_xmlDocPtr(n_doc, doc, 0);
40643 des_xmlNodePtr(n_node, node, 1);
40644 des_int(n_compression, compression, 2);
40645 xmlResetLastError();
40646 if (mem_base != xmlMemBlocks()) {
40647 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040649 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040650 printf(" %d", n_doc);
40651 printf(" %d", n_node);
40652 printf(" %d", n_compression);
40653 printf("\n");
40654 }
40655 }
40656 }
40657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040658 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040659#endif
40660
Daniel Veillard42595322004-11-08 10:52:06 +000040661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040662}
40663
40664
40665static int
40666test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040668
William M. Brack21e4ef22005-01-02 09:53:13 +000040669#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040670 int mem_base;
40671 int ret_val;
40672 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40673 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040674
Daniel Veillarde43cc572004-11-03 11:50:29 +000040675 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40676 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040677 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040678
40679 ret_val = xmlTextWriterEndAttribute(writer);
40680 desret_int(ret_val);
40681 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040682 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040683 xmlResetLastError();
40684 if (mem_base != xmlMemBlocks()) {
40685 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040687 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040688 printf(" %d", n_writer);
40689 printf("\n");
40690 }
40691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040692 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040693#endif
40694
Daniel Veillard42595322004-11-08 10:52:06 +000040695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040696}
40697
40698
40699static int
40700test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040702
William M. Brack21e4ef22005-01-02 09:53:13 +000040703#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040704 int mem_base;
40705 int ret_val;
40706 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40707 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040708
Daniel Veillarde43cc572004-11-03 11:50:29 +000040709 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40710 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040711 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040712
40713 ret_val = xmlTextWriterEndCDATA(writer);
40714 desret_int(ret_val);
40715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040716 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040717 xmlResetLastError();
40718 if (mem_base != xmlMemBlocks()) {
40719 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040721 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040722 printf(" %d", n_writer);
40723 printf("\n");
40724 }
40725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040726 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040727#endif
40728
Daniel Veillard42595322004-11-08 10:52:06 +000040729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040730}
40731
40732
40733static int
40734test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040736
William M. Brack21e4ef22005-01-02 09:53:13 +000040737#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040738 int mem_base;
40739 int ret_val;
40740 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40741 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040742
Daniel Veillarde43cc572004-11-03 11:50:29 +000040743 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040745 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040746
40747 ret_val = xmlTextWriterEndComment(writer);
40748 desret_int(ret_val);
40749 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040750 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040751 xmlResetLastError();
40752 if (mem_base != xmlMemBlocks()) {
40753 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040755 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040756 printf(" %d", n_writer);
40757 printf("\n");
40758 }
40759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040760 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761#endif
40762
Daniel Veillard42595322004-11-08 10:52:06 +000040763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040764}
40765
40766
40767static int
40768test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040770
William M. Brack21e4ef22005-01-02 09:53:13 +000040771#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040772 int mem_base;
40773 int ret_val;
40774 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40775 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040776
Daniel Veillarde43cc572004-11-03 11:50:29 +000040777 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40778 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040779 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040780
40781 ret_val = xmlTextWriterEndDTD(writer);
40782 desret_int(ret_val);
40783 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040784 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040785 xmlResetLastError();
40786 if (mem_base != xmlMemBlocks()) {
40787 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040789 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040790 printf(" %d", n_writer);
40791 printf("\n");
40792 }
40793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040794 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040795#endif
40796
Daniel Veillard42595322004-11-08 10:52:06 +000040797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040798}
40799
40800
40801static int
40802test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040804
William M. Brack21e4ef22005-01-02 09:53:13 +000040805#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040806 int mem_base;
40807 int ret_val;
40808 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40809 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040810
Daniel Veillarde43cc572004-11-03 11:50:29 +000040811 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040813 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040814
40815 ret_val = xmlTextWriterEndDTDAttlist(writer);
40816 desret_int(ret_val);
40817 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040818 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040819 xmlResetLastError();
40820 if (mem_base != xmlMemBlocks()) {
40821 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040823 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040824 printf(" %d", n_writer);
40825 printf("\n");
40826 }
40827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040828 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829#endif
40830
Daniel Veillard42595322004-11-08 10:52:06 +000040831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040832}
40833
40834
40835static int
40836test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040838
William M. Brack21e4ef22005-01-02 09:53:13 +000040839#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040840 int mem_base;
40841 int ret_val;
40842 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40843 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040844
Daniel Veillarde43cc572004-11-03 11:50:29 +000040845 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040847 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040848
40849 ret_val = xmlTextWriterEndDTDElement(writer);
40850 desret_int(ret_val);
40851 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040852 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040853 xmlResetLastError();
40854 if (mem_base != xmlMemBlocks()) {
40855 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040857 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040858 printf(" %d", n_writer);
40859 printf("\n");
40860 }
40861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040862 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040863#endif
40864
Daniel Veillard42595322004-11-08 10:52:06 +000040865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040866}
40867
40868
40869static int
40870test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040872
William M. Brack21e4ef22005-01-02 09:53:13 +000040873#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040874 int mem_base;
40875 int ret_val;
40876 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40877 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040878
Daniel Veillarde43cc572004-11-03 11:50:29 +000040879 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040881 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040882
40883 ret_val = xmlTextWriterEndDTDEntity(writer);
40884 desret_int(ret_val);
40885 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040886 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040887 xmlResetLastError();
40888 if (mem_base != xmlMemBlocks()) {
40889 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040891 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040892 printf(" %d", n_writer);
40893 printf("\n");
40894 }
40895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040896 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040897#endif
40898
Daniel Veillard42595322004-11-08 10:52:06 +000040899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040900}
40901
40902
40903static int
40904test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040906
William M. Brack21e4ef22005-01-02 09:53:13 +000040907#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040908 int mem_base;
40909 int ret_val;
40910 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40911 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040912
Daniel Veillarde43cc572004-11-03 11:50:29 +000040913 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40914 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040915 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040916
40917 ret_val = xmlTextWriterEndDocument(writer);
40918 desret_int(ret_val);
40919 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040920 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040921 xmlResetLastError();
40922 if (mem_base != xmlMemBlocks()) {
40923 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040925 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040926 printf(" %d", n_writer);
40927 printf("\n");
40928 }
40929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040930 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040931#endif
40932
Daniel Veillard42595322004-11-08 10:52:06 +000040933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040934}
40935
40936
40937static int
40938test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040940
William M. Brack21e4ef22005-01-02 09:53:13 +000040941#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040942 int mem_base;
40943 int ret_val;
40944 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40945 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040946
Daniel Veillarde43cc572004-11-03 11:50:29 +000040947 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40948 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040949 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040950
40951 ret_val = xmlTextWriterEndElement(writer);
40952 desret_int(ret_val);
40953 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040954 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040955 xmlResetLastError();
40956 if (mem_base != xmlMemBlocks()) {
40957 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040959 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040960 printf(" %d", n_writer);
40961 printf("\n");
40962 }
40963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040964 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040965#endif
40966
Daniel Veillard42595322004-11-08 10:52:06 +000040967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040968}
40969
40970
40971static int
40972test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040974
William M. Brack21e4ef22005-01-02 09:53:13 +000040975#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040976 int mem_base;
40977 int ret_val;
40978 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40979 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040980
Daniel Veillarde43cc572004-11-03 11:50:29 +000040981 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40982 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040983 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040984
40985 ret_val = xmlTextWriterEndPI(writer);
40986 desret_int(ret_val);
40987 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040988 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040989 xmlResetLastError();
40990 if (mem_base != xmlMemBlocks()) {
40991 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040993 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040994 printf(" %d", n_writer);
40995 printf("\n");
40996 }
40997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040998 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +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_xmlTextWriterFlush(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 Veillarde43cc572004-11-03 11:50:29 +000041010 int mem_base;
41011 int ret_val;
41012 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41013 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041014
Daniel Veillarde43cc572004-11-03 11:50:29 +000041015 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041017 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041018
41019 ret_val = xmlTextWriterFlush(writer);
41020 desret_int(ret_val);
41021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041022 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041023 xmlResetLastError();
41024 if (mem_base != xmlMemBlocks()) {
41025 printf("Leak of %d blocks found in xmlTextWriterFlush",
41026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041027 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041028 printf(" %d", n_writer);
41029 printf("\n");
41030 }
41031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041032 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041033#endif
41034
Daniel Veillard42595322004-11-08 10:52:06 +000041035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041036}
41037
41038
41039static int
41040test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041042
William M. Brack21e4ef22005-01-02 09:53:13 +000041043#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041044 int mem_base;
41045 int ret_val;
41046 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41047 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041048
Daniel Veillarde43cc572004-11-03 11:50:29 +000041049 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041051 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041052
41053 ret_val = xmlTextWriterFullEndElement(writer);
41054 desret_int(ret_val);
41055 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041056 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041057 xmlResetLastError();
41058 if (mem_base != xmlMemBlocks()) {
41059 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
41060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041061 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041062 printf(" %d", n_writer);
41063 printf("\n");
41064 }
41065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041066 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041067#endif
41068
Daniel Veillard42595322004-11-08 10:52:06 +000041069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041070}
41071
41072
41073static int
41074test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041076
William M. Brack21e4ef22005-01-02 09:53:13 +000041077#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041078 int mem_base;
41079 int ret_val;
41080 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41081 int n_writer;
41082 int indent; /* do indentation? */
41083 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041084
Daniel Veillarde43cc572004-11-03 11:50:29 +000041085 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41086 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
41087 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041088 writer = gen_xmlTextWriterPtr(n_writer, 0);
41089 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041090
41091 ret_val = xmlTextWriterSetIndent(writer, indent);
41092 desret_int(ret_val);
41093 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041094 des_xmlTextWriterPtr(n_writer, writer, 0);
41095 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041096 xmlResetLastError();
41097 if (mem_base != xmlMemBlocks()) {
41098 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
41099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041100 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041101 printf(" %d", n_writer);
41102 printf(" %d", n_indent);
41103 printf("\n");
41104 }
41105 }
41106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041107 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041108#endif
41109
Daniel Veillard42595322004-11-08 10:52:06 +000041110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041111}
41112
41113
41114static int
41115test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041117
William M. Brack21e4ef22005-01-02 09:53:13 +000041118#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041119 int mem_base;
41120 int ret_val;
41121 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41122 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041123 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041124 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041125
Daniel Veillarde43cc572004-11-03 11:50:29 +000041126 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41127 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
41128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041129 writer = gen_xmlTextWriterPtr(n_writer, 0);
41130 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041131
William M. Brackf13f77f2004-11-12 16:03:48 +000041132 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041133 desret_int(ret_val);
41134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041135 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041136 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041137 xmlResetLastError();
41138 if (mem_base != xmlMemBlocks()) {
41139 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
41140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041141 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041142 printf(" %d", n_writer);
41143 printf(" %d", n_str);
41144 printf("\n");
41145 }
41146 }
41147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041148 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041149#endif
41150
Daniel Veillard42595322004-11-08 10:52:06 +000041151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041152}
41153
41154
41155static int
41156test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041158
William M. Brack21e4ef22005-01-02 09:53:13 +000041159#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041160 int mem_base;
41161 int ret_val;
41162 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41163 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041164 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041165 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041166
Daniel Veillarde43cc572004-11-03 11:50:29 +000041167 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41168 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41169 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041170 writer = gen_xmlTextWriterPtr(n_writer, 0);
41171 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041172
William M. Brackf13f77f2004-11-12 16:03:48 +000041173 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041174 desret_int(ret_val);
41175 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041176 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041177 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041178 xmlResetLastError();
41179 if (mem_base != xmlMemBlocks()) {
41180 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
41181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041182 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041183 printf(" %d", n_writer);
41184 printf(" %d", n_name);
41185 printf("\n");
41186 }
41187 }
41188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041189 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041190#endif
41191
Daniel Veillard42595322004-11-08 10:52:06 +000041192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041193}
41194
41195
41196static int
41197test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041199
William M. Brack21e4ef22005-01-02 09:53:13 +000041200#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041201 int mem_base;
41202 int ret_val;
41203 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41204 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041205 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041206 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041207 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041208 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041209 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041210 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041211
Daniel Veillarde43cc572004-11-03 11:50:29 +000041212 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41213 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41214 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41215 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041217 writer = gen_xmlTextWriterPtr(n_writer, 0);
41218 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41219 name = gen_const_xmlChar_ptr(n_name, 2);
41220 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041221
William M. Brackf13f77f2004-11-12 16:03:48 +000041222 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041223 desret_int(ret_val);
41224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041225 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041226 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41227 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41228 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041229 xmlResetLastError();
41230 if (mem_base != xmlMemBlocks()) {
41231 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
41232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041233 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041234 printf(" %d", n_writer);
41235 printf(" %d", n_prefix);
41236 printf(" %d", n_name);
41237 printf(" %d", n_namespaceURI);
41238 printf("\n");
41239 }
41240 }
41241 }
41242 }
41243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041244 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041245#endif
41246
Daniel Veillard42595322004-11-08 10:52:06 +000041247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041248}
41249
41250
41251static int
41252test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041254
William M. Brack21e4ef22005-01-02 09:53:13 +000041255#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041256 int mem_base;
41257 int ret_val;
41258 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41259 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041260
Daniel Veillarde43cc572004-11-03 11:50:29 +000041261 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041263 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041264
41265 ret_val = xmlTextWriterStartCDATA(writer);
41266 desret_int(ret_val);
41267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041268 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041269 xmlResetLastError();
41270 if (mem_base != xmlMemBlocks()) {
41271 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
41272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041273 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041274 printf(" %d", n_writer);
41275 printf("\n");
41276 }
41277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041278 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279#endif
41280
Daniel Veillard42595322004-11-08 10:52:06 +000041281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041282}
41283
41284
41285static int
41286test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041288
William M. Brack21e4ef22005-01-02 09:53:13 +000041289#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041290 int mem_base;
41291 int ret_val;
41292 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41293 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041294
Daniel Veillarde43cc572004-11-03 11:50:29 +000041295 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041297 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041298
41299 ret_val = xmlTextWriterStartComment(writer);
41300 desret_int(ret_val);
41301 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041302 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041303 xmlResetLastError();
41304 if (mem_base != xmlMemBlocks()) {
41305 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041307 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041308 printf(" %d", n_writer);
41309 printf("\n");
41310 }
41311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041312 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041313#endif
41314
Daniel Veillard42595322004-11-08 10:52:06 +000041315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041316}
41317
41318
41319static int
41320test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041322
William M. Brack21e4ef22005-01-02 09:53:13 +000041323#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041324 int mem_base;
41325 int ret_val;
41326 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41327 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041328 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041329 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041330 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041331 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041332 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041333 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041334
Daniel Veillarde43cc572004-11-03 11:50:29 +000041335 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41336 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41337 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41338 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41339 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041340 writer = gen_xmlTextWriterPtr(n_writer, 0);
41341 name = gen_const_xmlChar_ptr(n_name, 1);
41342 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41343 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041344
William M. Brackf13f77f2004-11-12 16:03:48 +000041345 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041346 desret_int(ret_val);
41347 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041348 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041349 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41350 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41351 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041352 xmlResetLastError();
41353 if (mem_base != xmlMemBlocks()) {
41354 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041356 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041357 printf(" %d", n_writer);
41358 printf(" %d", n_name);
41359 printf(" %d", n_pubid);
41360 printf(" %d", n_sysid);
41361 printf("\n");
41362 }
41363 }
41364 }
41365 }
41366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041367 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041368#endif
41369
Daniel Veillard42595322004-11-08 10:52:06 +000041370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041371}
41372
41373
41374static int
41375test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041377
William M. Brack21e4ef22005-01-02 09:53:13 +000041378#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041379 int mem_base;
41380 int ret_val;
41381 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41382 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041383 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041384 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041385
Daniel Veillarde43cc572004-11-03 11:50:29 +000041386 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41387 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041389 writer = gen_xmlTextWriterPtr(n_writer, 0);
41390 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041391
William M. Brackf13f77f2004-11-12 16:03:48 +000041392 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041393 desret_int(ret_val);
41394 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041395 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041396 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041397 xmlResetLastError();
41398 if (mem_base != xmlMemBlocks()) {
41399 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041401 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041402 printf(" %d", n_writer);
41403 printf(" %d", n_name);
41404 printf("\n");
41405 }
41406 }
41407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041408 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041409#endif
41410
Daniel Veillard42595322004-11-08 10:52:06 +000041411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041412}
41413
41414
41415static int
41416test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041418
William M. Brack21e4ef22005-01-02 09:53:13 +000041419#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041420 int mem_base;
41421 int ret_val;
41422 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41423 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041424 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041425 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041426
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41428 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41429 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041430 writer = gen_xmlTextWriterPtr(n_writer, 0);
41431 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041432
William M. Brackf13f77f2004-11-12 16:03:48 +000041433 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041434 desret_int(ret_val);
41435 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041436 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041437 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438 xmlResetLastError();
41439 if (mem_base != xmlMemBlocks()) {
41440 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041442 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041443 printf(" %d", n_writer);
41444 printf(" %d", n_name);
41445 printf("\n");
41446 }
41447 }
41448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041449 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041450#endif
41451
Daniel Veillard42595322004-11-08 10:52:06 +000041452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041453}
41454
41455
41456static int
41457test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041459
William M. Brack21e4ef22005-01-02 09:53:13 +000041460#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041461 int mem_base;
41462 int ret_val;
41463 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41464 int n_writer;
41465 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41466 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041467 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041468 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041469
Daniel Veillarde43cc572004-11-03 11:50:29 +000041470 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41471 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41472 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41473 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041474 writer = gen_xmlTextWriterPtr(n_writer, 0);
41475 pe = gen_int(n_pe, 1);
41476 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041477
William M. Brackf13f77f2004-11-12 16:03:48 +000041478 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041479 desret_int(ret_val);
41480 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041481 des_xmlTextWriterPtr(n_writer, writer, 0);
41482 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041483 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041484 xmlResetLastError();
41485 if (mem_base != xmlMemBlocks()) {
41486 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041488 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041489 printf(" %d", n_writer);
41490 printf(" %d", n_pe);
41491 printf(" %d", n_name);
41492 printf("\n");
41493 }
41494 }
41495 }
41496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041497 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041498#endif
41499
Daniel Veillard42595322004-11-08 10:52:06 +000041500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041501}
41502
41503
41504static int
41505test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041507
William M. Brack21e4ef22005-01-02 09:53:13 +000041508#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041509 int mem_base;
41510 int ret_val;
41511 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41512 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041513 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041514 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041515 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041516 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041517 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041518 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041519
Daniel Veillarde43cc572004-11-03 11:50:29 +000041520 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41521 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41522 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41523 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041525 writer = gen_xmlTextWriterPtr(n_writer, 0);
41526 version = gen_const_char_ptr(n_version, 1);
41527 encoding = gen_const_char_ptr(n_encoding, 2);
41528 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041529
William M. Brackf13f77f2004-11-12 16:03:48 +000041530 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 desret_int(ret_val);
41532 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041533 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041534 des_const_char_ptr(n_version, (const char *)version, 1);
41535 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41536 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041537 xmlResetLastError();
41538 if (mem_base != xmlMemBlocks()) {
41539 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041541 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041542 printf(" %d", n_writer);
41543 printf(" %d", n_version);
41544 printf(" %d", n_encoding);
41545 printf(" %d", n_standalone);
41546 printf("\n");
41547 }
41548 }
41549 }
41550 }
41551 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041552 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041553#endif
41554
Daniel Veillard42595322004-11-08 10:52:06 +000041555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041556}
41557
41558
41559static int
41560test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041562
William M. Brack21e4ef22005-01-02 09:53:13 +000041563#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041564 int mem_base;
41565 int ret_val;
41566 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41567 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041568 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041569 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041570
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41572 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41573 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041574 writer = gen_xmlTextWriterPtr(n_writer, 0);
41575 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041576
William M. Brackf13f77f2004-11-12 16:03:48 +000041577 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041578 desret_int(ret_val);
41579 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041580 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041581 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041582 xmlResetLastError();
41583 if (mem_base != xmlMemBlocks()) {
41584 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41585 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041586 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041587 printf(" %d", n_writer);
41588 printf(" %d", n_name);
41589 printf("\n");
41590 }
41591 }
41592 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041593 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041594#endif
41595
Daniel Veillard42595322004-11-08 10:52:06 +000041596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041597}
41598
41599
41600static int
41601test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041603
William M. Brack21e4ef22005-01-02 09:53:13 +000041604#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041605 int mem_base;
41606 int ret_val;
41607 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41608 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041609 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041610 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041611 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041612 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041613 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041614 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041615
Daniel Veillarde43cc572004-11-03 11:50:29 +000041616 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41617 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41619 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041621 writer = gen_xmlTextWriterPtr(n_writer, 0);
41622 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41623 name = gen_const_xmlChar_ptr(n_name, 2);
41624 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041625
William M. Brackf13f77f2004-11-12 16:03:48 +000041626 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041627 desret_int(ret_val);
41628 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041629 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041630 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41631 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41632 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041633 xmlResetLastError();
41634 if (mem_base != xmlMemBlocks()) {
41635 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041637 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041638 printf(" %d", n_writer);
41639 printf(" %d", n_prefix);
41640 printf(" %d", n_name);
41641 printf(" %d", n_namespaceURI);
41642 printf("\n");
41643 }
41644 }
41645 }
41646 }
41647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041648 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041649#endif
41650
Daniel Veillard42595322004-11-08 10:52:06 +000041651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041652}
41653
41654
41655static int
41656test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041658
William M. Brack21e4ef22005-01-02 09:53:13 +000041659#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041660 int mem_base;
41661 int ret_val;
41662 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41663 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041664 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041665 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041666
Daniel Veillarde43cc572004-11-03 11:50:29 +000041667 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41668 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041670 writer = gen_xmlTextWriterPtr(n_writer, 0);
41671 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041672
William M. Brackf13f77f2004-11-12 16:03:48 +000041673 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041674 desret_int(ret_val);
41675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041676 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041677 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041678 xmlResetLastError();
41679 if (mem_base != xmlMemBlocks()) {
41680 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041682 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041683 printf(" %d", n_writer);
41684 printf(" %d", n_target);
41685 printf("\n");
41686 }
41687 }
41688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041689 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041690#endif
41691
Daniel Veillard42595322004-11-08 10:52:06 +000041692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041693}
41694
41695
41696static int
41697test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041699
William M. Brack21e4ef22005-01-02 09:53:13 +000041700#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701 int mem_base;
41702 int ret_val;
41703 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41704 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041705 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041706 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041707 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041708 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041709
Daniel Veillarde43cc572004-11-03 11:50:29 +000041710 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41711 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41712 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41713 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041714 writer = gen_xmlTextWriterPtr(n_writer, 0);
41715 name = gen_const_xmlChar_ptr(n_name, 1);
41716 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041717
William M. Brackf13f77f2004-11-12 16:03:48 +000041718 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041719 desret_int(ret_val);
41720 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041721 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041722 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41723 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041724 xmlResetLastError();
41725 if (mem_base != xmlMemBlocks()) {
41726 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041728 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041729 printf(" %d", n_writer);
41730 printf(" %d", n_name);
41731 printf(" %d", n_content);
41732 printf("\n");
41733 }
41734 }
41735 }
41736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041737 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738#endif
41739
Daniel Veillard42595322004-11-08 10:52:06 +000041740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041741}
41742
41743
41744static int
41745test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041747
William M. Brack21e4ef22005-01-02 09:53:13 +000041748#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041749 int mem_base;
41750 int ret_val;
41751 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41752 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041753 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041754 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041755 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041756 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041757 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041758 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041759 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041760 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041761
Daniel Veillarde43cc572004-11-03 11:50:29 +000041762 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41763 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41764 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41765 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41766 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41767 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041768 writer = gen_xmlTextWriterPtr(n_writer, 0);
41769 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41770 name = gen_const_xmlChar_ptr(n_name, 2);
41771 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41772 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041773
William M. Brackf13f77f2004-11-12 16:03:48 +000041774 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041775 desret_int(ret_val);
41776 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041777 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041778 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41779 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41780 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41781 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 xmlResetLastError();
41783 if (mem_base != xmlMemBlocks()) {
41784 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
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_prefix);
41789 printf(" %d", n_name);
41790 printf(" %d", n_namespaceURI);
41791 printf(" %d", n_content);
41792 printf("\n");
41793 }
41794 }
41795 }
41796 }
41797 }
41798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041799 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041800#endif
41801
Daniel Veillard42595322004-11-08 10:52:06 +000041802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041803}
41804
41805
41806static int
41807test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041809
William M. Brack21e4ef22005-01-02 09:53:13 +000041810#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041811 int mem_base;
41812 int ret_val;
41813 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41814 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041815 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041816 int n_data;
41817 int start; /* the position within the data of the first byte to encode */
41818 int n_start;
41819 int len; /* the number of bytes to encode */
41820 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041821
Daniel Veillarde43cc572004-11-03 11:50:29 +000041822 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41823 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41824 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41825 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041827 writer = gen_xmlTextWriterPtr(n_writer, 0);
41828 data = gen_const_char_ptr(n_data, 1);
41829 start = gen_int(n_start, 2);
41830 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041831
William M. Brackf13f77f2004-11-12 16:03:48 +000041832 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041833 desret_int(ret_val);
41834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041835 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041836 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041837 des_int(n_start, start, 2);
41838 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041839 xmlResetLastError();
41840 if (mem_base != xmlMemBlocks()) {
41841 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041843 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041844 printf(" %d", n_writer);
41845 printf(" %d", n_data);
41846 printf(" %d", n_start);
41847 printf(" %d", n_len);
41848 printf("\n");
41849 }
41850 }
41851 }
41852 }
41853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041854 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041855#endif
41856
Daniel Veillard42595322004-11-08 10:52:06 +000041857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041858}
41859
41860
41861static int
41862test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041864
William M. Brack21e4ef22005-01-02 09:53:13 +000041865#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041866 int mem_base;
41867 int ret_val;
41868 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41869 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041870 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041871 int n_data;
41872 int start; /* the position within the data of the first byte to encode */
41873 int n_start;
41874 int len; /* the number of bytes to encode */
41875 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041876
Daniel Veillarde43cc572004-11-03 11:50:29 +000041877 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41878 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41879 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41880 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041882 writer = gen_xmlTextWriterPtr(n_writer, 0);
41883 data = gen_const_char_ptr(n_data, 1);
41884 start = gen_int(n_start, 2);
41885 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041886
William M. Brackf13f77f2004-11-12 16:03:48 +000041887 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041888 desret_int(ret_val);
41889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041890 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041891 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041892 des_int(n_start, start, 2);
41893 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041894 xmlResetLastError();
41895 if (mem_base != xmlMemBlocks()) {
41896 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041898 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041899 printf(" %d", n_writer);
41900 printf(" %d", n_data);
41901 printf(" %d", n_start);
41902 printf(" %d", n_len);
41903 printf("\n");
41904 }
41905 }
41906 }
41907 }
41908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041909 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041910#endif
41911
Daniel Veillard42595322004-11-08 10:52:06 +000041912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041913}
41914
41915
41916static int
41917test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041919
William M. Brack21e4ef22005-01-02 09:53:13 +000041920#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041921 int mem_base;
41922 int ret_val;
41923 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41924 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041925 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041926 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041927
Daniel Veillarde43cc572004-11-03 11:50:29 +000041928 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41929 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041931 writer = gen_xmlTextWriterPtr(n_writer, 0);
41932 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041933
William M. Brackf13f77f2004-11-12 16:03:48 +000041934 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041935 desret_int(ret_val);
41936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041937 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041938 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041939 xmlResetLastError();
41940 if (mem_base != xmlMemBlocks()) {
41941 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041943 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041944 printf(" %d", n_writer);
41945 printf(" %d", n_content);
41946 printf("\n");
41947 }
41948 }
41949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041950 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041951#endif
41952
Daniel Veillard42595322004-11-08 10:52:06 +000041953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041954}
41955
41956
41957static int
41958test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041960
William M. Brack21e4ef22005-01-02 09:53:13 +000041961#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041962 int mem_base;
41963 int ret_val;
41964 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41965 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041966 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041967 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041968
Daniel Veillarde43cc572004-11-03 11:50:29 +000041969 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41970 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041972 writer = gen_xmlTextWriterPtr(n_writer, 0);
41973 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041974
William M. Brackf13f77f2004-11-12 16:03:48 +000041975 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976 desret_int(ret_val);
41977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041978 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041979 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041980 xmlResetLastError();
41981 if (mem_base != xmlMemBlocks()) {
41982 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041984 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041985 printf(" %d", n_writer);
41986 printf(" %d", n_content);
41987 printf("\n");
41988 }
41989 }
41990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041991 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041992#endif
41993
Daniel Veillard42595322004-11-08 10:52:06 +000041994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041995}
41996
41997
41998static int
41999test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042001
William M. Brack21e4ef22005-01-02 09:53:13 +000042002#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042003 int mem_base;
42004 int ret_val;
42005 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42006 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042007 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042008 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042009 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042010 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042011 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042012 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042013 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042014 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042015
Daniel Veillarde43cc572004-11-03 11:50:29 +000042016 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42017 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42018 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42019 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42020 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
42021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042022 writer = gen_xmlTextWriterPtr(n_writer, 0);
42023 name = gen_const_xmlChar_ptr(n_name, 1);
42024 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42025 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
42026 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042027
William M. Brackf13f77f2004-11-12 16:03:48 +000042028 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042029 desret_int(ret_val);
42030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042031 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42033 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42034 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
42035 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042036 xmlResetLastError();
42037 if (mem_base != xmlMemBlocks()) {
42038 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
42039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042040 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042041 printf(" %d", n_writer);
42042 printf(" %d", n_name);
42043 printf(" %d", n_pubid);
42044 printf(" %d", n_sysid);
42045 printf(" %d", n_subset);
42046 printf("\n");
42047 }
42048 }
42049 }
42050 }
42051 }
42052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042053 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042054#endif
42055
Daniel Veillard42595322004-11-08 10:52:06 +000042056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042057}
42058
42059
42060static int
42061test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042063
William M. Brack21e4ef22005-01-02 09:53:13 +000042064#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042065 int mem_base;
42066 int ret_val;
42067 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42068 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042069 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042070 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042071 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042072 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042073
Daniel Veillarde43cc572004-11-03 11:50:29 +000042074 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42075 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42076 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042078 writer = gen_xmlTextWriterPtr(n_writer, 0);
42079 name = gen_const_xmlChar_ptr(n_name, 1);
42080 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042081
William M. Brackf13f77f2004-11-12 16:03:48 +000042082 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042083 desret_int(ret_val);
42084 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042085 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042086 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42087 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042088 xmlResetLastError();
42089 if (mem_base != xmlMemBlocks()) {
42090 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
42091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042092 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042093 printf(" %d", n_writer);
42094 printf(" %d", n_name);
42095 printf(" %d", n_content);
42096 printf("\n");
42097 }
42098 }
42099 }
42100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042101 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042102#endif
42103
Daniel Veillard42595322004-11-08 10:52:06 +000042104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042105}
42106
42107
42108static int
42109test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042111
William M. Brack21e4ef22005-01-02 09:53:13 +000042112#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042113 int mem_base;
42114 int ret_val;
42115 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42116 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042117 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042118 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042119 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042120 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042121
Daniel Veillarde43cc572004-11-03 11:50:29 +000042122 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42123 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42124 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042126 writer = gen_xmlTextWriterPtr(n_writer, 0);
42127 name = gen_const_xmlChar_ptr(n_name, 1);
42128 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042129
William M. Brackf13f77f2004-11-12 16:03:48 +000042130 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042131 desret_int(ret_val);
42132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042133 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042134 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42135 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042136 xmlResetLastError();
42137 if (mem_base != xmlMemBlocks()) {
42138 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
42139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042140 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042141 printf(" %d", n_writer);
42142 printf(" %d", n_name);
42143 printf(" %d", n_content);
42144 printf("\n");
42145 }
42146 }
42147 }
42148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042149 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042150#endif
42151
Daniel Veillard42595322004-11-08 10:52:06 +000042152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042153}
42154
42155
42156static int
42157test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042159
William M. Brack21e4ef22005-01-02 09:53:13 +000042160#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042161 int mem_base;
42162 int ret_val;
42163 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42164 int n_writer;
42165 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42166 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042167 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042168 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042169 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042170 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042171 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042172 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042173 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042174 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042175 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042176 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042177
Daniel Veillarde43cc572004-11-03 11:50:29 +000042178 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42179 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42180 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42181 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42182 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42183 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42184 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42185 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042186 writer = gen_xmlTextWriterPtr(n_writer, 0);
42187 pe = gen_int(n_pe, 1);
42188 name = gen_const_xmlChar_ptr(n_name, 2);
42189 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42190 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42191 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
42192 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042193
William M. Brackf13f77f2004-11-12 16:03:48 +000042194 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 +000042195 desret_int(ret_val);
42196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042197 des_xmlTextWriterPtr(n_writer, writer, 0);
42198 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042199 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42200 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42201 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42202 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
42203 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042204 xmlResetLastError();
42205 if (mem_base != xmlMemBlocks()) {
42206 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
42207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042208 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042209 printf(" %d", n_writer);
42210 printf(" %d", n_pe);
42211 printf(" %d", n_name);
42212 printf(" %d", n_pubid);
42213 printf(" %d", n_sysid);
42214 printf(" %d", n_ndataid);
42215 printf(" %d", n_content);
42216 printf("\n");
42217 }
42218 }
42219 }
42220 }
42221 }
42222 }
42223 }
42224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042225 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042226#endif
42227
Daniel Veillard42595322004-11-08 10:52:06 +000042228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042229}
42230
42231
42232static int
42233test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042235
William M. Brack21e4ef22005-01-02 09:53:13 +000042236#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042237 int mem_base;
42238 int ret_val;
42239 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42240 int n_writer;
42241 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42242 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042243 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042244 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042245 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042246 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042247 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042248 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042249 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042250 int n_ndataid;
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_pe = 0;n_pe < gen_nb_int;n_pe++) {
42254 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42255 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42256 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42257 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42258 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042259 writer = gen_xmlTextWriterPtr(n_writer, 0);
42260 pe = gen_int(n_pe, 1);
42261 name = gen_const_xmlChar_ptr(n_name, 2);
42262 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42263 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42264 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042265
William M. Brackf13f77f2004-11-12 16:03:48 +000042266 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042267 desret_int(ret_val);
42268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042269 des_xmlTextWriterPtr(n_writer, writer, 0);
42270 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042271 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42272 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42273 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42274 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042275 xmlResetLastError();
42276 if (mem_base != xmlMemBlocks()) {
42277 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
42278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042279 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042280 printf(" %d", n_writer);
42281 printf(" %d", n_pe);
42282 printf(" %d", n_name);
42283 printf(" %d", n_pubid);
42284 printf(" %d", n_sysid);
42285 printf(" %d", n_ndataid);
42286 printf("\n");
42287 }
42288 }
42289 }
42290 }
42291 }
42292 }
42293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042294 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042295#endif
42296
Daniel Veillard42595322004-11-08 10:52:06 +000042297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042298}
42299
42300
42301static int
42302test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042304
William M. Brack21e4ef22005-01-02 09:53:13 +000042305#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042306 int mem_base;
42307 int ret_val;
42308 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42309 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042310 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042311 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042312 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042313 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042314 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042315 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042316
Daniel Veillarde43cc572004-11-03 11:50:29 +000042317 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42318 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42319 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42320 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42321 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042322 writer = gen_xmlTextWriterPtr(n_writer, 0);
42323 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42324 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42325 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042326
William M. Brackf13f77f2004-11-12 16:03:48 +000042327 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042328 desret_int(ret_val);
42329 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042330 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042331 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42332 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42333 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042334 xmlResetLastError();
42335 if (mem_base != xmlMemBlocks()) {
42336 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042338 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042339 printf(" %d", n_writer);
42340 printf(" %d", n_pubid);
42341 printf(" %d", n_sysid);
42342 printf(" %d", n_ndataid);
42343 printf("\n");
42344 }
42345 }
42346 }
42347 }
42348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042349 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042350#endif
42351
Daniel Veillard42595322004-11-08 10:52:06 +000042352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042353}
42354
42355
42356static int
42357test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042359
William M. Brack21e4ef22005-01-02 09:53:13 +000042360#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042361 int mem_base;
42362 int ret_val;
42363 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42364 int n_writer;
42365 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42366 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042367 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042368 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042369 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042370 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042371
Daniel Veillarde43cc572004-11-03 11:50:29 +000042372 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42373 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42374 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42375 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42376 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042377 writer = gen_xmlTextWriterPtr(n_writer, 0);
42378 pe = gen_int(n_pe, 1);
42379 name = gen_const_xmlChar_ptr(n_name, 2);
42380 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042381
William M. Brackf13f77f2004-11-12 16:03:48 +000042382 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042383 desret_int(ret_val);
42384 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042385 des_xmlTextWriterPtr(n_writer, writer, 0);
42386 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042387 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42388 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042389 xmlResetLastError();
42390 if (mem_base != xmlMemBlocks()) {
42391 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042393 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042394 printf(" %d", n_writer);
42395 printf(" %d", n_pe);
42396 printf(" %d", n_name);
42397 printf(" %d", n_content);
42398 printf("\n");
42399 }
42400 }
42401 }
42402 }
42403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042404 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042405#endif
42406
Daniel Veillard42595322004-11-08 10:52:06 +000042407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042408}
42409
42410
42411static int
42412test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042414
William M. Brack21e4ef22005-01-02 09:53:13 +000042415#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042416 int mem_base;
42417 int ret_val;
42418 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42419 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042420 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042421 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042422 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042423 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042424 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042425 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042426
Daniel Veillarde43cc572004-11-03 11:50:29 +000042427 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42428 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42429 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42430 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42431 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042432 writer = gen_xmlTextWriterPtr(n_writer, 0);
42433 name = gen_const_xmlChar_ptr(n_name, 1);
42434 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42435 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042436
William M. Brackf13f77f2004-11-12 16:03:48 +000042437 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042438 desret_int(ret_val);
42439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042440 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042441 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42442 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42443 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042444 xmlResetLastError();
42445 if (mem_base != xmlMemBlocks()) {
42446 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042448 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042449 printf(" %d", n_writer);
42450 printf(" %d", n_name);
42451 printf(" %d", n_pubid);
42452 printf(" %d", n_sysid);
42453 printf("\n");
42454 }
42455 }
42456 }
42457 }
42458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042459 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042460#endif
42461
Daniel Veillard42595322004-11-08 10:52:06 +000042462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042463}
42464
42465
42466static int
42467test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042469
William M. Brack21e4ef22005-01-02 09:53:13 +000042470#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042471 int mem_base;
42472 int ret_val;
42473 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42474 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042475 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042476 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042477 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042478 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042479
Daniel Veillarde43cc572004-11-03 11:50:29 +000042480 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42481 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42482 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42483 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042484 writer = gen_xmlTextWriterPtr(n_writer, 0);
42485 name = gen_const_xmlChar_ptr(n_name, 1);
42486 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042487
William M. Brackf13f77f2004-11-12 16:03:48 +000042488 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042489 desret_int(ret_val);
42490 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042491 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042492 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42493 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042494 xmlResetLastError();
42495 if (mem_base != xmlMemBlocks()) {
42496 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042498 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042499 printf(" %d", n_writer);
42500 printf(" %d", n_name);
42501 printf(" %d", n_content);
42502 printf("\n");
42503 }
42504 }
42505 }
42506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042507 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042508#endif
42509
Daniel Veillard42595322004-11-08 10:52:06 +000042510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042511}
42512
42513
42514static int
42515test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042517
William M. Brack21e4ef22005-01-02 09:53:13 +000042518#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042519 int mem_base;
42520 int ret_val;
42521 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42522 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042523 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042524 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042525 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042526 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042527 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042528 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042529 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042530 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042531
Daniel Veillarde43cc572004-11-03 11:50:29 +000042532 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42533 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42534 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42535 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42536 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042538 writer = gen_xmlTextWriterPtr(n_writer, 0);
42539 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42540 name = gen_const_xmlChar_ptr(n_name, 2);
42541 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42542 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042543
William M. Brackf13f77f2004-11-12 16:03:48 +000042544 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042545 desret_int(ret_val);
42546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042547 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042548 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42549 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42550 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42551 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042552 xmlResetLastError();
42553 if (mem_base != xmlMemBlocks()) {
42554 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042556 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042557 printf(" %d", n_writer);
42558 printf(" %d", n_prefix);
42559 printf(" %d", n_name);
42560 printf(" %d", n_namespaceURI);
42561 printf(" %d", n_content);
42562 printf("\n");
42563 }
42564 }
42565 }
42566 }
42567 }
42568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042569 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042570#endif
42571
Daniel Veillard42595322004-11-08 10:52:06 +000042572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042573}
42574
42575
42576static int
42577test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042579
42580
42581 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042583}
42584
42585
42586static int
42587test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042589
42590
42591 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042593}
42594
42595
42596static int
42597test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042599
42600
42601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042603}
42604
42605
42606static int
42607test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042609
42610
42611 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042613}
42614
42615
42616static int
42617test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042619
42620
42621 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042623}
42624
42625
42626static int
42627test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042629
42630
42631 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042633}
42634
42635
42636static int
42637test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042639
42640
42641 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042643}
42644
42645
42646static int
42647test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042649
42650
42651 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042653}
42654
42655
42656static int
42657test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042659
42660
42661 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042663}
42664
42665
42666static int
42667test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042669
42670
42671 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042673}
42674
42675
42676static int
42677test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042679
42680
42681 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042683}
42684
42685
42686static int
42687test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042689
42690
42691 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042693}
42694
42695
42696static int
42697test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042699
42700
42701 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042703}
42704
42705
42706static int
42707test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042709
William M. Brack21e4ef22005-01-02 09:53:13 +000042710#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042711 int mem_base;
42712 int ret_val;
42713 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42714 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042715 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042716 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042717 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042718 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042719
Daniel Veillarde43cc572004-11-03 11:50:29 +000042720 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42721 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42722 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042724 writer = gen_xmlTextWriterPtr(n_writer, 0);
42725 target = gen_const_xmlChar_ptr(n_target, 1);
42726 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042727
William M. Brackf13f77f2004-11-12 16:03:48 +000042728 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042729 desret_int(ret_val);
42730 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042731 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042732 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42733 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042734 xmlResetLastError();
42735 if (mem_base != xmlMemBlocks()) {
42736 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042738 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042739 printf(" %d", n_writer);
42740 printf(" %d", n_target);
42741 printf(" %d", n_content);
42742 printf("\n");
42743 }
42744 }
42745 }
42746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042747 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042748#endif
42749
Daniel Veillard42595322004-11-08 10:52:06 +000042750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042751}
42752
42753
42754static int
42755test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042757
William M. Brack21e4ef22005-01-02 09:53:13 +000042758#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042759 int mem_base;
42760 int ret_val;
42761 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42762 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042763 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042764 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042765
Daniel Veillarde43cc572004-11-03 11:50:29 +000042766 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42767 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042769 writer = gen_xmlTextWriterPtr(n_writer, 0);
42770 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042771
William M. Brackf13f77f2004-11-12 16:03:48 +000042772 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042773 desret_int(ret_val);
42774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042775 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042776 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042777 xmlResetLastError();
42778 if (mem_base != xmlMemBlocks()) {
42779 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042781 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042782 printf(" %d", n_writer);
42783 printf(" %d", n_content);
42784 printf("\n");
42785 }
42786 }
42787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042788 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042789#endif
42790
Daniel Veillard42595322004-11-08 10:52:06 +000042791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042792}
42793
42794
42795static int
42796test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042798
William M. Brack21e4ef22005-01-02 09:53:13 +000042799#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042800 int mem_base;
42801 int ret_val;
42802 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42803 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042804 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042805 int n_content;
42806 int len; /* length of the text string */
42807 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042808
Daniel Veillarde43cc572004-11-03 11:50:29 +000042809 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42810 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42811 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042813 writer = gen_xmlTextWriterPtr(n_writer, 0);
42814 content = gen_const_xmlChar_ptr(n_content, 1);
42815 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042816
William M. Brackf13f77f2004-11-12 16:03:48 +000042817 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042818 desret_int(ret_val);
42819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042820 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042821 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042822 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042823 xmlResetLastError();
42824 if (mem_base != xmlMemBlocks()) {
42825 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042827 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042828 printf(" %d", n_writer);
42829 printf(" %d", n_content);
42830 printf(" %d", n_len);
42831 printf("\n");
42832 }
42833 }
42834 }
42835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042836 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042837#endif
42838
Daniel Veillard42595322004-11-08 10:52:06 +000042839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042840}
42841
42842
42843static int
42844test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042846
William M. Brack21e4ef22005-01-02 09:53:13 +000042847#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042848 int mem_base;
42849 int ret_val;
42850 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42851 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042852 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042853 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042854
Daniel Veillarde43cc572004-11-03 11:50:29 +000042855 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42856 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042858 writer = gen_xmlTextWriterPtr(n_writer, 0);
42859 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042860
William M. Brackf13f77f2004-11-12 16:03:48 +000042861 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042862 desret_int(ret_val);
42863 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042864 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042865 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042866 xmlResetLastError();
42867 if (mem_base != xmlMemBlocks()) {
42868 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042870 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042871 printf(" %d", n_writer);
42872 printf(" %d", n_content);
42873 printf("\n");
42874 }
42875 }
42876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042877 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042878#endif
42879
Daniel Veillard42595322004-11-08 10:52:06 +000042880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042881}
42882
42883
42884static int
42885test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042887
42888
42889 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042891}
42892
42893
42894static int
42895test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042897
42898
42899 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042901}
42902
42903
42904static int
42905test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042907
42908
42909 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042911}
42912
42913
42914static int
42915test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042917
42918
42919 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042921}
42922
42923
42924static int
42925test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042927
42928
42929 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042931}
42932
42933
42934static int
42935test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042937
42938
42939 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042941}
42942
42943
42944static int
42945test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042947
42948
42949 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042951}
42952
42953
42954static int
42955test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042957
42958
42959 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042961}
42962
42963
42964static int
42965test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042967
42968
42969 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042971}
42972
42973
42974static int
42975test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042977
42978
42979 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042981}
42982
42983
42984static int
42985test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042987
42988
42989 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042991}
42992
42993
42994static int
42995test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042997
42998
42999 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043001}
43002
43003
43004static int
43005test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043007
43008
43009 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043011}
43012
43013static int
43014test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043016
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043017 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043018 test_ret += test_xmlNewTextWriter();
43019 test_ret += test_xmlNewTextWriterFilename();
43020 test_ret += test_xmlNewTextWriterMemory();
43021 test_ret += test_xmlNewTextWriterPushParser();
43022 test_ret += test_xmlNewTextWriterTree();
43023 test_ret += test_xmlTextWriterEndAttribute();
43024 test_ret += test_xmlTextWriterEndCDATA();
43025 test_ret += test_xmlTextWriterEndComment();
43026 test_ret += test_xmlTextWriterEndDTD();
43027 test_ret += test_xmlTextWriterEndDTDAttlist();
43028 test_ret += test_xmlTextWriterEndDTDElement();
43029 test_ret += test_xmlTextWriterEndDTDEntity();
43030 test_ret += test_xmlTextWriterEndDocument();
43031 test_ret += test_xmlTextWriterEndElement();
43032 test_ret += test_xmlTextWriterEndPI();
43033 test_ret += test_xmlTextWriterFlush();
43034 test_ret += test_xmlTextWriterFullEndElement();
43035 test_ret += test_xmlTextWriterSetIndent();
43036 test_ret += test_xmlTextWriterSetIndentString();
43037 test_ret += test_xmlTextWriterStartAttribute();
43038 test_ret += test_xmlTextWriterStartAttributeNS();
43039 test_ret += test_xmlTextWriterStartCDATA();
43040 test_ret += test_xmlTextWriterStartComment();
43041 test_ret += test_xmlTextWriterStartDTD();
43042 test_ret += test_xmlTextWriterStartDTDAttlist();
43043 test_ret += test_xmlTextWriterStartDTDElement();
43044 test_ret += test_xmlTextWriterStartDTDEntity();
43045 test_ret += test_xmlTextWriterStartDocument();
43046 test_ret += test_xmlTextWriterStartElement();
43047 test_ret += test_xmlTextWriterStartElementNS();
43048 test_ret += test_xmlTextWriterStartPI();
43049 test_ret += test_xmlTextWriterWriteAttribute();
43050 test_ret += test_xmlTextWriterWriteAttributeNS();
43051 test_ret += test_xmlTextWriterWriteBase64();
43052 test_ret += test_xmlTextWriterWriteBinHex();
43053 test_ret += test_xmlTextWriterWriteCDATA();
43054 test_ret += test_xmlTextWriterWriteComment();
43055 test_ret += test_xmlTextWriterWriteDTD();
43056 test_ret += test_xmlTextWriterWriteDTDAttlist();
43057 test_ret += test_xmlTextWriterWriteDTDElement();
43058 test_ret += test_xmlTextWriterWriteDTDEntity();
43059 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
43060 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
43061 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
43062 test_ret += test_xmlTextWriterWriteDTDNotation();
43063 test_ret += test_xmlTextWriterWriteElement();
43064 test_ret += test_xmlTextWriterWriteElementNS();
43065 test_ret += test_xmlTextWriterWriteFormatAttribute();
43066 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
43067 test_ret += test_xmlTextWriterWriteFormatCDATA();
43068 test_ret += test_xmlTextWriterWriteFormatComment();
43069 test_ret += test_xmlTextWriterWriteFormatDTD();
43070 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
43071 test_ret += test_xmlTextWriterWriteFormatDTDElement();
43072 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
43073 test_ret += test_xmlTextWriterWriteFormatElement();
43074 test_ret += test_xmlTextWriterWriteFormatElementNS();
43075 test_ret += test_xmlTextWriterWriteFormatPI();
43076 test_ret += test_xmlTextWriterWriteFormatRaw();
43077 test_ret += test_xmlTextWriterWriteFormatString();
43078 test_ret += test_xmlTextWriterWritePI();
43079 test_ret += test_xmlTextWriterWriteRaw();
43080 test_ret += test_xmlTextWriterWriteRawLen();
43081 test_ret += test_xmlTextWriterWriteString();
43082 test_ret += test_xmlTextWriterWriteVFormatAttribute();
43083 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
43084 test_ret += test_xmlTextWriterWriteVFormatCDATA();
43085 test_ret += test_xmlTextWriterWriteVFormatComment();
43086 test_ret += test_xmlTextWriterWriteVFormatDTD();
43087 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
43088 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
43089 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
43090 test_ret += test_xmlTextWriterWriteVFormatElement();
43091 test_ret += test_xmlTextWriterWriteVFormatElementNS();
43092 test_ret += test_xmlTextWriterWriteVFormatPI();
43093 test_ret += test_xmlTextWriterWriteVFormatRaw();
43094 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043095
Daniel Veillard42595322004-11-08 10:52:06 +000043096 if (test_ret != 0)
43097 printf("Module xmlwriter: %d errors\n", test_ret);
43098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043099}
43100
43101static int
43102test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043104
William M. Brack21e4ef22005-01-02 09:53:13 +000043105#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043106 int mem_base;
43107 double ret_val;
43108 int val; /* a boolean */
43109 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043110
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043111 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43112 mem_base = xmlMemBlocks();
43113 val = gen_int(n_val, 0);
43114
43115 ret_val = xmlXPathCastBooleanToNumber(val);
43116 desret_double(ret_val);
43117 call_tests++;
43118 des_int(n_val, val, 0);
43119 xmlResetLastError();
43120 if (mem_base != xmlMemBlocks()) {
43121 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
43122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043123 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043124 printf(" %d", n_val);
43125 printf("\n");
43126 }
43127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043128 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043129#endif
43130
Daniel Veillard42595322004-11-08 10:52:06 +000043131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043132}
43133
43134
43135static int
43136test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043138
William M. Brack21e4ef22005-01-02 09:53:13 +000043139#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043140 int mem_base;
43141 xmlChar * ret_val;
43142 int val; /* a boolean */
43143 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043144
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043145 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043147 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043148
43149 ret_val = xmlXPathCastBooleanToString(val);
43150 desret_xmlChar_ptr(ret_val);
43151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043152 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043153 xmlResetLastError();
43154 if (mem_base != xmlMemBlocks()) {
43155 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
43156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043157 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043158 printf(" %d", n_val);
43159 printf("\n");
43160 }
43161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043162 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043163#endif
43164
Daniel Veillard42595322004-11-08 10:52:06 +000043165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043166}
43167
43168
43169static int
43170test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043172
William M. Brack21e4ef22005-01-02 09:53:13 +000043173#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043174 int mem_base;
43175 int ret_val;
43176 xmlNodeSetPtr ns; /* a node-set */
43177 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043178
Daniel Veillardce682bc2004-11-05 17:22:25 +000043179 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43180 mem_base = xmlMemBlocks();
43181 ns = gen_xmlNodeSetPtr(n_ns, 0);
43182
43183 ret_val = xmlXPathCastNodeSetToBoolean(ns);
43184 desret_int(ret_val);
43185 call_tests++;
43186 des_xmlNodeSetPtr(n_ns, ns, 0);
43187 xmlResetLastError();
43188 if (mem_base != xmlMemBlocks()) {
43189 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
43190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043191 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043192 printf(" %d", n_ns);
43193 printf("\n");
43194 }
43195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043196 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043197#endif
43198
Daniel Veillard42595322004-11-08 10:52:06 +000043199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043200}
43201
43202
43203static int
43204test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043206
William M. Brack21e4ef22005-01-02 09:53:13 +000043207#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043208 int mem_base;
43209 double ret_val;
43210 xmlNodeSetPtr ns; /* a node-set */
43211 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043212
Daniel Veillardce682bc2004-11-05 17:22:25 +000043213 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43214 mem_base = xmlMemBlocks();
43215 ns = gen_xmlNodeSetPtr(n_ns, 0);
43216
43217 ret_val = xmlXPathCastNodeSetToNumber(ns);
43218 desret_double(ret_val);
43219 call_tests++;
43220 des_xmlNodeSetPtr(n_ns, ns, 0);
43221 xmlResetLastError();
43222 if (mem_base != xmlMemBlocks()) {
43223 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
43224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043225 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043226 printf(" %d", n_ns);
43227 printf("\n");
43228 }
43229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043230 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043231#endif
43232
Daniel Veillard42595322004-11-08 10:52:06 +000043233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043234}
43235
43236
43237static int
43238test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043240
William M. Brack21e4ef22005-01-02 09:53:13 +000043241#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043242 int mem_base;
43243 xmlChar * ret_val;
43244 xmlNodeSetPtr ns; /* a node-set */
43245 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043246
Daniel Veillardce682bc2004-11-05 17:22:25 +000043247 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43248 mem_base = xmlMemBlocks();
43249 ns = gen_xmlNodeSetPtr(n_ns, 0);
43250
43251 ret_val = xmlXPathCastNodeSetToString(ns);
43252 desret_xmlChar_ptr(ret_val);
43253 call_tests++;
43254 des_xmlNodeSetPtr(n_ns, ns, 0);
43255 xmlResetLastError();
43256 if (mem_base != xmlMemBlocks()) {
43257 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
43258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043259 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043260 printf(" %d", n_ns);
43261 printf("\n");
43262 }
43263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043264 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043265#endif
43266
Daniel Veillard42595322004-11-08 10:52:06 +000043267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043268}
43269
43270
43271static int
43272test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043274
William M. Brack21e4ef22005-01-02 09:53:13 +000043275#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043276 int mem_base;
43277 double ret_val;
43278 xmlNodePtr node; /* a node */
43279 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043280
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043281 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43282 mem_base = xmlMemBlocks();
43283 node = gen_xmlNodePtr(n_node, 0);
43284
43285 ret_val = xmlXPathCastNodeToNumber(node);
43286 desret_double(ret_val);
43287 call_tests++;
43288 des_xmlNodePtr(n_node, node, 0);
43289 xmlResetLastError();
43290 if (mem_base != xmlMemBlocks()) {
43291 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043293 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043294 printf(" %d", n_node);
43295 printf("\n");
43296 }
43297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043298 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043299#endif
43300
Daniel Veillard42595322004-11-08 10:52:06 +000043301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043302}
43303
43304
43305static int
43306test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043308
William M. Brack21e4ef22005-01-02 09:53:13 +000043309#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043310 int mem_base;
43311 xmlChar * ret_val;
43312 xmlNodePtr node; /* a node */
43313 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043314
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043315 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43316 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043317 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043318
43319 ret_val = xmlXPathCastNodeToString(node);
43320 desret_xmlChar_ptr(ret_val);
43321 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043322 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043323 xmlResetLastError();
43324 if (mem_base != xmlMemBlocks()) {
43325 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043327 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043328 printf(" %d", n_node);
43329 printf("\n");
43330 }
43331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043332 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043333#endif
43334
Daniel Veillard42595322004-11-08 10:52:06 +000043335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043336}
43337
43338
43339static int
43340test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043342
William M. Brack21e4ef22005-01-02 09:53:13 +000043343#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043344 int mem_base;
43345 int ret_val;
43346 double val; /* a number */
43347 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043348
Daniel Veillard3d95c732004-11-06 22:25:14 +000043349 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43350 mem_base = xmlMemBlocks();
43351 val = gen_double(n_val, 0);
43352
43353 ret_val = xmlXPathCastNumberToBoolean(val);
43354 desret_int(ret_val);
43355 call_tests++;
43356 des_double(n_val, val, 0);
43357 xmlResetLastError();
43358 if (mem_base != xmlMemBlocks()) {
43359 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043361 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043362 printf(" %d", n_val);
43363 printf("\n");
43364 }
43365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043366 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043367#endif
43368
Daniel Veillard42595322004-11-08 10:52:06 +000043369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043370}
43371
43372
43373static int
43374test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043376
William M. Brack21e4ef22005-01-02 09:53:13 +000043377#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043378 int mem_base;
43379 xmlChar * ret_val;
43380 double val; /* a number */
43381 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043382
Daniel Veillard3d95c732004-11-06 22:25:14 +000043383 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43384 mem_base = xmlMemBlocks();
43385 val = gen_double(n_val, 0);
43386
43387 ret_val = xmlXPathCastNumberToString(val);
43388 desret_xmlChar_ptr(ret_val);
43389 call_tests++;
43390 des_double(n_val, val, 0);
43391 xmlResetLastError();
43392 if (mem_base != xmlMemBlocks()) {
43393 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043395 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043396 printf(" %d", n_val);
43397 printf("\n");
43398 }
43399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043400 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043401#endif
43402
Daniel Veillard42595322004-11-08 10:52:06 +000043403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043404}
43405
43406
43407static int
43408test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043410
William M. Brack21e4ef22005-01-02 09:53:13 +000043411#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043412 int mem_base;
43413 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043414 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043415 int n_val;
43416
43417 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43418 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043419 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043420
William M. Brackf13f77f2004-11-12 16:03:48 +000043421 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043422 desret_int(ret_val);
43423 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043424 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043425 xmlResetLastError();
43426 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043427 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043429 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043430 printf(" %d", n_val);
43431 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043432 }
43433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043434 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043435#endif
43436
Daniel Veillard42595322004-11-08 10:52:06 +000043437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043438}
43439
43440
43441static int
43442test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043444
William M. Brack21e4ef22005-01-02 09:53:13 +000043445#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043446 int mem_base;
43447 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043448 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043449 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043450
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043451 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43452 mem_base = xmlMemBlocks();
43453 val = gen_const_xmlChar_ptr(n_val, 0);
43454
William M. Brackf13f77f2004-11-12 16:03:48 +000043455 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043456 desret_double(ret_val);
43457 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043458 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043459 xmlResetLastError();
43460 if (mem_base != xmlMemBlocks()) {
43461 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043463 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043464 printf(" %d", n_val);
43465 printf("\n");
43466 }
43467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043468 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043469#endif
43470
Daniel Veillard42595322004-11-08 10:52:06 +000043471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043472}
43473
43474
43475static int
43476test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043478
William M. Brack21e4ef22005-01-02 09:53:13 +000043479#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043480 int mem_base;
43481 int ret_val;
43482 xmlXPathObjectPtr val; /* an XPath object */
43483 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043484
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043485 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043487 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043488
43489 ret_val = xmlXPathCastToBoolean(val);
43490 desret_int(ret_val);
43491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043492 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043493 xmlResetLastError();
43494 if (mem_base != xmlMemBlocks()) {
43495 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043497 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043498 printf(" %d", n_val);
43499 printf("\n");
43500 }
43501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043502 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043503#endif
43504
Daniel Veillard42595322004-11-08 10:52:06 +000043505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043506}
43507
43508
43509static int
43510test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043512
William M. Brack21e4ef22005-01-02 09:53:13 +000043513#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043514 int mem_base;
43515 double ret_val;
43516 xmlXPathObjectPtr val; /* an XPath object */
43517 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043518
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043519 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43520 mem_base = xmlMemBlocks();
43521 val = gen_xmlXPathObjectPtr(n_val, 0);
43522
43523 ret_val = xmlXPathCastToNumber(val);
43524 desret_double(ret_val);
43525 call_tests++;
43526 des_xmlXPathObjectPtr(n_val, val, 0);
43527 xmlResetLastError();
43528 if (mem_base != xmlMemBlocks()) {
43529 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043531 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043532 printf(" %d", n_val);
43533 printf("\n");
43534 }
43535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043536 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043537#endif
43538
Daniel Veillard42595322004-11-08 10:52:06 +000043539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043540}
43541
43542
43543static int
43544test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043546
William M. Brack21e4ef22005-01-02 09:53:13 +000043547#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043548 int mem_base;
43549 xmlChar * ret_val;
43550 xmlXPathObjectPtr val; /* an XPath object */
43551 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043552
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043553 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43554 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043555 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043556
43557 ret_val = xmlXPathCastToString(val);
43558 desret_xmlChar_ptr(ret_val);
43559 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043560 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043561 xmlResetLastError();
43562 if (mem_base != xmlMemBlocks()) {
43563 printf("Leak of %d blocks found in xmlXPathCastToString",
43564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043565 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043566 printf(" %d", n_val);
43567 printf("\n");
43568 }
43569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043570 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043571#endif
43572
Daniel Veillard42595322004-11-08 10:52:06 +000043573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043574}
43575
43576
43577static int
43578test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043580
William M. Brack21e4ef22005-01-02 09:53:13 +000043581#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043582 int mem_base;
43583 int ret_val;
43584 xmlNodePtr node1; /* the first node */
43585 int n_node1;
43586 xmlNodePtr node2; /* the second node */
43587 int n_node2;
43588
43589 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43590 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43591 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043592 node1 = gen_xmlNodePtr(n_node1, 0);
43593 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043594
43595 ret_val = xmlXPathCmpNodes(node1, node2);
43596 desret_int(ret_val);
43597 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043598 des_xmlNodePtr(n_node1, node1, 0);
43599 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043600 xmlResetLastError();
43601 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043602 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043604 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043605 printf(" %d", n_node1);
43606 printf(" %d", n_node2);
43607 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043608 }
43609 }
43610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043611 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043612#endif
43613
Daniel Veillard42595322004-11-08 10:52:06 +000043614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043615}
43616
43617
43618static int
43619test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043621
43622
43623 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043625}
43626
Daniel Veillarda521d282004-11-09 14:59:59 +000043627#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043628
Daniel Veillardce682bc2004-11-05 17:22:25 +000043629#define gen_nb_xmlXPathCompExprPtr 1
43630static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43631 return(NULL);
43632}
43633static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43634}
Daniel Veillarda521d282004-11-09 14:59:59 +000043635#endif
43636
43637#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043638
43639#define gen_nb_xmlXPathContextPtr 1
43640static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43641 return(NULL);
43642}
43643static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43644}
Daniel Veillarda521d282004-11-09 14:59:59 +000043645#endif
43646
Daniel Veillardce682bc2004-11-05 17:22:25 +000043647
Daniel Veillardd93f6252004-11-02 15:53:51 +000043648static int
43649test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043651
William M. Brack21e4ef22005-01-02 09:53:13 +000043652#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043653 int mem_base;
43654 xmlXPathObjectPtr ret_val;
43655 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43656 int n_comp;
43657 xmlXPathContextPtr ctx; /* the XPath context */
43658 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043659
Daniel Veillardce682bc2004-11-05 17:22:25 +000043660 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43661 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43662 mem_base = xmlMemBlocks();
43663 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43664 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43665
43666 ret_val = xmlXPathCompiledEval(comp, ctx);
43667 desret_xmlXPathObjectPtr(ret_val);
43668 call_tests++;
43669 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43670 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43671 xmlResetLastError();
43672 if (mem_base != xmlMemBlocks()) {
43673 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043675 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043676 printf(" %d", n_comp);
43677 printf(" %d", n_ctx);
43678 printf("\n");
43679 }
43680 }
43681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043682 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043683#endif
43684
Daniel Veillard42595322004-11-08 10:52:06 +000043685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043686}
43687
43688
43689static int
43690test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043692
William M. Brack21e4ef22005-01-02 09:53:13 +000043693#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043694 int mem_base;
43695 xmlXPathObjectPtr ret_val;
43696 xmlXPathObjectPtr val; /* an XPath object */
43697 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043698
Daniel Veillard3d97e662004-11-04 10:49:00 +000043699 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43700 mem_base = xmlMemBlocks();
43701 val = gen_xmlXPathObjectPtr(n_val, 0);
43702
43703 ret_val = xmlXPathConvertBoolean(val);
43704 val = NULL;
43705 desret_xmlXPathObjectPtr(ret_val);
43706 call_tests++;
43707 des_xmlXPathObjectPtr(n_val, val, 0);
43708 xmlResetLastError();
43709 if (mem_base != xmlMemBlocks()) {
43710 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043712 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043713 printf(" %d", n_val);
43714 printf("\n");
43715 }
43716 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043717 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043718#endif
43719
Daniel Veillard42595322004-11-08 10:52:06 +000043720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043721}
43722
43723
43724static int
43725test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043727
William M. Brack21e4ef22005-01-02 09:53:13 +000043728#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043729 int mem_base;
43730 xmlXPathObjectPtr ret_val;
43731 xmlXPathObjectPtr val; /* an XPath object */
43732 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043733
Daniel Veillard3d97e662004-11-04 10:49:00 +000043734 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43735 mem_base = xmlMemBlocks();
43736 val = gen_xmlXPathObjectPtr(n_val, 0);
43737
43738 ret_val = xmlXPathConvertNumber(val);
43739 val = NULL;
43740 desret_xmlXPathObjectPtr(ret_val);
43741 call_tests++;
43742 des_xmlXPathObjectPtr(n_val, val, 0);
43743 xmlResetLastError();
43744 if (mem_base != xmlMemBlocks()) {
43745 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043747 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043748 printf(" %d", n_val);
43749 printf("\n");
43750 }
43751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043752 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043753#endif
43754
Daniel Veillard42595322004-11-08 10:52:06 +000043755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043756}
43757
43758
43759static int
43760test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043762
William M. Brack21e4ef22005-01-02 09:53:13 +000043763#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043764 int mem_base;
43765 xmlXPathObjectPtr ret_val;
43766 xmlXPathObjectPtr val; /* an XPath object */
43767 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043768
Daniel Veillard3d97e662004-11-04 10:49:00 +000043769 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43770 mem_base = xmlMemBlocks();
43771 val = gen_xmlXPathObjectPtr(n_val, 0);
43772
43773 ret_val = xmlXPathConvertString(val);
43774 val = NULL;
43775 desret_xmlXPathObjectPtr(ret_val);
43776 call_tests++;
43777 des_xmlXPathObjectPtr(n_val, val, 0);
43778 xmlResetLastError();
43779 if (mem_base != xmlMemBlocks()) {
43780 printf("Leak of %d blocks found in xmlXPathConvertString",
43781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043782 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043783 printf(" %d", n_val);
43784 printf("\n");
43785 }
43786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043787 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043788#endif
43789
Daniel Veillard42595322004-11-08 10:52:06 +000043790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043791}
43792
43793
43794static int
43795test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043797
43798
43799 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043801}
43802
43803
43804static int
43805test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043807
William M. Brack21e4ef22005-01-02 09:53:13 +000043808#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043809 int mem_base;
43810 xmlXPathObjectPtr ret_val;
43811 xmlChar * str; /* the XPath expression */
43812 int n_str;
43813 xmlXPathContextPtr ctx; /* the XPath context */
43814 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043815
Daniel Veillardce682bc2004-11-05 17:22:25 +000043816 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43817 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43818 mem_base = xmlMemBlocks();
43819 str = gen_const_xmlChar_ptr(n_str, 0);
43820 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43821
William M. Brackf13f77f2004-11-12 16:03:48 +000043822 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043823 desret_xmlXPathObjectPtr(ret_val);
43824 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043825 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043826 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43827 xmlResetLastError();
43828 if (mem_base != xmlMemBlocks()) {
43829 printf("Leak of %d blocks found in xmlXPathEval",
43830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043831 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043832 printf(" %d", n_str);
43833 printf(" %d", n_ctx);
43834 printf("\n");
43835 }
43836 }
43837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043838 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043839#endif
43840
Daniel Veillard42595322004-11-08 10:52:06 +000043841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043842}
43843
43844
43845static int
43846test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043848
William M. Brack21e4ef22005-01-02 09:53:13 +000043849#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043850 int mem_base;
43851 xmlXPathObjectPtr ret_val;
43852 xmlChar * str; /* the XPath expression */
43853 int n_str;
43854 xmlXPathContextPtr ctxt; /* the XPath context */
43855 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043856
Daniel Veillardce682bc2004-11-05 17:22:25 +000043857 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43858 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43859 mem_base = xmlMemBlocks();
43860 str = gen_const_xmlChar_ptr(n_str, 0);
43861 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43862
William M. Brackf13f77f2004-11-12 16:03:48 +000043863 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043864 desret_xmlXPathObjectPtr(ret_val);
43865 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043866 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043867 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43868 xmlResetLastError();
43869 if (mem_base != xmlMemBlocks()) {
43870 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043872 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043873 printf(" %d", n_str);
43874 printf(" %d", n_ctxt);
43875 printf("\n");
43876 }
43877 }
43878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043879 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043880#endif
43881
Daniel Veillard42595322004-11-08 10:52:06 +000043882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043883}
43884
43885
43886static int
43887test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043889
William M. Brack21e4ef22005-01-02 09:53:13 +000043890#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043891 int mem_base;
43892 int ret_val;
43893 xmlXPathContextPtr ctxt; /* the XPath context */
43894 int n_ctxt;
43895 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43896 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043897
Daniel Veillardce682bc2004-11-05 17:22:25 +000043898 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43899 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43900 mem_base = xmlMemBlocks();
43901 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43902 res = gen_xmlXPathObjectPtr(n_res, 1);
43903
43904 ret_val = xmlXPathEvalPredicate(ctxt, res);
43905 desret_int(ret_val);
43906 call_tests++;
43907 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43908 des_xmlXPathObjectPtr(n_res, res, 1);
43909 xmlResetLastError();
43910 if (mem_base != xmlMemBlocks()) {
43911 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043913 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043914 printf(" %d", n_ctxt);
43915 printf(" %d", n_res);
43916 printf("\n");
43917 }
43918 }
43919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043920 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043921#endif
43922
Daniel Veillard42595322004-11-08 10:52:06 +000043923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043924}
43925
43926
43927static int
43928test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043930
William M. Brack21e4ef22005-01-02 09:53:13 +000043931#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043932 int mem_base;
43933
43934 mem_base = xmlMemBlocks();
43935
43936 xmlXPathInit();
43937 call_tests++;
43938 xmlResetLastError();
43939 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043940 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043942 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043943 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043945 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043946#endif
43947
Daniel Veillard42595322004-11-08 10:52:06 +000043948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043949}
43950
43951
43952static int
43953test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043955
William M. Brack21e4ef22005-01-02 09:53:13 +000043956#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043957 int mem_base;
43958 int ret_val;
43959 double val; /* a double value */
43960 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043961
Daniel Veillard3d95c732004-11-06 22:25:14 +000043962 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43963 mem_base = xmlMemBlocks();
43964 val = gen_double(n_val, 0);
43965
43966 ret_val = xmlXPathIsInf(val);
43967 desret_int(ret_val);
43968 call_tests++;
43969 des_double(n_val, val, 0);
43970 xmlResetLastError();
43971 if (mem_base != xmlMemBlocks()) {
43972 printf("Leak of %d blocks found in xmlXPathIsInf",
43973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043974 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043975 printf(" %d", n_val);
43976 printf("\n");
43977 }
43978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043979 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043980#endif
43981
Daniel Veillard42595322004-11-08 10:52:06 +000043982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043983}
43984
43985
43986static int
43987test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043989
William M. Brack21e4ef22005-01-02 09:53:13 +000043990#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043991 int mem_base;
43992 int ret_val;
43993 double val; /* a double value */
43994 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043995
Daniel Veillard3d95c732004-11-06 22:25:14 +000043996 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43997 mem_base = xmlMemBlocks();
43998 val = gen_double(n_val, 0);
43999
44000 ret_val = xmlXPathIsNaN(val);
44001 desret_int(ret_val);
44002 call_tests++;
44003 des_double(n_val, val, 0);
44004 xmlResetLastError();
44005 if (mem_base != xmlMemBlocks()) {
44006 printf("Leak of %d blocks found in xmlXPathIsNaN",
44007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044008 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044009 printf(" %d", n_val);
44010 printf("\n");
44011 }
44012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044013 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044014#endif
44015
Daniel Veillard42595322004-11-08 10:52:06 +000044016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044017}
44018
44019
44020static int
44021test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044023
44024
44025 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044027}
44028
44029
44030static int
44031test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044033
William M. Brack21e4ef22005-01-02 09:53:13 +000044034#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044035 int mem_base;
44036 xmlNodeSetPtr ret_val;
44037 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
44038 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044039
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044040 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44041 mem_base = xmlMemBlocks();
44042 val = gen_xmlNodePtr(n_val, 0);
44043
44044 ret_val = xmlXPathNodeSetCreate(val);
44045 desret_xmlNodeSetPtr(ret_val);
44046 call_tests++;
44047 des_xmlNodePtr(n_val, val, 0);
44048 xmlResetLastError();
44049 if (mem_base != xmlMemBlocks()) {
44050 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
44051 xmlMemBlocks() - mem_base);
44052 test_ret++;
44053 printf(" %d", n_val);
44054 printf("\n");
44055 }
44056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044057 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044058#endif
44059
Daniel Veillard42595322004-11-08 10:52:06 +000044060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044061}
44062
44063
44064static int
44065test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044067
William M. Brack21e4ef22005-01-02 09:53:13 +000044068#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044069 int mem_base;
44070 xmlXPathObjectPtr ret_val;
44071 xmlXPathObjectPtr val; /* the original object */
44072 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044073
Daniel Veillard3d97e662004-11-04 10:49:00 +000044074 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44075 mem_base = xmlMemBlocks();
44076 val = gen_xmlXPathObjectPtr(n_val, 0);
44077
44078 ret_val = xmlXPathObjectCopy(val);
44079 desret_xmlXPathObjectPtr(ret_val);
44080 call_tests++;
44081 des_xmlXPathObjectPtr(n_val, val, 0);
44082 xmlResetLastError();
44083 if (mem_base != xmlMemBlocks()) {
44084 printf("Leak of %d blocks found in xmlXPathObjectCopy",
44085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044086 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044087 printf(" %d", n_val);
44088 printf("\n");
44089 }
44090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044091 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044092#endif
44093
Daniel Veillard42595322004-11-08 10:52:06 +000044094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044095}
44096
44097
44098static int
44099test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044101
William M. Brack21e4ef22005-01-02 09:53:13 +000044102#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044103 int mem_base;
44104 long ret_val;
44105 xmlDocPtr doc; /* an input document */
44106 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044107
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044108 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
44109 mem_base = xmlMemBlocks();
44110 doc = gen_xmlDocPtr(n_doc, 0);
44111
44112 ret_val = xmlXPathOrderDocElems(doc);
44113 desret_long(ret_val);
44114 call_tests++;
44115 des_xmlDocPtr(n_doc, doc, 0);
44116 xmlResetLastError();
44117 if (mem_base != xmlMemBlocks()) {
44118 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
44119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044120 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044121 printf(" %d", n_doc);
44122 printf("\n");
44123 }
44124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044125 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044126#endif
44127
Daniel Veillard42595322004-11-08 10:52:06 +000044128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044129}
44130
44131static int
44132test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044134
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044135 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000044136 test_ret += test_xmlXPathCastBooleanToNumber();
44137 test_ret += test_xmlXPathCastBooleanToString();
44138 test_ret += test_xmlXPathCastNodeSetToBoolean();
44139 test_ret += test_xmlXPathCastNodeSetToNumber();
44140 test_ret += test_xmlXPathCastNodeSetToString();
44141 test_ret += test_xmlXPathCastNodeToNumber();
44142 test_ret += test_xmlXPathCastNodeToString();
44143 test_ret += test_xmlXPathCastNumberToBoolean();
44144 test_ret += test_xmlXPathCastNumberToString();
44145 test_ret += test_xmlXPathCastStringToBoolean();
44146 test_ret += test_xmlXPathCastStringToNumber();
44147 test_ret += test_xmlXPathCastToBoolean();
44148 test_ret += test_xmlXPathCastToNumber();
44149 test_ret += test_xmlXPathCastToString();
44150 test_ret += test_xmlXPathCmpNodes();
44151 test_ret += test_xmlXPathCompile();
44152 test_ret += test_xmlXPathCompiledEval();
44153 test_ret += test_xmlXPathConvertBoolean();
44154 test_ret += test_xmlXPathConvertNumber();
44155 test_ret += test_xmlXPathConvertString();
44156 test_ret += test_xmlXPathCtxtCompile();
44157 test_ret += test_xmlXPathEval();
44158 test_ret += test_xmlXPathEvalExpression();
44159 test_ret += test_xmlXPathEvalPredicate();
44160 test_ret += test_xmlXPathInit();
44161 test_ret += test_xmlXPathIsInf();
44162 test_ret += test_xmlXPathIsNaN();
44163 test_ret += test_xmlXPathNewContext();
44164 test_ret += test_xmlXPathNodeSetCreate();
44165 test_ret += test_xmlXPathObjectCopy();
44166 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000044167
Daniel Veillard42595322004-11-08 10:52:06 +000044168 if (test_ret != 0)
44169 printf("Module xpath: %d errors\n", test_ret);
44170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044171}
Daniel Veillarda521d282004-11-09 14:59:59 +000044172#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044173
Daniel Veillarda82b1822004-11-08 16:24:57 +000044174#define gen_nb_xmlXPathParserContextPtr 1
44175static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44176 return(NULL);
44177}
44178static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44179}
Daniel Veillarda521d282004-11-09 14:59:59 +000044180#endif
44181
Daniel Veillarda82b1822004-11-08 16:24:57 +000044182
44183static int
44184test_valuePop(void) {
44185 int test_ret = 0;
44186
William M. Brack21e4ef22005-01-02 09:53:13 +000044187#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044188 int mem_base;
44189 xmlXPathObjectPtr ret_val;
44190 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44191 int n_ctxt;
44192
44193 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44194 mem_base = xmlMemBlocks();
44195 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44196
44197 ret_val = valuePop(ctxt);
44198 desret_xmlXPathObjectPtr(ret_val);
44199 call_tests++;
44200 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44201 xmlResetLastError();
44202 if (mem_base != xmlMemBlocks()) {
44203 printf("Leak of %d blocks found in valuePop",
44204 xmlMemBlocks() - mem_base);
44205 test_ret++;
44206 printf(" %d", n_ctxt);
44207 printf("\n");
44208 }
44209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044210 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044211#endif
44212
Daniel Veillarda82b1822004-11-08 16:24:57 +000044213 return(test_ret);
44214}
44215
44216
44217static int
44218test_valuePush(void) {
44219 int test_ret = 0;
44220
William M. Brack21e4ef22005-01-02 09:53:13 +000044221#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044222 int mem_base;
44223 int ret_val;
44224 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44225 int n_ctxt;
44226 xmlXPathObjectPtr value; /* the XPath object */
44227 int n_value;
44228
44229 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44230 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44231 mem_base = xmlMemBlocks();
44232 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44233 value = gen_xmlXPathObjectPtr(n_value, 1);
44234
44235 ret_val = valuePush(ctxt, value);
44236 desret_int(ret_val);
44237 call_tests++;
44238 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44239 des_xmlXPathObjectPtr(n_value, value, 1);
44240 xmlResetLastError();
44241 if (mem_base != xmlMemBlocks()) {
44242 printf("Leak of %d blocks found in valuePush",
44243 xmlMemBlocks() - mem_base);
44244 test_ret++;
44245 printf(" %d", n_ctxt);
44246 printf(" %d", n_value);
44247 printf("\n");
44248 }
44249 }
44250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044251 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044252#endif
44253
Daniel Veillarda82b1822004-11-08 16:24:57 +000044254 return(test_ret);
44255}
44256
44257
44258static int
44259test_xmlXPathAddValues(void) {
44260 int test_ret = 0;
44261
William M. Brack21e4ef22005-01-02 09:53:13 +000044262#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044263 int mem_base;
44264 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44265 int n_ctxt;
44266
44267 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44268 mem_base = xmlMemBlocks();
44269 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44270
44271 xmlXPathAddValues(ctxt);
44272 call_tests++;
44273 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44274 xmlResetLastError();
44275 if (mem_base != xmlMemBlocks()) {
44276 printf("Leak of %d blocks found in xmlXPathAddValues",
44277 xmlMemBlocks() - mem_base);
44278 test_ret++;
44279 printf(" %d", n_ctxt);
44280 printf("\n");
44281 }
44282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044283 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044284#endif
44285
Daniel Veillarda82b1822004-11-08 16:24:57 +000044286 return(test_ret);
44287}
44288
44289
44290static int
44291test_xmlXPathBooleanFunction(void) {
44292 int test_ret = 0;
44293
William M. Brack21e4ef22005-01-02 09:53:13 +000044294#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044295 int mem_base;
44296 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44297 int n_ctxt;
44298 int nargs; /* the number of arguments */
44299 int n_nargs;
44300
44301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44302 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44303 mem_base = xmlMemBlocks();
44304 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44305 nargs = gen_int(n_nargs, 1);
44306
44307 xmlXPathBooleanFunction(ctxt, nargs);
44308 call_tests++;
44309 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44310 des_int(n_nargs, nargs, 1);
44311 xmlResetLastError();
44312 if (mem_base != xmlMemBlocks()) {
44313 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44314 xmlMemBlocks() - mem_base);
44315 test_ret++;
44316 printf(" %d", n_ctxt);
44317 printf(" %d", n_nargs);
44318 printf("\n");
44319 }
44320 }
44321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044322 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044323#endif
44324
Daniel Veillarda82b1822004-11-08 16:24:57 +000044325 return(test_ret);
44326}
44327
44328
44329static int
44330test_xmlXPathCeilingFunction(void) {
44331 int test_ret = 0;
44332
William M. Brack21e4ef22005-01-02 09:53:13 +000044333#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044334 int mem_base;
44335 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44336 int n_ctxt;
44337 int nargs; /* the number of arguments */
44338 int n_nargs;
44339
44340 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44341 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44342 mem_base = xmlMemBlocks();
44343 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44344 nargs = gen_int(n_nargs, 1);
44345
44346 xmlXPathCeilingFunction(ctxt, nargs);
44347 call_tests++;
44348 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44349 des_int(n_nargs, nargs, 1);
44350 xmlResetLastError();
44351 if (mem_base != xmlMemBlocks()) {
44352 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44353 xmlMemBlocks() - mem_base);
44354 test_ret++;
44355 printf(" %d", n_ctxt);
44356 printf(" %d", n_nargs);
44357 printf("\n");
44358 }
44359 }
44360 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044361 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044362#endif
44363
Daniel Veillarda82b1822004-11-08 16:24:57 +000044364 return(test_ret);
44365}
44366
44367
44368static int
44369test_xmlXPathCompareValues(void) {
44370 int test_ret = 0;
44371
William M. Brack21e4ef22005-01-02 09:53:13 +000044372#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044373 int mem_base;
44374 int ret_val;
44375 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44376 int n_ctxt;
44377 int inf; /* less than (1) or greater than (0) */
44378 int n_inf;
44379 int strict; /* is the comparison strict */
44380 int n_strict;
44381
44382 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44383 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44384 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44385 mem_base = xmlMemBlocks();
44386 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44387 inf = gen_int(n_inf, 1);
44388 strict = gen_int(n_strict, 2);
44389
44390 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44391 desret_int(ret_val);
44392 call_tests++;
44393 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44394 des_int(n_inf, inf, 1);
44395 des_int(n_strict, strict, 2);
44396 xmlResetLastError();
44397 if (mem_base != xmlMemBlocks()) {
44398 printf("Leak of %d blocks found in xmlXPathCompareValues",
44399 xmlMemBlocks() - mem_base);
44400 test_ret++;
44401 printf(" %d", n_ctxt);
44402 printf(" %d", n_inf);
44403 printf(" %d", n_strict);
44404 printf("\n");
44405 }
44406 }
44407 }
44408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044409 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044410#endif
44411
Daniel Veillarda82b1822004-11-08 16:24:57 +000044412 return(test_ret);
44413}
44414
44415
44416static int
44417test_xmlXPathConcatFunction(void) {
44418 int test_ret = 0;
44419
William M. Brack21e4ef22005-01-02 09:53:13 +000044420#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044421 int mem_base;
44422 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44423 int n_ctxt;
44424 int nargs; /* the number of arguments */
44425 int n_nargs;
44426
44427 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44428 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44429 mem_base = xmlMemBlocks();
44430 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44431 nargs = gen_int(n_nargs, 1);
44432
44433 xmlXPathConcatFunction(ctxt, nargs);
44434 call_tests++;
44435 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44436 des_int(n_nargs, nargs, 1);
44437 xmlResetLastError();
44438 if (mem_base != xmlMemBlocks()) {
44439 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44440 xmlMemBlocks() - mem_base);
44441 test_ret++;
44442 printf(" %d", n_ctxt);
44443 printf(" %d", n_nargs);
44444 printf("\n");
44445 }
44446 }
44447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044448 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044449#endif
44450
Daniel Veillarda82b1822004-11-08 16:24:57 +000044451 return(test_ret);
44452}
44453
44454
44455static int
44456test_xmlXPathContainsFunction(void) {
44457 int test_ret = 0;
44458
William M. Brack21e4ef22005-01-02 09:53:13 +000044459#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044460 int mem_base;
44461 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44462 int n_ctxt;
44463 int nargs; /* the number of arguments */
44464 int n_nargs;
44465
44466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44467 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44468 mem_base = xmlMemBlocks();
44469 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44470 nargs = gen_int(n_nargs, 1);
44471
44472 xmlXPathContainsFunction(ctxt, nargs);
44473 call_tests++;
44474 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44475 des_int(n_nargs, nargs, 1);
44476 xmlResetLastError();
44477 if (mem_base != xmlMemBlocks()) {
44478 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44479 xmlMemBlocks() - mem_base);
44480 test_ret++;
44481 printf(" %d", n_ctxt);
44482 printf(" %d", n_nargs);
44483 printf("\n");
44484 }
44485 }
44486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044487 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044488#endif
44489
Daniel Veillarda82b1822004-11-08 16:24:57 +000044490 return(test_ret);
44491}
44492
44493
44494static int
44495test_xmlXPathCountFunction(void) {
44496 int test_ret = 0;
44497
William M. Brack21e4ef22005-01-02 09:53:13 +000044498#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044499 int mem_base;
44500 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44501 int n_ctxt;
44502 int nargs; /* the number of arguments */
44503 int n_nargs;
44504
44505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44506 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44507 mem_base = xmlMemBlocks();
44508 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44509 nargs = gen_int(n_nargs, 1);
44510
44511 xmlXPathCountFunction(ctxt, nargs);
44512 call_tests++;
44513 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44514 des_int(n_nargs, nargs, 1);
44515 xmlResetLastError();
44516 if (mem_base != xmlMemBlocks()) {
44517 printf("Leak of %d blocks found in xmlXPathCountFunction",
44518 xmlMemBlocks() - mem_base);
44519 test_ret++;
44520 printf(" %d", n_ctxt);
44521 printf(" %d", n_nargs);
44522 printf("\n");
44523 }
44524 }
44525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044526 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044527#endif
44528
Daniel Veillarda82b1822004-11-08 16:24:57 +000044529 return(test_ret);
44530}
44531
44532
44533static int
44534test_xmlXPathDebugDumpCompExpr(void) {
44535 int test_ret = 0;
44536
William M. Brack21e4ef22005-01-02 09:53:13 +000044537#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044538 int mem_base;
44539 FILE * output; /* the FILE * for the output */
44540 int n_output;
44541 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44542 int n_comp;
44543 int depth; /* the indentation level. */
44544 int n_depth;
44545
44546 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44547 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44548 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44549 mem_base = xmlMemBlocks();
44550 output = gen_FILE_ptr(n_output, 0);
44551 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44552 depth = gen_int(n_depth, 2);
44553
44554 xmlXPathDebugDumpCompExpr(output, comp, depth);
44555 call_tests++;
44556 des_FILE_ptr(n_output, output, 0);
44557 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44558 des_int(n_depth, depth, 2);
44559 xmlResetLastError();
44560 if (mem_base != xmlMemBlocks()) {
44561 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44562 xmlMemBlocks() - mem_base);
44563 test_ret++;
44564 printf(" %d", n_output);
44565 printf(" %d", n_comp);
44566 printf(" %d", n_depth);
44567 printf("\n");
44568 }
44569 }
44570 }
44571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044572 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044573#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044574
Daniel Veillarda82b1822004-11-08 16:24:57 +000044575 return(test_ret);
44576}
44577
44578
44579static int
44580test_xmlXPathDebugDumpObject(void) {
44581 int test_ret = 0;
44582
William M. Brack21e4ef22005-01-02 09:53:13 +000044583#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044584 int mem_base;
44585 FILE * output; /* the FILE * to dump the output */
44586 int n_output;
44587 xmlXPathObjectPtr cur; /* the object to inspect */
44588 int n_cur;
44589 int depth; /* indentation level */
44590 int n_depth;
44591
44592 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44593 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44594 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44595 mem_base = xmlMemBlocks();
44596 output = gen_FILE_ptr(n_output, 0);
44597 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44598 depth = gen_int(n_depth, 2);
44599
44600 xmlXPathDebugDumpObject(output, cur, depth);
44601 call_tests++;
44602 des_FILE_ptr(n_output, output, 0);
44603 des_xmlXPathObjectPtr(n_cur, cur, 1);
44604 des_int(n_depth, depth, 2);
44605 xmlResetLastError();
44606 if (mem_base != xmlMemBlocks()) {
44607 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44608 xmlMemBlocks() - mem_base);
44609 test_ret++;
44610 printf(" %d", n_output);
44611 printf(" %d", n_cur);
44612 printf(" %d", n_depth);
44613 printf("\n");
44614 }
44615 }
44616 }
44617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044618 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044619#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044620
Daniel Veillarda82b1822004-11-08 16:24:57 +000044621 return(test_ret);
44622}
44623
44624
44625static int
44626test_xmlXPathDifference(void) {
44627 int test_ret = 0;
44628
William M. Brack21e4ef22005-01-02 09:53:13 +000044629#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044630 int mem_base;
44631 xmlNodeSetPtr ret_val;
44632 xmlNodeSetPtr nodes1; /* a node-set */
44633 int n_nodes1;
44634 xmlNodeSetPtr nodes2; /* a node-set */
44635 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044636
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044637 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44638 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44639 mem_base = xmlMemBlocks();
44640 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44641 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44642
44643 ret_val = xmlXPathDifference(nodes1, nodes2);
44644 desret_xmlNodeSetPtr(ret_val);
44645 call_tests++;
44646 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44647 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44648 xmlResetLastError();
44649 if (mem_base != xmlMemBlocks()) {
44650 printf("Leak of %d blocks found in xmlXPathDifference",
44651 xmlMemBlocks() - mem_base);
44652 test_ret++;
44653 printf(" %d", n_nodes1);
44654 printf(" %d", n_nodes2);
44655 printf("\n");
44656 }
44657 }
44658 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044659 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044660#endif
44661
Daniel Veillarda82b1822004-11-08 16:24:57 +000044662 return(test_ret);
44663}
44664
44665
44666static int
44667test_xmlXPathDistinct(void) {
44668 int test_ret = 0;
44669
William M. Brack21e4ef22005-01-02 09:53:13 +000044670#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044671 int mem_base;
44672 xmlNodeSetPtr ret_val;
44673 xmlNodeSetPtr nodes; /* a node-set */
44674 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044675
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044676 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44677 mem_base = xmlMemBlocks();
44678 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44679
44680 ret_val = xmlXPathDistinct(nodes);
44681 desret_xmlNodeSetPtr(ret_val);
44682 call_tests++;
44683 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44684 xmlResetLastError();
44685 if (mem_base != xmlMemBlocks()) {
44686 printf("Leak of %d blocks found in xmlXPathDistinct",
44687 xmlMemBlocks() - mem_base);
44688 test_ret++;
44689 printf(" %d", n_nodes);
44690 printf("\n");
44691 }
44692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044693 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044694#endif
44695
Daniel Veillarda82b1822004-11-08 16:24:57 +000044696 return(test_ret);
44697}
44698
44699
44700static int
44701test_xmlXPathDistinctSorted(void) {
44702 int test_ret = 0;
44703
William M. Brack21e4ef22005-01-02 09:53:13 +000044704#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044705 int mem_base;
44706 xmlNodeSetPtr ret_val;
44707 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44708 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044709
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044710 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44711 mem_base = xmlMemBlocks();
44712 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44713
44714 ret_val = xmlXPathDistinctSorted(nodes);
44715 desret_xmlNodeSetPtr(ret_val);
44716 call_tests++;
44717 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44718 xmlResetLastError();
44719 if (mem_base != xmlMemBlocks()) {
44720 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44721 xmlMemBlocks() - mem_base);
44722 test_ret++;
44723 printf(" %d", n_nodes);
44724 printf("\n");
44725 }
44726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044727 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044728#endif
44729
Daniel Veillarda82b1822004-11-08 16:24:57 +000044730 return(test_ret);
44731}
44732
44733
44734static int
44735test_xmlXPathDivValues(void) {
44736 int test_ret = 0;
44737
William M. Brack21e4ef22005-01-02 09:53:13 +000044738#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044739 int mem_base;
44740 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44741 int n_ctxt;
44742
44743 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44744 mem_base = xmlMemBlocks();
44745 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44746
44747 xmlXPathDivValues(ctxt);
44748 call_tests++;
44749 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44750 xmlResetLastError();
44751 if (mem_base != xmlMemBlocks()) {
44752 printf("Leak of %d blocks found in xmlXPathDivValues",
44753 xmlMemBlocks() - mem_base);
44754 test_ret++;
44755 printf(" %d", n_ctxt);
44756 printf("\n");
44757 }
44758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044759 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044760#endif
44761
Daniel Veillarda82b1822004-11-08 16:24:57 +000044762 return(test_ret);
44763}
44764
44765
44766static int
44767test_xmlXPathEqualValues(void) {
44768 int test_ret = 0;
44769
William M. Brack21e4ef22005-01-02 09:53:13 +000044770#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044771 int mem_base;
44772 int ret_val;
44773 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44774 int n_ctxt;
44775
44776 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44777 mem_base = xmlMemBlocks();
44778 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44779
44780 ret_val = xmlXPathEqualValues(ctxt);
44781 desret_int(ret_val);
44782 call_tests++;
44783 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44784 xmlResetLastError();
44785 if (mem_base != xmlMemBlocks()) {
44786 printf("Leak of %d blocks found in xmlXPathEqualValues",
44787 xmlMemBlocks() - mem_base);
44788 test_ret++;
44789 printf(" %d", n_ctxt);
44790 printf("\n");
44791 }
44792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044793 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044794#endif
44795
Daniel Veillarda82b1822004-11-08 16:24:57 +000044796 return(test_ret);
44797}
44798
44799
44800static int
44801test_xmlXPathErr(void) {
44802 int test_ret = 0;
44803
William M. Brack21e4ef22005-01-02 09:53:13 +000044804#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044805 int mem_base;
44806 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44807 int n_ctxt;
44808 int error; /* the error code */
44809 int n_error;
44810
44811 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44812 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44813 mem_base = xmlMemBlocks();
44814 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44815 error = gen_int(n_error, 1);
44816
44817 xmlXPathErr(ctxt, error);
44818 call_tests++;
44819 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44820 des_int(n_error, error, 1);
44821 xmlResetLastError();
44822 if (mem_base != xmlMemBlocks()) {
44823 printf("Leak of %d blocks found in xmlXPathErr",
44824 xmlMemBlocks() - mem_base);
44825 test_ret++;
44826 printf(" %d", n_ctxt);
44827 printf(" %d", n_error);
44828 printf("\n");
44829 }
44830 }
44831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044832 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044833#endif
44834
Daniel Veillarda82b1822004-11-08 16:24:57 +000044835 return(test_ret);
44836}
44837
44838
44839static int
44840test_xmlXPathEvalExpr(void) {
44841 int test_ret = 0;
44842
William M. Brack21e4ef22005-01-02 09:53:13 +000044843#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044844 int mem_base;
44845 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44846 int n_ctxt;
44847
44848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44849 mem_base = xmlMemBlocks();
44850 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44851
44852 xmlXPathEvalExpr(ctxt);
44853 call_tests++;
44854 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44855 xmlResetLastError();
44856 if (mem_base != xmlMemBlocks()) {
44857 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44858 xmlMemBlocks() - mem_base);
44859 test_ret++;
44860 printf(" %d", n_ctxt);
44861 printf("\n");
44862 }
44863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044864 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044865#endif
44866
Daniel Veillarda82b1822004-11-08 16:24:57 +000044867 return(test_ret);
44868}
44869
44870
44871static int
44872test_xmlXPathEvaluatePredicateResult(void) {
44873 int test_ret = 0;
44874
William M. Brack21e4ef22005-01-02 09:53:13 +000044875#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044876 int mem_base;
44877 int ret_val;
44878 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44879 int n_ctxt;
44880 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44881 int n_res;
44882
44883 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44884 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44885 mem_base = xmlMemBlocks();
44886 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44887 res = gen_xmlXPathObjectPtr(n_res, 1);
44888
44889 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44890 desret_int(ret_val);
44891 call_tests++;
44892 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44893 des_xmlXPathObjectPtr(n_res, res, 1);
44894 xmlResetLastError();
44895 if (mem_base != xmlMemBlocks()) {
44896 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44897 xmlMemBlocks() - mem_base);
44898 test_ret++;
44899 printf(" %d", n_ctxt);
44900 printf(" %d", n_res);
44901 printf("\n");
44902 }
44903 }
44904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044905 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044906#endif
44907
Daniel Veillarda82b1822004-11-08 16:24:57 +000044908 return(test_ret);
44909}
44910
44911
44912static int
44913test_xmlXPathFalseFunction(void) {
44914 int test_ret = 0;
44915
William M. Brack21e4ef22005-01-02 09:53:13 +000044916#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044917 int mem_base;
44918 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44919 int n_ctxt;
44920 int nargs; /* the number of arguments */
44921 int n_nargs;
44922
44923 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44924 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44925 mem_base = xmlMemBlocks();
44926 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44927 nargs = gen_int(n_nargs, 1);
44928
44929 xmlXPathFalseFunction(ctxt, nargs);
44930 call_tests++;
44931 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44932 des_int(n_nargs, nargs, 1);
44933 xmlResetLastError();
44934 if (mem_base != xmlMemBlocks()) {
44935 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44936 xmlMemBlocks() - mem_base);
44937 test_ret++;
44938 printf(" %d", n_ctxt);
44939 printf(" %d", n_nargs);
44940 printf("\n");
44941 }
44942 }
44943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044944 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044945#endif
44946
Daniel Veillarda82b1822004-11-08 16:24:57 +000044947 return(test_ret);
44948}
44949
44950
44951static int
44952test_xmlXPathFloorFunction(void) {
44953 int test_ret = 0;
44954
William M. Brack21e4ef22005-01-02 09:53:13 +000044955#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044956 int mem_base;
44957 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44958 int n_ctxt;
44959 int nargs; /* the number of arguments */
44960 int n_nargs;
44961
44962 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44963 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44964 mem_base = xmlMemBlocks();
44965 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44966 nargs = gen_int(n_nargs, 1);
44967
44968 xmlXPathFloorFunction(ctxt, nargs);
44969 call_tests++;
44970 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44971 des_int(n_nargs, nargs, 1);
44972 xmlResetLastError();
44973 if (mem_base != xmlMemBlocks()) {
44974 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44975 xmlMemBlocks() - mem_base);
44976 test_ret++;
44977 printf(" %d", n_ctxt);
44978 printf(" %d", n_nargs);
44979 printf("\n");
44980 }
44981 }
44982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044983 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044984#endif
44985
Daniel Veillarda82b1822004-11-08 16:24:57 +000044986 return(test_ret);
44987}
44988
44989
44990static int
44991test_xmlXPathFunctionLookup(void) {
44992 int test_ret = 0;
44993
44994
44995 /* missing type support */
44996 return(test_ret);
44997}
44998
44999
45000static int
45001test_xmlXPathFunctionLookupNS(void) {
45002 int test_ret = 0;
45003
45004
45005 /* missing type support */
45006 return(test_ret);
45007}
45008
45009
45010static int
45011test_xmlXPathHasSameNodes(void) {
45012 int test_ret = 0;
45013
William M. Brack21e4ef22005-01-02 09:53:13 +000045014#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045015 int mem_base;
45016 int ret_val;
45017 xmlNodeSetPtr nodes1; /* a node-set */
45018 int n_nodes1;
45019 xmlNodeSetPtr nodes2; /* a node-set */
45020 int n_nodes2;
45021
45022 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45023 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45024 mem_base = xmlMemBlocks();
45025 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45026 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45027
45028 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
45029 desret_int(ret_val);
45030 call_tests++;
45031 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45032 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45033 xmlResetLastError();
45034 if (mem_base != xmlMemBlocks()) {
45035 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
45036 xmlMemBlocks() - mem_base);
45037 test_ret++;
45038 printf(" %d", n_nodes1);
45039 printf(" %d", n_nodes2);
45040 printf("\n");
45041 }
45042 }
45043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045044 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045045#endif
45046
Daniel Veillarda82b1822004-11-08 16:24:57 +000045047 return(test_ret);
45048}
45049
45050
45051static int
45052test_xmlXPathIdFunction(void) {
45053 int test_ret = 0;
45054
William M. Brack21e4ef22005-01-02 09:53:13 +000045055#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045056 int mem_base;
45057 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45058 int n_ctxt;
45059 int nargs; /* the number of arguments */
45060 int n_nargs;
45061
45062 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45063 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45064 mem_base = xmlMemBlocks();
45065 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45066 nargs = gen_int(n_nargs, 1);
45067
45068 xmlXPathIdFunction(ctxt, nargs);
45069 call_tests++;
45070 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45071 des_int(n_nargs, nargs, 1);
45072 xmlResetLastError();
45073 if (mem_base != xmlMemBlocks()) {
45074 printf("Leak of %d blocks found in xmlXPathIdFunction",
45075 xmlMemBlocks() - mem_base);
45076 test_ret++;
45077 printf(" %d", n_ctxt);
45078 printf(" %d", n_nargs);
45079 printf("\n");
45080 }
45081 }
45082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045083 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045084#endif
45085
Daniel Veillarda82b1822004-11-08 16:24:57 +000045086 return(test_ret);
45087}
45088
45089
45090static int
45091test_xmlXPathIntersection(void) {
45092 int test_ret = 0;
45093
William M. Brack21e4ef22005-01-02 09:53:13 +000045094#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045095 int mem_base;
45096 xmlNodeSetPtr ret_val;
45097 xmlNodeSetPtr nodes1; /* a node-set */
45098 int n_nodes1;
45099 xmlNodeSetPtr nodes2; /* a node-set */
45100 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045101
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045102 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45103 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45104 mem_base = xmlMemBlocks();
45105 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45106 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45107
45108 ret_val = xmlXPathIntersection(nodes1, nodes2);
45109 desret_xmlNodeSetPtr(ret_val);
45110 call_tests++;
45111 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45112 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45113 xmlResetLastError();
45114 if (mem_base != xmlMemBlocks()) {
45115 printf("Leak of %d blocks found in xmlXPathIntersection",
45116 xmlMemBlocks() - mem_base);
45117 test_ret++;
45118 printf(" %d", n_nodes1);
45119 printf(" %d", n_nodes2);
45120 printf("\n");
45121 }
45122 }
45123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045124 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045125#endif
45126
Daniel Veillarda82b1822004-11-08 16:24:57 +000045127 return(test_ret);
45128}
45129
45130
45131static int
45132test_xmlXPathIsNodeType(void) {
45133 int test_ret = 0;
45134
William M. Brack21e4ef22005-01-02 09:53:13 +000045135#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045136 int mem_base;
45137 int ret_val;
45138 xmlChar * name; /* a name string */
45139 int n_name;
45140
45141 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45142 mem_base = xmlMemBlocks();
45143 name = gen_const_xmlChar_ptr(n_name, 0);
45144
William M. Brackf13f77f2004-11-12 16:03:48 +000045145 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045146 desret_int(ret_val);
45147 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045148 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045149 xmlResetLastError();
45150 if (mem_base != xmlMemBlocks()) {
45151 printf("Leak of %d blocks found in xmlXPathIsNodeType",
45152 xmlMemBlocks() - mem_base);
45153 test_ret++;
45154 printf(" %d", n_name);
45155 printf("\n");
45156 }
45157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045158 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045159#endif
45160
Daniel Veillarda82b1822004-11-08 16:24:57 +000045161 return(test_ret);
45162}
45163
45164
45165static int
45166test_xmlXPathLangFunction(void) {
45167 int test_ret = 0;
45168
William M. Brack21e4ef22005-01-02 09:53:13 +000045169#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045170 int mem_base;
45171 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45172 int n_ctxt;
45173 int nargs; /* the number of arguments */
45174 int n_nargs;
45175
45176 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45177 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45178 mem_base = xmlMemBlocks();
45179 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45180 nargs = gen_int(n_nargs, 1);
45181
45182 xmlXPathLangFunction(ctxt, nargs);
45183 call_tests++;
45184 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45185 des_int(n_nargs, nargs, 1);
45186 xmlResetLastError();
45187 if (mem_base != xmlMemBlocks()) {
45188 printf("Leak of %d blocks found in xmlXPathLangFunction",
45189 xmlMemBlocks() - mem_base);
45190 test_ret++;
45191 printf(" %d", n_ctxt);
45192 printf(" %d", n_nargs);
45193 printf("\n");
45194 }
45195 }
45196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045197 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045198#endif
45199
Daniel Veillarda82b1822004-11-08 16:24:57 +000045200 return(test_ret);
45201}
45202
45203
45204static int
45205test_xmlXPathLastFunction(void) {
45206 int test_ret = 0;
45207
William M. Brack21e4ef22005-01-02 09:53:13 +000045208#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045209 int mem_base;
45210 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45211 int n_ctxt;
45212 int nargs; /* the number of arguments */
45213 int n_nargs;
45214
45215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45216 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45217 mem_base = xmlMemBlocks();
45218 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45219 nargs = gen_int(n_nargs, 1);
45220
45221 xmlXPathLastFunction(ctxt, nargs);
45222 call_tests++;
45223 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45224 des_int(n_nargs, nargs, 1);
45225 xmlResetLastError();
45226 if (mem_base != xmlMemBlocks()) {
45227 printf("Leak of %d blocks found in xmlXPathLastFunction",
45228 xmlMemBlocks() - mem_base);
45229 test_ret++;
45230 printf(" %d", n_ctxt);
45231 printf(" %d", n_nargs);
45232 printf("\n");
45233 }
45234 }
45235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045236 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045237#endif
45238
Daniel Veillarda82b1822004-11-08 16:24:57 +000045239 return(test_ret);
45240}
45241
45242
45243static int
45244test_xmlXPathLeading(void) {
45245 int test_ret = 0;
45246
William M. Brack21e4ef22005-01-02 09:53:13 +000045247#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045248 int mem_base;
45249 xmlNodeSetPtr ret_val;
45250 xmlNodeSetPtr nodes1; /* a node-set */
45251 int n_nodes1;
45252 xmlNodeSetPtr nodes2; /* a node-set */
45253 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045254
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045255 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45256 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45257 mem_base = xmlMemBlocks();
45258 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45259 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45260
45261 ret_val = xmlXPathLeading(nodes1, nodes2);
45262 desret_xmlNodeSetPtr(ret_val);
45263 call_tests++;
45264 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45265 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45266 xmlResetLastError();
45267 if (mem_base != xmlMemBlocks()) {
45268 printf("Leak of %d blocks found in xmlXPathLeading",
45269 xmlMemBlocks() - mem_base);
45270 test_ret++;
45271 printf(" %d", n_nodes1);
45272 printf(" %d", n_nodes2);
45273 printf("\n");
45274 }
45275 }
45276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045277 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045278#endif
45279
Daniel Veillarda82b1822004-11-08 16:24:57 +000045280 return(test_ret);
45281}
45282
45283
45284static int
45285test_xmlXPathLeadingSorted(void) {
45286 int test_ret = 0;
45287
William M. Brack21e4ef22005-01-02 09:53:13 +000045288#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045289 int mem_base;
45290 xmlNodeSetPtr ret_val;
45291 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45292 int n_nodes1;
45293 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45294 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045295
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045296 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45297 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45298 mem_base = xmlMemBlocks();
45299 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45300 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45301
45302 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45303 desret_xmlNodeSetPtr(ret_val);
45304 call_tests++;
45305 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45306 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45307 xmlResetLastError();
45308 if (mem_base != xmlMemBlocks()) {
45309 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45310 xmlMemBlocks() - mem_base);
45311 test_ret++;
45312 printf(" %d", n_nodes1);
45313 printf(" %d", n_nodes2);
45314 printf("\n");
45315 }
45316 }
45317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045318 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045319#endif
45320
Daniel Veillarda82b1822004-11-08 16:24:57 +000045321 return(test_ret);
45322}
45323
45324
45325static int
45326test_xmlXPathLocalNameFunction(void) {
45327 int test_ret = 0;
45328
William M. Brack21e4ef22005-01-02 09:53:13 +000045329#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045330 int mem_base;
45331 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45332 int n_ctxt;
45333 int nargs; /* the number of arguments */
45334 int n_nargs;
45335
45336 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45337 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45338 mem_base = xmlMemBlocks();
45339 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45340 nargs = gen_int(n_nargs, 1);
45341
45342 xmlXPathLocalNameFunction(ctxt, nargs);
45343 call_tests++;
45344 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45345 des_int(n_nargs, nargs, 1);
45346 xmlResetLastError();
45347 if (mem_base != xmlMemBlocks()) {
45348 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45349 xmlMemBlocks() - mem_base);
45350 test_ret++;
45351 printf(" %d", n_ctxt);
45352 printf(" %d", n_nargs);
45353 printf("\n");
45354 }
45355 }
45356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045357 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045358#endif
45359
Daniel Veillarda82b1822004-11-08 16:24:57 +000045360 return(test_ret);
45361}
45362
45363
45364static int
45365test_xmlXPathModValues(void) {
45366 int test_ret = 0;
45367
William M. Brack21e4ef22005-01-02 09:53:13 +000045368#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045369 int mem_base;
45370 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45371 int n_ctxt;
45372
45373 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45374 mem_base = xmlMemBlocks();
45375 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45376
45377 xmlXPathModValues(ctxt);
45378 call_tests++;
45379 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45380 xmlResetLastError();
45381 if (mem_base != xmlMemBlocks()) {
45382 printf("Leak of %d blocks found in xmlXPathModValues",
45383 xmlMemBlocks() - mem_base);
45384 test_ret++;
45385 printf(" %d", n_ctxt);
45386 printf("\n");
45387 }
45388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045389 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045390#endif
45391
Daniel Veillarda82b1822004-11-08 16:24:57 +000045392 return(test_ret);
45393}
45394
45395
45396static int
45397test_xmlXPathMultValues(void) {
45398 int test_ret = 0;
45399
William M. Brack21e4ef22005-01-02 09:53:13 +000045400#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045401 int mem_base;
45402 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45403 int n_ctxt;
45404
45405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45406 mem_base = xmlMemBlocks();
45407 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45408
45409 xmlXPathMultValues(ctxt);
45410 call_tests++;
45411 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45412 xmlResetLastError();
45413 if (mem_base != xmlMemBlocks()) {
45414 printf("Leak of %d blocks found in xmlXPathMultValues",
45415 xmlMemBlocks() - mem_base);
45416 test_ret++;
45417 printf(" %d", n_ctxt);
45418 printf("\n");
45419 }
45420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045421 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045422#endif
45423
Daniel Veillarda82b1822004-11-08 16:24:57 +000045424 return(test_ret);
45425}
45426
45427
45428static int
45429test_xmlXPathNamespaceURIFunction(void) {
45430 int test_ret = 0;
45431
William M. Brack21e4ef22005-01-02 09:53:13 +000045432#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045433 int mem_base;
45434 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45435 int n_ctxt;
45436 int nargs; /* the number of arguments */
45437 int n_nargs;
45438
45439 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45440 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45441 mem_base = xmlMemBlocks();
45442 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45443 nargs = gen_int(n_nargs, 1);
45444
45445 xmlXPathNamespaceURIFunction(ctxt, nargs);
45446 call_tests++;
45447 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45448 des_int(n_nargs, nargs, 1);
45449 xmlResetLastError();
45450 if (mem_base != xmlMemBlocks()) {
45451 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45452 xmlMemBlocks() - mem_base);
45453 test_ret++;
45454 printf(" %d", n_ctxt);
45455 printf(" %d", n_nargs);
45456 printf("\n");
45457 }
45458 }
45459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045460 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045461#endif
45462
Daniel Veillarda82b1822004-11-08 16:24:57 +000045463 return(test_ret);
45464}
45465
45466
45467static int
45468test_xmlXPathNewBoolean(void) {
45469 int test_ret = 0;
45470
William M. Brack21e4ef22005-01-02 09:53:13 +000045471#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045472 int mem_base;
45473 xmlXPathObjectPtr ret_val;
45474 int val; /* the boolean value */
45475 int n_val;
45476
45477 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45478 mem_base = xmlMemBlocks();
45479 val = gen_int(n_val, 0);
45480
45481 ret_val = xmlXPathNewBoolean(val);
45482 desret_xmlXPathObjectPtr(ret_val);
45483 call_tests++;
45484 des_int(n_val, val, 0);
45485 xmlResetLastError();
45486 if (mem_base != xmlMemBlocks()) {
45487 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45488 xmlMemBlocks() - mem_base);
45489 test_ret++;
45490 printf(" %d", n_val);
45491 printf("\n");
45492 }
45493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045494 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045495#endif
45496
Daniel Veillarda82b1822004-11-08 16:24:57 +000045497 return(test_ret);
45498}
45499
45500
45501static int
45502test_xmlXPathNewCString(void) {
45503 int test_ret = 0;
45504
William M. Brack21e4ef22005-01-02 09:53:13 +000045505#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045506 int mem_base;
45507 xmlXPathObjectPtr ret_val;
45508 char * val; /* the char * value */
45509 int n_val;
45510
45511 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45512 mem_base = xmlMemBlocks();
45513 val = gen_const_char_ptr(n_val, 0);
45514
William M. Brackf13f77f2004-11-12 16:03:48 +000045515 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045516 desret_xmlXPathObjectPtr(ret_val);
45517 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045518 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045519 xmlResetLastError();
45520 if (mem_base != xmlMemBlocks()) {
45521 printf("Leak of %d blocks found in xmlXPathNewCString",
45522 xmlMemBlocks() - mem_base);
45523 test_ret++;
45524 printf(" %d", n_val);
45525 printf("\n");
45526 }
45527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045528 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045529#endif
45530
Daniel Veillarda82b1822004-11-08 16:24:57 +000045531 return(test_ret);
45532}
45533
45534
45535static int
45536test_xmlXPathNewFloat(void) {
45537 int test_ret = 0;
45538
William M. Brack21e4ef22005-01-02 09:53:13 +000045539#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045540 int mem_base;
45541 xmlXPathObjectPtr ret_val;
45542 double val; /* the double value */
45543 int n_val;
45544
45545 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45546 mem_base = xmlMemBlocks();
45547 val = gen_double(n_val, 0);
45548
45549 ret_val = xmlXPathNewFloat(val);
45550 desret_xmlXPathObjectPtr(ret_val);
45551 call_tests++;
45552 des_double(n_val, val, 0);
45553 xmlResetLastError();
45554 if (mem_base != xmlMemBlocks()) {
45555 printf("Leak of %d blocks found in xmlXPathNewFloat",
45556 xmlMemBlocks() - mem_base);
45557 test_ret++;
45558 printf(" %d", n_val);
45559 printf("\n");
45560 }
45561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045562 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045563#endif
45564
Daniel Veillarda82b1822004-11-08 16:24:57 +000045565 return(test_ret);
45566}
45567
45568
45569static int
45570test_xmlXPathNewNodeSet(void) {
45571 int test_ret = 0;
45572
William M. Brack21e4ef22005-01-02 09:53:13 +000045573#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045574 int mem_base;
45575 xmlXPathObjectPtr ret_val;
45576 xmlNodePtr val; /* the NodePtr value */
45577 int n_val;
45578
45579 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45580 mem_base = xmlMemBlocks();
45581 val = gen_xmlNodePtr(n_val, 0);
45582
45583 ret_val = xmlXPathNewNodeSet(val);
45584 desret_xmlXPathObjectPtr(ret_val);
45585 call_tests++;
45586 des_xmlNodePtr(n_val, val, 0);
45587 xmlResetLastError();
45588 if (mem_base != xmlMemBlocks()) {
45589 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45590 xmlMemBlocks() - mem_base);
45591 test_ret++;
45592 printf(" %d", n_val);
45593 printf("\n");
45594 }
45595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045596 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045597#endif
45598
Daniel Veillarda82b1822004-11-08 16:24:57 +000045599 return(test_ret);
45600}
45601
45602
45603static int
45604test_xmlXPathNewNodeSetList(void) {
45605 int test_ret = 0;
45606
William M. Brack21e4ef22005-01-02 09:53:13 +000045607#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045608 int mem_base;
45609 xmlXPathObjectPtr ret_val;
45610 xmlNodeSetPtr val; /* an existing NodeSet */
45611 int n_val;
45612
45613 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45614 mem_base = xmlMemBlocks();
45615 val = gen_xmlNodeSetPtr(n_val, 0);
45616
45617 ret_val = xmlXPathNewNodeSetList(val);
45618 desret_xmlXPathObjectPtr(ret_val);
45619 call_tests++;
45620 des_xmlNodeSetPtr(n_val, val, 0);
45621 xmlResetLastError();
45622 if (mem_base != xmlMemBlocks()) {
45623 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45624 xmlMemBlocks() - mem_base);
45625 test_ret++;
45626 printf(" %d", n_val);
45627 printf("\n");
45628 }
45629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045630 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045631#endif
45632
Daniel Veillarda82b1822004-11-08 16:24:57 +000045633 return(test_ret);
45634}
45635
45636
45637static int
45638test_xmlXPathNewParserContext(void) {
45639 int test_ret = 0;
45640
45641
45642 /* missing type support */
45643 return(test_ret);
45644}
45645
45646
45647static int
45648test_xmlXPathNewString(void) {
45649 int test_ret = 0;
45650
William M. Brack21e4ef22005-01-02 09:53:13 +000045651#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045652 int mem_base;
45653 xmlXPathObjectPtr ret_val;
45654 xmlChar * val; /* the xmlChar * value */
45655 int n_val;
45656
45657 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45658 mem_base = xmlMemBlocks();
45659 val = gen_const_xmlChar_ptr(n_val, 0);
45660
William M. Brackf13f77f2004-11-12 16:03:48 +000045661 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045662 desret_xmlXPathObjectPtr(ret_val);
45663 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045664 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045665 xmlResetLastError();
45666 if (mem_base != xmlMemBlocks()) {
45667 printf("Leak of %d blocks found in xmlXPathNewString",
45668 xmlMemBlocks() - mem_base);
45669 test_ret++;
45670 printf(" %d", n_val);
45671 printf("\n");
45672 }
45673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045674 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045675#endif
45676
Daniel Veillarda82b1822004-11-08 16:24:57 +000045677 return(test_ret);
45678}
45679
45680
45681static int
45682test_xmlXPathNextAncestor(void) {
45683 int test_ret = 0;
45684
William M. Brack21e4ef22005-01-02 09:53:13 +000045685#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045686 int mem_base;
45687 xmlNodePtr ret_val;
45688 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45689 int n_ctxt;
45690 xmlNodePtr cur; /* the current node in the traversal */
45691 int n_cur;
45692
45693 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45694 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45695 mem_base = xmlMemBlocks();
45696 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45697 cur = gen_xmlNodePtr(n_cur, 1);
45698
45699 ret_val = xmlXPathNextAncestor(ctxt, cur);
45700 desret_xmlNodePtr(ret_val);
45701 call_tests++;
45702 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45703 des_xmlNodePtr(n_cur, cur, 1);
45704 xmlResetLastError();
45705 if (mem_base != xmlMemBlocks()) {
45706 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45707 xmlMemBlocks() - mem_base);
45708 test_ret++;
45709 printf(" %d", n_ctxt);
45710 printf(" %d", n_cur);
45711 printf("\n");
45712 }
45713 }
45714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045715 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045716#endif
45717
Daniel Veillarda82b1822004-11-08 16:24:57 +000045718 return(test_ret);
45719}
45720
45721
45722static int
45723test_xmlXPathNextAncestorOrSelf(void) {
45724 int test_ret = 0;
45725
William M. Brack21e4ef22005-01-02 09:53:13 +000045726#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045727 int mem_base;
45728 xmlNodePtr ret_val;
45729 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45730 int n_ctxt;
45731 xmlNodePtr cur; /* the current node in the traversal */
45732 int n_cur;
45733
45734 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45735 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45736 mem_base = xmlMemBlocks();
45737 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45738 cur = gen_xmlNodePtr(n_cur, 1);
45739
45740 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45741 desret_xmlNodePtr(ret_val);
45742 call_tests++;
45743 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45744 des_xmlNodePtr(n_cur, cur, 1);
45745 xmlResetLastError();
45746 if (mem_base != xmlMemBlocks()) {
45747 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45748 xmlMemBlocks() - mem_base);
45749 test_ret++;
45750 printf(" %d", n_ctxt);
45751 printf(" %d", n_cur);
45752 printf("\n");
45753 }
45754 }
45755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045756 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045757#endif
45758
Daniel Veillarda82b1822004-11-08 16:24:57 +000045759 return(test_ret);
45760}
45761
45762
45763static int
45764test_xmlXPathNextAttribute(void) {
45765 int test_ret = 0;
45766
William M. Brack21e4ef22005-01-02 09:53:13 +000045767#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045768 int mem_base;
45769 xmlNodePtr ret_val;
45770 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45771 int n_ctxt;
45772 xmlNodePtr cur; /* the current attribute in the traversal */
45773 int n_cur;
45774
45775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45776 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45777 mem_base = xmlMemBlocks();
45778 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45779 cur = gen_xmlNodePtr(n_cur, 1);
45780
45781 ret_val = xmlXPathNextAttribute(ctxt, cur);
45782 desret_xmlNodePtr(ret_val);
45783 call_tests++;
45784 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45785 des_xmlNodePtr(n_cur, cur, 1);
45786 xmlResetLastError();
45787 if (mem_base != xmlMemBlocks()) {
45788 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45789 xmlMemBlocks() - mem_base);
45790 test_ret++;
45791 printf(" %d", n_ctxt);
45792 printf(" %d", n_cur);
45793 printf("\n");
45794 }
45795 }
45796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045797 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045798#endif
45799
Daniel Veillarda82b1822004-11-08 16:24:57 +000045800 return(test_ret);
45801}
45802
45803
45804static int
45805test_xmlXPathNextChild(void) {
45806 int test_ret = 0;
45807
William M. Brack21e4ef22005-01-02 09:53:13 +000045808#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045809 int mem_base;
45810 xmlNodePtr ret_val;
45811 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45812 int n_ctxt;
45813 xmlNodePtr cur; /* the current node in the traversal */
45814 int n_cur;
45815
45816 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45817 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45818 mem_base = xmlMemBlocks();
45819 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45820 cur = gen_xmlNodePtr(n_cur, 1);
45821
45822 ret_val = xmlXPathNextChild(ctxt, cur);
45823 desret_xmlNodePtr(ret_val);
45824 call_tests++;
45825 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45826 des_xmlNodePtr(n_cur, cur, 1);
45827 xmlResetLastError();
45828 if (mem_base != xmlMemBlocks()) {
45829 printf("Leak of %d blocks found in xmlXPathNextChild",
45830 xmlMemBlocks() - mem_base);
45831 test_ret++;
45832 printf(" %d", n_ctxt);
45833 printf(" %d", n_cur);
45834 printf("\n");
45835 }
45836 }
45837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045838 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045839#endif
45840
Daniel Veillarda82b1822004-11-08 16:24:57 +000045841 return(test_ret);
45842}
45843
45844
45845static int
45846test_xmlXPathNextDescendant(void) {
45847 int test_ret = 0;
45848
William M. Brack21e4ef22005-01-02 09:53:13 +000045849#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045850 int mem_base;
45851 xmlNodePtr ret_val;
45852 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45853 int n_ctxt;
45854 xmlNodePtr cur; /* the current node in the traversal */
45855 int n_cur;
45856
45857 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45858 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45859 mem_base = xmlMemBlocks();
45860 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45861 cur = gen_xmlNodePtr(n_cur, 1);
45862
45863 ret_val = xmlXPathNextDescendant(ctxt, cur);
45864 desret_xmlNodePtr(ret_val);
45865 call_tests++;
45866 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45867 des_xmlNodePtr(n_cur, cur, 1);
45868 xmlResetLastError();
45869 if (mem_base != xmlMemBlocks()) {
45870 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45871 xmlMemBlocks() - mem_base);
45872 test_ret++;
45873 printf(" %d", n_ctxt);
45874 printf(" %d", n_cur);
45875 printf("\n");
45876 }
45877 }
45878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045879 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045880#endif
45881
Daniel Veillarda82b1822004-11-08 16:24:57 +000045882 return(test_ret);
45883}
45884
45885
45886static int
45887test_xmlXPathNextDescendantOrSelf(void) {
45888 int test_ret = 0;
45889
William M. Brack21e4ef22005-01-02 09:53:13 +000045890#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045891 int mem_base;
45892 xmlNodePtr ret_val;
45893 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45894 int n_ctxt;
45895 xmlNodePtr cur; /* the current node in the traversal */
45896 int n_cur;
45897
45898 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45899 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45900 mem_base = xmlMemBlocks();
45901 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45902 cur = gen_xmlNodePtr(n_cur, 1);
45903
45904 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45905 desret_xmlNodePtr(ret_val);
45906 call_tests++;
45907 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45908 des_xmlNodePtr(n_cur, cur, 1);
45909 xmlResetLastError();
45910 if (mem_base != xmlMemBlocks()) {
45911 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45912 xmlMemBlocks() - mem_base);
45913 test_ret++;
45914 printf(" %d", n_ctxt);
45915 printf(" %d", n_cur);
45916 printf("\n");
45917 }
45918 }
45919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045920 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045921#endif
45922
Daniel Veillarda82b1822004-11-08 16:24:57 +000045923 return(test_ret);
45924}
45925
45926
45927static int
45928test_xmlXPathNextFollowing(void) {
45929 int test_ret = 0;
45930
William M. Brack21e4ef22005-01-02 09:53:13 +000045931#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045932 int mem_base;
45933 xmlNodePtr ret_val;
45934 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45935 int n_ctxt;
45936 xmlNodePtr cur; /* the current node in the traversal */
45937 int n_cur;
45938
45939 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45940 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45941 mem_base = xmlMemBlocks();
45942 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45943 cur = gen_xmlNodePtr(n_cur, 1);
45944
45945 ret_val = xmlXPathNextFollowing(ctxt, cur);
45946 desret_xmlNodePtr(ret_val);
45947 call_tests++;
45948 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45949 des_xmlNodePtr(n_cur, cur, 1);
45950 xmlResetLastError();
45951 if (mem_base != xmlMemBlocks()) {
45952 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45953 xmlMemBlocks() - mem_base);
45954 test_ret++;
45955 printf(" %d", n_ctxt);
45956 printf(" %d", n_cur);
45957 printf("\n");
45958 }
45959 }
45960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045961 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045962#endif
45963
Daniel Veillarda82b1822004-11-08 16:24:57 +000045964 return(test_ret);
45965}
45966
45967
45968static int
45969test_xmlXPathNextFollowingSibling(void) {
45970 int test_ret = 0;
45971
William M. Brack21e4ef22005-01-02 09:53:13 +000045972#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045973 int mem_base;
45974 xmlNodePtr ret_val;
45975 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45976 int n_ctxt;
45977 xmlNodePtr cur; /* the current node in the traversal */
45978 int n_cur;
45979
45980 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45981 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45982 mem_base = xmlMemBlocks();
45983 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45984 cur = gen_xmlNodePtr(n_cur, 1);
45985
45986 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45987 desret_xmlNodePtr(ret_val);
45988 call_tests++;
45989 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45990 des_xmlNodePtr(n_cur, cur, 1);
45991 xmlResetLastError();
45992 if (mem_base != xmlMemBlocks()) {
45993 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45994 xmlMemBlocks() - mem_base);
45995 test_ret++;
45996 printf(" %d", n_ctxt);
45997 printf(" %d", n_cur);
45998 printf("\n");
45999 }
46000 }
46001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046002 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046003#endif
46004
Daniel Veillarda82b1822004-11-08 16:24:57 +000046005 return(test_ret);
46006}
46007
46008
46009static int
46010test_xmlXPathNextNamespace(void) {
46011 int test_ret = 0;
46012
William M. Brack21e4ef22005-01-02 09:53:13 +000046013#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046014 int mem_base;
46015 xmlNodePtr ret_val;
46016 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46017 int n_ctxt;
46018 xmlNodePtr cur; /* the current attribute in the traversal */
46019 int n_cur;
46020
46021 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46022 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46023 mem_base = xmlMemBlocks();
46024 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46025 cur = gen_xmlNodePtr(n_cur, 1);
46026
46027 ret_val = xmlXPathNextNamespace(ctxt, cur);
46028 desret_xmlNodePtr(ret_val);
46029 call_tests++;
46030 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46031 des_xmlNodePtr(n_cur, cur, 1);
46032 xmlResetLastError();
46033 if (mem_base != xmlMemBlocks()) {
46034 printf("Leak of %d blocks found in xmlXPathNextNamespace",
46035 xmlMemBlocks() - mem_base);
46036 test_ret++;
46037 printf(" %d", n_ctxt);
46038 printf(" %d", n_cur);
46039 printf("\n");
46040 }
46041 }
46042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046043 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046044#endif
46045
Daniel Veillarda82b1822004-11-08 16:24:57 +000046046 return(test_ret);
46047}
46048
46049
46050static int
46051test_xmlXPathNextParent(void) {
46052 int test_ret = 0;
46053
William M. Brack21e4ef22005-01-02 09:53:13 +000046054#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046055 int mem_base;
46056 xmlNodePtr ret_val;
46057 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46058 int n_ctxt;
46059 xmlNodePtr cur; /* the current node in the traversal */
46060 int n_cur;
46061
46062 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46063 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46064 mem_base = xmlMemBlocks();
46065 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46066 cur = gen_xmlNodePtr(n_cur, 1);
46067
46068 ret_val = xmlXPathNextParent(ctxt, cur);
46069 desret_xmlNodePtr(ret_val);
46070 call_tests++;
46071 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46072 des_xmlNodePtr(n_cur, cur, 1);
46073 xmlResetLastError();
46074 if (mem_base != xmlMemBlocks()) {
46075 printf("Leak of %d blocks found in xmlXPathNextParent",
46076 xmlMemBlocks() - mem_base);
46077 test_ret++;
46078 printf(" %d", n_ctxt);
46079 printf(" %d", n_cur);
46080 printf("\n");
46081 }
46082 }
46083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046084 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046085#endif
46086
Daniel Veillarda82b1822004-11-08 16:24:57 +000046087 return(test_ret);
46088}
46089
46090
46091static int
46092test_xmlXPathNextPreceding(void) {
46093 int test_ret = 0;
46094
William M. Brack21e4ef22005-01-02 09:53:13 +000046095#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046096 int mem_base;
46097 xmlNodePtr ret_val;
46098 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46099 int n_ctxt;
46100 xmlNodePtr cur; /* the current node in the traversal */
46101 int n_cur;
46102
46103 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46104 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46105 mem_base = xmlMemBlocks();
46106 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46107 cur = gen_xmlNodePtr(n_cur, 1);
46108
46109 ret_val = xmlXPathNextPreceding(ctxt, cur);
46110 desret_xmlNodePtr(ret_val);
46111 call_tests++;
46112 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46113 des_xmlNodePtr(n_cur, cur, 1);
46114 xmlResetLastError();
46115 if (mem_base != xmlMemBlocks()) {
46116 printf("Leak of %d blocks found in xmlXPathNextPreceding",
46117 xmlMemBlocks() - mem_base);
46118 test_ret++;
46119 printf(" %d", n_ctxt);
46120 printf(" %d", n_cur);
46121 printf("\n");
46122 }
46123 }
46124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046125 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046126#endif
46127
Daniel Veillarda82b1822004-11-08 16:24:57 +000046128 return(test_ret);
46129}
46130
46131
46132static int
46133test_xmlXPathNextPrecedingSibling(void) {
46134 int test_ret = 0;
46135
William M. Brack21e4ef22005-01-02 09:53:13 +000046136#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046137 int mem_base;
46138 xmlNodePtr ret_val;
46139 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46140 int n_ctxt;
46141 xmlNodePtr cur; /* the current node in the traversal */
46142 int n_cur;
46143
46144 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46145 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46146 mem_base = xmlMemBlocks();
46147 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46148 cur = gen_xmlNodePtr(n_cur, 1);
46149
46150 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
46151 desret_xmlNodePtr(ret_val);
46152 call_tests++;
46153 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46154 des_xmlNodePtr(n_cur, cur, 1);
46155 xmlResetLastError();
46156 if (mem_base != xmlMemBlocks()) {
46157 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
46158 xmlMemBlocks() - mem_base);
46159 test_ret++;
46160 printf(" %d", n_ctxt);
46161 printf(" %d", n_cur);
46162 printf("\n");
46163 }
46164 }
46165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046166 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046167#endif
46168
Daniel Veillarda82b1822004-11-08 16:24:57 +000046169 return(test_ret);
46170}
46171
46172
46173static int
46174test_xmlXPathNextSelf(void) {
46175 int test_ret = 0;
46176
William M. Brack21e4ef22005-01-02 09:53:13 +000046177#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046178 int mem_base;
46179 xmlNodePtr ret_val;
46180 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46181 int n_ctxt;
46182 xmlNodePtr cur; /* the current node in the traversal */
46183 int n_cur;
46184
46185 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46186 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46187 mem_base = xmlMemBlocks();
46188 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46189 cur = gen_xmlNodePtr(n_cur, 1);
46190
46191 ret_val = xmlXPathNextSelf(ctxt, cur);
46192 desret_xmlNodePtr(ret_val);
46193 call_tests++;
46194 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46195 des_xmlNodePtr(n_cur, cur, 1);
46196 xmlResetLastError();
46197 if (mem_base != xmlMemBlocks()) {
46198 printf("Leak of %d blocks found in xmlXPathNextSelf",
46199 xmlMemBlocks() - mem_base);
46200 test_ret++;
46201 printf(" %d", n_ctxt);
46202 printf(" %d", n_cur);
46203 printf("\n");
46204 }
46205 }
46206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046207 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046208#endif
46209
Daniel Veillarda82b1822004-11-08 16:24:57 +000046210 return(test_ret);
46211}
46212
46213
46214static int
46215test_xmlXPathNodeLeading(void) {
46216 int test_ret = 0;
46217
William M. Brack21e4ef22005-01-02 09:53:13 +000046218#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046219 int mem_base;
46220 xmlNodeSetPtr ret_val;
46221 xmlNodeSetPtr nodes; /* a node-set */
46222 int n_nodes;
46223 xmlNodePtr node; /* a node */
46224 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046225
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046226 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46227 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46228 mem_base = xmlMemBlocks();
46229 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46230 node = gen_xmlNodePtr(n_node, 1);
46231
46232 ret_val = xmlXPathNodeLeading(nodes, node);
46233 desret_xmlNodeSetPtr(ret_val);
46234 call_tests++;
46235 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46236 des_xmlNodePtr(n_node, node, 1);
46237 xmlResetLastError();
46238 if (mem_base != xmlMemBlocks()) {
46239 printf("Leak of %d blocks found in xmlXPathNodeLeading",
46240 xmlMemBlocks() - mem_base);
46241 test_ret++;
46242 printf(" %d", n_nodes);
46243 printf(" %d", n_node);
46244 printf("\n");
46245 }
46246 }
46247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046248 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046249#endif
46250
Daniel Veillarda82b1822004-11-08 16:24:57 +000046251 return(test_ret);
46252}
46253
46254
46255static int
46256test_xmlXPathNodeLeadingSorted(void) {
46257 int test_ret = 0;
46258
William M. Brack21e4ef22005-01-02 09:53:13 +000046259#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046260 int mem_base;
46261 xmlNodeSetPtr ret_val;
46262 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46263 int n_nodes;
46264 xmlNodePtr node; /* a node */
46265 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046266
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046267 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46268 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46269 mem_base = xmlMemBlocks();
46270 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46271 node = gen_xmlNodePtr(n_node, 1);
46272
46273 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
46274 desret_xmlNodeSetPtr(ret_val);
46275 call_tests++;
46276 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46277 des_xmlNodePtr(n_node, node, 1);
46278 xmlResetLastError();
46279 if (mem_base != xmlMemBlocks()) {
46280 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
46281 xmlMemBlocks() - mem_base);
46282 test_ret++;
46283 printf(" %d", n_nodes);
46284 printf(" %d", n_node);
46285 printf("\n");
46286 }
46287 }
46288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046289 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046290#endif
46291
Daniel Veillarda82b1822004-11-08 16:24:57 +000046292 return(test_ret);
46293}
46294
46295
46296static int
46297test_xmlXPathNodeSetAdd(void) {
46298 int test_ret = 0;
46299
William M. Brack21e4ef22005-01-02 09:53:13 +000046300#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046301 int mem_base;
46302 xmlNodeSetPtr cur; /* the initial node set */
46303 int n_cur;
46304 xmlNodePtr val; /* a new xmlNodePtr */
46305 int n_val;
46306
46307 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46308 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46309 mem_base = xmlMemBlocks();
46310 cur = gen_xmlNodeSetPtr(n_cur, 0);
46311 val = gen_xmlNodePtr(n_val, 1);
46312
46313 xmlXPathNodeSetAdd(cur, val);
46314 call_tests++;
46315 des_xmlNodeSetPtr(n_cur, cur, 0);
46316 des_xmlNodePtr(n_val, val, 1);
46317 xmlResetLastError();
46318 if (mem_base != xmlMemBlocks()) {
46319 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46320 xmlMemBlocks() - mem_base);
46321 test_ret++;
46322 printf(" %d", n_cur);
46323 printf(" %d", n_val);
46324 printf("\n");
46325 }
46326 }
46327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046328 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046329#endif
46330
Daniel Veillarda82b1822004-11-08 16:24:57 +000046331 return(test_ret);
46332}
46333
46334
46335static int
46336test_xmlXPathNodeSetAddNs(void) {
46337 int test_ret = 0;
46338
William M. Brack21e4ef22005-01-02 09:53:13 +000046339#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046340 int mem_base;
46341 xmlNodeSetPtr cur; /* the initial node set */
46342 int n_cur;
46343 xmlNodePtr node; /* the hosting node */
46344 int n_node;
46345 xmlNsPtr ns; /* a the namespace node */
46346 int n_ns;
46347
46348 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46349 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46350 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46351 mem_base = xmlMemBlocks();
46352 cur = gen_xmlNodeSetPtr(n_cur, 0);
46353 node = gen_xmlNodePtr(n_node, 1);
46354 ns = gen_xmlNsPtr(n_ns, 2);
46355
46356 xmlXPathNodeSetAddNs(cur, node, ns);
46357 call_tests++;
46358 des_xmlNodeSetPtr(n_cur, cur, 0);
46359 des_xmlNodePtr(n_node, node, 1);
46360 des_xmlNsPtr(n_ns, ns, 2);
46361 xmlResetLastError();
46362 if (mem_base != xmlMemBlocks()) {
46363 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46364 xmlMemBlocks() - mem_base);
46365 test_ret++;
46366 printf(" %d", n_cur);
46367 printf(" %d", n_node);
46368 printf(" %d", n_ns);
46369 printf("\n");
46370 }
46371 }
46372 }
46373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046374 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046375#endif
46376
Daniel Veillarda82b1822004-11-08 16:24:57 +000046377 return(test_ret);
46378}
46379
46380
46381static int
46382test_xmlXPathNodeSetAddUnique(void) {
46383 int test_ret = 0;
46384
William M. Brack21e4ef22005-01-02 09:53:13 +000046385#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046386 int mem_base;
46387 xmlNodeSetPtr cur; /* the initial node set */
46388 int n_cur;
46389 xmlNodePtr val; /* a new xmlNodePtr */
46390 int n_val;
46391
46392 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46393 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46394 mem_base = xmlMemBlocks();
46395 cur = gen_xmlNodeSetPtr(n_cur, 0);
46396 val = gen_xmlNodePtr(n_val, 1);
46397
46398 xmlXPathNodeSetAddUnique(cur, val);
46399 call_tests++;
46400 des_xmlNodeSetPtr(n_cur, cur, 0);
46401 des_xmlNodePtr(n_val, val, 1);
46402 xmlResetLastError();
46403 if (mem_base != xmlMemBlocks()) {
46404 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46405 xmlMemBlocks() - mem_base);
46406 test_ret++;
46407 printf(" %d", n_cur);
46408 printf(" %d", n_val);
46409 printf("\n");
46410 }
46411 }
46412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046413 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046414#endif
46415
Daniel Veillarda82b1822004-11-08 16:24:57 +000046416 return(test_ret);
46417}
46418
46419
46420static int
46421test_xmlXPathNodeSetContains(void) {
46422 int test_ret = 0;
46423
William M. Brack21e4ef22005-01-02 09:53:13 +000046424#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046425 int mem_base;
46426 int ret_val;
46427 xmlNodeSetPtr cur; /* the node-set */
46428 int n_cur;
46429 xmlNodePtr val; /* the node */
46430 int n_val;
46431
46432 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46433 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46434 mem_base = xmlMemBlocks();
46435 cur = gen_xmlNodeSetPtr(n_cur, 0);
46436 val = gen_xmlNodePtr(n_val, 1);
46437
46438 ret_val = xmlXPathNodeSetContains(cur, val);
46439 desret_int(ret_val);
46440 call_tests++;
46441 des_xmlNodeSetPtr(n_cur, cur, 0);
46442 des_xmlNodePtr(n_val, val, 1);
46443 xmlResetLastError();
46444 if (mem_base != xmlMemBlocks()) {
46445 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46446 xmlMemBlocks() - mem_base);
46447 test_ret++;
46448 printf(" %d", n_cur);
46449 printf(" %d", n_val);
46450 printf("\n");
46451 }
46452 }
46453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046454 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046455#endif
46456
Daniel Veillarda82b1822004-11-08 16:24:57 +000046457 return(test_ret);
46458}
46459
46460
46461static int
46462test_xmlXPathNodeSetDel(void) {
46463 int test_ret = 0;
46464
William M. Brack21e4ef22005-01-02 09:53:13 +000046465#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046466 int mem_base;
46467 xmlNodeSetPtr cur; /* the initial node set */
46468 int n_cur;
46469 xmlNodePtr val; /* an xmlNodePtr */
46470 int n_val;
46471
46472 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46473 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46474 mem_base = xmlMemBlocks();
46475 cur = gen_xmlNodeSetPtr(n_cur, 0);
46476 val = gen_xmlNodePtr(n_val, 1);
46477
46478 xmlXPathNodeSetDel(cur, val);
46479 call_tests++;
46480 des_xmlNodeSetPtr(n_cur, cur, 0);
46481 des_xmlNodePtr(n_val, val, 1);
46482 xmlResetLastError();
46483 if (mem_base != xmlMemBlocks()) {
46484 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46485 xmlMemBlocks() - mem_base);
46486 test_ret++;
46487 printf(" %d", n_cur);
46488 printf(" %d", n_val);
46489 printf("\n");
46490 }
46491 }
46492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046493 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046494#endif
46495
Daniel Veillarda82b1822004-11-08 16:24:57 +000046496 return(test_ret);
46497}
46498
46499
46500static int
46501test_xmlXPathNodeSetMerge(void) {
46502 int test_ret = 0;
46503
William M. Brack21e4ef22005-01-02 09:53:13 +000046504#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046505 int mem_base;
46506 xmlNodeSetPtr ret_val;
46507 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46508 int n_val1;
46509 xmlNodeSetPtr val2; /* the second NodeSet */
46510 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046511
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046512 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46513 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46514 mem_base = xmlMemBlocks();
46515 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46516 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46517
46518 ret_val = xmlXPathNodeSetMerge(val1, val2);
46519 desret_xmlNodeSetPtr(ret_val);
46520 call_tests++;
46521 des_xmlNodeSetPtr(n_val1, val1, 0);
46522 des_xmlNodeSetPtr(n_val2, val2, 1);
46523 xmlResetLastError();
46524 if (mem_base != xmlMemBlocks()) {
46525 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46526 xmlMemBlocks() - mem_base);
46527 test_ret++;
46528 printf(" %d", n_val1);
46529 printf(" %d", n_val2);
46530 printf("\n");
46531 }
46532 }
46533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046534 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046535#endif
46536
Daniel Veillarda82b1822004-11-08 16:24:57 +000046537 return(test_ret);
46538}
46539
46540
46541static int
46542test_xmlXPathNodeSetRemove(void) {
46543 int test_ret = 0;
46544
William M. Brack21e4ef22005-01-02 09:53:13 +000046545#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046546 int mem_base;
46547 xmlNodeSetPtr cur; /* the initial node set */
46548 int n_cur;
46549 int val; /* the index to remove */
46550 int n_val;
46551
46552 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46553 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46554 mem_base = xmlMemBlocks();
46555 cur = gen_xmlNodeSetPtr(n_cur, 0);
46556 val = gen_int(n_val, 1);
46557
46558 xmlXPathNodeSetRemove(cur, val);
46559 call_tests++;
46560 des_xmlNodeSetPtr(n_cur, cur, 0);
46561 des_int(n_val, val, 1);
46562 xmlResetLastError();
46563 if (mem_base != xmlMemBlocks()) {
46564 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46565 xmlMemBlocks() - mem_base);
46566 test_ret++;
46567 printf(" %d", n_cur);
46568 printf(" %d", n_val);
46569 printf("\n");
46570 }
46571 }
46572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046573 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046574#endif
46575
Daniel Veillarda82b1822004-11-08 16:24:57 +000046576 return(test_ret);
46577}
46578
46579
46580static int
46581test_xmlXPathNodeSetSort(void) {
46582 int test_ret = 0;
46583
William M. Brack21e4ef22005-01-02 09:53:13 +000046584#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046585 int mem_base;
46586 xmlNodeSetPtr set; /* the node set */
46587 int n_set;
46588
46589 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46590 mem_base = xmlMemBlocks();
46591 set = gen_xmlNodeSetPtr(n_set, 0);
46592
46593 xmlXPathNodeSetSort(set);
46594 call_tests++;
46595 des_xmlNodeSetPtr(n_set, set, 0);
46596 xmlResetLastError();
46597 if (mem_base != xmlMemBlocks()) {
46598 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46599 xmlMemBlocks() - mem_base);
46600 test_ret++;
46601 printf(" %d", n_set);
46602 printf("\n");
46603 }
46604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046605 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046606#endif
46607
Daniel Veillarda82b1822004-11-08 16:24:57 +000046608 return(test_ret);
46609}
46610
46611
46612static int
46613test_xmlXPathNodeTrailing(void) {
46614 int test_ret = 0;
46615
William M. Brack21e4ef22005-01-02 09:53:13 +000046616#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046617 int mem_base;
46618 xmlNodeSetPtr ret_val;
46619 xmlNodeSetPtr nodes; /* a node-set */
46620 int n_nodes;
46621 xmlNodePtr node; /* a node */
46622 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046623
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046624 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46625 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46626 mem_base = xmlMemBlocks();
46627 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46628 node = gen_xmlNodePtr(n_node, 1);
46629
46630 ret_val = xmlXPathNodeTrailing(nodes, node);
46631 desret_xmlNodeSetPtr(ret_val);
46632 call_tests++;
46633 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46634 des_xmlNodePtr(n_node, node, 1);
46635 xmlResetLastError();
46636 if (mem_base != xmlMemBlocks()) {
46637 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46638 xmlMemBlocks() - mem_base);
46639 test_ret++;
46640 printf(" %d", n_nodes);
46641 printf(" %d", n_node);
46642 printf("\n");
46643 }
46644 }
46645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046646 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046647#endif
46648
Daniel Veillarda82b1822004-11-08 16:24:57 +000046649 return(test_ret);
46650}
46651
46652
46653static int
46654test_xmlXPathNodeTrailingSorted(void) {
46655 int test_ret = 0;
46656
William M. Brack21e4ef22005-01-02 09:53:13 +000046657#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046658 int mem_base;
46659 xmlNodeSetPtr ret_val;
46660 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46661 int n_nodes;
46662 xmlNodePtr node; /* a node */
46663 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046664
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046665 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46666 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46667 mem_base = xmlMemBlocks();
46668 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46669 node = gen_xmlNodePtr(n_node, 1);
46670
46671 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46672 desret_xmlNodeSetPtr(ret_val);
46673 call_tests++;
46674 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46675 des_xmlNodePtr(n_node, node, 1);
46676 xmlResetLastError();
46677 if (mem_base != xmlMemBlocks()) {
46678 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46679 xmlMemBlocks() - mem_base);
46680 test_ret++;
46681 printf(" %d", n_nodes);
46682 printf(" %d", n_node);
46683 printf("\n");
46684 }
46685 }
46686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046687 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046688#endif
46689
Daniel Veillarda82b1822004-11-08 16:24:57 +000046690 return(test_ret);
46691}
46692
46693
46694static int
46695test_xmlXPathNormalizeFunction(void) {
46696 int test_ret = 0;
46697
William M. Brack21e4ef22005-01-02 09:53:13 +000046698#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046699 int mem_base;
46700 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46701 int n_ctxt;
46702 int nargs; /* the number of arguments */
46703 int n_nargs;
46704
46705 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46706 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46707 mem_base = xmlMemBlocks();
46708 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46709 nargs = gen_int(n_nargs, 1);
46710
46711 xmlXPathNormalizeFunction(ctxt, nargs);
46712 call_tests++;
46713 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46714 des_int(n_nargs, nargs, 1);
46715 xmlResetLastError();
46716 if (mem_base != xmlMemBlocks()) {
46717 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46718 xmlMemBlocks() - mem_base);
46719 test_ret++;
46720 printf(" %d", n_ctxt);
46721 printf(" %d", n_nargs);
46722 printf("\n");
46723 }
46724 }
46725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046726 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046727#endif
46728
Daniel Veillarda82b1822004-11-08 16:24:57 +000046729 return(test_ret);
46730}
46731
46732
46733static int
46734test_xmlXPathNotEqualValues(void) {
46735 int test_ret = 0;
46736
William M. Brack21e4ef22005-01-02 09:53:13 +000046737#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046738 int mem_base;
46739 int ret_val;
46740 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46741 int n_ctxt;
46742
46743 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46744 mem_base = xmlMemBlocks();
46745 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46746
46747 ret_val = xmlXPathNotEqualValues(ctxt);
46748 desret_int(ret_val);
46749 call_tests++;
46750 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46751 xmlResetLastError();
46752 if (mem_base != xmlMemBlocks()) {
46753 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46754 xmlMemBlocks() - mem_base);
46755 test_ret++;
46756 printf(" %d", n_ctxt);
46757 printf("\n");
46758 }
46759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046760 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761#endif
46762
Daniel Veillarda82b1822004-11-08 16:24:57 +000046763 return(test_ret);
46764}
46765
46766
46767static int
46768test_xmlXPathNotFunction(void) {
46769 int test_ret = 0;
46770
William M. Brack21e4ef22005-01-02 09:53:13 +000046771#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046772 int mem_base;
46773 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46774 int n_ctxt;
46775 int nargs; /* the number of arguments */
46776 int n_nargs;
46777
46778 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46779 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46780 mem_base = xmlMemBlocks();
46781 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46782 nargs = gen_int(n_nargs, 1);
46783
46784 xmlXPathNotFunction(ctxt, nargs);
46785 call_tests++;
46786 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46787 des_int(n_nargs, nargs, 1);
46788 xmlResetLastError();
46789 if (mem_base != xmlMemBlocks()) {
46790 printf("Leak of %d blocks found in xmlXPathNotFunction",
46791 xmlMemBlocks() - mem_base);
46792 test_ret++;
46793 printf(" %d", n_ctxt);
46794 printf(" %d", n_nargs);
46795 printf("\n");
46796 }
46797 }
46798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046799 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046800#endif
46801
Daniel Veillarda82b1822004-11-08 16:24:57 +000046802 return(test_ret);
46803}
46804
46805
46806static int
46807test_xmlXPathNsLookup(void) {
46808 int test_ret = 0;
46809
William M. Brack21e4ef22005-01-02 09:53:13 +000046810#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046811 int mem_base;
46812 const xmlChar * ret_val;
46813 xmlXPathContextPtr ctxt; /* the XPath context */
46814 int n_ctxt;
46815 xmlChar * prefix; /* the namespace prefix value */
46816 int n_prefix;
46817
46818 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46819 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46820 mem_base = xmlMemBlocks();
46821 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46822 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46823
William M. Brackf13f77f2004-11-12 16:03:48 +000046824 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046825 desret_const_xmlChar_ptr(ret_val);
46826 call_tests++;
46827 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046828 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046829 xmlResetLastError();
46830 if (mem_base != xmlMemBlocks()) {
46831 printf("Leak of %d blocks found in xmlXPathNsLookup",
46832 xmlMemBlocks() - mem_base);
46833 test_ret++;
46834 printf(" %d", n_ctxt);
46835 printf(" %d", n_prefix);
46836 printf("\n");
46837 }
46838 }
46839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046840 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046841#endif
46842
Daniel Veillarda82b1822004-11-08 16:24:57 +000046843 return(test_ret);
46844}
46845
46846
46847static int
46848test_xmlXPathNumberFunction(void) {
46849 int test_ret = 0;
46850
William M. Brack21e4ef22005-01-02 09:53:13 +000046851#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046852 int mem_base;
46853 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46854 int n_ctxt;
46855 int nargs; /* the number of arguments */
46856 int n_nargs;
46857
46858 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46859 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46860 mem_base = xmlMemBlocks();
46861 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46862 nargs = gen_int(n_nargs, 1);
46863
46864 xmlXPathNumberFunction(ctxt, nargs);
46865 call_tests++;
46866 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46867 des_int(n_nargs, nargs, 1);
46868 xmlResetLastError();
46869 if (mem_base != xmlMemBlocks()) {
46870 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46871 xmlMemBlocks() - mem_base);
46872 test_ret++;
46873 printf(" %d", n_ctxt);
46874 printf(" %d", n_nargs);
46875 printf("\n");
46876 }
46877 }
46878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046879 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046880#endif
46881
Daniel Veillarda82b1822004-11-08 16:24:57 +000046882 return(test_ret);
46883}
46884
46885
46886static int
46887test_xmlXPathParseNCName(void) {
46888 int test_ret = 0;
46889
William M. Brack21e4ef22005-01-02 09:53:13 +000046890#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046891 int mem_base;
46892 xmlChar * ret_val;
46893 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46894 int n_ctxt;
46895
46896 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46897 mem_base = xmlMemBlocks();
46898 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46899
46900 ret_val = xmlXPathParseNCName(ctxt);
46901 desret_xmlChar_ptr(ret_val);
46902 call_tests++;
46903 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46904 xmlResetLastError();
46905 if (mem_base != xmlMemBlocks()) {
46906 printf("Leak of %d blocks found in xmlXPathParseNCName",
46907 xmlMemBlocks() - mem_base);
46908 test_ret++;
46909 printf(" %d", n_ctxt);
46910 printf("\n");
46911 }
46912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046913 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046914#endif
46915
Daniel Veillarda82b1822004-11-08 16:24:57 +000046916 return(test_ret);
46917}
46918
46919
46920static int
46921test_xmlXPathParseName(void) {
46922 int test_ret = 0;
46923
William M. Brack21e4ef22005-01-02 09:53:13 +000046924#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046925 int mem_base;
46926 xmlChar * ret_val;
46927 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46928 int n_ctxt;
46929
46930 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46931 mem_base = xmlMemBlocks();
46932 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46933
46934 ret_val = xmlXPathParseName(ctxt);
46935 desret_xmlChar_ptr(ret_val);
46936 call_tests++;
46937 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46938 xmlResetLastError();
46939 if (mem_base != xmlMemBlocks()) {
46940 printf("Leak of %d blocks found in xmlXPathParseName",
46941 xmlMemBlocks() - mem_base);
46942 test_ret++;
46943 printf(" %d", n_ctxt);
46944 printf("\n");
46945 }
46946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046947 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046948#endif
46949
Daniel Veillarda82b1822004-11-08 16:24:57 +000046950 return(test_ret);
46951}
46952
46953
46954static int
46955test_xmlXPathPopBoolean(void) {
46956 int test_ret = 0;
46957
William M. Brack21e4ef22005-01-02 09:53:13 +000046958#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046959 int mem_base;
46960 int ret_val;
46961 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46962 int n_ctxt;
46963
46964 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46965 mem_base = xmlMemBlocks();
46966 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46967
46968 ret_val = xmlXPathPopBoolean(ctxt);
46969 desret_int(ret_val);
46970 call_tests++;
46971 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46972 xmlResetLastError();
46973 if (mem_base != xmlMemBlocks()) {
46974 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46975 xmlMemBlocks() - mem_base);
46976 test_ret++;
46977 printf(" %d", n_ctxt);
46978 printf("\n");
46979 }
46980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046981 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046982#endif
46983
Daniel Veillarda82b1822004-11-08 16:24:57 +000046984 return(test_ret);
46985}
46986
46987
46988static int
46989test_xmlXPathPopExternal(void) {
46990 int test_ret = 0;
46991
William M. Brack21e4ef22005-01-02 09:53:13 +000046992#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046993 int mem_base;
46994 void * ret_val;
46995 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46996 int n_ctxt;
46997
46998 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46999 mem_base = xmlMemBlocks();
47000 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47001
47002 ret_val = xmlXPathPopExternal(ctxt);
47003 desret_void_ptr(ret_val);
47004 call_tests++;
47005 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47006 xmlResetLastError();
47007 if (mem_base != xmlMemBlocks()) {
47008 printf("Leak of %d blocks found in xmlXPathPopExternal",
47009 xmlMemBlocks() - mem_base);
47010 test_ret++;
47011 printf(" %d", n_ctxt);
47012 printf("\n");
47013 }
47014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047015 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047016#endif
47017
Daniel Veillarda82b1822004-11-08 16:24:57 +000047018 return(test_ret);
47019}
47020
47021
47022static int
47023test_xmlXPathPopNodeSet(void) {
47024 int test_ret = 0;
47025
William M. Brack21e4ef22005-01-02 09:53:13 +000047026#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047027 int mem_base;
47028 xmlNodeSetPtr ret_val;
47029 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47030 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047031
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047032 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47033 mem_base = xmlMemBlocks();
47034 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47035
47036 ret_val = xmlXPathPopNodeSet(ctxt);
47037 desret_xmlNodeSetPtr(ret_val);
47038 call_tests++;
47039 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47040 xmlResetLastError();
47041 if (mem_base != xmlMemBlocks()) {
47042 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
47043 xmlMemBlocks() - mem_base);
47044 test_ret++;
47045 printf(" %d", n_ctxt);
47046 printf("\n");
47047 }
47048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047049 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047050#endif
47051
Daniel Veillarda82b1822004-11-08 16:24:57 +000047052 return(test_ret);
47053}
47054
47055
47056static int
47057test_xmlXPathPopNumber(void) {
47058 int test_ret = 0;
47059
William M. Brack21e4ef22005-01-02 09:53:13 +000047060#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047061 int mem_base;
47062 double ret_val;
47063 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47064 int n_ctxt;
47065
47066 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47067 mem_base = xmlMemBlocks();
47068 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47069
47070 ret_val = xmlXPathPopNumber(ctxt);
47071 desret_double(ret_val);
47072 call_tests++;
47073 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47074 xmlResetLastError();
47075 if (mem_base != xmlMemBlocks()) {
47076 printf("Leak of %d blocks found in xmlXPathPopNumber",
47077 xmlMemBlocks() - mem_base);
47078 test_ret++;
47079 printf(" %d", n_ctxt);
47080 printf("\n");
47081 }
47082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047083 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047084#endif
47085
Daniel Veillarda82b1822004-11-08 16:24:57 +000047086 return(test_ret);
47087}
47088
47089
47090static int
47091test_xmlXPathPopString(void) {
47092 int test_ret = 0;
47093
William M. Brack21e4ef22005-01-02 09:53:13 +000047094#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047095 int mem_base;
47096 xmlChar * ret_val;
47097 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47098 int n_ctxt;
47099
47100 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47101 mem_base = xmlMemBlocks();
47102 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47103
47104 ret_val = xmlXPathPopString(ctxt);
47105 desret_xmlChar_ptr(ret_val);
47106 call_tests++;
47107 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47108 xmlResetLastError();
47109 if (mem_base != xmlMemBlocks()) {
47110 printf("Leak of %d blocks found in xmlXPathPopString",
47111 xmlMemBlocks() - mem_base);
47112 test_ret++;
47113 printf(" %d", n_ctxt);
47114 printf("\n");
47115 }
47116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047117 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047118#endif
47119
Daniel Veillarda82b1822004-11-08 16:24:57 +000047120 return(test_ret);
47121}
47122
47123
47124static int
47125test_xmlXPathPositionFunction(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 xmlXPathPositionFunction(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 xmlXPathPositionFunction",
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_xmlXPathRegisterAllFunctions(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 xmlXPathContextPtr ctxt; /* the XPath context */
47170 int n_ctxt;
47171
47172 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47173 mem_base = xmlMemBlocks();
47174 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47175
47176 xmlXPathRegisterAllFunctions(ctxt);
47177 call_tests++;
47178 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47179 xmlResetLastError();
47180 if (mem_base != xmlMemBlocks()) {
47181 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
47182 xmlMemBlocks() - mem_base);
47183 test_ret++;
47184 printf(" %d", n_ctxt);
47185 printf("\n");
47186 }
47187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047188 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047189#endif
47190
Daniel Veillarda82b1822004-11-08 16:24:57 +000047191 return(test_ret);
47192}
47193
47194
47195static int
47196test_xmlXPathRegisterFunc(void) {
47197 int test_ret = 0;
47198
47199
47200 /* missing type support */
47201 return(test_ret);
47202}
47203
47204
47205static int
47206test_xmlXPathRegisterFuncLookup(void) {
47207 int test_ret = 0;
47208
47209
47210 /* missing type support */
47211 return(test_ret);
47212}
47213
47214
47215static int
47216test_xmlXPathRegisterFuncNS(void) {
47217 int test_ret = 0;
47218
47219
47220 /* missing type support */
47221 return(test_ret);
47222}
47223
47224
47225static int
47226test_xmlXPathRegisterNs(void) {
47227 int test_ret = 0;
47228
William M. Brack21e4ef22005-01-02 09:53:13 +000047229#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047230 int mem_base;
47231 int ret_val;
47232 xmlXPathContextPtr ctxt; /* the XPath context */
47233 int n_ctxt;
47234 xmlChar * prefix; /* the namespace prefix */
47235 int n_prefix;
47236 xmlChar * ns_uri; /* the namespace name */
47237 int n_ns_uri;
47238
47239 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47240 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47241 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47242 mem_base = xmlMemBlocks();
47243 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47244 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47245 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47246
William M. Brackf13f77f2004-11-12 16:03:48 +000047247 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047248 desret_int(ret_val);
47249 call_tests++;
47250 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047251 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
47252 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047253 xmlResetLastError();
47254 if (mem_base != xmlMemBlocks()) {
47255 printf("Leak of %d blocks found in xmlXPathRegisterNs",
47256 xmlMemBlocks() - mem_base);
47257 test_ret++;
47258 printf(" %d", n_ctxt);
47259 printf(" %d", n_prefix);
47260 printf(" %d", n_ns_uri);
47261 printf("\n");
47262 }
47263 }
47264 }
47265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047266 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047267#endif
47268
Daniel Veillarda82b1822004-11-08 16:24:57 +000047269 return(test_ret);
47270}
47271
47272
47273static int
47274test_xmlXPathRegisterVariable(void) {
47275 int test_ret = 0;
47276
William M. Brack21e4ef22005-01-02 09:53:13 +000047277#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047278 int mem_base;
47279 int ret_val;
47280 xmlXPathContextPtr ctxt; /* the XPath context */
47281 int n_ctxt;
47282 xmlChar * name; /* the variable name */
47283 int n_name;
47284 xmlXPathObjectPtr value; /* the variable value or NULL */
47285 int n_value;
47286
47287 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47288 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47289 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47290 mem_base = xmlMemBlocks();
47291 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47292 name = gen_const_xmlChar_ptr(n_name, 1);
47293 value = gen_xmlXPathObjectPtr(n_value, 2);
47294
William M. Brackf13f77f2004-11-12 16:03:48 +000047295 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047296 desret_int(ret_val);
47297 call_tests++;
47298 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047299 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047300 des_xmlXPathObjectPtr(n_value, value, 2);
47301 xmlResetLastError();
47302 if (mem_base != xmlMemBlocks()) {
47303 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47304 xmlMemBlocks() - mem_base);
47305 test_ret++;
47306 printf(" %d", n_ctxt);
47307 printf(" %d", n_name);
47308 printf(" %d", n_value);
47309 printf("\n");
47310 }
47311 }
47312 }
47313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047314 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047315#endif
47316
Daniel Veillarda82b1822004-11-08 16:24:57 +000047317 return(test_ret);
47318}
47319
47320
47321static int
47322test_xmlXPathRegisterVariableLookup(void) {
47323 int test_ret = 0;
47324
47325
47326 /* missing type support */
47327 return(test_ret);
47328}
47329
47330
47331static int
47332test_xmlXPathRegisterVariableNS(void) {
47333 int test_ret = 0;
47334
William M. Brack21e4ef22005-01-02 09:53:13 +000047335#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047336 int mem_base;
47337 int ret_val;
47338 xmlXPathContextPtr ctxt; /* the XPath context */
47339 int n_ctxt;
47340 xmlChar * name; /* the variable name */
47341 int n_name;
47342 xmlChar * ns_uri; /* the variable namespace URI */
47343 int n_ns_uri;
47344 xmlXPathObjectPtr value; /* the variable value or NULL */
47345 int n_value;
47346
47347 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47348 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47349 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47350 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47351 mem_base = xmlMemBlocks();
47352 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47353 name = gen_const_xmlChar_ptr(n_name, 1);
47354 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47355 value = gen_xmlXPathObjectPtr(n_value, 3);
47356
William M. Brackf13f77f2004-11-12 16:03:48 +000047357 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047358 desret_int(ret_val);
47359 call_tests++;
47360 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047361 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47362 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047363 des_xmlXPathObjectPtr(n_value, value, 3);
47364 xmlResetLastError();
47365 if (mem_base != xmlMemBlocks()) {
47366 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47367 xmlMemBlocks() - mem_base);
47368 test_ret++;
47369 printf(" %d", n_ctxt);
47370 printf(" %d", n_name);
47371 printf(" %d", n_ns_uri);
47372 printf(" %d", n_value);
47373 printf("\n");
47374 }
47375 }
47376 }
47377 }
47378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047379 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047380#endif
47381
Daniel Veillarda82b1822004-11-08 16:24:57 +000047382 return(test_ret);
47383}
47384
47385
47386static int
47387test_xmlXPathRegisteredFuncsCleanup(void) {
47388 int test_ret = 0;
47389
William M. Brack21e4ef22005-01-02 09:53:13 +000047390#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047391 int mem_base;
47392 xmlXPathContextPtr ctxt; /* the XPath context */
47393 int n_ctxt;
47394
47395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47396 mem_base = xmlMemBlocks();
47397 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47398
47399 xmlXPathRegisteredFuncsCleanup(ctxt);
47400 call_tests++;
47401 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47402 xmlResetLastError();
47403 if (mem_base != xmlMemBlocks()) {
47404 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
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_xmlXPathRegisteredNsCleanup(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 xmlXPathContextPtr ctxt; /* the XPath context */
47425 int n_ctxt;
47426
47427 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47428 mem_base = xmlMemBlocks();
47429 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47430
47431 xmlXPathRegisteredNsCleanup(ctxt);
47432 call_tests++;
47433 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47434 xmlResetLastError();
47435 if (mem_base != xmlMemBlocks()) {
47436 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47437 xmlMemBlocks() - mem_base);
47438 test_ret++;
47439 printf(" %d", n_ctxt);
47440 printf("\n");
47441 }
47442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047443 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047444#endif
47445
Daniel Veillarda82b1822004-11-08 16:24:57 +000047446 return(test_ret);
47447}
47448
47449
47450static int
47451test_xmlXPathRegisteredVariablesCleanup(void) {
47452 int test_ret = 0;
47453
William M. Brack21e4ef22005-01-02 09:53:13 +000047454#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047455 int mem_base;
47456 xmlXPathContextPtr ctxt; /* the XPath context */
47457 int n_ctxt;
47458
47459 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47460 mem_base = xmlMemBlocks();
47461 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47462
47463 xmlXPathRegisteredVariablesCleanup(ctxt);
47464 call_tests++;
47465 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47466 xmlResetLastError();
47467 if (mem_base != xmlMemBlocks()) {
47468 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47469 xmlMemBlocks() - mem_base);
47470 test_ret++;
47471 printf(" %d", n_ctxt);
47472 printf("\n");
47473 }
47474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047475 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047476#endif
47477
Daniel Veillarda82b1822004-11-08 16:24:57 +000047478 return(test_ret);
47479}
47480
47481
47482static int
47483test_xmlXPathRoot(void) {
47484 int test_ret = 0;
47485
William M. Brack21e4ef22005-01-02 09:53:13 +000047486#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047487 int mem_base;
47488 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47489 int n_ctxt;
47490
47491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47492 mem_base = xmlMemBlocks();
47493 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47494
47495 xmlXPathRoot(ctxt);
47496 call_tests++;
47497 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47498 xmlResetLastError();
47499 if (mem_base != xmlMemBlocks()) {
47500 printf("Leak of %d blocks found in xmlXPathRoot",
47501 xmlMemBlocks() - mem_base);
47502 test_ret++;
47503 printf(" %d", n_ctxt);
47504 printf("\n");
47505 }
47506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047507 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047508#endif
47509
Daniel Veillarda82b1822004-11-08 16:24:57 +000047510 return(test_ret);
47511}
47512
47513
47514static int
47515test_xmlXPathRoundFunction(void) {
47516 int test_ret = 0;
47517
William M. Brack21e4ef22005-01-02 09:53:13 +000047518#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047519 int mem_base;
47520 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47521 int n_ctxt;
47522 int nargs; /* the number of arguments */
47523 int n_nargs;
47524
47525 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47526 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47527 mem_base = xmlMemBlocks();
47528 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47529 nargs = gen_int(n_nargs, 1);
47530
47531 xmlXPathRoundFunction(ctxt, nargs);
47532 call_tests++;
47533 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47534 des_int(n_nargs, nargs, 1);
47535 xmlResetLastError();
47536 if (mem_base != xmlMemBlocks()) {
47537 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47538 xmlMemBlocks() - mem_base);
47539 test_ret++;
47540 printf(" %d", n_ctxt);
47541 printf(" %d", n_nargs);
47542 printf("\n");
47543 }
47544 }
47545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047546 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047547#endif
47548
Daniel Veillarda82b1822004-11-08 16:24:57 +000047549 return(test_ret);
47550}
47551
47552
47553static int
47554test_xmlXPathStartsWithFunction(void) {
47555 int test_ret = 0;
47556
William M. Brack21e4ef22005-01-02 09:53:13 +000047557#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047558 int mem_base;
47559 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47560 int n_ctxt;
47561 int nargs; /* the number of arguments */
47562 int n_nargs;
47563
47564 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47565 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47566 mem_base = xmlMemBlocks();
47567 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47568 nargs = gen_int(n_nargs, 1);
47569
47570 xmlXPathStartsWithFunction(ctxt, nargs);
47571 call_tests++;
47572 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47573 des_int(n_nargs, nargs, 1);
47574 xmlResetLastError();
47575 if (mem_base != xmlMemBlocks()) {
47576 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47577 xmlMemBlocks() - mem_base);
47578 test_ret++;
47579 printf(" %d", n_ctxt);
47580 printf(" %d", n_nargs);
47581 printf("\n");
47582 }
47583 }
47584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047585 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047586#endif
47587
Daniel Veillarda82b1822004-11-08 16:24:57 +000047588 return(test_ret);
47589}
47590
47591
47592static int
47593test_xmlXPathStringEvalNumber(void) {
47594 int test_ret = 0;
47595
William M. Brack21e4ef22005-01-02 09:53:13 +000047596#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047597 int mem_base;
47598 double ret_val;
47599 xmlChar * str; /* A string to scan */
47600 int n_str;
47601
47602 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47603 mem_base = xmlMemBlocks();
47604 str = gen_const_xmlChar_ptr(n_str, 0);
47605
William M. Brackf13f77f2004-11-12 16:03:48 +000047606 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047607 desret_double(ret_val);
47608 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047609 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047610 xmlResetLastError();
47611 if (mem_base != xmlMemBlocks()) {
47612 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47613 xmlMemBlocks() - mem_base);
47614 test_ret++;
47615 printf(" %d", n_str);
47616 printf("\n");
47617 }
47618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047619 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047620#endif
47621
Daniel Veillarda82b1822004-11-08 16:24:57 +000047622 return(test_ret);
47623}
47624
47625
47626static int
47627test_xmlXPathStringFunction(void) {
47628 int test_ret = 0;
47629
William M. Brack21e4ef22005-01-02 09:53:13 +000047630#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047631 int mem_base;
47632 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47633 int n_ctxt;
47634 int nargs; /* the number of arguments */
47635 int n_nargs;
47636
47637 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47638 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47639 mem_base = xmlMemBlocks();
47640 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47641 nargs = gen_int(n_nargs, 1);
47642
47643 xmlXPathStringFunction(ctxt, nargs);
47644 call_tests++;
47645 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47646 des_int(n_nargs, nargs, 1);
47647 xmlResetLastError();
47648 if (mem_base != xmlMemBlocks()) {
47649 printf("Leak of %d blocks found in xmlXPathStringFunction",
47650 xmlMemBlocks() - mem_base);
47651 test_ret++;
47652 printf(" %d", n_ctxt);
47653 printf(" %d", n_nargs);
47654 printf("\n");
47655 }
47656 }
47657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047658 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047659#endif
47660
Daniel Veillarda82b1822004-11-08 16:24:57 +000047661 return(test_ret);
47662}
47663
47664
47665static int
47666test_xmlXPathStringLengthFunction(void) {
47667 int test_ret = 0;
47668
William M. Brack21e4ef22005-01-02 09:53:13 +000047669#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047670 int mem_base;
47671 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47672 int n_ctxt;
47673 int nargs; /* the number of arguments */
47674 int n_nargs;
47675
47676 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47677 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47678 mem_base = xmlMemBlocks();
47679 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47680 nargs = gen_int(n_nargs, 1);
47681
47682 xmlXPathStringLengthFunction(ctxt, nargs);
47683 call_tests++;
47684 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47685 des_int(n_nargs, nargs, 1);
47686 xmlResetLastError();
47687 if (mem_base != xmlMemBlocks()) {
47688 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47689 xmlMemBlocks() - mem_base);
47690 test_ret++;
47691 printf(" %d", n_ctxt);
47692 printf(" %d", n_nargs);
47693 printf("\n");
47694 }
47695 }
47696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047697 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047698#endif
47699
Daniel Veillarda82b1822004-11-08 16:24:57 +000047700 return(test_ret);
47701}
47702
47703
47704static int
47705test_xmlXPathSubValues(void) {
47706 int test_ret = 0;
47707
William M. Brack21e4ef22005-01-02 09:53:13 +000047708#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047709 int mem_base;
47710 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47711 int n_ctxt;
47712
47713 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47714 mem_base = xmlMemBlocks();
47715 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47716
47717 xmlXPathSubValues(ctxt);
47718 call_tests++;
47719 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47720 xmlResetLastError();
47721 if (mem_base != xmlMemBlocks()) {
47722 printf("Leak of %d blocks found in xmlXPathSubValues",
47723 xmlMemBlocks() - mem_base);
47724 test_ret++;
47725 printf(" %d", n_ctxt);
47726 printf("\n");
47727 }
47728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047729 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047730#endif
47731
Daniel Veillarda82b1822004-11-08 16:24:57 +000047732 return(test_ret);
47733}
47734
47735
47736static int
47737test_xmlXPathSubstringAfterFunction(void) {
47738 int test_ret = 0;
47739
William M. Brack21e4ef22005-01-02 09:53:13 +000047740#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047741 int mem_base;
47742 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47743 int n_ctxt;
47744 int nargs; /* the number of arguments */
47745 int n_nargs;
47746
47747 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47748 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47749 mem_base = xmlMemBlocks();
47750 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47751 nargs = gen_int(n_nargs, 1);
47752
47753 xmlXPathSubstringAfterFunction(ctxt, nargs);
47754 call_tests++;
47755 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47756 des_int(n_nargs, nargs, 1);
47757 xmlResetLastError();
47758 if (mem_base != xmlMemBlocks()) {
47759 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47760 xmlMemBlocks() - mem_base);
47761 test_ret++;
47762 printf(" %d", n_ctxt);
47763 printf(" %d", n_nargs);
47764 printf("\n");
47765 }
47766 }
47767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047768 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047769#endif
47770
Daniel Veillarda82b1822004-11-08 16:24:57 +000047771 return(test_ret);
47772}
47773
47774
47775static int
47776test_xmlXPathSubstringBeforeFunction(void) {
47777 int test_ret = 0;
47778
William M. Brack21e4ef22005-01-02 09:53:13 +000047779#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047780 int mem_base;
47781 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47782 int n_ctxt;
47783 int nargs; /* the number of arguments */
47784 int n_nargs;
47785
47786 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47787 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47788 mem_base = xmlMemBlocks();
47789 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47790 nargs = gen_int(n_nargs, 1);
47791
47792 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47793 call_tests++;
47794 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47795 des_int(n_nargs, nargs, 1);
47796 xmlResetLastError();
47797 if (mem_base != xmlMemBlocks()) {
47798 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47799 xmlMemBlocks() - mem_base);
47800 test_ret++;
47801 printf(" %d", n_ctxt);
47802 printf(" %d", n_nargs);
47803 printf("\n");
47804 }
47805 }
47806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047807 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047808#endif
47809
Daniel Veillarda82b1822004-11-08 16:24:57 +000047810 return(test_ret);
47811}
47812
47813
47814static int
47815test_xmlXPathSubstringFunction(void) {
47816 int test_ret = 0;
47817
William M. Brack21e4ef22005-01-02 09:53:13 +000047818#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047819 int mem_base;
47820 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47821 int n_ctxt;
47822 int nargs; /* the number of arguments */
47823 int n_nargs;
47824
47825 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47826 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47827 mem_base = xmlMemBlocks();
47828 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47829 nargs = gen_int(n_nargs, 1);
47830
47831 xmlXPathSubstringFunction(ctxt, nargs);
47832 call_tests++;
47833 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47834 des_int(n_nargs, nargs, 1);
47835 xmlResetLastError();
47836 if (mem_base != xmlMemBlocks()) {
47837 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47838 xmlMemBlocks() - mem_base);
47839 test_ret++;
47840 printf(" %d", n_ctxt);
47841 printf(" %d", n_nargs);
47842 printf("\n");
47843 }
47844 }
47845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047846 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047847#endif
47848
Daniel Veillarda82b1822004-11-08 16:24:57 +000047849 return(test_ret);
47850}
47851
47852
47853static int
47854test_xmlXPathSumFunction(void) {
47855 int test_ret = 0;
47856
William M. Brack21e4ef22005-01-02 09:53:13 +000047857#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047858 int mem_base;
47859 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47860 int n_ctxt;
47861 int nargs; /* the number of arguments */
47862 int n_nargs;
47863
47864 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47865 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47866 mem_base = xmlMemBlocks();
47867 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47868 nargs = gen_int(n_nargs, 1);
47869
47870 xmlXPathSumFunction(ctxt, nargs);
47871 call_tests++;
47872 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47873 des_int(n_nargs, nargs, 1);
47874 xmlResetLastError();
47875 if (mem_base != xmlMemBlocks()) {
47876 printf("Leak of %d blocks found in xmlXPathSumFunction",
47877 xmlMemBlocks() - mem_base);
47878 test_ret++;
47879 printf(" %d", n_ctxt);
47880 printf(" %d", n_nargs);
47881 printf("\n");
47882 }
47883 }
47884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047885 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047886#endif
47887
Daniel Veillarda82b1822004-11-08 16:24:57 +000047888 return(test_ret);
47889}
47890
47891
47892static int
47893test_xmlXPathTrailing(void) {
47894 int test_ret = 0;
47895
William M. Brack21e4ef22005-01-02 09:53:13 +000047896#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047897 int mem_base;
47898 xmlNodeSetPtr ret_val;
47899 xmlNodeSetPtr nodes1; /* a node-set */
47900 int n_nodes1;
47901 xmlNodeSetPtr nodes2; /* a node-set */
47902 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047903
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047904 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47905 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47906 mem_base = xmlMemBlocks();
47907 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47908 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47909
47910 ret_val = xmlXPathTrailing(nodes1, nodes2);
47911 desret_xmlNodeSetPtr(ret_val);
47912 call_tests++;
47913 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47914 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47915 xmlResetLastError();
47916 if (mem_base != xmlMemBlocks()) {
47917 printf("Leak of %d blocks found in xmlXPathTrailing",
47918 xmlMemBlocks() - mem_base);
47919 test_ret++;
47920 printf(" %d", n_nodes1);
47921 printf(" %d", n_nodes2);
47922 printf("\n");
47923 }
47924 }
47925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047926 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047927#endif
47928
Daniel Veillarda82b1822004-11-08 16:24:57 +000047929 return(test_ret);
47930}
47931
47932
47933static int
47934test_xmlXPathTrailingSorted(void) {
47935 int test_ret = 0;
47936
William M. Brack21e4ef22005-01-02 09:53:13 +000047937#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047938 int mem_base;
47939 xmlNodeSetPtr ret_val;
47940 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47941 int n_nodes1;
47942 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47943 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047944
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047945 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47946 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47947 mem_base = xmlMemBlocks();
47948 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47949 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47950
47951 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47952 desret_xmlNodeSetPtr(ret_val);
47953 call_tests++;
47954 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47955 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47956 xmlResetLastError();
47957 if (mem_base != xmlMemBlocks()) {
47958 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47959 xmlMemBlocks() - mem_base);
47960 test_ret++;
47961 printf(" %d", n_nodes1);
47962 printf(" %d", n_nodes2);
47963 printf("\n");
47964 }
47965 }
47966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047967 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047968#endif
47969
Daniel Veillarda82b1822004-11-08 16:24:57 +000047970 return(test_ret);
47971}
47972
47973
47974static int
47975test_xmlXPathTranslateFunction(void) {
47976 int test_ret = 0;
47977
William M. Brack21e4ef22005-01-02 09:53:13 +000047978#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047979 int mem_base;
47980 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47981 int n_ctxt;
47982 int nargs; /* the number of arguments */
47983 int n_nargs;
47984
47985 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47986 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47987 mem_base = xmlMemBlocks();
47988 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47989 nargs = gen_int(n_nargs, 1);
47990
47991 xmlXPathTranslateFunction(ctxt, nargs);
47992 call_tests++;
47993 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47994 des_int(n_nargs, nargs, 1);
47995 xmlResetLastError();
47996 if (mem_base != xmlMemBlocks()) {
47997 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47998 xmlMemBlocks() - mem_base);
47999 test_ret++;
48000 printf(" %d", n_ctxt);
48001 printf(" %d", n_nargs);
48002 printf("\n");
48003 }
48004 }
48005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048006 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048007#endif
48008
Daniel Veillarda82b1822004-11-08 16:24:57 +000048009 return(test_ret);
48010}
48011
48012
48013static int
48014test_xmlXPathTrueFunction(void) {
48015 int test_ret = 0;
48016
William M. Brack21e4ef22005-01-02 09:53:13 +000048017#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048018 int mem_base;
48019 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48020 int n_ctxt;
48021 int nargs; /* the number of arguments */
48022 int n_nargs;
48023
48024 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48025 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48026 mem_base = xmlMemBlocks();
48027 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48028 nargs = gen_int(n_nargs, 1);
48029
48030 xmlXPathTrueFunction(ctxt, nargs);
48031 call_tests++;
48032 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48033 des_int(n_nargs, nargs, 1);
48034 xmlResetLastError();
48035 if (mem_base != xmlMemBlocks()) {
48036 printf("Leak of %d blocks found in xmlXPathTrueFunction",
48037 xmlMemBlocks() - mem_base);
48038 test_ret++;
48039 printf(" %d", n_ctxt);
48040 printf(" %d", n_nargs);
48041 printf("\n");
48042 }
48043 }
48044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048045 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048046#endif
48047
Daniel Veillarda82b1822004-11-08 16:24:57 +000048048 return(test_ret);
48049}
48050
48051
48052static int
48053test_xmlXPathValueFlipSign(void) {
48054 int test_ret = 0;
48055
William M. Brack21e4ef22005-01-02 09:53:13 +000048056#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048057 int mem_base;
48058 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48059 int n_ctxt;
48060
48061 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48062 mem_base = xmlMemBlocks();
48063 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48064
48065 xmlXPathValueFlipSign(ctxt);
48066 call_tests++;
48067 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48068 xmlResetLastError();
48069 if (mem_base != xmlMemBlocks()) {
48070 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
48071 xmlMemBlocks() - mem_base);
48072 test_ret++;
48073 printf(" %d", n_ctxt);
48074 printf("\n");
48075 }
48076 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048077 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048078#endif
48079
Daniel Veillarda82b1822004-11-08 16:24:57 +000048080 return(test_ret);
48081}
48082
48083
48084static int
48085test_xmlXPathVariableLookup(void) {
48086 int test_ret = 0;
48087
William M. Brack21e4ef22005-01-02 09:53:13 +000048088#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048089 int mem_base;
48090 xmlXPathObjectPtr ret_val;
48091 xmlXPathContextPtr ctxt; /* the XPath context */
48092 int n_ctxt;
48093 xmlChar * name; /* the variable name */
48094 int n_name;
48095
48096 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48097 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48098 mem_base = xmlMemBlocks();
48099 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48100 name = gen_const_xmlChar_ptr(n_name, 1);
48101
William M. Brackf13f77f2004-11-12 16:03:48 +000048102 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048103 desret_xmlXPathObjectPtr(ret_val);
48104 call_tests++;
48105 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048106 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048107 xmlResetLastError();
48108 if (mem_base != xmlMemBlocks()) {
48109 printf("Leak of %d blocks found in xmlXPathVariableLookup",
48110 xmlMemBlocks() - mem_base);
48111 test_ret++;
48112 printf(" %d", n_ctxt);
48113 printf(" %d", n_name);
48114 printf("\n");
48115 }
48116 }
48117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048118 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048119#endif
48120
Daniel Veillarda82b1822004-11-08 16:24:57 +000048121 return(test_ret);
48122}
48123
48124
48125static int
48126test_xmlXPathVariableLookupNS(void) {
48127 int test_ret = 0;
48128
William M. Brack21e4ef22005-01-02 09:53:13 +000048129#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048130 int mem_base;
48131 xmlXPathObjectPtr ret_val;
48132 xmlXPathContextPtr ctxt; /* the XPath context */
48133 int n_ctxt;
48134 xmlChar * name; /* the variable name */
48135 int n_name;
48136 xmlChar * ns_uri; /* the variable namespace URI */
48137 int n_ns_uri;
48138
48139 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48140 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48141 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
48142 mem_base = xmlMemBlocks();
48143 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48144 name = gen_const_xmlChar_ptr(n_name, 1);
48145 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
48146
William M. Brackf13f77f2004-11-12 16:03:48 +000048147 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048148 desret_xmlXPathObjectPtr(ret_val);
48149 call_tests++;
48150 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048151 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
48152 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048153 xmlResetLastError();
48154 if (mem_base != xmlMemBlocks()) {
48155 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
48156 xmlMemBlocks() - mem_base);
48157 test_ret++;
48158 printf(" %d", n_ctxt);
48159 printf(" %d", n_name);
48160 printf(" %d", n_ns_uri);
48161 printf("\n");
48162 }
48163 }
48164 }
48165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048166 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048167#endif
48168
Daniel Veillarda82b1822004-11-08 16:24:57 +000048169 return(test_ret);
48170}
48171
48172
48173static int
48174test_xmlXPathWrapCString(void) {
48175 int test_ret = 0;
48176
William M. Brack21e4ef22005-01-02 09:53:13 +000048177#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048178 int mem_base;
48179 xmlXPathObjectPtr ret_val;
48180 char * val; /* the char * value */
48181 int n_val;
48182
48183 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
48184 mem_base = xmlMemBlocks();
48185 val = gen_char_ptr(n_val, 0);
48186
48187 ret_val = xmlXPathWrapCString(val);
48188 desret_xmlXPathObjectPtr(ret_val);
48189 call_tests++;
48190 des_char_ptr(n_val, val, 0);
48191 xmlResetLastError();
48192 if (mem_base != xmlMemBlocks()) {
48193 printf("Leak of %d blocks found in xmlXPathWrapCString",
48194 xmlMemBlocks() - mem_base);
48195 test_ret++;
48196 printf(" %d", n_val);
48197 printf("\n");
48198 }
48199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048200 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048201#endif
48202
Daniel Veillarda82b1822004-11-08 16:24:57 +000048203 return(test_ret);
48204}
48205
48206
48207static int
48208test_xmlXPathWrapExternal(void) {
48209 int test_ret = 0;
48210
William M. Brack21e4ef22005-01-02 09:53:13 +000048211#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048212 int mem_base;
48213 xmlXPathObjectPtr ret_val;
48214 void * val; /* the user data */
48215 int n_val;
48216
48217 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
48218 mem_base = xmlMemBlocks();
48219 val = gen_void_ptr(n_val, 0);
48220
48221 ret_val = xmlXPathWrapExternal(val);
48222 desret_xmlXPathObjectPtr(ret_val);
48223 call_tests++;
48224 des_void_ptr(n_val, val, 0);
48225 xmlResetLastError();
48226 if (mem_base != xmlMemBlocks()) {
48227 printf("Leak of %d blocks found in xmlXPathWrapExternal",
48228 xmlMemBlocks() - mem_base);
48229 test_ret++;
48230 printf(" %d", n_val);
48231 printf("\n");
48232 }
48233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048234 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048235#endif
48236
Daniel Veillarda82b1822004-11-08 16:24:57 +000048237 return(test_ret);
48238}
48239
48240
48241static int
48242test_xmlXPathWrapNodeSet(void) {
48243 int test_ret = 0;
48244
William M. Brack21e4ef22005-01-02 09:53:13 +000048245#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048246 int mem_base;
48247 xmlXPathObjectPtr ret_val;
48248 xmlNodeSetPtr val; /* the NodePtr value */
48249 int n_val;
48250
48251 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
48252 mem_base = xmlMemBlocks();
48253 val = gen_xmlNodeSetPtr(n_val, 0);
48254
48255 ret_val = xmlXPathWrapNodeSet(val);
48256 desret_xmlXPathObjectPtr(ret_val);
48257 call_tests++;
48258 des_xmlNodeSetPtr(n_val, val, 0);
48259 xmlResetLastError();
48260 if (mem_base != xmlMemBlocks()) {
48261 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
48262 xmlMemBlocks() - mem_base);
48263 test_ret++;
48264 printf(" %d", n_val);
48265 printf("\n");
48266 }
48267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048268 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048269#endif
48270
Daniel Veillarda82b1822004-11-08 16:24:57 +000048271 return(test_ret);
48272}
48273
48274
48275static int
48276test_xmlXPatherror(void) {
48277 int test_ret = 0;
48278
William M. Brack21e4ef22005-01-02 09:53:13 +000048279#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048280 int mem_base;
48281 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48282 int n_ctxt;
48283 const char * file; /* the file name */
48284 int n_file;
48285 int line; /* the line number */
48286 int n_line;
48287 int no; /* the error number */
48288 int n_no;
48289
48290 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48291 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48292 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48293 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48294 mem_base = xmlMemBlocks();
48295 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48296 file = gen_filepath(n_file, 1);
48297 line = gen_int(n_line, 2);
48298 no = gen_int(n_no, 3);
48299
48300 xmlXPatherror(ctxt, file, line, no);
48301 call_tests++;
48302 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48303 des_filepath(n_file, file, 1);
48304 des_int(n_line, line, 2);
48305 des_int(n_no, no, 3);
48306 xmlResetLastError();
48307 if (mem_base != xmlMemBlocks()) {
48308 printf("Leak of %d blocks found in xmlXPatherror",
48309 xmlMemBlocks() - mem_base);
48310 test_ret++;
48311 printf(" %d", n_ctxt);
48312 printf(" %d", n_file);
48313 printf(" %d", n_line);
48314 printf(" %d", n_no);
48315 printf("\n");
48316 }
48317 }
48318 }
48319 }
48320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048321 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048322#endif
48323
Daniel Veillarda82b1822004-11-08 16:24:57 +000048324 return(test_ret);
48325}
48326
48327static int
48328test_xpathInternals(void) {
48329 int test_ret = 0;
48330
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048331 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048332 test_ret += test_valuePop();
48333 test_ret += test_valuePush();
48334 test_ret += test_xmlXPathAddValues();
48335 test_ret += test_xmlXPathBooleanFunction();
48336 test_ret += test_xmlXPathCeilingFunction();
48337 test_ret += test_xmlXPathCompareValues();
48338 test_ret += test_xmlXPathConcatFunction();
48339 test_ret += test_xmlXPathContainsFunction();
48340 test_ret += test_xmlXPathCountFunction();
48341 test_ret += test_xmlXPathDebugDumpCompExpr();
48342 test_ret += test_xmlXPathDebugDumpObject();
48343 test_ret += test_xmlXPathDifference();
48344 test_ret += test_xmlXPathDistinct();
48345 test_ret += test_xmlXPathDistinctSorted();
48346 test_ret += test_xmlXPathDivValues();
48347 test_ret += test_xmlXPathEqualValues();
48348 test_ret += test_xmlXPathErr();
48349 test_ret += test_xmlXPathEvalExpr();
48350 test_ret += test_xmlXPathEvaluatePredicateResult();
48351 test_ret += test_xmlXPathFalseFunction();
48352 test_ret += test_xmlXPathFloorFunction();
48353 test_ret += test_xmlXPathFunctionLookup();
48354 test_ret += test_xmlXPathFunctionLookupNS();
48355 test_ret += test_xmlXPathHasSameNodes();
48356 test_ret += test_xmlXPathIdFunction();
48357 test_ret += test_xmlXPathIntersection();
48358 test_ret += test_xmlXPathIsNodeType();
48359 test_ret += test_xmlXPathLangFunction();
48360 test_ret += test_xmlXPathLastFunction();
48361 test_ret += test_xmlXPathLeading();
48362 test_ret += test_xmlXPathLeadingSorted();
48363 test_ret += test_xmlXPathLocalNameFunction();
48364 test_ret += test_xmlXPathModValues();
48365 test_ret += test_xmlXPathMultValues();
48366 test_ret += test_xmlXPathNamespaceURIFunction();
48367 test_ret += test_xmlXPathNewBoolean();
48368 test_ret += test_xmlXPathNewCString();
48369 test_ret += test_xmlXPathNewFloat();
48370 test_ret += test_xmlXPathNewNodeSet();
48371 test_ret += test_xmlXPathNewNodeSetList();
48372 test_ret += test_xmlXPathNewParserContext();
48373 test_ret += test_xmlXPathNewString();
48374 test_ret += test_xmlXPathNextAncestor();
48375 test_ret += test_xmlXPathNextAncestorOrSelf();
48376 test_ret += test_xmlXPathNextAttribute();
48377 test_ret += test_xmlXPathNextChild();
48378 test_ret += test_xmlXPathNextDescendant();
48379 test_ret += test_xmlXPathNextDescendantOrSelf();
48380 test_ret += test_xmlXPathNextFollowing();
48381 test_ret += test_xmlXPathNextFollowingSibling();
48382 test_ret += test_xmlXPathNextNamespace();
48383 test_ret += test_xmlXPathNextParent();
48384 test_ret += test_xmlXPathNextPreceding();
48385 test_ret += test_xmlXPathNextPrecedingSibling();
48386 test_ret += test_xmlXPathNextSelf();
48387 test_ret += test_xmlXPathNodeLeading();
48388 test_ret += test_xmlXPathNodeLeadingSorted();
48389 test_ret += test_xmlXPathNodeSetAdd();
48390 test_ret += test_xmlXPathNodeSetAddNs();
48391 test_ret += test_xmlXPathNodeSetAddUnique();
48392 test_ret += test_xmlXPathNodeSetContains();
48393 test_ret += test_xmlXPathNodeSetDel();
48394 test_ret += test_xmlXPathNodeSetMerge();
48395 test_ret += test_xmlXPathNodeSetRemove();
48396 test_ret += test_xmlXPathNodeSetSort();
48397 test_ret += test_xmlXPathNodeTrailing();
48398 test_ret += test_xmlXPathNodeTrailingSorted();
48399 test_ret += test_xmlXPathNormalizeFunction();
48400 test_ret += test_xmlXPathNotEqualValues();
48401 test_ret += test_xmlXPathNotFunction();
48402 test_ret += test_xmlXPathNsLookup();
48403 test_ret += test_xmlXPathNumberFunction();
48404 test_ret += test_xmlXPathParseNCName();
48405 test_ret += test_xmlXPathParseName();
48406 test_ret += test_xmlXPathPopBoolean();
48407 test_ret += test_xmlXPathPopExternal();
48408 test_ret += test_xmlXPathPopNodeSet();
48409 test_ret += test_xmlXPathPopNumber();
48410 test_ret += test_xmlXPathPopString();
48411 test_ret += test_xmlXPathPositionFunction();
48412 test_ret += test_xmlXPathRegisterAllFunctions();
48413 test_ret += test_xmlXPathRegisterFunc();
48414 test_ret += test_xmlXPathRegisterFuncLookup();
48415 test_ret += test_xmlXPathRegisterFuncNS();
48416 test_ret += test_xmlXPathRegisterNs();
48417 test_ret += test_xmlXPathRegisterVariable();
48418 test_ret += test_xmlXPathRegisterVariableLookup();
48419 test_ret += test_xmlXPathRegisterVariableNS();
48420 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48421 test_ret += test_xmlXPathRegisteredNsCleanup();
48422 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48423 test_ret += test_xmlXPathRoot();
48424 test_ret += test_xmlXPathRoundFunction();
48425 test_ret += test_xmlXPathStartsWithFunction();
48426 test_ret += test_xmlXPathStringEvalNumber();
48427 test_ret += test_xmlXPathStringFunction();
48428 test_ret += test_xmlXPathStringLengthFunction();
48429 test_ret += test_xmlXPathSubValues();
48430 test_ret += test_xmlXPathSubstringAfterFunction();
48431 test_ret += test_xmlXPathSubstringBeforeFunction();
48432 test_ret += test_xmlXPathSubstringFunction();
48433 test_ret += test_xmlXPathSumFunction();
48434 test_ret += test_xmlXPathTrailing();
48435 test_ret += test_xmlXPathTrailingSorted();
48436 test_ret += test_xmlXPathTranslateFunction();
48437 test_ret += test_xmlXPathTrueFunction();
48438 test_ret += test_xmlXPathValueFlipSign();
48439 test_ret += test_xmlXPathVariableLookup();
48440 test_ret += test_xmlXPathVariableLookupNS();
48441 test_ret += test_xmlXPathWrapCString();
48442 test_ret += test_xmlXPathWrapExternal();
48443 test_ret += test_xmlXPathWrapNodeSet();
48444 test_ret += test_xmlXPatherror();
48445
48446 if (test_ret != 0)
48447 printf("Module xpathInternals: %d errors\n", test_ret);
48448 return(test_ret);
48449}
48450
Daniel Veillardd93f6252004-11-02 15:53:51 +000048451static int
48452test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048454
William M. Brack21e4ef22005-01-02 09:53:13 +000048455#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048456 int mem_base;
48457 xmlNodePtr ret_val;
48458 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48459 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048460
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048461 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048463 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048464
48465 ret_val = xmlXPtrBuildNodeList(obj);
48466 desret_xmlNodePtr(ret_val);
48467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048468 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048469 xmlResetLastError();
48470 if (mem_base != xmlMemBlocks()) {
48471 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048473 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048474 printf(" %d", n_obj);
48475 printf("\n");
48476 }
48477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048478 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048479#endif
48480
Daniel Veillard42595322004-11-08 10:52:06 +000048481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048482}
48483
48484
48485static int
48486test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048488
William M. Brack21e4ef22005-01-02 09:53:13 +000048489#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048490 int mem_base;
48491 xmlXPathObjectPtr ret_val;
48492 xmlChar * str; /* the XPointer expression */
48493 int n_str;
48494 xmlXPathContextPtr ctx; /* the XPointer context */
48495 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048496
Daniel Veillardce682bc2004-11-05 17:22:25 +000048497 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48498 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48499 mem_base = xmlMemBlocks();
48500 str = gen_const_xmlChar_ptr(n_str, 0);
48501 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48502
William M. Brackf13f77f2004-11-12 16:03:48 +000048503 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048504 desret_xmlXPathObjectPtr(ret_val);
48505 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048506 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048507 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48508 xmlResetLastError();
48509 if (mem_base != xmlMemBlocks()) {
48510 printf("Leak of %d blocks found in xmlXPtrEval",
48511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048512 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048513 printf(" %d", n_str);
48514 printf(" %d", n_ctx);
48515 printf("\n");
48516 }
48517 }
48518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048519 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048520#endif
48521
Daniel Veillard42595322004-11-08 10:52:06 +000048522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048523}
48524
48525
48526static int
48527test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048529
William M. Brack21e4ef22005-01-02 09:53:13 +000048530#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048531 int mem_base;
48532 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48533 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048534
Daniel Veillardce682bc2004-11-05 17:22:25 +000048535 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48536 mem_base = xmlMemBlocks();
48537 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48538
48539 xmlXPtrEvalRangePredicate(ctxt);
48540 call_tests++;
48541 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48542 xmlResetLastError();
48543 if (mem_base != xmlMemBlocks()) {
48544 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048546 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048547 printf(" %d", n_ctxt);
48548 printf("\n");
48549 }
48550 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048551 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048552#endif
48553
Daniel Veillard42595322004-11-08 10:52:06 +000048554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048555}
48556
Daniel Veillarda521d282004-11-09 14:59:59 +000048557#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048558
Daniel Veillardce682bc2004-11-05 17:22:25 +000048559#define gen_nb_xmlLocationSetPtr 1
48560static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48561 return(NULL);
48562}
48563static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48564}
Daniel Veillarda521d282004-11-09 14:59:59 +000048565#endif
48566
Daniel Veillardce682bc2004-11-05 17:22:25 +000048567
Daniel Veillardd93f6252004-11-02 15:53:51 +000048568static int
48569test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048571
William M. Brack21e4ef22005-01-02 09:53:13 +000048572#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048573 int mem_base;
48574 xmlLocationSetPtr cur; /* the initial range set */
48575 int n_cur;
48576 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48577 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048578
Daniel Veillardce682bc2004-11-05 17:22:25 +000048579 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48580 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48581 mem_base = xmlMemBlocks();
48582 cur = gen_xmlLocationSetPtr(n_cur, 0);
48583 val = gen_xmlXPathObjectPtr(n_val, 1);
48584
48585 xmlXPtrLocationSetAdd(cur, val);
48586 call_tests++;
48587 des_xmlLocationSetPtr(n_cur, cur, 0);
48588 des_xmlXPathObjectPtr(n_val, val, 1);
48589 xmlResetLastError();
48590 if (mem_base != xmlMemBlocks()) {
48591 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048593 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048594 printf(" %d", n_cur);
48595 printf(" %d", n_val);
48596 printf("\n");
48597 }
48598 }
48599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048600 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048601#endif
48602
Daniel Veillard42595322004-11-08 10:52:06 +000048603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048604}
48605
48606
48607static int
48608test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048610
48611
48612 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048614}
48615
48616
48617static int
48618test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048620
William M. Brack21e4ef22005-01-02 09:53:13 +000048621#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048622 int mem_base;
48623 xmlLocationSetPtr cur; /* the initial range set */
48624 int n_cur;
48625 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48626 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048627
Daniel Veillardce682bc2004-11-05 17:22:25 +000048628 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48629 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48630 mem_base = xmlMemBlocks();
48631 cur = gen_xmlLocationSetPtr(n_cur, 0);
48632 val = gen_xmlXPathObjectPtr(n_val, 1);
48633
48634 xmlXPtrLocationSetDel(cur, val);
48635 call_tests++;
48636 des_xmlLocationSetPtr(n_cur, cur, 0);
48637 des_xmlXPathObjectPtr(n_val, val, 1);
48638 xmlResetLastError();
48639 if (mem_base != xmlMemBlocks()) {
48640 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048642 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048643 printf(" %d", n_cur);
48644 printf(" %d", n_val);
48645 printf("\n");
48646 }
48647 }
48648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048649 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048650#endif
48651
Daniel Veillard42595322004-11-08 10:52:06 +000048652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048653}
48654
48655
48656static int
48657test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048659
48660
48661 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048663}
48664
48665
48666static int
48667test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048669
William M. Brack21e4ef22005-01-02 09:53:13 +000048670#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048671 int mem_base;
48672 xmlLocationSetPtr cur; /* the initial range set */
48673 int n_cur;
48674 int val; /* the index to remove */
48675 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048676
Daniel Veillardce682bc2004-11-05 17:22:25 +000048677 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48678 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48679 mem_base = xmlMemBlocks();
48680 cur = gen_xmlLocationSetPtr(n_cur, 0);
48681 val = gen_int(n_val, 1);
48682
48683 xmlXPtrLocationSetRemove(cur, val);
48684 call_tests++;
48685 des_xmlLocationSetPtr(n_cur, cur, 0);
48686 des_int(n_val, val, 1);
48687 xmlResetLastError();
48688 if (mem_base != xmlMemBlocks()) {
48689 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048691 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048692 printf(" %d", n_cur);
48693 printf(" %d", n_val);
48694 printf("\n");
48695 }
48696 }
48697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048698 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048699#endif
48700
Daniel Veillard42595322004-11-08 10:52:06 +000048701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048702}
48703
48704
48705static int
48706test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048708
William M. Brack21e4ef22005-01-02 09:53:13 +000048709#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048710 int mem_base;
48711 xmlXPathObjectPtr ret_val;
48712 xmlNodePtr start; /* the starting and ending node */
48713 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048714
Daniel Veillard3d97e662004-11-04 10:49:00 +000048715 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48716 mem_base = xmlMemBlocks();
48717 start = gen_xmlNodePtr(n_start, 0);
48718
48719 ret_val = xmlXPtrNewCollapsedRange(start);
48720 desret_xmlXPathObjectPtr(ret_val);
48721 call_tests++;
48722 des_xmlNodePtr(n_start, start, 0);
48723 xmlResetLastError();
48724 if (mem_base != xmlMemBlocks()) {
48725 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048727 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048728 printf(" %d", n_start);
48729 printf("\n");
48730 }
48731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048732 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048733#endif
48734
Daniel Veillard42595322004-11-08 10:52:06 +000048735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048736}
48737
48738
48739static int
48740test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048742
48743
48744 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048746}
48747
48748
48749static int
48750test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048752
William M. Brack21e4ef22005-01-02 09:53:13 +000048753#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048754 int mem_base;
48755 xmlXPathObjectPtr ret_val;
48756 xmlNodeSetPtr set; /* a node set */
48757 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048758
Daniel Veillardce682bc2004-11-05 17:22:25 +000048759 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48760 mem_base = xmlMemBlocks();
48761 set = gen_xmlNodeSetPtr(n_set, 0);
48762
48763 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48764 desret_xmlXPathObjectPtr(ret_val);
48765 call_tests++;
48766 des_xmlNodeSetPtr(n_set, set, 0);
48767 xmlResetLastError();
48768 if (mem_base != xmlMemBlocks()) {
48769 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048771 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048772 printf(" %d", n_set);
48773 printf("\n");
48774 }
48775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048776 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048777#endif
48778
Daniel Veillard42595322004-11-08 10:52:06 +000048779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048780}
48781
48782
48783static int
48784test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048786
William M. Brack21e4ef22005-01-02 09:53:13 +000048787#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048788 int mem_base;
48789 xmlXPathObjectPtr ret_val;
48790 xmlNodePtr start; /* the start NodePtr value */
48791 int n_start;
48792 xmlNodePtr end; /* the end NodePtr value or NULL */
48793 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048794
Daniel Veillard3d97e662004-11-04 10:49:00 +000048795 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48796 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48797 mem_base = xmlMemBlocks();
48798 start = gen_xmlNodePtr(n_start, 0);
48799 end = gen_xmlNodePtr(n_end, 1);
48800
48801 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48802 desret_xmlXPathObjectPtr(ret_val);
48803 call_tests++;
48804 des_xmlNodePtr(n_start, start, 0);
48805 des_xmlNodePtr(n_end, end, 1);
48806 xmlResetLastError();
48807 if (mem_base != xmlMemBlocks()) {
48808 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048810 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048811 printf(" %d", n_start);
48812 printf(" %d", n_end);
48813 printf("\n");
48814 }
48815 }
48816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048817 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048818#endif
48819
Daniel Veillard42595322004-11-08 10:52:06 +000048820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048821}
48822
48823
48824static int
48825test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048827
William M. Brack21e4ef22005-01-02 09:53:13 +000048828#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048829 int mem_base;
48830 xmlXPathObjectPtr ret_val;
48831 xmlNodePtr start; /* the starting node */
48832 int n_start;
48833 int startindex; /* the start index */
48834 int n_startindex;
48835 xmlNodePtr end; /* the ending point */
48836 int n_end;
48837 int endindex; /* the ending index */
48838 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048839
Daniel Veillard3d97e662004-11-04 10:49:00 +000048840 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48841 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48842 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48843 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48844 mem_base = xmlMemBlocks();
48845 start = gen_xmlNodePtr(n_start, 0);
48846 startindex = gen_int(n_startindex, 1);
48847 end = gen_xmlNodePtr(n_end, 2);
48848 endindex = gen_int(n_endindex, 3);
48849
48850 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48851 desret_xmlXPathObjectPtr(ret_val);
48852 call_tests++;
48853 des_xmlNodePtr(n_start, start, 0);
48854 des_int(n_startindex, startindex, 1);
48855 des_xmlNodePtr(n_end, end, 2);
48856 des_int(n_endindex, endindex, 3);
48857 xmlResetLastError();
48858 if (mem_base != xmlMemBlocks()) {
48859 printf("Leak of %d blocks found in xmlXPtrNewRange",
48860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048861 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048862 printf(" %d", n_start);
48863 printf(" %d", n_startindex);
48864 printf(" %d", n_end);
48865 printf(" %d", n_endindex);
48866 printf("\n");
48867 }
48868 }
48869 }
48870 }
48871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048872 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048873#endif
48874
Daniel Veillard42595322004-11-08 10:52:06 +000048875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048876}
48877
48878
48879static int
48880test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048882
William M. Brack21e4ef22005-01-02 09:53:13 +000048883#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048884 int mem_base;
48885 xmlXPathObjectPtr ret_val;
48886 xmlNodePtr start; /* the starting node */
48887 int n_start;
48888 xmlXPathObjectPtr end; /* the ending object */
48889 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048890
Daniel Veillard3d97e662004-11-04 10:49:00 +000048891 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48892 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48893 mem_base = xmlMemBlocks();
48894 start = gen_xmlNodePtr(n_start, 0);
48895 end = gen_xmlXPathObjectPtr(n_end, 1);
48896
48897 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48898 desret_xmlXPathObjectPtr(ret_val);
48899 call_tests++;
48900 des_xmlNodePtr(n_start, start, 0);
48901 des_xmlXPathObjectPtr(n_end, end, 1);
48902 xmlResetLastError();
48903 if (mem_base != xmlMemBlocks()) {
48904 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048906 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048907 printf(" %d", n_start);
48908 printf(" %d", n_end);
48909 printf("\n");
48910 }
48911 }
48912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048913 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048914#endif
48915
Daniel Veillard42595322004-11-08 10:52:06 +000048916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048917}
48918
48919
48920static int
48921test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048923
William M. Brack21e4ef22005-01-02 09:53:13 +000048924#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048925 int mem_base;
48926 xmlXPathObjectPtr ret_val;
48927 xmlNodePtr start; /* the starting node */
48928 int n_start;
48929 xmlXPathObjectPtr end; /* the ending point */
48930 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048931
Daniel Veillard3d97e662004-11-04 10:49:00 +000048932 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48933 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48934 mem_base = xmlMemBlocks();
48935 start = gen_xmlNodePtr(n_start, 0);
48936 end = gen_xmlXPathObjectPtr(n_end, 1);
48937
48938 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48939 desret_xmlXPathObjectPtr(ret_val);
48940 call_tests++;
48941 des_xmlNodePtr(n_start, start, 0);
48942 des_xmlXPathObjectPtr(n_end, end, 1);
48943 xmlResetLastError();
48944 if (mem_base != xmlMemBlocks()) {
48945 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048947 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048948 printf(" %d", n_start);
48949 printf(" %d", n_end);
48950 printf("\n");
48951 }
48952 }
48953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048954 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048955#endif
48956
Daniel Veillard42595322004-11-08 10:52:06 +000048957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048958}
48959
48960
48961static int
48962test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048964
William M. Brack21e4ef22005-01-02 09:53:13 +000048965#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048966 int mem_base;
48967 xmlXPathObjectPtr ret_val;
48968 xmlNodePtr start; /* the starting node */
48969 int n_start;
48970 xmlNodePtr end; /* the ending node */
48971 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048972
Daniel Veillard3d97e662004-11-04 10:49:00 +000048973 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48974 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48975 mem_base = xmlMemBlocks();
48976 start = gen_xmlNodePtr(n_start, 0);
48977 end = gen_xmlNodePtr(n_end, 1);
48978
48979 ret_val = xmlXPtrNewRangeNodes(start, end);
48980 desret_xmlXPathObjectPtr(ret_val);
48981 call_tests++;
48982 des_xmlNodePtr(n_start, start, 0);
48983 des_xmlNodePtr(n_end, end, 1);
48984 xmlResetLastError();
48985 if (mem_base != xmlMemBlocks()) {
48986 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048988 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048989 printf(" %d", n_start);
48990 printf(" %d", n_end);
48991 printf("\n");
48992 }
48993 }
48994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048995 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048996#endif
48997
Daniel Veillard42595322004-11-08 10:52:06 +000048998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048999}
49000
49001
49002static int
49003test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049005
William M. Brack21e4ef22005-01-02 09:53:13 +000049006#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049007 int mem_base;
49008 xmlXPathObjectPtr ret_val;
49009 xmlXPathObjectPtr start; /* the starting point */
49010 int n_start;
49011 xmlNodePtr end; /* the ending node */
49012 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049013
Daniel Veillard3d97e662004-11-04 10:49:00 +000049014 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49015 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49016 mem_base = xmlMemBlocks();
49017 start = gen_xmlXPathObjectPtr(n_start, 0);
49018 end = gen_xmlNodePtr(n_end, 1);
49019
49020 ret_val = xmlXPtrNewRangePointNode(start, end);
49021 desret_xmlXPathObjectPtr(ret_val);
49022 call_tests++;
49023 des_xmlXPathObjectPtr(n_start, start, 0);
49024 des_xmlNodePtr(n_end, end, 1);
49025 xmlResetLastError();
49026 if (mem_base != xmlMemBlocks()) {
49027 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
49028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049029 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049030 printf(" %d", n_start);
49031 printf(" %d", n_end);
49032 printf("\n");
49033 }
49034 }
49035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049036 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049037#endif
49038
Daniel Veillard42595322004-11-08 10:52:06 +000049039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049040}
49041
49042
49043static int
49044test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049046
William M. Brack21e4ef22005-01-02 09:53:13 +000049047#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049048 int mem_base;
49049 xmlXPathObjectPtr ret_val;
49050 xmlXPathObjectPtr start; /* the starting point */
49051 int n_start;
49052 xmlXPathObjectPtr end; /* the ending point */
49053 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049054
Daniel Veillard3d97e662004-11-04 10:49:00 +000049055 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49056 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49057 mem_base = xmlMemBlocks();
49058 start = gen_xmlXPathObjectPtr(n_start, 0);
49059 end = gen_xmlXPathObjectPtr(n_end, 1);
49060
49061 ret_val = xmlXPtrNewRangePoints(start, end);
49062 desret_xmlXPathObjectPtr(ret_val);
49063 call_tests++;
49064 des_xmlXPathObjectPtr(n_start, start, 0);
49065 des_xmlXPathObjectPtr(n_end, end, 1);
49066 xmlResetLastError();
49067 if (mem_base != xmlMemBlocks()) {
49068 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
49069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049070 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049071 printf(" %d", n_start);
49072 printf(" %d", n_end);
49073 printf("\n");
49074 }
49075 }
49076 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049077 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049078#endif
49079
Daniel Veillard42595322004-11-08 10:52:06 +000049080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049081}
49082
49083
49084static int
49085test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049087
William M. Brack21e4ef22005-01-02 09:53:13 +000049088#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049089 int mem_base;
49090 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
49091 int n_ctxt;
49092 int nargs; /* the number of args */
49093 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049094
Daniel Veillardce682bc2004-11-05 17:22:25 +000049095 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
49096 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
49097 mem_base = xmlMemBlocks();
49098 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
49099 nargs = gen_int(n_nargs, 1);
49100
49101 xmlXPtrRangeToFunction(ctxt, nargs);
49102 call_tests++;
49103 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
49104 des_int(n_nargs, nargs, 1);
49105 xmlResetLastError();
49106 if (mem_base != xmlMemBlocks()) {
49107 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
49108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049109 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049110 printf(" %d", n_ctxt);
49111 printf(" %d", n_nargs);
49112 printf("\n");
49113 }
49114 }
49115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049116 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049117#endif
49118
Daniel Veillard42595322004-11-08 10:52:06 +000049119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049120}
49121
49122
49123static int
49124test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049126
William M. Brack21e4ef22005-01-02 09:53:13 +000049127#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049128 int mem_base;
49129 xmlXPathObjectPtr ret_val;
49130 xmlLocationSetPtr val; /* the LocationSet value */
49131 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049132
Daniel Veillardce682bc2004-11-05 17:22:25 +000049133 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
49134 mem_base = xmlMemBlocks();
49135 val = gen_xmlLocationSetPtr(n_val, 0);
49136
49137 ret_val = xmlXPtrWrapLocationSet(val);
49138 desret_xmlXPathObjectPtr(ret_val);
49139 call_tests++;
49140 des_xmlLocationSetPtr(n_val, val, 0);
49141 xmlResetLastError();
49142 if (mem_base != xmlMemBlocks()) {
49143 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
49144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049145 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049146 printf(" %d", n_val);
49147 printf("\n");
49148 }
49149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049150 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049151#endif
49152
Daniel Veillard42595322004-11-08 10:52:06 +000049153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049154}
49155
49156static int
49157test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049159
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049160 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000049161 test_ret += test_xmlXPtrBuildNodeList();
49162 test_ret += test_xmlXPtrEval();
49163 test_ret += test_xmlXPtrEvalRangePredicate();
49164 test_ret += test_xmlXPtrLocationSetAdd();
49165 test_ret += test_xmlXPtrLocationSetCreate();
49166 test_ret += test_xmlXPtrLocationSetDel();
49167 test_ret += test_xmlXPtrLocationSetMerge();
49168 test_ret += test_xmlXPtrLocationSetRemove();
49169 test_ret += test_xmlXPtrNewCollapsedRange();
49170 test_ret += test_xmlXPtrNewContext();
49171 test_ret += test_xmlXPtrNewLocationSetNodeSet();
49172 test_ret += test_xmlXPtrNewLocationSetNodes();
49173 test_ret += test_xmlXPtrNewRange();
49174 test_ret += test_xmlXPtrNewRangeNodeObject();
49175 test_ret += test_xmlXPtrNewRangeNodePoint();
49176 test_ret += test_xmlXPtrNewRangeNodes();
49177 test_ret += test_xmlXPtrNewRangePointNode();
49178 test_ret += test_xmlXPtrNewRangePoints();
49179 test_ret += test_xmlXPtrRangeToFunction();
49180 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000049181
Daniel Veillard42595322004-11-08 10:52:06 +000049182 if (test_ret != 0)
49183 printf("Module xpointer: %d errors\n", test_ret);
49184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049185}
Daniel Veillardce244ad2004-11-05 10:03:46 +000049186static int
49187test_module(const char *module) {
49188 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
49189 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049190 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049191 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049192 if (!strcmp(module, "catalog")) return(test_catalog());
49193 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049194 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049195 if (!strcmp(module, "dict")) return(test_dict());
49196 if (!strcmp(module, "encoding")) return(test_encoding());
49197 if (!strcmp(module, "entities")) return(test_entities());
49198 if (!strcmp(module, "hash")) return(test_hash());
49199 if (!strcmp(module, "list")) return(test_list());
49200 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
49201 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
49202 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049203 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049204 if (!strcmp(module, "pattern")) return(test_pattern());
49205 if (!strcmp(module, "relaxng")) return(test_relaxng());
49206 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
49207 if (!strcmp(module, "tree")) return(test_tree());
49208 if (!strcmp(module, "uri")) return(test_uri());
49209 if (!strcmp(module, "valid")) return(test_valid());
49210 if (!strcmp(module, "xinclude")) return(test_xinclude());
49211 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049212 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049213 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049214 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049215 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049216 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049217 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
49218 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
49219 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
49220 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000049221 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049222 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
49223 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049224 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049225 if (!strcmp(module, "xpointer")) return(test_xpointer());
49226 return(0);
49227}