blob: 14421372c8838c8e7bb4849b3656ab0e2c828302 [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
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000196#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000197
Daniel Veillard3d97e662004-11-04 10:49:00 +0000198static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000199 return(NULL);
200}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000201static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000202}
203
Daniel Veillardce244ad2004-11-05 10:03:46 +0000204#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000205#define gen_nb_const_void_ptr 2
206
207static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
208 if (no == 0) return((const void *) "immutable string");
209 return(NULL);
210}
211static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
212}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000213#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000214
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000215#define gen_nb_userdata 3
216
Daniel Veillard3d97e662004-11-04 10:49:00 +0000217static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000218 if (no == 0) return((void *) &call_tests);
219 if (no == 1) return((void *) -1);
220 return(NULL);
221}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000222static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223}
224
225
Daniel Veillardd93f6252004-11-02 15:53:51 +0000226#define gen_nb_int 4
227
Daniel Veillard3d97e662004-11-04 10:49:00 +0000228static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
229 if (no == 0) return(0);
230 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000231 if (no == 2) return(-1);
232 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000233 return(-1);
234}
235
236static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
237}
238
Daniel Veillard6128c012004-11-08 17:16:15 +0000239#define gen_nb_parseroptions 5
240
241static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
242 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
243 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
244 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
245 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
246 return(XML_PARSE_SAX1);
247}
248
249static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
250}
251
Daniel Veillardce244ad2004-11-05 10:03:46 +0000252#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000253#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000254
255static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
256 if (no == 0) return(0);
257 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000258 if (no == 2) return(-1);
259 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000260 return(-1);
261}
262
263static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
264}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000265#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000266
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000267#define gen_nb_xmlChar 4
268
269static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
270 if (no == 0) return('a');
271 if (no == 1) return(' ');
272 if (no == 2) return('ø');
273 return(0);
274}
275
276static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
277}
278
Daniel Veillard3d97e662004-11-04 10:49:00 +0000279#define gen_nb_unsigned_int 3
280
281static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000282 if (no == 0) return(0);
283 if (no == 1) return(1);
284 if (no == 2) return(122);
285 return(-1);
286}
287
Daniel Veillard3d97e662004-11-04 10:49:00 +0000288static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000289}
290
Daniel Veillard3d95c732004-11-06 22:25:14 +0000291#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000292
293static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
294 if (no == 0) return(0);
295 if (no == 1) return(1);
296 if (no == 2) return(122);
297 return(-1);
298}
299
300static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
301}
302
Daniel Veillard3d95c732004-11-06 22:25:14 +0000303#define gen_nb_double 4
304
305static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
306 if (no == 0) return(0);
307 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000308#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000309 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000310#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311 return(-1);
312}
313
314static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
315}
316
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000317#define gen_nb_unsigned_long_ptr 2
318
319static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
320 if (no == 0) return(&longtab[nr]);
321 return(NULL);
322}
323
324static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
325}
326
327#define gen_nb_int_ptr 2
328
329static int *gen_int_ptr(int no, int nr) {
330 if (no == 0) return(&inttab[nr]);
331 return(NULL);
332}
333
334static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
335}
336
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337#define gen_nb_const_char_ptr 4
338
Daniel Veillardce682bc2004-11-05 17:22:25 +0000339static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
340 if (no == 0) return((char *) "foo");
341 if (no == 1) return((char *) "<foo/>");
342 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000343 return(NULL);
344}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000345static 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 +0000346}
347
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000348#define gen_nb_xmlChar_ptr 2
349
Daniel Veillard3d97e662004-11-04 10:49:00 +0000350static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000351 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000352 return(NULL);
353}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000354static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000355}
356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000357#define gen_nb_FILE_ptr 2
358
359static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
360 if (no == 0) return(fopen("test.out", "a+"));
361 return(NULL);
362}
363static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
364 if (val != NULL) fclose(val);
365}
366
Daniel Veillarda82b1822004-11-08 16:24:57 +0000367#define gen_nb_debug_FILE_ptr 2
368static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
369 return(fopen("test.out", "a+"));
370}
371static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillardd93f6252004-11-02 15:53:51 +0000375#define gen_nb_const_xmlChar_ptr 5
376
Daniel Veillardce682bc2004-11-05 17:22:25 +0000377static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
378 if (no == 0) return((xmlChar *) "foo");
379 if (no == 1) return((xmlChar *) "<foo/>");
380 if (no == 2) return((xmlChar *) "nøne");
381 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000382 return(NULL);
383}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000384static 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 +0000385}
386
387#define gen_nb_filepath 8
388
Daniel Veillard3d97e662004-11-04 10:49:00 +0000389static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 if (no == 0) return("missing.xml");
391 if (no == 1) return("<foo/>");
392 if (no == 2) return("test/ent2");
393 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000394 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000395 if (no == 5) return("http://missing.example.org/");
396 if (no == 6) return("http://missing. example.org/");
397 return(NULL);
398}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000399static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000400}
401
Daniel Veillard27f20102004-11-05 11:50:11 +0000402#define gen_nb_eaten_name 2
403
404static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000405 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000406 return(NULL);
407}
408static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
409}
410
Daniel Veillardd93f6252004-11-02 15:53:51 +0000411#define gen_nb_fileoutput 6
412
Daniel Veillard3d97e662004-11-04 10:49:00 +0000413static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000414 if (no == 0) return("/missing.xml");
415 if (no == 1) return("<foo/>");
416 if (no == 2) return("ftp://missing.example.org/foo");
417 if (no == 3) return("http://missing.example.org/");
418 if (no == 4) return("http://missing. example.org/");
419 return(NULL);
420}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422}
423
Daniel Veillarda521d282004-11-09 14:59:59 +0000424#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000425static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000426 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000427 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000428 return(NULL);
429}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000431 if (val != NULL)
432 xmlFreeParserCtxt(val);
433}
434
Daniel Veillard34099b42004-11-04 17:34:35 +0000435#define gen_nb_xmlSAXHandlerPtr 2
436static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000437#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000438 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000439#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000440 return(NULL);
441}
442static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
443}
444
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000445#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000446static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000448 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000449#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000450 return(NULL);
451}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000452static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000453#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000454 if (val != NULL)
455 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000456#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000457}
458
Daniel Veillard34099b42004-11-04 17:34:35 +0000459#define gen_nb_xmlParserInputBufferPtr 8
460
461static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
462 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
463 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
464 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
465 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
466 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
467 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
468 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
469 return(NULL);
470}
471static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
472 xmlFreeParserInputBuffer(val);
473}
474
Daniel Veillardd93f6252004-11-02 15:53:51 +0000475#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000476static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000477 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
478 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
479 return(NULL);
480}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000481static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000482 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483 xmlFreeDoc(val);
484}
485
Daniel Veillardce244ad2004-11-05 10:03:46 +0000486#define gen_nb_xmlAttrPtr 2
487static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
488 if (no == 0) return(get_api_attr());
489 return(NULL);
490}
491static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
492 if (no == 0) free_api_doc();
493}
494
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000495#define gen_nb_xmlDictPtr 2
496static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
497 if (no == 0) return(xmlDictCreate());
498 return(NULL);
499}
500static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
501 if (val != NULL)
502 xmlDictFree(val);
503}
504
Daniel Veillardce244ad2004-11-05 10:03:46 +0000505#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000506static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000507 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000508 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000509 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000510/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000511}
Daniel Veillard27f20102004-11-05 11:50:11 +0000512static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513 if (no == 1) free_api_doc();
514 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 xmlUnlinkNode(val);
516 xmlFreeNode(val);
517 }
518}
519
Daniel Veillard27f20102004-11-05 11:50:11 +0000520#define gen_nb_xmlDtdPtr 3
521static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000522 if (no == 0)
523 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000524 if (no == 1) return(get_api_dtd());
525 return(NULL);
526}
527static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
528 if (no == 1) free_api_doc();
529 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 xmlUnlinkNode((xmlNodePtr) val);
531 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 }
533}
534
535#define gen_nb_xmlNsPtr 2
536static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
537 if (no == 0) return(get_api_ns());
538 return(NULL);
539}
540static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
541 if (no == 0) free_api_doc();
542}
543
Daniel Veillardd93f6252004-11-02 15:53:51 +0000544#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000546 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
547 if (no == 0) return(xmlNewText(BAD_CAST "text"));
548 return(NULL);
549}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000550static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000551}
552
Daniel Veillardc8311492004-11-08 16:51:13 +0000553#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000554#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000555static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000556 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000560 if (val != NULL) xmlFreeTextWriter(val);
561}
Daniel Veillardc8311492004-11-08 16:51:13 +0000562#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000563
Daniel Veillardc8311492004-11-08 16:51:13 +0000564#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000565#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000567 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
568 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
569 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
570 return(NULL);
571}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000572static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573 if (val != NULL) xmlFreeTextReader(val);
574}
Daniel Veillardc8311492004-11-08 16:51:13 +0000575#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000576
Daniel Veillard34099b42004-11-04 17:34:35 +0000577#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000578static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000580 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000581 return(NULL);
582}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000583static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000584 if (val != NULL) {
585 xmlBufferFree(val);
586 }
587}
588
589#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000590static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000591 if (no == 0) return(xmlListCreate(NULL, NULL));
592 return(NULL);
593}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000594static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000595 if (val != NULL) {
596 xmlListDelete(val);
597 }
598}
599
600#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000601static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000602 if (no == 0) return(xmlHashCreate(10));
603 return(NULL);
604}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000605static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000606 if (val != NULL) {
607 xmlHashFree(val, NULL);
608 }
609}
610
611#include <libxml/xpathInternals.h>
612
Daniel Veillardc8311492004-11-08 16:51:13 +0000613#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000615static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000616 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
617 if (no == 1) return(xmlXPathNewFloat(1.1));
618 if (no == 2) return(xmlXPathNewBoolean(1));
619 if (no == 3) return(xmlXPathNewNodeSet(NULL));
620 return(NULL);
621}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000622static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000623 if (val != NULL) {
624 xmlXPathFreeObject(val);
625 }
626}
Daniel Veillardc8311492004-11-08 16:51:13 +0000627#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000628
Daniel Veillardc8311492004-11-08 16:51:13 +0000629#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630#define gen_nb_xmlOutputBufferPtr 2
631static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
632 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
633 return(NULL);
634}
635static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
636 if (val != NULL) {
637 xmlOutputBufferClose(val);
638 }
639}
Daniel Veillardc8311492004-11-08 16:51:13 +0000640#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000641
Daniel Veillardc8311492004-11-08 16:51:13 +0000642#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000643#define gen_nb_xmlNanoFTPCtxtPtr 4
644static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
645 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
646 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
647 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
648 return(NULL);
649}
650static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
651 if (val != NULL) {
652 xmlNanoFTPFreeCtxt(val);
653 }
654}
Daniel Veillardc8311492004-11-08 16:51:13 +0000655#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000656
Daniel Veillardc8311492004-11-08 16:51:13 +0000657#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000658#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000659static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000660 return(NULL);
661}
662static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
663}
Daniel Veillardc8311492004-11-08 16:51:13 +0000664#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000665
Daniel Veillard3d97e662004-11-04 10:49:00 +0000666#define gen_nb_xmlCharEncoding 4
667static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
669 if (no == 1) return(XML_CHAR_ENCODING_NONE);
670 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
671 return(XML_CHAR_ENCODING_ERROR);
672}
673static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
674}
675
Daniel Veillard42595322004-11-08 10:52:06 +0000676#define gen_nb_xmlHashDeallocator 2
677static void
678test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
679}
680
681static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(test_xmlHashDeallocator);
683 return(NULL);
684}
685static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
686}
687
Daniel Veillardd93f6252004-11-02 15:53:51 +0000688
689static void desret_int(int val ATTRIBUTE_UNUSED) {
690}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000691static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
692}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000693static void desret_long(long val ATTRIBUTE_UNUSED) {
694}
William M. Brack094dd862004-11-14 14:28:34 +0000695static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
696}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000697static void desret_double(double val ATTRIBUTE_UNUSED) {
698}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000699static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
700}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000701#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000702static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
703}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000704#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000705static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
706}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000707static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
708}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000709static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000711static void desret_xmlChar_ptr(xmlChar *val) {
712 if (val != NULL)
713 xmlFree(val);
714}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000715static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000716 if (val != api_doc)
717 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000718}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000719static void desret_xmlDictPtr(xmlDictPtr val) {
720 xmlDictFree(val);
721}
Daniel Veillardc8311492004-11-08 16:51:13 +0000722#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000723static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
724 xmlOutputBufferClose(val);
725}
Daniel Veillardc8311492004-11-08 16:51:13 +0000726#endif
727#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000728static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
729 xmlFreeTextReader(val);
730}
Daniel Veillardc8311492004-11-08 16:51:13 +0000731#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000733 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
734 xmlUnlinkNode(val);
735 xmlFreeNode(val);
736 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000737}
Daniel Veillard57b25162004-11-06 14:50:18 +0000738static void desret_xmlAttrPtr(xmlAttrPtr val) {
739 if (val != NULL) {
740 xmlUnlinkNode((xmlNodePtr) val);
741 xmlFreeNode((xmlNodePtr) val);
742 }
743}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000744static void desret_xmlEntityPtr(xmlEntityPtr val) {
745 if (val != NULL) {
746 xmlUnlinkNode((xmlNodePtr) val);
747 xmlFreeNode((xmlNodePtr) val);
748 }
749}
Daniel Veillard42595322004-11-08 10:52:06 +0000750static void desret_xmlElementPtr(xmlElementPtr val) {
751 if (val != NULL) {
752 xmlUnlinkNode((xmlNodePtr) val);
753 }
754}
755static void desret_xmlAttributePtr(xmlAttributePtr val) {
756 if (val != NULL) {
757 xmlUnlinkNode((xmlNodePtr) val);
758 }
759}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000760static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
761}
Daniel Veillard34099b42004-11-04 17:34:35 +0000762static void desret_xmlDtdPtr(xmlDtdPtr val) {
763 desret_xmlNodePtr((xmlNodePtr)val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000766static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000767 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000768}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000769static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
770 xmlXPathFreeNodeSet(val);
771}
Daniel Veillardc8311492004-11-08 16:51:13 +0000772#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000773static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
774 xmlFreeParserCtxt(val);
775}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000776static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
777 xmlFreeParserInputBuffer(val);
778}
Daniel Veillard42595322004-11-08 10:52:06 +0000779static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
780 xmlFreeInputStream(val);
781}
Daniel Veillardc8311492004-11-08 16:51:13 +0000782#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000783static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
784 xmlFreeTextWriter(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000787static void desret_xmlBufferPtr(xmlBufferPtr val) {
788 xmlBufferFree(val);
789}
Daniel Veillardc8311492004-11-08 16:51:13 +0000790#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000791static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
792 xmlSchemaFreeParserCtxt(val);
793}
794static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
795}
796static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
797 xmlRelaxNGFreeParserCtxt(val);
798}
Daniel Veillardc8311492004-11-08 16:51:13 +0000799#endif
800#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000801static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000802}
Daniel Veillardc8311492004-11-08 16:51:13 +0000803#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000804
Daniel Veillarda521d282004-11-09 14:59:59 +0000805/* cut and pasted from autogenerated to avoid troubles */
806#define gen_nb_const_xmlChar_ptr_ptr 1
807static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808 return(NULL);
809}
810static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
811}
812
813#define gen_nb_unsigned_char_ptr 1
814static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
815 return(NULL);
816}
817static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819
820#define gen_nb_const_unsigned_char_ptr 1
821static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822 return(NULL);
823}
824static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
825}
826
827#ifdef LIBXML_HTML_ENABLED
828#define gen_nb_const_htmlNodePtr 1
829static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
830 return(NULL);
831}
832static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
833}
834#endif
835
836#ifdef LIBXML_HTML_ENABLED
837#define gen_nb_htmlDocPtr 3
838static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839 if (no == 0) return(htmlNewDoc(NULL, NULL));
840 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
841 return(NULL);
842}
843static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
844 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
845 xmlFreeDoc(val);
846}
847static void desret_htmlDocPtr(htmlDocPtr val) {
848 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
849 xmlFreeDoc(val);
850}
851#define gen_nb_htmlParserCtxtPtr 3
852static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 if (no == 0) return(xmlNewParserCtxt());
854 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
855 return(NULL);
856}
857static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
858 if (val != NULL)
859 htmlFreeParserCtxt(val);
860}
861static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
862 if (val != NULL)
863 htmlFreeParserCtxt(val);
864}
865#endif
866
867#ifdef LIBXML_XPATH_ENABLED
868#define gen_nb_xmlNodeSetPtr 1
869static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
870 return(NULL);
871}
872static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
873}
874#endif
875
876#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000877#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000878#define gen_nb_xmlShellCtxtPtr 1
879static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
880 return(NULL);
881}
882static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
883}
884#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000885#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000886
887#ifdef LIBXML_PATTERN_ENABLED
888#define gen_nb_xmlPatternPtr 1
889static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
890 return(NULL);
891}
892static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893}
894#endif
895
William M. Brack094dd862004-11-14 14:28:34 +0000896#define gen_nb_xmlElementContentPtr 1
897static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
898 return(NULL);
899}
900static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
901 if (val != NULL)
902 xmlFreeElementContent(val);
903}
904static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
905 if (val != NULL)
906 xmlFreeElementContent(val);
907}
908
909#define gen_nb_xmlParserNodeInfoSeqPtr 1
910static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915
916static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
917}
918
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000919/************************************************************************
920 * *
921 * WARNING: end of the manually maintained part of the test code *
922 * do not remove or alter the CUT HERE line *
923 * *
924 ************************************************************************/
925
Daniel Veillard34099b42004-11-04 17:34:35 +0000926/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000927#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000928static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
929}
930
Daniel Veillarda521d282004-11-09 14:59:59 +0000931#endif
932
Daniel Veillard57b25162004-11-06 14:50:18 +0000933#define gen_nb_xmlAttributeDefault 4
934static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
935 if (no == 1) return(XML_ATTRIBUTE_FIXED);
936 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
937 if (no == 3) return(XML_ATTRIBUTE_NONE);
938 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
939 return(0);
940}
William M. Brack094dd862004-11-14 14:28:34 +0000941
Daniel Veillard57b25162004-11-06 14:50:18 +0000942static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943}
Daniel Veillard57b25162004-11-06 14:50:18 +0000944
945#define gen_nb_xmlAttributeType 4
946static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
947 if (no == 1) return(XML_ATTRIBUTE_CDATA);
948 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
949 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
950 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
951 return(0);
952}
William M. Brack094dd862004-11-14 14:28:34 +0000953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
955}
Daniel Veillard57b25162004-11-06 14:50:18 +0000956
957#define gen_nb_xmlBufferAllocationScheme 3
958static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
959 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
960 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
961 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
962 return(0);
963}
William M. Brack094dd862004-11-14 14:28:34 +0000964
Daniel Veillard57b25162004-11-06 14:50:18 +0000965static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
966}
William M. Brack094dd862004-11-14 14:28:34 +0000967
Daniel Veillard57b25162004-11-06 14:50:18 +0000968static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
969}
970
Daniel Veillarda521d282004-11-09 14:59:59 +0000971#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000972#define gen_nb_xmlCatalogAllow 4
973static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
974 if (no == 1) return(XML_CATA_ALLOW_ALL);
975 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
976 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
977 if (no == 4) return(XML_CATA_ALLOW_NONE);
978 return(0);
979}
William M. Brack094dd862004-11-14 14:28:34 +0000980
Daniel Veillard57b25162004-11-06 14:50:18 +0000981static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
982}
William M. Brack094dd862004-11-14 14:28:34 +0000983
Daniel Veillard57b25162004-11-06 14:50:18 +0000984static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
985}
986
Daniel Veillarda521d282004-11-09 14:59:59 +0000987#endif
988
989#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000990#define gen_nb_xmlCatalogPrefer 3
991static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
992 if (no == 1) return(XML_CATA_PREFER_NONE);
993 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
994 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
995 return(0);
996}
William M. Brack094dd862004-11-14 14:28:34 +0000997
Daniel Veillard57b25162004-11-06 14:50:18 +0000998static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
999}
William M. Brack094dd862004-11-14 14:28:34 +00001000
Daniel Veillard57b25162004-11-06 14:50:18 +00001001static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1002}
1003
Daniel Veillarda521d282004-11-09 14:59:59 +00001004#endif
1005
Daniel Veillard57b25162004-11-06 14:50:18 +00001006#define gen_nb_xmlElementContentType 4
1007static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1009 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1010 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1011 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1012 return(0);
1013}
Daniel Veillard57b25162004-11-06 14:50:18 +00001014
William M. Brack094dd862004-11-14 14:28:34 +00001015static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001016}
1017
1018#define gen_nb_xmlElementTypeVal 4
1019static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1020 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1021 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1022 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1023 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1024 return(0);
1025}
William M. Brack094dd862004-11-14 14:28:34 +00001026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1028}
Daniel Veillard57b25162004-11-06 14:50:18 +00001029
Daniel Veillard57b25162004-11-06 14:50:18 +00001030static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1031}
1032
Daniel Veillarda521d282004-11-09 14:59:59 +00001033#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001034#define gen_nb_xmlSchemaValType 4
1035static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1036 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1037 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1038 if (no == 3) return(XML_SCHEMAS_ANYURI);
1039 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1040 return(0);
1041}
William M. Brack094dd862004-11-14 14:28:34 +00001042
Daniel Veillard57b25162004-11-06 14:50:18 +00001043static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1044}
Daniel Veillard57b25162004-11-06 14:50:18 +00001045
Daniel Veillarda521d282004-11-09 14:59:59 +00001046#endif
1047
Daniel Veillard34099b42004-11-04 17:34:35 +00001048#include <libxml/HTMLparser.h>
1049#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001050#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001051#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001052#include <libxml/catalog.h>
1053#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001054#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001055#include <libxml/dict.h>
1056#include <libxml/encoding.h>
1057#include <libxml/entities.h>
1058#include <libxml/hash.h>
1059#include <libxml/list.h>
1060#include <libxml/nanoftp.h>
1061#include <libxml/nanohttp.h>
1062#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001063#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001064#include <libxml/pattern.h>
1065#include <libxml/relaxng.h>
1066#include <libxml/schemasInternals.h>
1067#include <libxml/tree.h>
1068#include <libxml/uri.h>
1069#include <libxml/valid.h>
1070#include <libxml/xinclude.h>
1071#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001072#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001073#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001074#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001075#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001076#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001077#include <libxml/xmlsave.h>
1078#include <libxml/xmlschemas.h>
1079#include <libxml/xmlschemastypes.h>
1080#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001081#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001082#include <libxml/xmlwriter.h>
1083#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001084#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001085#include <libxml/xpointer.h>
1086static int test_HTMLparser(void);
1087static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001088static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001089static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001090static int test_catalog(void);
1091static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001092static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001093static int test_dict(void);
1094static int test_encoding(void);
1095static int test_entities(void);
1096static int test_hash(void);
1097static int test_list(void);
1098static int test_nanoftp(void);
1099static int test_nanohttp(void);
1100static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001101static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001102static int test_pattern(void);
1103static int test_relaxng(void);
1104static int test_schemasInternals(void);
1105static int test_tree(void);
1106static int test_uri(void);
1107static int test_valid(void);
1108static int test_xinclude(void);
1109static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001110static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001111static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001112static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001113static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001114static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001115static int test_xmlsave(void);
1116static int test_xmlschemas(void);
1117static int test_xmlschemastypes(void);
1118static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001119static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001120static int test_xmlwriter(void);
1121static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001122static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001123static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001124
1125/**
1126 * testlibxml2:
1127 *
1128 * Main entry point of the tester for the full libxml2 module,
1129 * it calls all the tester entry point for each module.
1130 *
1131 * Returns the number of error found
1132 */
1133static int
1134testlibxml2(void)
1135{
Daniel Veillard42595322004-11-08 10:52:06 +00001136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001137
Daniel Veillard42595322004-11-08 10:52:06 +00001138 test_ret += test_HTMLparser();
1139 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001140 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001141 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001142 test_ret += test_catalog();
1143 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001144 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001145 test_ret += test_dict();
1146 test_ret += test_encoding();
1147 test_ret += test_entities();
1148 test_ret += test_hash();
1149 test_ret += test_list();
1150 test_ret += test_nanoftp();
1151 test_ret += test_nanohttp();
1152 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001153 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001154 test_ret += test_pattern();
1155 test_ret += test_relaxng();
1156 test_ret += test_schemasInternals();
1157 test_ret += test_tree();
1158 test_ret += test_uri();
1159 test_ret += test_valid();
1160 test_ret += test_xinclude();
1161 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001162 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001163 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001164 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001165 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001166 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001167 test_ret += test_xmlsave();
1168 test_ret += test_xmlschemas();
1169 test_ret += test_xmlschemastypes();
1170 test_ret += test_xmlstring();
1171 test_ret += test_xmlunicode();
1172 test_ret += test_xmlwriter();
1173 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001174 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001175 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001176
Daniel Veillard3d97e662004-11-04 10:49:00 +00001177 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001178 function_tests, call_tests, test_ret);
1179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001180}
1181
1182
1183static int
1184test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001186
William M. Brack21e4ef22005-01-02 09:53:13 +00001187#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001188 int mem_base;
1189 int ret_val;
1190 unsigned char * out; /* a pointer to an array of bytes to store the result */
1191 int n_out;
1192 int * outlen; /* the length of @out */
1193 int n_outlen;
1194 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1195 int n_in;
1196 int * inlen; /* the length of @in */
1197 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001198
Daniel Veillardce682bc2004-11-05 17:22:25 +00001199 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1200 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1201 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1202 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1203 mem_base = xmlMemBlocks();
1204 out = gen_unsigned_char_ptr(n_out, 0);
1205 outlen = gen_int_ptr(n_outlen, 1);
1206 in = gen_const_unsigned_char_ptr(n_in, 2);
1207 inlen = gen_int_ptr(n_inlen, 3);
1208
William M. Brackf13f77f2004-11-12 16:03:48 +00001209 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001210 desret_int(ret_val);
1211 call_tests++;
1212 des_unsigned_char_ptr(n_out, out, 0);
1213 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001214 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001215 des_int_ptr(n_inlen, inlen, 3);
1216 xmlResetLastError();
1217 if (mem_base != xmlMemBlocks()) {
1218 printf("Leak of %d blocks found in UTF8ToHtml",
1219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001220 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001221 printf(" %d", n_out);
1222 printf(" %d", n_outlen);
1223 printf(" %d", n_in);
1224 printf(" %d", n_inlen);
1225 printf("\n");
1226 }
1227 }
1228 }
1229 }
1230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001231 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001232#endif
1233
Daniel Veillard42595322004-11-08 10:52:06 +00001234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001235}
1236
Daniel Veillarda521d282004-11-09 14:59:59 +00001237#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001238
Daniel Veillardce682bc2004-11-05 17:22:25 +00001239#define gen_nb_const_htmlElemDesc_ptr 1
1240static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1241 return(NULL);
1242}
1243static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1244}
Daniel Veillarda521d282004-11-09 14:59:59 +00001245#endif
1246
Daniel Veillardce682bc2004-11-05 17:22:25 +00001247
Daniel Veillardd93f6252004-11-02 15:53:51 +00001248static int
1249test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001251
William M. Brack21e4ef22005-01-02 09:53:13 +00001252#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001253 int mem_base;
1254 htmlStatus ret_val;
1255 htmlElemDesc * elt; /* HTML element */
1256 int n_elt;
1257 xmlChar * attr; /* HTML attribute */
1258 int n_attr;
1259 int legacy; /* whether to allow deprecated attributes */
1260 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001261
Daniel Veillard57b25162004-11-06 14:50:18 +00001262 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1263 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1264 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1265 mem_base = xmlMemBlocks();
1266 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1267 attr = gen_const_xmlChar_ptr(n_attr, 1);
1268 legacy = gen_int(n_legacy, 2);
1269
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001271 desret_htmlStatus(ret_val);
1272 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001273 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1274 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001275 des_int(n_legacy, legacy, 2);
1276 xmlResetLastError();
1277 if (mem_base != xmlMemBlocks()) {
1278 printf("Leak of %d blocks found in htmlAttrAllowed",
1279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001280 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001281 printf(" %d", n_elt);
1282 printf(" %d", n_attr);
1283 printf(" %d", n_legacy);
1284 printf("\n");
1285 }
1286 }
1287 }
1288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001289 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001290#endif
1291
Daniel Veillard42595322004-11-08 10:52:06 +00001292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001293}
1294
Daniel Veillarda521d282004-11-09 14:59:59 +00001295#ifdef LIBXML_HTML_ENABLED
1296
1297#define gen_nb_htmlNodePtr 1
1298static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1299 return(NULL);
1300}
1301static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1302}
1303#endif
1304
Daniel Veillardd93f6252004-11-02 15:53:51 +00001305
1306static int
1307test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001309
William M. Brack21e4ef22005-01-02 09:53:13 +00001310#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001311 int mem_base;
1312 int ret_val;
1313 htmlDocPtr doc; /* the HTML document */
1314 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001315 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001316 int n_name;
1317 htmlNodePtr elem; /* the HTML element */
1318 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001319
Daniel Veillarda521d282004-11-09 14:59:59 +00001320 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001321 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001322 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001323 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001324 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001325 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001326 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001327
William M. Brackf13f77f2004-11-12 16:03:48 +00001328 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001329 desret_int(ret_val);
1330 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001331 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001332 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001333 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001334 xmlResetLastError();
1335 if (mem_base != xmlMemBlocks()) {
1336 printf("Leak of %d blocks found in htmlAutoCloseTag",
1337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001339 printf(" %d", n_doc);
1340 printf(" %d", n_name);
1341 printf(" %d", n_elem);
1342 printf("\n");
1343 }
1344 }
1345 }
1346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001347 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001348#endif
1349
Daniel Veillard42595322004-11-08 10:52:06 +00001350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001351}
1352
1353
1354static int
1355test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001357
William M. Brack21e4ef22005-01-02 09:53:13 +00001358#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001359 int mem_base;
1360 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001361 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001362 int n_buffer;
1363 int size; /* the size of the array */
1364 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001365
Daniel Veillard34099b42004-11-04 17:34:35 +00001366 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1367 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1368 mem_base = xmlMemBlocks();
1369 buffer = gen_const_char_ptr(n_buffer, 0);
1370 size = gen_int(n_size, 1);
1371
William M. Brackf13f77f2004-11-12 16:03:48 +00001372 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001373 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001374 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001375 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001376 des_int(n_size, size, 1);
1377 xmlResetLastError();
1378 if (mem_base != xmlMemBlocks()) {
1379 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001381 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001382 printf(" %d", n_buffer);
1383 printf(" %d", n_size);
1384 printf("\n");
1385 }
1386 }
1387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001388 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001389#endif
1390
Daniel Veillard42595322004-11-08 10:52:06 +00001391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001392}
1393
Daniel Veillarda521d282004-11-09 14:59:59 +00001394#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001395
Daniel Veillardce682bc2004-11-05 17:22:25 +00001396#define gen_nb_htmlSAXHandlerPtr 1
1397static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1398 return(NULL);
1399}
1400static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1401}
Daniel Veillarda521d282004-11-09 14:59:59 +00001402#endif
1403
Daniel Veillardce682bc2004-11-05 17:22:25 +00001404
Daniel Veillardd93f6252004-11-02 15:53:51 +00001405static int
1406test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001408
William M. Brack21e4ef22005-01-02 09:53:13 +00001409#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001410 int mem_base;
1411 htmlParserCtxtPtr ret_val;
1412 htmlSAXHandlerPtr sax; /* a SAX handler */
1413 int n_sax;
1414 void * user_data; /* The user data returned on SAX callbacks */
1415 int n_user_data;
1416 char * chunk; /* a pointer to an array of chars */
1417 int n_chunk;
1418 int size; /* number of chars in the array */
1419 int n_size;
1420 const char * filename; /* an optional file name or URI */
1421 int n_filename;
1422 xmlCharEncoding enc; /* an optional encoding */
1423 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001424
Daniel Veillardce682bc2004-11-05 17:22:25 +00001425 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1426 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1427 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1428 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001429 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001430 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1431 mem_base = xmlMemBlocks();
1432 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1433 user_data = gen_userdata(n_user_data, 1);
1434 chunk = gen_const_char_ptr(n_chunk, 2);
1435 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001436 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001437 enc = gen_xmlCharEncoding(n_enc, 5);
1438
William M. Brackf13f77f2004-11-12 16:03:48 +00001439 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001440 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001441 call_tests++;
1442 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1443 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001444 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001445 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001446 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001447 des_xmlCharEncoding(n_enc, enc, 5);
1448 xmlResetLastError();
1449 if (mem_base != xmlMemBlocks()) {
1450 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001453 printf(" %d", n_sax);
1454 printf(" %d", n_user_data);
1455 printf(" %d", n_chunk);
1456 printf(" %d", n_size);
1457 printf(" %d", n_filename);
1458 printf(" %d", n_enc);
1459 printf("\n");
1460 }
1461 }
1462 }
1463 }
1464 }
1465 }
1466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001467 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001468#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001469
Daniel Veillard42595322004-11-08 10:52:06 +00001470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001471}
1472
1473
1474static int
1475test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001477
William M. Brack21e4ef22005-01-02 09:53:13 +00001478#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001479 int mem_base;
1480 htmlDocPtr ret_val;
1481 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1482 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001483 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001484 int n_cur;
1485 const char * URL; /* the base URL to use for the document */
1486 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001487 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001488 int n_encoding;
1489 int options; /* a combination of htmlParserOption(s) */
1490 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001491
Daniel Veillarda521d282004-11-09 14:59:59 +00001492 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001493 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1494 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1495 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1496 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1497 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001498 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001499 cur = gen_const_xmlChar_ptr(n_cur, 1);
1500 URL = gen_filepath(n_URL, 2);
1501 encoding = gen_const_char_ptr(n_encoding, 3);
1502 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001503
William M. Brackf13f77f2004-11-12 16:03:48 +00001504 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001505 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001506 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001507 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001508 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001509 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001510 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001511 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001512 xmlResetLastError();
1513 if (mem_base != xmlMemBlocks()) {
1514 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001517 printf(" %d", n_ctxt);
1518 printf(" %d", n_cur);
1519 printf(" %d", n_URL);
1520 printf(" %d", n_encoding);
1521 printf(" %d", n_options);
1522 printf("\n");
1523 }
1524 }
1525 }
1526 }
1527 }
1528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001529 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001530#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001531
Daniel Veillard42595322004-11-08 10:52:06 +00001532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001533}
1534
1535
1536static int
1537test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001539
William M. Brack21e4ef22005-01-02 09:53:13 +00001540#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001541 htmlDocPtr ret_val;
1542 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1543 int n_ctxt;
1544 const char * filename; /* a file or URL */
1545 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001546 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001547 int n_encoding;
1548 int options; /* a combination of htmlParserOption(s) */
1549 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001550
Daniel Veillarda521d282004-11-09 14:59:59 +00001551 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001552 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1553 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1554 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001555 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001556 filename = gen_filepath(n_filename, 1);
1557 encoding = gen_const_char_ptr(n_encoding, 2);
1558 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001559
William M. Brackf13f77f2004-11-12 16:03:48 +00001560 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001561 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001562 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001563 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001564 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001565 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001566 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001567 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001568 }
1569 }
1570 }
1571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001572 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573#endif
1574
Daniel Veillard42595322004-11-08 10:52:06 +00001575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001576}
1577
1578
1579static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001580test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001582
William M. Brack21e4ef22005-01-02 09:53:13 +00001583#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001584 int mem_base;
1585 htmlDocPtr ret_val;
1586 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1587 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001588 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001589 int n_buffer;
1590 int size; /* the size of the array */
1591 int n_size;
1592 const char * URL; /* the base URL to use for the document */
1593 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001594 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001595 int n_encoding;
1596 int options; /* a combination of htmlParserOption(s) */
1597 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001598
Daniel Veillarda521d282004-11-09 14:59:59 +00001599 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001600 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1601 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1602 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1603 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1604 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1605 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001606 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001607 buffer = gen_const_char_ptr(n_buffer, 1);
1608 size = gen_int(n_size, 2);
1609 URL = gen_filepath(n_URL, 3);
1610 encoding = gen_const_char_ptr(n_encoding, 4);
1611 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001612
William M. Brackf13f77f2004-11-12 16:03:48 +00001613 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001614 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001615 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001616 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001617 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001618 des_int(n_size, size, 2);
1619 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001620 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001621 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001622 xmlResetLastError();
1623 if (mem_base != xmlMemBlocks()) {
1624 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001626 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001627 printf(" %d", n_ctxt);
1628 printf(" %d", n_buffer);
1629 printf(" %d", n_size);
1630 printf(" %d", n_URL);
1631 printf(" %d", n_encoding);
1632 printf(" %d", n_options);
1633 printf("\n");
1634 }
1635 }
1636 }
1637 }
1638 }
1639 }
1640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001641 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001642#endif
1643
Daniel Veillard42595322004-11-08 10:52:06 +00001644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001645}
1646
1647
1648static int
1649test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001651
William M. Brack21e4ef22005-01-02 09:53:13 +00001652#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001653 int mem_base;
1654 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1655 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001656
Daniel Veillarda521d282004-11-09 14:59:59 +00001657 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001658 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001659 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001660
1661 htmlCtxtReset(ctxt);
1662 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001663 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001664 xmlResetLastError();
1665 if (mem_base != xmlMemBlocks()) {
1666 printf("Leak of %d blocks found in htmlCtxtReset",
1667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001668 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001669 printf(" %d", n_ctxt);
1670 printf("\n");
1671 }
1672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001673 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001674#endif
1675
Daniel Veillard42595322004-11-08 10:52:06 +00001676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001677}
1678
1679
1680static int
1681test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001683
William M. Brack21e4ef22005-01-02 09:53:13 +00001684#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001685 int mem_base;
1686 int ret_val;
1687 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1688 int n_ctxt;
1689 int options; /* a combination of htmlParserOption(s) */
1690 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001691
Daniel Veillarda521d282004-11-09 14:59:59 +00001692 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001693 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1694 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001695 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001696 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001697
1698 ret_val = htmlCtxtUseOptions(ctxt, options);
1699 desret_int(ret_val);
1700 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001701 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001702 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001703 xmlResetLastError();
1704 if (mem_base != xmlMemBlocks()) {
1705 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001707 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001708 printf(" %d", n_ctxt);
1709 printf(" %d", n_options);
1710 printf("\n");
1711 }
1712 }
1713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001714 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001715#endif
1716
Daniel Veillard42595322004-11-08 10:52:06 +00001717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001718}
1719
1720
1721static int
1722test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001724
William M. Brack21e4ef22005-01-02 09:53:13 +00001725#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001726 int mem_base;
1727 int ret_val;
1728 htmlElemDesc * parent; /* HTML parent element */
1729 int n_parent;
1730 xmlChar * elt; /* HTML element */
1731 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001732
Daniel Veillardce682bc2004-11-05 17:22:25 +00001733 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1734 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1735 mem_base = xmlMemBlocks();
1736 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1737 elt = gen_const_xmlChar_ptr(n_elt, 1);
1738
William M. Brackf13f77f2004-11-12 16:03:48 +00001739 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001740 desret_int(ret_val);
1741 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001742 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1743 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001744 xmlResetLastError();
1745 if (mem_base != xmlMemBlocks()) {
1746 printf("Leak of %d blocks found in htmlElementAllowedHere",
1747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001748 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001749 printf(" %d", n_parent);
1750 printf(" %d", n_elt);
1751 printf("\n");
1752 }
1753 }
1754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001755 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001756#endif
1757
Daniel Veillard42595322004-11-08 10:52:06 +00001758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001759}
1760
1761
1762static int
1763test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001765
William M. Brack21e4ef22005-01-02 09:53:13 +00001766#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001767 int mem_base;
1768 htmlStatus ret_val;
1769 htmlElemDesc * parent; /* HTML parent element */
1770 int n_parent;
1771 htmlElemDesc * elt; /* HTML element */
1772 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001773
Daniel Veillard57b25162004-11-06 14:50:18 +00001774 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1775 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1776 mem_base = xmlMemBlocks();
1777 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1778 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1779
William M. Brackf13f77f2004-11-12 16:03:48 +00001780 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001781 desret_htmlStatus(ret_val);
1782 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001783 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1784 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001785 xmlResetLastError();
1786 if (mem_base != xmlMemBlocks()) {
1787 printf("Leak of %d blocks found in htmlElementStatusHere",
1788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001789 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001790 printf(" %d", n_parent);
1791 printf(" %d", n_elt);
1792 printf("\n");
1793 }
1794 }
1795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001796 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001797#endif
1798
Daniel Veillard42595322004-11-08 10:52:06 +00001799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001800}
1801
1802
1803static int
1804test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001806
William M. Brack21e4ef22005-01-02 09:53:13 +00001807#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001808 int mem_base;
1809 int ret_val;
1810 unsigned char * out; /* a pointer to an array of bytes to store the result */
1811 int n_out;
1812 int * outlen; /* the length of @out */
1813 int n_outlen;
1814 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1815 int n_in;
1816 int * inlen; /* the length of @in */
1817 int n_inlen;
1818 int quoteChar; /* the quote character to escape (' or ") or zero. */
1819 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001820
Daniel Veillardce682bc2004-11-05 17:22:25 +00001821 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1822 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1823 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1824 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1825 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1826 mem_base = xmlMemBlocks();
1827 out = gen_unsigned_char_ptr(n_out, 0);
1828 outlen = gen_int_ptr(n_outlen, 1);
1829 in = gen_const_unsigned_char_ptr(n_in, 2);
1830 inlen = gen_int_ptr(n_inlen, 3);
1831 quoteChar = gen_int(n_quoteChar, 4);
1832
William M. Brackf13f77f2004-11-12 16:03:48 +00001833 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001834 desret_int(ret_val);
1835 call_tests++;
1836 des_unsigned_char_ptr(n_out, out, 0);
1837 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001838 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001839 des_int_ptr(n_inlen, inlen, 3);
1840 des_int(n_quoteChar, quoteChar, 4);
1841 xmlResetLastError();
1842 if (mem_base != xmlMemBlocks()) {
1843 printf("Leak of %d blocks found in htmlEncodeEntities",
1844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001846 printf(" %d", n_out);
1847 printf(" %d", n_outlen);
1848 printf(" %d", n_in);
1849 printf(" %d", n_inlen);
1850 printf(" %d", n_quoteChar);
1851 printf("\n");
1852 }
1853 }
1854 }
1855 }
1856 }
1857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001858 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001859#endif
1860
Daniel Veillard42595322004-11-08 10:52:06 +00001861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001862}
1863
1864
1865static int
1866test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001868
William M. Brack21e4ef22005-01-02 09:53:13 +00001869#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001870 int mem_base;
1871 const htmlEntityDesc * ret_val;
1872 xmlChar * name; /* the entity name */
1873 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001874
Daniel Veillard42595322004-11-08 10:52:06 +00001875 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1876 mem_base = xmlMemBlocks();
1877 name = gen_const_xmlChar_ptr(n_name, 0);
1878
William M. Brackf13f77f2004-11-12 16:03:48 +00001879 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001880 desret_const_htmlEntityDesc_ptr(ret_val);
1881 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001882 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001883 xmlResetLastError();
1884 if (mem_base != xmlMemBlocks()) {
1885 printf("Leak of %d blocks found in htmlEntityLookup",
1886 xmlMemBlocks() - mem_base);
1887 test_ret++;
1888 printf(" %d", n_name);
1889 printf("\n");
1890 }
1891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001893#endif
1894
Daniel Veillard42595322004-11-08 10:52:06 +00001895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001896}
1897
1898
1899static int
1900test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001902
William M. Brack21e4ef22005-01-02 09:53:13 +00001903#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001904 int mem_base;
1905 const htmlEntityDesc * ret_val;
1906 unsigned int value; /* the entity's unicode value */
1907 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001908
Daniel Veillard42595322004-11-08 10:52:06 +00001909 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1910 mem_base = xmlMemBlocks();
1911 value = gen_unsigned_int(n_value, 0);
1912
1913 ret_val = htmlEntityValueLookup(value);
1914 desret_const_htmlEntityDesc_ptr(ret_val);
1915 call_tests++;
1916 des_unsigned_int(n_value, value, 0);
1917 xmlResetLastError();
1918 if (mem_base != xmlMemBlocks()) {
1919 printf("Leak of %d blocks found in htmlEntityValueLookup",
1920 xmlMemBlocks() - mem_base);
1921 test_ret++;
1922 printf(" %d", n_value);
1923 printf("\n");
1924 }
1925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001926 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001927#endif
1928
Daniel Veillard42595322004-11-08 10:52:06 +00001929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001930}
1931
1932
1933static int
1934test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001936
William M. Brack21e4ef22005-01-02 09:53:13 +00001937#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001938 int mem_base;
1939 int ret_val;
1940 int val; /* int 0 or 1 */
1941 int n_val;
1942
1943 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001945 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001946
1947 ret_val = htmlHandleOmittedElem(val);
1948 desret_int(ret_val);
1949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001950 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001951 xmlResetLastError();
1952 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001953 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001955 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001956 printf(" %d", n_val);
1957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001958 }
1959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001960 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001961#endif
1962
Daniel Veillard42595322004-11-08 10:52:06 +00001963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001964}
1965
1966
1967static int
1968test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001970
William M. Brack21e4ef22005-01-02 09:53:13 +00001971#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001972 int mem_base;
1973 int ret_val;
1974 htmlDocPtr doc; /* the HTML document */
1975 int n_doc;
1976 htmlNodePtr elem; /* the HTML element */
1977 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001978
Daniel Veillarda521d282004-11-09 14:59:59 +00001979 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1980 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001981 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001982 doc = gen_htmlDocPtr(n_doc, 0);
1983 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001984
1985 ret_val = htmlIsAutoClosed(doc, elem);
1986 desret_int(ret_val);
1987 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001988 des_htmlDocPtr(n_doc, doc, 0);
1989 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001990 xmlResetLastError();
1991 if (mem_base != xmlMemBlocks()) {
1992 printf("Leak of %d blocks found in htmlIsAutoClosed",
1993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001994 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001995 printf(" %d", n_doc);
1996 printf(" %d", n_elem);
1997 printf("\n");
1998 }
1999 }
2000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002001 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002002#endif
2003
Daniel Veillard42595322004-11-08 10:52:06 +00002004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002005}
2006
2007
2008static int
2009test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002011
William M. Brack21e4ef22005-01-02 09:53:13 +00002012#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002013 int mem_base;
2014 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002015 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002016 int n_name;
2017
2018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002020 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002021
William M. Brackf13f77f2004-11-12 16:03:48 +00002022 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002023 desret_int(ret_val);
2024 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002025 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002026 xmlResetLastError();
2027 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002028 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031 printf(" %d", n_name);
2032 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002033 }
2034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002035 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002036#endif
2037
Daniel Veillard42595322004-11-08 10:52:06 +00002038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002039}
2040
2041
2042static int
2043test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002045
William M. Brack21e4ef22005-01-02 09:53:13 +00002046#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002047 int mem_base;
2048 htmlStatus ret_val;
2049 htmlNodePtr node; /* an htmlNodePtr in a tree */
2050 int n_node;
2051 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2052 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002053
Daniel Veillarda521d282004-11-09 14:59:59 +00002054 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002055 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2056 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002057 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002058 legacy = gen_int(n_legacy, 1);
2059
William M. Brackf13f77f2004-11-12 16:03:48 +00002060 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002061 desret_htmlStatus(ret_val);
2062 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002063 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002064 des_int(n_legacy, legacy, 1);
2065 xmlResetLastError();
2066 if (mem_base != xmlMemBlocks()) {
2067 printf("Leak of %d blocks found in htmlNodeStatus",
2068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002069 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002070 printf(" %d", n_node);
2071 printf(" %d", n_legacy);
2072 printf("\n");
2073 }
2074 }
2075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002076 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002077#endif
2078
Daniel Veillard42595322004-11-08 10:52:06 +00002079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002080}
2081
2082
2083static int
2084test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002086
William M. Brack21e4ef22005-01-02 09:53:13 +00002087#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002088 int mem_base;
2089 int ret_val;
2090 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2091 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002092
Daniel Veillarda521d282004-11-09 14:59:59 +00002093 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002094 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002095 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002096
2097 ret_val = htmlParseCharRef(ctxt);
2098 desret_int(ret_val);
2099 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002100 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlParseCharRef",
2104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002105 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002106 printf(" %d", n_ctxt);
2107 printf("\n");
2108 }
2109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002110 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002111#endif
2112
Daniel Veillard42595322004-11-08 10:52:06 +00002113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002114}
2115
2116
2117static int
2118test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002120
William M. Brack21e4ef22005-01-02 09:53:13 +00002121#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002122 int mem_base;
2123 int ret_val;
2124 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2125 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002126 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002127 int n_chunk;
2128 int size; /* the size in byte of the chunk */
2129 int n_size;
2130 int terminate; /* last chunk indicator */
2131 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002132
Daniel Veillarda521d282004-11-09 14:59:59 +00002133 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002134 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2135 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2136 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2137 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002138 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002139 chunk = gen_const_char_ptr(n_chunk, 1);
2140 size = gen_int(n_size, 2);
2141 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142
William M. Brackf13f77f2004-11-12 16:03:48 +00002143 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002144 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002145 desret_int(ret_val);
2146 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002147 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002148 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002149 des_int(n_size, size, 2);
2150 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002151 xmlResetLastError();
2152 if (mem_base != xmlMemBlocks()) {
2153 printf("Leak of %d blocks found in htmlParseChunk",
2154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002156 printf(" %d", n_ctxt);
2157 printf(" %d", n_chunk);
2158 printf(" %d", n_size);
2159 printf(" %d", n_terminate);
2160 printf("\n");
2161 }
2162 }
2163 }
2164 }
2165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002166 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002167#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002168
Daniel Veillard42595322004-11-08 10:52:06 +00002169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002170}
2171
2172
2173static int
2174test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002176
William M. Brack21e4ef22005-01-02 09:53:13 +00002177#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002178 int mem_base;
2179 htmlDocPtr ret_val;
2180 xmlChar * cur; /* a pointer to an array of xmlChar */
2181 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002182 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002183 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002184
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002185 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2186 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002188 cur = gen_xmlChar_ptr(n_cur, 0);
2189 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002190
William M. Brackf13f77f2004-11-12 16:03:48 +00002191 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002192 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002193 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002194 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002195 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002196 xmlResetLastError();
2197 if (mem_base != xmlMemBlocks()) {
2198 printf("Leak of %d blocks found in htmlParseDoc",
2199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002200 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002201 printf(" %d", n_cur);
2202 printf(" %d", n_encoding);
2203 printf("\n");
2204 }
2205 }
2206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002207 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002208#endif
2209
Daniel Veillard42595322004-11-08 10:52:06 +00002210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002211}
2212
2213
2214static int
2215test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002217
William M. Brack21e4ef22005-01-02 09:53:13 +00002218#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002219 int mem_base;
2220 int ret_val;
2221 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2222 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002223
Daniel Veillarda521d282004-11-09 14:59:59 +00002224 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002225 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002226 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002227
2228 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002229 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002230 desret_int(ret_val);
2231 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002232 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002233 xmlResetLastError();
2234 if (mem_base != xmlMemBlocks()) {
2235 printf("Leak of %d blocks found in htmlParseDocument",
2236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002238 printf(" %d", n_ctxt);
2239 printf("\n");
2240 }
2241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002242 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002243#endif
2244
Daniel Veillard42595322004-11-08 10:52:06 +00002245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002246}
2247
2248
2249static int
2250test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002252
William M. Brack21e4ef22005-01-02 09:53:13 +00002253#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002254 int mem_base;
2255 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2256 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002257
Daniel Veillarda521d282004-11-09 14:59:59 +00002258 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002259 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002260 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002261
2262 htmlParseElement(ctxt);
2263 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002264 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002265 xmlResetLastError();
2266 if (mem_base != xmlMemBlocks()) {
2267 printf("Leak of %d blocks found in htmlParseElement",
2268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002269 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002270 printf(" %d", n_ctxt);
2271 printf("\n");
2272 }
2273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002274 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002275#endif
2276
Daniel Veillard42595322004-11-08 10:52:06 +00002277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002278}
2279
2280
2281static int
2282test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002284
William M. Brack21e4ef22005-01-02 09:53:13 +00002285#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002286 int mem_base;
2287 const htmlEntityDesc * ret_val;
2288 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2289 int n_ctxt;
2290 xmlChar ** str; /* location to store the entity name */
2291 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002292
Daniel Veillarda521d282004-11-09 14:59:59 +00002293 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002294 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2295 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002296 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002297 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2298
William M. Brackf13f77f2004-11-12 16:03:48 +00002299 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002300 desret_const_htmlEntityDesc_ptr(ret_val);
2301 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002302 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002303 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002304 xmlResetLastError();
2305 if (mem_base != xmlMemBlocks()) {
2306 printf("Leak of %d blocks found in htmlParseEntityRef",
2307 xmlMemBlocks() - mem_base);
2308 test_ret++;
2309 printf(" %d", n_ctxt);
2310 printf(" %d", n_str);
2311 printf("\n");
2312 }
2313 }
2314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002316#endif
2317
Daniel Veillard42595322004-11-08 10:52:06 +00002318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002319}
2320
2321
2322static int
2323test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002325
William M. Brack21e4ef22005-01-02 09:53:13 +00002326#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002327 htmlDocPtr ret_val;
2328 const char * filename; /* the filename */
2329 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002330 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002331 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002332
Daniel Veillarda03e3652004-11-02 18:45:30 +00002333 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2334 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002335 filename = gen_filepath(n_filename, 0);
2336 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002337
William M. Brackf13f77f2004-11-12 16:03:48 +00002338 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002339 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002341 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002342 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002343 xmlResetLastError();
2344 }
2345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002346 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002347#endif
2348
Daniel Veillard42595322004-11-08 10:52:06 +00002349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002350}
2351
2352
2353static int
2354test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002356
William M. Brack21e4ef22005-01-02 09:53:13 +00002357#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358 int mem_base;
2359 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002360 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002361 int n_cur;
2362 const char * URL; /* the base URL to use for the document */
2363 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002364 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002365 int n_encoding;
2366 int options; /* a combination of htmlParserOption(s) */
2367 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillarda03e3652004-11-02 18:45:30 +00002369 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2370 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2371 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2372 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002374 cur = gen_const_xmlChar_ptr(n_cur, 0);
2375 URL = gen_filepath(n_URL, 1);
2376 encoding = gen_const_char_ptr(n_encoding, 2);
2377 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002378
William M. Brackf13f77f2004-11-12 16:03:48 +00002379 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002380 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002381 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002382 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002383 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002384 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002385 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002386 xmlResetLastError();
2387 if (mem_base != xmlMemBlocks()) {
2388 printf("Leak of %d blocks found in htmlReadDoc",
2389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002390 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002391 printf(" %d", n_cur);
2392 printf(" %d", n_URL);
2393 printf(" %d", n_encoding);
2394 printf(" %d", n_options);
2395 printf("\n");
2396 }
2397 }
2398 }
2399 }
2400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002401 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002402#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002403
Daniel Veillard42595322004-11-08 10:52:06 +00002404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002405}
2406
2407
2408static int
2409test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002411
William M. Brack21e4ef22005-01-02 09:53:13 +00002412#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002413 int mem_base;
2414 htmlDocPtr ret_val;
2415 const char * filename; /* a file or URL */
2416 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002417 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002418 int n_encoding;
2419 int options; /* a combination of htmlParserOption(s) */
2420 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002421
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2423 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2424 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002426 filename = gen_filepath(n_filename, 0);
2427 encoding = gen_const_char_ptr(n_encoding, 1);
2428 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002429
William M. Brackf13f77f2004-11-12 16:03:48 +00002430 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002431 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002433 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002434 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002435 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002436 xmlResetLastError();
2437 if (mem_base != xmlMemBlocks()) {
2438 printf("Leak of %d blocks found in htmlReadFile",
2439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002440 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002441 printf(" %d", n_filename);
2442 printf(" %d", n_encoding);
2443 printf(" %d", n_options);
2444 printf("\n");
2445 }
2446 }
2447 }
2448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002449 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002450#endif
2451
Daniel Veillard42595322004-11-08 10:52:06 +00002452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002453}
2454
2455
2456static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002459
William M. Brack21e4ef22005-01-02 09:53:13 +00002460#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002461 int mem_base;
2462 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002463 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002464 int n_buffer;
2465 int size; /* the size of the array */
2466 int n_size;
2467 const char * URL; /* the base URL to use for the document */
2468 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002469 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002470 int n_encoding;
2471 int options; /* a combination of htmlParserOption(s) */
2472 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002473
Daniel Veillarda03e3652004-11-02 18:45:30 +00002474 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2475 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2476 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2477 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2478 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002480 buffer = gen_const_char_ptr(n_buffer, 0);
2481 size = gen_int(n_size, 1);
2482 URL = gen_filepath(n_URL, 2);
2483 encoding = gen_const_char_ptr(n_encoding, 3);
2484 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002485
William M. Brackf13f77f2004-11-12 16:03:48 +00002486 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002487 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002488 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002489 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002490 des_int(n_size, size, 1);
2491 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002492 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002493 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002494 xmlResetLastError();
2495 if (mem_base != xmlMemBlocks()) {
2496 printf("Leak of %d blocks found in htmlReadMemory",
2497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002498 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002499 printf(" %d", n_buffer);
2500 printf(" %d", n_size);
2501 printf(" %d", n_URL);
2502 printf(" %d", n_encoding);
2503 printf(" %d", n_options);
2504 printf("\n");
2505 }
2506 }
2507 }
2508 }
2509 }
2510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002511 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002512#endif
2513
Daniel Veillard42595322004-11-08 10:52:06 +00002514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002515}
2516
2517
2518static int
2519test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002521
William M. Brack21e4ef22005-01-02 09:53:13 +00002522#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002523 int mem_base;
2524 htmlDocPtr ret_val;
2525 xmlChar * cur; /* a pointer to an array of xmlChar */
2526 int n_cur;
2527 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2528 int n_encoding;
2529 htmlSAXHandlerPtr sax; /* the SAX handler block */
2530 int n_sax;
2531 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2532 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002533
Daniel Veillardce682bc2004-11-05 17:22:25 +00002534 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2535 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2536 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2537 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2538 mem_base = xmlMemBlocks();
2539 cur = gen_xmlChar_ptr(n_cur, 0);
2540 encoding = gen_const_char_ptr(n_encoding, 1);
2541 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2542 userData = gen_userdata(n_userData, 3);
2543
William M. Brackf13f77f2004-11-12 16:03:48 +00002544 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002545 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002546 call_tests++;
2547 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002548 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002549 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2550 des_userdata(n_userData, userData, 3);
2551 xmlResetLastError();
2552 if (mem_base != xmlMemBlocks()) {
2553 printf("Leak of %d blocks found in htmlSAXParseDoc",
2554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002555 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002556 printf(" %d", n_cur);
2557 printf(" %d", n_encoding);
2558 printf(" %d", n_sax);
2559 printf(" %d", n_userData);
2560 printf("\n");
2561 }
2562 }
2563 }
2564 }
2565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002566 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002567#endif
2568
Daniel Veillard42595322004-11-08 10:52:06 +00002569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002570}
2571
2572
2573static int
2574test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002576
William M. Brack21e4ef22005-01-02 09:53:13 +00002577#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002578 int mem_base;
2579 htmlDocPtr ret_val;
2580 const char * filename; /* the filename */
2581 int n_filename;
2582 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2583 int n_encoding;
2584 htmlSAXHandlerPtr sax; /* the SAX handler block */
2585 int n_sax;
2586 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2587 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002588
Daniel Veillardce682bc2004-11-05 17:22:25 +00002589 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2590 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2591 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2592 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2593 mem_base = xmlMemBlocks();
2594 filename = gen_filepath(n_filename, 0);
2595 encoding = gen_const_char_ptr(n_encoding, 1);
2596 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2597 userData = gen_userdata(n_userData, 3);
2598
William M. Brackf13f77f2004-11-12 16:03:48 +00002599 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002600 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002601 call_tests++;
2602 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002603 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002604 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2605 des_userdata(n_userData, userData, 3);
2606 xmlResetLastError();
2607 if (mem_base != xmlMemBlocks()) {
2608 printf("Leak of %d blocks found in htmlSAXParseFile",
2609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002610 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002611 printf(" %d", n_filename);
2612 printf(" %d", n_encoding);
2613 printf(" %d", n_sax);
2614 printf(" %d", n_userData);
2615 printf("\n");
2616 }
2617 }
2618 }
2619 }
2620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002621 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002622#endif
2623
Daniel Veillard42595322004-11-08 10:52:06 +00002624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002625}
2626
2627
2628static int
2629test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002631
2632
2633 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002635}
2636
2637static int
2638test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002640
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002641 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002642 test_ret += test_UTF8ToHtml();
2643 test_ret += test_htmlAttrAllowed();
2644 test_ret += test_htmlAutoCloseTag();
2645 test_ret += test_htmlCreateMemoryParserCtxt();
2646 test_ret += test_htmlCreatePushParserCtxt();
2647 test_ret += test_htmlCtxtReadDoc();
2648 test_ret += test_htmlCtxtReadFile();
2649 test_ret += test_htmlCtxtReadMemory();
2650 test_ret += test_htmlCtxtReset();
2651 test_ret += test_htmlCtxtUseOptions();
2652 test_ret += test_htmlElementAllowedHere();
2653 test_ret += test_htmlElementStatusHere();
2654 test_ret += test_htmlEncodeEntities();
2655 test_ret += test_htmlEntityLookup();
2656 test_ret += test_htmlEntityValueLookup();
2657 test_ret += test_htmlHandleOmittedElem();
2658 test_ret += test_htmlIsAutoClosed();
2659 test_ret += test_htmlIsScriptAttribute();
2660 test_ret += test_htmlNodeStatus();
2661 test_ret += test_htmlParseCharRef();
2662 test_ret += test_htmlParseChunk();
2663 test_ret += test_htmlParseDoc();
2664 test_ret += test_htmlParseDocument();
2665 test_ret += test_htmlParseElement();
2666 test_ret += test_htmlParseEntityRef();
2667 test_ret += test_htmlParseFile();
2668 test_ret += test_htmlReadDoc();
2669 test_ret += test_htmlReadFile();
2670 test_ret += test_htmlReadMemory();
2671 test_ret += test_htmlSAXParseDoc();
2672 test_ret += test_htmlSAXParseFile();
2673 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002674
Daniel Veillard42595322004-11-08 10:52:06 +00002675 if (test_ret != 0)
2676 printf("Module HTMLparser: %d errors\n", test_ret);
2677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002678}
2679
2680static int
2681test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002683
William M. Brack21e4ef22005-01-02 09:53:13 +00002684#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002685 int mem_base;
2686 xmlOutputBufferPtr buf; /* the HTML buffer output */
2687 int n_buf;
2688 xmlDocPtr cur; /* the document */
2689 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002690 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002691 int n_encoding;
2692 int format; /* should formatting spaces been added */
2693 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002694
Daniel Veillard3d97e662004-11-04 10:49:00 +00002695 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2696 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2697 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2698 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2699 mem_base = xmlMemBlocks();
2700 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2701 cur = gen_xmlDocPtr(n_cur, 1);
2702 encoding = gen_const_char_ptr(n_encoding, 2);
2703 format = gen_int(n_format, 3);
2704
William M. Brackf13f77f2004-11-12 16:03:48 +00002705 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002706 call_tests++;
2707 des_xmlOutputBufferPtr(n_buf, buf, 0);
2708 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002709 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002710 des_int(n_format, format, 3);
2711 xmlResetLastError();
2712 if (mem_base != xmlMemBlocks()) {
2713 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002715 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002716 printf(" %d", n_buf);
2717 printf(" %d", n_cur);
2718 printf(" %d", n_encoding);
2719 printf(" %d", n_format);
2720 printf("\n");
2721 }
2722 }
2723 }
2724 }
2725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002726 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002728
Daniel Veillard42595322004-11-08 10:52:06 +00002729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730}
2731
2732
2733static int
2734test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002736
William M. Brack21e4ef22005-01-02 09:53:13 +00002737#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002738 int mem_base;
2739 xmlOutputBufferPtr buf; /* the HTML buffer output */
2740 int n_buf;
2741 xmlDocPtr cur; /* the document */
2742 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002743 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002744 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002745
Daniel Veillard3d97e662004-11-04 10:49:00 +00002746 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2747 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2748 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2749 mem_base = xmlMemBlocks();
2750 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2751 cur = gen_xmlDocPtr(n_cur, 1);
2752 encoding = gen_const_char_ptr(n_encoding, 2);
2753
William M. Brackf13f77f2004-11-12 16:03:48 +00002754 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002755 call_tests++;
2756 des_xmlOutputBufferPtr(n_buf, buf, 0);
2757 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002758 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002759 xmlResetLastError();
2760 if (mem_base != xmlMemBlocks()) {
2761 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002763 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002764 printf(" %d", n_buf);
2765 printf(" %d", n_cur);
2766 printf(" %d", n_encoding);
2767 printf("\n");
2768 }
2769 }
2770 }
2771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002772 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002773#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774
Daniel Veillard42595322004-11-08 10:52:06 +00002775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002776}
2777
2778
2779static int
2780test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002782
William M. Brack21e4ef22005-01-02 09:53:13 +00002783#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002784 int mem_base;
2785 int ret_val;
2786 FILE * f; /* the FILE* */
2787 int n_f;
2788 xmlDocPtr cur; /* the document */
2789 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002790
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002791 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2792 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2793 mem_base = xmlMemBlocks();
2794 f = gen_FILE_ptr(n_f, 0);
2795 cur = gen_xmlDocPtr(n_cur, 1);
2796
2797 ret_val = htmlDocDump(f, cur);
2798 desret_int(ret_val);
2799 call_tests++;
2800 des_FILE_ptr(n_f, f, 0);
2801 des_xmlDocPtr(n_cur, cur, 1);
2802 xmlResetLastError();
2803 if (mem_base != xmlMemBlocks()) {
2804 printf("Leak of %d blocks found in htmlDocDump",
2805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002806 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002807 printf(" %d", n_f);
2808 printf(" %d", n_cur);
2809 printf("\n");
2810 }
2811 }
2812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002813 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002814#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002815
Daniel Veillard42595322004-11-08 10:52:06 +00002816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002817}
2818
2819
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002820#define gen_nb_xmlChar_ptr_ptr 1
2821static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2822 return(NULL);
2823}
2824static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2825}
2826
Daniel Veillardd93f6252004-11-02 15:53:51 +00002827static int
2828test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002830
William M. Brack21e4ef22005-01-02 09:53:13 +00002831#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002832 int mem_base;
2833 xmlDocPtr cur; /* the document */
2834 int n_cur;
2835 xmlChar ** mem; /* OUT: the memory pointer */
2836 int n_mem;
2837 int * size; /* OUT: the memory length */
2838 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002839
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002840 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2841 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2842 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2843 mem_base = xmlMemBlocks();
2844 cur = gen_xmlDocPtr(n_cur, 0);
2845 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2846 size = gen_int_ptr(n_size, 2);
2847
2848 htmlDocDumpMemory(cur, mem, size);
2849 call_tests++;
2850 des_xmlDocPtr(n_cur, cur, 0);
2851 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2852 des_int_ptr(n_size, size, 2);
2853 xmlResetLastError();
2854 if (mem_base != xmlMemBlocks()) {
2855 printf("Leak of %d blocks found in htmlDocDumpMemory",
2856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002857 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002858 printf(" %d", n_cur);
2859 printf(" %d", n_mem);
2860 printf(" %d", n_size);
2861 printf("\n");
2862 }
2863 }
2864 }
2865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002866 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002867#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002868
Daniel Veillard42595322004-11-08 10:52:06 +00002869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002870}
2871
2872
2873static int
2874test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002876
William M. Brack21e4ef22005-01-02 09:53:13 +00002877#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002878 int mem_base;
2879 const xmlChar * ret_val;
2880 htmlDocPtr doc; /* the document */
2881 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002882
Daniel Veillarda521d282004-11-09 14:59:59 +00002883 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002884 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002885 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002886
2887 ret_val = htmlGetMetaEncoding(doc);
2888 desret_const_xmlChar_ptr(ret_val);
2889 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002890 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002891 xmlResetLastError();
2892 if (mem_base != xmlMemBlocks()) {
2893 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002895 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002896 printf(" %d", n_doc);
2897 printf("\n");
2898 }
2899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002900 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002901#endif
2902
Daniel Veillard42595322004-11-08 10:52:06 +00002903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002904}
2905
2906
2907static int
2908test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002910
William M. Brack21e4ef22005-01-02 09:53:13 +00002911#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912 int mem_base;
2913 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002914 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002915 int n_name;
2916
2917 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002919 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002920
William M. Brackf13f77f2004-11-12 16:03:48 +00002921 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002922 desret_int(ret_val);
2923 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002924 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002925 xmlResetLastError();
2926 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002927 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002929 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002930 printf(" %d", n_name);
2931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002932 }
2933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002934 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002935#endif
2936
Daniel Veillard42595322004-11-08 10:52:06 +00002937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002938}
2939
2940
2941static int
2942test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002944
William M. Brack21e4ef22005-01-02 09:53:13 +00002945#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002946 int mem_base;
2947 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002948 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002949 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002950 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002951 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002952
Daniel Veillarda03e3652004-11-02 18:45:30 +00002953 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2954 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002956 URI = gen_const_xmlChar_ptr(n_URI, 0);
2957 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002958
William M. Brackf13f77f2004-11-12 16:03:48 +00002959 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002960 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002961 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002962 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2963 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002964 xmlResetLastError();
2965 if (mem_base != xmlMemBlocks()) {
2966 printf("Leak of %d blocks found in htmlNewDoc",
2967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002968 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002969 printf(" %d", n_URI);
2970 printf(" %d", n_ExternalID);
2971 printf("\n");
2972 }
2973 }
2974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002975 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002976#endif
2977
Daniel Veillard42595322004-11-08 10:52:06 +00002978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002979}
2980
2981
2982static int
2983test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002985
William M. Brack21e4ef22005-01-02 09:53:13 +00002986#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int mem_base;
2988 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002989 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002990 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002991 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002992 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002993
Daniel Veillarda03e3652004-11-02 18:45:30 +00002994 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2995 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002997 URI = gen_const_xmlChar_ptr(n_URI, 0);
2998 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002999
William M. Brackf13f77f2004-11-12 16:03:48 +00003000 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003001 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003002 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003003 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3004 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 xmlResetLastError();
3006 if (mem_base != xmlMemBlocks()) {
3007 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003009 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003010 printf(" %d", n_URI);
3011 printf(" %d", n_ExternalID);
3012 printf("\n");
3013 }
3014 }
3015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003016 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003017#endif
3018
Daniel Veillard42595322004-11-08 10:52:06 +00003019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003020}
3021
3022
3023static int
3024test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003026
William M. Brack21e4ef22005-01-02 09:53:13 +00003027#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003028 int mem_base;
3029 int ret_val;
3030 xmlBufferPtr buf; /* the HTML buffer output */
3031 int n_buf;
3032 xmlDocPtr doc; /* the document */
3033 int n_doc;
3034 xmlNodePtr cur; /* the current node */
3035 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003036
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003037 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3038 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3039 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003041 buf = gen_xmlBufferPtr(n_buf, 0);
3042 doc = gen_xmlDocPtr(n_doc, 1);
3043 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003044
3045 ret_val = htmlNodeDump(buf, doc, cur);
3046 desret_int(ret_val);
3047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003048 des_xmlBufferPtr(n_buf, buf, 0);
3049 des_xmlDocPtr(n_doc, doc, 1);
3050 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003051 xmlResetLastError();
3052 if (mem_base != xmlMemBlocks()) {
3053 printf("Leak of %d blocks found in htmlNodeDump",
3054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003055 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003056 printf(" %d", n_buf);
3057 printf(" %d", n_doc);
3058 printf(" %d", n_cur);
3059 printf("\n");
3060 }
3061 }
3062 }
3063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003064 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003065#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003066
Daniel Veillard42595322004-11-08 10:52:06 +00003067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003068}
3069
3070
3071static int
3072test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003074
William M. Brack21e4ef22005-01-02 09:53:13 +00003075#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003076 int mem_base;
3077 FILE * out; /* the FILE pointer */
3078 int n_out;
3079 xmlDocPtr doc; /* the document */
3080 int n_doc;
3081 xmlNodePtr cur; /* the current node */
3082 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003083
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003084 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3086 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3087 mem_base = xmlMemBlocks();
3088 out = gen_FILE_ptr(n_out, 0);
3089 doc = gen_xmlDocPtr(n_doc, 1);
3090 cur = gen_xmlNodePtr(n_cur, 2);
3091
3092 htmlNodeDumpFile(out, doc, cur);
3093 call_tests++;
3094 des_FILE_ptr(n_out, out, 0);
3095 des_xmlDocPtr(n_doc, doc, 1);
3096 des_xmlNodePtr(n_cur, cur, 2);
3097 xmlResetLastError();
3098 if (mem_base != xmlMemBlocks()) {
3099 printf("Leak of %d blocks found in htmlNodeDumpFile",
3100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003101 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003102 printf(" %d", n_out);
3103 printf(" %d", n_doc);
3104 printf(" %d", n_cur);
3105 printf("\n");
3106 }
3107 }
3108 }
3109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003110 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003111#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003112
Daniel Veillard42595322004-11-08 10:52:06 +00003113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003114}
3115
3116
3117static int
3118test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003120
William M. Brack21e4ef22005-01-02 09:53:13 +00003121#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003122 int mem_base;
3123 int ret_val;
3124 FILE * out; /* the FILE pointer */
3125 int n_out;
3126 xmlDocPtr doc; /* the document */
3127 int n_doc;
3128 xmlNodePtr cur; /* the current node */
3129 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003130 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003131 int n_encoding;
3132 int format; /* should formatting spaces been added */
3133 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003134
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003135 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3137 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3138 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3139 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3140 mem_base = xmlMemBlocks();
3141 out = gen_FILE_ptr(n_out, 0);
3142 doc = gen_xmlDocPtr(n_doc, 1);
3143 cur = gen_xmlNodePtr(n_cur, 2);
3144 encoding = gen_const_char_ptr(n_encoding, 3);
3145 format = gen_int(n_format, 4);
3146
William M. Brackf13f77f2004-11-12 16:03:48 +00003147 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148 desret_int(ret_val);
3149 call_tests++;
3150 des_FILE_ptr(n_out, out, 0);
3151 des_xmlDocPtr(n_doc, doc, 1);
3152 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003153 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003154 des_int(n_format, format, 4);
3155 xmlResetLastError();
3156 if (mem_base != xmlMemBlocks()) {
3157 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003160 printf(" %d", n_out);
3161 printf(" %d", n_doc);
3162 printf(" %d", n_cur);
3163 printf(" %d", n_encoding);
3164 printf(" %d", n_format);
3165 printf("\n");
3166 }
3167 }
3168 }
3169 }
3170 }
3171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003172 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003173#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003174
Daniel Veillard42595322004-11-08 10:52:06 +00003175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003176}
3177
3178
3179static int
3180test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003182
William M. Brack21e4ef22005-01-02 09:53:13 +00003183#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003184 int mem_base;
3185 xmlOutputBufferPtr buf; /* the HTML buffer output */
3186 int n_buf;
3187 xmlDocPtr doc; /* the document */
3188 int n_doc;
3189 xmlNodePtr cur; /* the current node */
3190 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003191 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003192 int n_encoding;
3193 int format; /* should formatting spaces been added */
3194 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003195
Daniel Veillard3d97e662004-11-04 10:49:00 +00003196 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3198 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3199 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3200 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3201 mem_base = xmlMemBlocks();
3202 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3203 doc = gen_xmlDocPtr(n_doc, 1);
3204 cur = gen_xmlNodePtr(n_cur, 2);
3205 encoding = gen_const_char_ptr(n_encoding, 3);
3206 format = gen_int(n_format, 4);
3207
William M. Brackf13f77f2004-11-12 16:03:48 +00003208 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003209 call_tests++;
3210 des_xmlOutputBufferPtr(n_buf, buf, 0);
3211 des_xmlDocPtr(n_doc, doc, 1);
3212 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003213 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003214 des_int(n_format, format, 4);
3215 xmlResetLastError();
3216 if (mem_base != xmlMemBlocks()) {
3217 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003219 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 printf(" %d", n_buf);
3221 printf(" %d", n_doc);
3222 printf(" %d", n_cur);
3223 printf(" %d", n_encoding);
3224 printf(" %d", n_format);
3225 printf("\n");
3226 }
3227 }
3228 }
3229 }
3230 }
3231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003232 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003233#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003234
Daniel Veillard42595322004-11-08 10:52:06 +00003235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003236}
3237
3238
3239static int
3240test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003242
William M. Brack21e4ef22005-01-02 09:53:13 +00003243#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003244 int mem_base;
3245 xmlOutputBufferPtr buf; /* the HTML buffer output */
3246 int n_buf;
3247 xmlDocPtr doc; /* the document */
3248 int n_doc;
3249 xmlNodePtr cur; /* the current node */
3250 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003251 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003252 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003253
Daniel Veillard3d97e662004-11-04 10:49:00 +00003254 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3256 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3257 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3258 mem_base = xmlMemBlocks();
3259 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3260 doc = gen_xmlDocPtr(n_doc, 1);
3261 cur = gen_xmlNodePtr(n_cur, 2);
3262 encoding = gen_const_char_ptr(n_encoding, 3);
3263
William M. Brackf13f77f2004-11-12 16:03:48 +00003264 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003265 call_tests++;
3266 des_xmlOutputBufferPtr(n_buf, buf, 0);
3267 des_xmlDocPtr(n_doc, doc, 1);
3268 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003269 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270 xmlResetLastError();
3271 if (mem_base != xmlMemBlocks()) {
3272 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003274 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003275 printf(" %d", n_buf);
3276 printf(" %d", n_doc);
3277 printf(" %d", n_cur);
3278 printf(" %d", n_encoding);
3279 printf("\n");
3280 }
3281 }
3282 }
3283 }
3284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003285 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003286#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003287
Daniel Veillard42595322004-11-08 10:52:06 +00003288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003289}
3290
3291
3292static int
3293test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003295
William M. Brack21e4ef22005-01-02 09:53:13 +00003296#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003297 int mem_base;
3298 int ret_val;
3299 const char * filename; /* the filename (or URL) */
3300 int n_filename;
3301 xmlDocPtr cur; /* the document */
3302 int n_cur;
3303
3304 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3305 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003307 filename = gen_fileoutput(n_filename, 0);
3308 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003309
3310 ret_val = htmlSaveFile(filename, cur);
3311 desret_int(ret_val);
3312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003313 des_fileoutput(n_filename, filename, 0);
3314 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003315 xmlResetLastError();
3316 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003317 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003319 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003320 printf(" %d", n_filename);
3321 printf(" %d", n_cur);
3322 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003323 }
3324 }
3325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003326 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003327#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003328
Daniel Veillard42595322004-11-08 10:52:06 +00003329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003330}
3331
3332
3333static int
3334test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003336
William M. Brack21e4ef22005-01-02 09:53:13 +00003337#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003338 int mem_base;
3339 int ret_val;
3340 const char * filename; /* the filename */
3341 int n_filename;
3342 xmlDocPtr cur; /* the document */
3343 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003344 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345 int n_encoding;
3346
3347 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3348 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3349 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3350 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003351 filename = gen_fileoutput(n_filename, 0);
3352 cur = gen_xmlDocPtr(n_cur, 1);
3353 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354
William M. Brackf13f77f2004-11-12 16:03:48 +00003355 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003356 desret_int(ret_val);
3357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003358 des_fileoutput(n_filename, filename, 0);
3359 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003360 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003361 xmlResetLastError();
3362 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003363 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003366 printf(" %d", n_filename);
3367 printf(" %d", n_cur);
3368 printf(" %d", n_encoding);
3369 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003370 }
3371 }
3372 }
3373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003374 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003375#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003376
Daniel Veillard42595322004-11-08 10:52:06 +00003377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003378}
3379
3380
3381static int
3382test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003384
William M. Brack21e4ef22005-01-02 09:53:13 +00003385#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003386 int mem_base;
3387 int ret_val;
3388 const char * filename; /* the filename */
3389 int n_filename;
3390 xmlDocPtr cur; /* the document */
3391 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003392 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003393 int n_encoding;
3394 int format; /* should formatting spaces been added */
3395 int n_format;
3396
3397 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3398 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3399 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3400 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003402 filename = gen_fileoutput(n_filename, 0);
3403 cur = gen_xmlDocPtr(n_cur, 1);
3404 encoding = gen_const_char_ptr(n_encoding, 2);
3405 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003406
William M. Brackf13f77f2004-11-12 16:03:48 +00003407 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003408 desret_int(ret_val);
3409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003410 des_fileoutput(n_filename, filename, 0);
3411 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003412 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003413 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414 xmlResetLastError();
3415 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003416 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003418 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003419 printf(" %d", n_filename);
3420 printf(" %d", n_cur);
3421 printf(" %d", n_encoding);
3422 printf(" %d", n_format);
3423 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003424 }
3425 }
3426 }
3427 }
3428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003429 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003430#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003431
Daniel Veillard42595322004-11-08 10:52:06 +00003432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003433}
3434
3435
3436static int
3437test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003439
William M. Brack21e4ef22005-01-02 09:53:13 +00003440#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003441 int mem_base;
3442 int ret_val;
3443 htmlDocPtr doc; /* the document */
3444 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003445 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003446 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003447
Daniel Veillarda521d282004-11-09 14:59:59 +00003448 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003449 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3450 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003451 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003452 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003453
William M. Brackf13f77f2004-11-12 16:03:48 +00003454 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 desret_int(ret_val);
3456 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003457 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003458 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003459 xmlResetLastError();
3460 if (mem_base != xmlMemBlocks()) {
3461 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003464 printf(" %d", n_doc);
3465 printf(" %d", n_encoding);
3466 printf("\n");
3467 }
3468 }
3469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003470 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003471#endif
3472
Daniel Veillard42595322004-11-08 10:52:06 +00003473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003474}
3475
3476static int
3477test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003479
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003480 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003481 test_ret += test_htmlDocContentDumpFormatOutput();
3482 test_ret += test_htmlDocContentDumpOutput();
3483 test_ret += test_htmlDocDump();
3484 test_ret += test_htmlDocDumpMemory();
3485 test_ret += test_htmlGetMetaEncoding();
3486 test_ret += test_htmlIsBooleanAttr();
3487 test_ret += test_htmlNewDoc();
3488 test_ret += test_htmlNewDocNoDtD();
3489 test_ret += test_htmlNodeDump();
3490 test_ret += test_htmlNodeDumpFile();
3491 test_ret += test_htmlNodeDumpFileFormat();
3492 test_ret += test_htmlNodeDumpFormatOutput();
3493 test_ret += test_htmlNodeDumpOutput();
3494 test_ret += test_htmlSaveFile();
3495 test_ret += test_htmlSaveFileEnc();
3496 test_ret += test_htmlSaveFileFormat();
3497 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003498
Daniel Veillard42595322004-11-08 10:52:06 +00003499 if (test_ret != 0)
3500 printf("Module HTMLtree: %d errors\n", test_ret);
3501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003502}
3503
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003504static int
3505test_docbDefaultSAXHandlerInit(void) {
3506 int test_ret = 0;
3507
William M. Brack21e4ef22005-01-02 09:53:13 +00003508#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003509#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003510 int mem_base;
3511
3512 mem_base = xmlMemBlocks();
3513
3514 docbDefaultSAXHandlerInit();
3515 call_tests++;
3516 xmlResetLastError();
3517 if (mem_base != xmlMemBlocks()) {
3518 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3519 xmlMemBlocks() - mem_base);
3520 test_ret++;
3521 printf("\n");
3522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003523 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003524#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003525#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003526
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003527 return(test_ret);
3528}
3529
3530
3531static int
3532test_htmlDefaultSAXHandlerInit(void) {
3533 int test_ret = 0;
3534
William M. Brack21e4ef22005-01-02 09:53:13 +00003535#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003536#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003537 int mem_base;
3538
3539 mem_base = xmlMemBlocks();
3540
3541 htmlDefaultSAXHandlerInit();
3542 call_tests++;
3543 xmlResetLastError();
3544 if (mem_base != xmlMemBlocks()) {
3545 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3546 xmlMemBlocks() - mem_base);
3547 test_ret++;
3548 printf("\n");
3549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003550 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003551#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003552#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003553
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003554 return(test_ret);
3555}
3556
3557
3558static int
3559test_xmlDefaultSAXHandlerInit(void) {
3560 int test_ret = 0;
3561
3562 int mem_base;
3563
3564 mem_base = xmlMemBlocks();
3565
3566 xmlDefaultSAXHandlerInit();
3567 call_tests++;
3568 xmlResetLastError();
3569 if (mem_base != xmlMemBlocks()) {
3570 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3571 xmlMemBlocks() - mem_base);
3572 test_ret++;
3573 printf("\n");
3574 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003575 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003576
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003577 return(test_ret);
3578}
3579
3580
3581#define gen_nb_xmlEnumerationPtr 1
3582static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3583 return(NULL);
3584}
3585static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3586}
3587
3588static int
3589test_xmlSAX2AttributeDecl(void) {
3590 int test_ret = 0;
3591
3592 int mem_base;
3593 void * ctx; /* the user data (XML parser context) */
3594 int n_ctx;
3595 xmlChar * elem; /* the name of the element */
3596 int n_elem;
3597 xmlChar * fullname; /* the attribute name */
3598 int n_fullname;
3599 int type; /* the attribute type */
3600 int n_type;
3601 int def; /* the type of default value */
3602 int n_def;
3603 xmlChar * defaultValue; /* the attribute default value */
3604 int n_defaultValue;
3605 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3606 int n_tree;
3607
3608 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3609 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3610 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3611 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3612 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3613 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3614 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3615 mem_base = xmlMemBlocks();
3616 ctx = gen_void_ptr(n_ctx, 0);
3617 elem = gen_const_xmlChar_ptr(n_elem, 1);
3618 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3619 type = gen_int(n_type, 3);
3620 def = gen_int(n_def, 4);
3621 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3622 tree = gen_xmlEnumerationPtr(n_tree, 6);
3623
William M. Brackf13f77f2004-11-12 16:03:48 +00003624 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003625 call_tests++;
3626 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003627 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3628 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003629 des_int(n_type, type, 3);
3630 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003631 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003632 des_xmlEnumerationPtr(n_tree, tree, 6);
3633 xmlResetLastError();
3634 if (mem_base != xmlMemBlocks()) {
3635 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3636 xmlMemBlocks() - mem_base);
3637 test_ret++;
3638 printf(" %d", n_ctx);
3639 printf(" %d", n_elem);
3640 printf(" %d", n_fullname);
3641 printf(" %d", n_type);
3642 printf(" %d", n_def);
3643 printf(" %d", n_defaultValue);
3644 printf(" %d", n_tree);
3645 printf("\n");
3646 }
3647 }
3648 }
3649 }
3650 }
3651 }
3652 }
3653 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003655
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003656 return(test_ret);
3657}
3658
3659
3660static int
3661test_xmlSAX2CDataBlock(void) {
3662 int test_ret = 0;
3663
3664 int mem_base;
3665 void * ctx; /* the user data (XML parser context) */
3666 int n_ctx;
3667 xmlChar * value; /* The pcdata content */
3668 int n_value;
3669 int len; /* the block length */
3670 int n_len;
3671
3672 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3673 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3674 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3675 mem_base = xmlMemBlocks();
3676 ctx = gen_void_ptr(n_ctx, 0);
3677 value = gen_const_xmlChar_ptr(n_value, 1);
3678 len = gen_int(n_len, 2);
3679
William M. Brackf13f77f2004-11-12 16:03:48 +00003680 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003681 call_tests++;
3682 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003683 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003684 des_int(n_len, len, 2);
3685 xmlResetLastError();
3686 if (mem_base != xmlMemBlocks()) {
3687 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3688 xmlMemBlocks() - mem_base);
3689 test_ret++;
3690 printf(" %d", n_ctx);
3691 printf(" %d", n_value);
3692 printf(" %d", n_len);
3693 printf("\n");
3694 }
3695 }
3696 }
3697 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003699
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003700 return(test_ret);
3701}
3702
3703
3704static int
3705test_xmlSAX2Characters(void) {
3706 int test_ret = 0;
3707
3708 int mem_base;
3709 void * ctx; /* the user data (XML parser context) */
3710 int n_ctx;
3711 xmlChar * ch; /* a xmlChar string */
3712 int n_ch;
3713 int len; /* the number of xmlChar */
3714 int n_len;
3715
3716 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3717 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3718 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3719 mem_base = xmlMemBlocks();
3720 ctx = gen_void_ptr(n_ctx, 0);
3721 ch = gen_const_xmlChar_ptr(n_ch, 1);
3722 len = gen_int(n_len, 2);
3723
William M. Brackf13f77f2004-11-12 16:03:48 +00003724 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003725 call_tests++;
3726 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003727 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003728 des_int(n_len, len, 2);
3729 xmlResetLastError();
3730 if (mem_base != xmlMemBlocks()) {
3731 printf("Leak of %d blocks found in xmlSAX2Characters",
3732 xmlMemBlocks() - mem_base);
3733 test_ret++;
3734 printf(" %d", n_ctx);
3735 printf(" %d", n_ch);
3736 printf(" %d", n_len);
3737 printf("\n");
3738 }
3739 }
3740 }
3741 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003743
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003744 return(test_ret);
3745}
3746
3747
3748static int
3749test_xmlSAX2Comment(void) {
3750 int test_ret = 0;
3751
3752 int mem_base;
3753 void * ctx; /* the user data (XML parser context) */
3754 int n_ctx;
3755 xmlChar * value; /* the xmlSAX2Comment content */
3756 int n_value;
3757
3758 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3759 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3760 mem_base = xmlMemBlocks();
3761 ctx = gen_void_ptr(n_ctx, 0);
3762 value = gen_const_xmlChar_ptr(n_value, 1);
3763
William M. Brackf13f77f2004-11-12 16:03:48 +00003764 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003765 call_tests++;
3766 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003767 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003768 xmlResetLastError();
3769 if (mem_base != xmlMemBlocks()) {
3770 printf("Leak of %d blocks found in xmlSAX2Comment",
3771 xmlMemBlocks() - mem_base);
3772 test_ret++;
3773 printf(" %d", n_ctx);
3774 printf(" %d", n_value);
3775 printf("\n");
3776 }
3777 }
3778 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003779 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003780
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003781 return(test_ret);
3782}
3783
3784
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003785static int
3786test_xmlSAX2ElementDecl(void) {
3787 int test_ret = 0;
3788
3789 int mem_base;
3790 void * ctx; /* the user data (XML parser context) */
3791 int n_ctx;
3792 xmlChar * name; /* the element name */
3793 int n_name;
3794 int type; /* the element type */
3795 int n_type;
3796 xmlElementContentPtr content; /* the element value tree */
3797 int n_content;
3798
3799 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3800 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3801 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3802 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3803 mem_base = xmlMemBlocks();
3804 ctx = gen_void_ptr(n_ctx, 0);
3805 name = gen_const_xmlChar_ptr(n_name, 1);
3806 type = gen_int(n_type, 2);
3807 content = gen_xmlElementContentPtr(n_content, 3);
3808
William M. Brackf13f77f2004-11-12 16:03:48 +00003809 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003810 call_tests++;
3811 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003812 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003813 des_int(n_type, type, 2);
3814 des_xmlElementContentPtr(n_content, content, 3);
3815 xmlResetLastError();
3816 if (mem_base != xmlMemBlocks()) {
3817 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3818 xmlMemBlocks() - mem_base);
3819 test_ret++;
3820 printf(" %d", n_ctx);
3821 printf(" %d", n_name);
3822 printf(" %d", n_type);
3823 printf(" %d", n_content);
3824 printf("\n");
3825 }
3826 }
3827 }
3828 }
3829 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003831
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003832 return(test_ret);
3833}
3834
3835
3836static int
3837test_xmlSAX2EndDocument(void) {
3838 int test_ret = 0;
3839
3840 int mem_base;
3841 void * ctx; /* the user data (XML parser context) */
3842 int n_ctx;
3843
3844 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3845 mem_base = xmlMemBlocks();
3846 ctx = gen_void_ptr(n_ctx, 0);
3847
3848 xmlSAX2EndDocument(ctx);
3849 call_tests++;
3850 des_void_ptr(n_ctx, ctx, 0);
3851 xmlResetLastError();
3852 if (mem_base != xmlMemBlocks()) {
3853 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3854 xmlMemBlocks() - mem_base);
3855 test_ret++;
3856 printf(" %d", n_ctx);
3857 printf("\n");
3858 }
3859 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003861
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003862 return(test_ret);
3863}
3864
3865
3866static int
3867test_xmlSAX2EndElement(void) {
3868 int test_ret = 0;
3869
William M. Brack21e4ef22005-01-02 09:53:13 +00003870#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003871#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003872 int mem_base;
3873 void * ctx; /* the user data (XML parser context) */
3874 int n_ctx;
3875 xmlChar * name; /* The element name */
3876 int n_name;
3877
3878 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3880 mem_base = xmlMemBlocks();
3881 ctx = gen_void_ptr(n_ctx, 0);
3882 name = gen_const_xmlChar_ptr(n_name, 1);
3883
William M. Brackf13f77f2004-11-12 16:03:48 +00003884 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003885 call_tests++;
3886 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003887 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003888 xmlResetLastError();
3889 if (mem_base != xmlMemBlocks()) {
3890 printf("Leak of %d blocks found in xmlSAX2EndElement",
3891 xmlMemBlocks() - mem_base);
3892 test_ret++;
3893 printf(" %d", n_ctx);
3894 printf(" %d", n_name);
3895 printf("\n");
3896 }
3897 }
3898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003899 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003900#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003901#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003902
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003903 return(test_ret);
3904}
3905
3906
3907static int
3908test_xmlSAX2EndElementNs(void) {
3909 int test_ret = 0;
3910
3911 int mem_base;
3912 void * ctx; /* the user data (XML parser context) */
3913 int n_ctx;
3914 xmlChar * localname; /* the local name of the element */
3915 int n_localname;
3916 xmlChar * prefix; /* the element namespace prefix if available */
3917 int n_prefix;
3918 xmlChar * URI; /* the element namespace name if available */
3919 int n_URI;
3920
3921 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3922 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3923 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3924 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3925 mem_base = xmlMemBlocks();
3926 ctx = gen_void_ptr(n_ctx, 0);
3927 localname = gen_const_xmlChar_ptr(n_localname, 1);
3928 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3929 URI = gen_const_xmlChar_ptr(n_URI, 3);
3930
William M. Brackf13f77f2004-11-12 16:03:48 +00003931 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003932 call_tests++;
3933 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003934 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3935 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3936 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003937 xmlResetLastError();
3938 if (mem_base != xmlMemBlocks()) {
3939 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3940 xmlMemBlocks() - mem_base);
3941 test_ret++;
3942 printf(" %d", n_ctx);
3943 printf(" %d", n_localname);
3944 printf(" %d", n_prefix);
3945 printf(" %d", n_URI);
3946 printf("\n");
3947 }
3948 }
3949 }
3950 }
3951 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003952 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003953
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003954 return(test_ret);
3955}
3956
3957
3958static int
3959test_xmlSAX2EntityDecl(void) {
3960 int test_ret = 0;
3961
3962 int mem_base;
3963 void * ctx; /* the user data (XML parser context) */
3964 int n_ctx;
3965 xmlChar * name; /* the entity name */
3966 int n_name;
3967 int type; /* the entity type */
3968 int n_type;
3969 xmlChar * publicId; /* The public ID of the entity */
3970 int n_publicId;
3971 xmlChar * systemId; /* The system ID of the entity */
3972 int n_systemId;
3973 xmlChar * content; /* the entity value (without processing). */
3974 int n_content;
3975
3976 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3977 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3978 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3979 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
3980 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
3981 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
3982 mem_base = xmlMemBlocks();
3983 ctx = gen_void_ptr(n_ctx, 0);
3984 name = gen_const_xmlChar_ptr(n_name, 1);
3985 type = gen_int(n_type, 2);
3986 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
3987 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
3988 content = gen_xmlChar_ptr(n_content, 5);
3989
William M. Brackf13f77f2004-11-12 16:03:48 +00003990 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003991 call_tests++;
3992 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003994 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003995 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
3996 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003997 des_xmlChar_ptr(n_content, content, 5);
3998 xmlResetLastError();
3999 if (mem_base != xmlMemBlocks()) {
4000 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4001 xmlMemBlocks() - mem_base);
4002 test_ret++;
4003 printf(" %d", n_ctx);
4004 printf(" %d", n_name);
4005 printf(" %d", n_type);
4006 printf(" %d", n_publicId);
4007 printf(" %d", n_systemId);
4008 printf(" %d", n_content);
4009 printf("\n");
4010 }
4011 }
4012 }
4013 }
4014 }
4015 }
4016 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004018
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004019 return(test_ret);
4020}
4021
4022
4023static int
4024test_xmlSAX2ExternalSubset(void) {
4025 int test_ret = 0;
4026
4027 int mem_base;
4028 void * ctx; /* the user data (XML parser context) */
4029 int n_ctx;
4030 xmlChar * name; /* the root element name */
4031 int n_name;
4032 xmlChar * ExternalID; /* the external ID */
4033 int n_ExternalID;
4034 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4035 int n_SystemID;
4036
4037 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4038 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4039 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4040 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4041 mem_base = xmlMemBlocks();
4042 ctx = gen_void_ptr(n_ctx, 0);
4043 name = gen_const_xmlChar_ptr(n_name, 1);
4044 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4045 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4046
William M. Brackf13f77f2004-11-12 16:03:48 +00004047 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004048 call_tests++;
4049 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004050 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4051 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4052 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 xmlResetLastError();
4054 if (mem_base != xmlMemBlocks()) {
4055 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4056 xmlMemBlocks() - mem_base);
4057 test_ret++;
4058 printf(" %d", n_ctx);
4059 printf(" %d", n_name);
4060 printf(" %d", n_ExternalID);
4061 printf(" %d", n_SystemID);
4062 printf("\n");
4063 }
4064 }
4065 }
4066 }
4067 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004069
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004070 return(test_ret);
4071}
4072
4073
4074static int
4075test_xmlSAX2GetColumnNumber(void) {
4076 int test_ret = 0;
4077
4078 int mem_base;
4079 int ret_val;
4080 void * ctx; /* the user data (XML parser context) */
4081 int n_ctx;
4082
4083 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4084 mem_base = xmlMemBlocks();
4085 ctx = gen_void_ptr(n_ctx, 0);
4086
4087 ret_val = xmlSAX2GetColumnNumber(ctx);
4088 desret_int(ret_val);
4089 call_tests++;
4090 des_void_ptr(n_ctx, ctx, 0);
4091 xmlResetLastError();
4092 if (mem_base != xmlMemBlocks()) {
4093 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4094 xmlMemBlocks() - mem_base);
4095 test_ret++;
4096 printf(" %d", n_ctx);
4097 printf("\n");
4098 }
4099 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004101
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004102 return(test_ret);
4103}
4104
4105
4106static int
4107test_xmlSAX2GetEntity(void) {
4108 int test_ret = 0;
4109
4110 int mem_base;
4111 xmlEntityPtr ret_val;
4112 void * ctx; /* the user data (XML parser context) */
4113 int n_ctx;
4114 xmlChar * name; /* The entity name */
4115 int n_name;
4116
4117 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4118 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4119 mem_base = xmlMemBlocks();
4120 ctx = gen_void_ptr(n_ctx, 0);
4121 name = gen_const_xmlChar_ptr(n_name, 1);
4122
William M. Brackf13f77f2004-11-12 16:03:48 +00004123 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004124 desret_xmlEntityPtr(ret_val);
4125 call_tests++;
4126 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004128 xmlResetLastError();
4129 if (mem_base != xmlMemBlocks()) {
4130 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4131 xmlMemBlocks() - mem_base);
4132 test_ret++;
4133 printf(" %d", n_ctx);
4134 printf(" %d", n_name);
4135 printf("\n");
4136 }
4137 }
4138 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004140
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004141 return(test_ret);
4142}
4143
4144
4145static int
4146test_xmlSAX2GetLineNumber(void) {
4147 int test_ret = 0;
4148
4149 int mem_base;
4150 int ret_val;
4151 void * ctx; /* the user data (XML parser context) */
4152 int n_ctx;
4153
4154 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4155 mem_base = xmlMemBlocks();
4156 ctx = gen_void_ptr(n_ctx, 0);
4157
4158 ret_val = xmlSAX2GetLineNumber(ctx);
4159 desret_int(ret_val);
4160 call_tests++;
4161 des_void_ptr(n_ctx, ctx, 0);
4162 xmlResetLastError();
4163 if (mem_base != xmlMemBlocks()) {
4164 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4165 xmlMemBlocks() - mem_base);
4166 test_ret++;
4167 printf(" %d", n_ctx);
4168 printf("\n");
4169 }
4170 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004171 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004172
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004173 return(test_ret);
4174}
4175
4176
4177static int
4178test_xmlSAX2GetParameterEntity(void) {
4179 int test_ret = 0;
4180
4181 int mem_base;
4182 xmlEntityPtr ret_val;
4183 void * ctx; /* the user data (XML parser context) */
4184 int n_ctx;
4185 xmlChar * name; /* The entity name */
4186 int n_name;
4187
4188 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4189 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4190 mem_base = xmlMemBlocks();
4191 ctx = gen_void_ptr(n_ctx, 0);
4192 name = gen_const_xmlChar_ptr(n_name, 1);
4193
William M. Brackf13f77f2004-11-12 16:03:48 +00004194 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004195 desret_xmlEntityPtr(ret_val);
4196 call_tests++;
4197 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004199 xmlResetLastError();
4200 if (mem_base != xmlMemBlocks()) {
4201 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4202 xmlMemBlocks() - mem_base);
4203 test_ret++;
4204 printf(" %d", n_ctx);
4205 printf(" %d", n_name);
4206 printf("\n");
4207 }
4208 }
4209 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004210 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004211
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004212 return(test_ret);
4213}
4214
4215
4216static int
4217test_xmlSAX2GetPublicId(void) {
4218 int test_ret = 0;
4219
4220 int mem_base;
4221 const xmlChar * ret_val;
4222 void * ctx; /* the user data (XML parser context) */
4223 int n_ctx;
4224
4225 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4226 mem_base = xmlMemBlocks();
4227 ctx = gen_void_ptr(n_ctx, 0);
4228
4229 ret_val = xmlSAX2GetPublicId(ctx);
4230 desret_const_xmlChar_ptr(ret_val);
4231 call_tests++;
4232 des_void_ptr(n_ctx, ctx, 0);
4233 xmlResetLastError();
4234 if (mem_base != xmlMemBlocks()) {
4235 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4236 xmlMemBlocks() - mem_base);
4237 test_ret++;
4238 printf(" %d", n_ctx);
4239 printf("\n");
4240 }
4241 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004243
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004244 return(test_ret);
4245}
4246
4247
4248static int
4249test_xmlSAX2GetSystemId(void) {
4250 int test_ret = 0;
4251
4252 int mem_base;
4253 const xmlChar * ret_val;
4254 void * ctx; /* the user data (XML parser context) */
4255 int n_ctx;
4256
4257 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4258 mem_base = xmlMemBlocks();
4259 ctx = gen_void_ptr(n_ctx, 0);
4260
4261 ret_val = xmlSAX2GetSystemId(ctx);
4262 desret_const_xmlChar_ptr(ret_val);
4263 call_tests++;
4264 des_void_ptr(n_ctx, ctx, 0);
4265 xmlResetLastError();
4266 if (mem_base != xmlMemBlocks()) {
4267 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4268 xmlMemBlocks() - mem_base);
4269 test_ret++;
4270 printf(" %d", n_ctx);
4271 printf("\n");
4272 }
4273 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004274 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004275
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004276 return(test_ret);
4277}
4278
4279
4280static int
4281test_xmlSAX2HasExternalSubset(void) {
4282 int test_ret = 0;
4283
4284 int mem_base;
4285 int ret_val;
4286 void * ctx; /* the user data (XML parser context) */
4287 int n_ctx;
4288
4289 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4290 mem_base = xmlMemBlocks();
4291 ctx = gen_void_ptr(n_ctx, 0);
4292
4293 ret_val = xmlSAX2HasExternalSubset(ctx);
4294 desret_int(ret_val);
4295 call_tests++;
4296 des_void_ptr(n_ctx, ctx, 0);
4297 xmlResetLastError();
4298 if (mem_base != xmlMemBlocks()) {
4299 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4300 xmlMemBlocks() - mem_base);
4301 test_ret++;
4302 printf(" %d", n_ctx);
4303 printf("\n");
4304 }
4305 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004307
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004308 return(test_ret);
4309}
4310
4311
4312static int
4313test_xmlSAX2HasInternalSubset(void) {
4314 int test_ret = 0;
4315
4316 int mem_base;
4317 int ret_val;
4318 void * ctx; /* the user data (XML parser context) */
4319 int n_ctx;
4320
4321 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4322 mem_base = xmlMemBlocks();
4323 ctx = gen_void_ptr(n_ctx, 0);
4324
4325 ret_val = xmlSAX2HasInternalSubset(ctx);
4326 desret_int(ret_val);
4327 call_tests++;
4328 des_void_ptr(n_ctx, ctx, 0);
4329 xmlResetLastError();
4330 if (mem_base != xmlMemBlocks()) {
4331 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4332 xmlMemBlocks() - mem_base);
4333 test_ret++;
4334 printf(" %d", n_ctx);
4335 printf("\n");
4336 }
4337 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004339
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004340 return(test_ret);
4341}
4342
4343
4344static int
4345test_xmlSAX2IgnorableWhitespace(void) {
4346 int test_ret = 0;
4347
4348 int mem_base;
4349 void * ctx; /* the user data (XML parser context) */
4350 int n_ctx;
4351 xmlChar * ch; /* a xmlChar string */
4352 int n_ch;
4353 int len; /* the number of xmlChar */
4354 int n_len;
4355
4356 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4357 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4358 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4359 mem_base = xmlMemBlocks();
4360 ctx = gen_void_ptr(n_ctx, 0);
4361 ch = gen_const_xmlChar_ptr(n_ch, 1);
4362 len = gen_int(n_len, 2);
4363
William M. Brackf13f77f2004-11-12 16:03:48 +00004364 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004365 call_tests++;
4366 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004367 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004368 des_int(n_len, len, 2);
4369 xmlResetLastError();
4370 if (mem_base != xmlMemBlocks()) {
4371 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4372 xmlMemBlocks() - mem_base);
4373 test_ret++;
4374 printf(" %d", n_ctx);
4375 printf(" %d", n_ch);
4376 printf(" %d", n_len);
4377 printf("\n");
4378 }
4379 }
4380 }
4381 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004382 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004383
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004384 return(test_ret);
4385}
4386
4387
4388#define gen_nb_xmlSAXHandler_ptr 1
4389static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4390 return(NULL);
4391}
4392static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4393}
4394
4395static int
4396test_xmlSAX2InitDefaultSAXHandler(void) {
4397 int test_ret = 0;
4398
4399 int mem_base;
4400 xmlSAXHandler * hdlr; /* the SAX handler */
4401 int n_hdlr;
4402 int warning; /* flag if non-zero sets the handler warning procedure */
4403 int n_warning;
4404
4405 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4406 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4407 mem_base = xmlMemBlocks();
4408 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4409 warning = gen_int(n_warning, 1);
4410
4411 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4412 call_tests++;
4413 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4414 des_int(n_warning, warning, 1);
4415 xmlResetLastError();
4416 if (mem_base != xmlMemBlocks()) {
4417 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4418 xmlMemBlocks() - mem_base);
4419 test_ret++;
4420 printf(" %d", n_hdlr);
4421 printf(" %d", n_warning);
4422 printf("\n");
4423 }
4424 }
4425 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004427
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004428 return(test_ret);
4429}
4430
4431
4432static int
4433test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4434 int test_ret = 0;
4435
William M. Brack21e4ef22005-01-02 09:53:13 +00004436#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004437 int mem_base;
4438 xmlSAXHandler * hdlr; /* the SAX handler */
4439 int n_hdlr;
4440
4441 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4442 mem_base = xmlMemBlocks();
4443 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4444
4445 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4446 call_tests++;
4447 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4448 xmlResetLastError();
4449 if (mem_base != xmlMemBlocks()) {
4450 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4451 xmlMemBlocks() - mem_base);
4452 test_ret++;
4453 printf(" %d", n_hdlr);
4454 printf("\n");
4455 }
4456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004457 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004458#endif
4459
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004460 return(test_ret);
4461}
4462
4463
4464static int
4465test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4466 int test_ret = 0;
4467
William M. Brack21e4ef22005-01-02 09:53:13 +00004468#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004469 int mem_base;
4470 xmlSAXHandler * hdlr; /* the SAX handler */
4471 int n_hdlr;
4472
4473 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4474 mem_base = xmlMemBlocks();
4475 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4476
4477 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4478 call_tests++;
4479 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4480 xmlResetLastError();
4481 if (mem_base != xmlMemBlocks()) {
4482 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4483 xmlMemBlocks() - mem_base);
4484 test_ret++;
4485 printf(" %d", n_hdlr);
4486 printf("\n");
4487 }
4488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004489 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004490#endif
4491
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004492 return(test_ret);
4493}
4494
4495
4496static int
4497test_xmlSAX2InternalSubset(void) {
4498 int test_ret = 0;
4499
4500 int mem_base;
4501 void * ctx; /* the user data (XML parser context) */
4502 int n_ctx;
4503 xmlChar * name; /* the root element name */
4504 int n_name;
4505 xmlChar * ExternalID; /* the external ID */
4506 int n_ExternalID;
4507 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4508 int n_SystemID;
4509
4510 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4511 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4512 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4513 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4514 mem_base = xmlMemBlocks();
4515 ctx = gen_void_ptr(n_ctx, 0);
4516 name = gen_const_xmlChar_ptr(n_name, 1);
4517 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4518 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4519
William M. Brackf13f77f2004-11-12 16:03:48 +00004520 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004521 call_tests++;
4522 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4524 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4525 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526 xmlResetLastError();
4527 if (mem_base != xmlMemBlocks()) {
4528 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4529 xmlMemBlocks() - mem_base);
4530 test_ret++;
4531 printf(" %d", n_ctx);
4532 printf(" %d", n_name);
4533 printf(" %d", n_ExternalID);
4534 printf(" %d", n_SystemID);
4535 printf("\n");
4536 }
4537 }
4538 }
4539 }
4540 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004542
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004543 return(test_ret);
4544}
4545
4546
4547static int
4548test_xmlSAX2IsStandalone(void) {
4549 int test_ret = 0;
4550
4551 int mem_base;
4552 int ret_val;
4553 void * ctx; /* the user data (XML parser context) */
4554 int n_ctx;
4555
4556 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4557 mem_base = xmlMemBlocks();
4558 ctx = gen_void_ptr(n_ctx, 0);
4559
4560 ret_val = xmlSAX2IsStandalone(ctx);
4561 desret_int(ret_val);
4562 call_tests++;
4563 des_void_ptr(n_ctx, ctx, 0);
4564 xmlResetLastError();
4565 if (mem_base != xmlMemBlocks()) {
4566 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4567 xmlMemBlocks() - mem_base);
4568 test_ret++;
4569 printf(" %d", n_ctx);
4570 printf("\n");
4571 }
4572 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004574
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004575 return(test_ret);
4576}
4577
4578
4579static int
4580test_xmlSAX2NotationDecl(void) {
4581 int test_ret = 0;
4582
4583 int mem_base;
4584 void * ctx; /* the user data (XML parser context) */
4585 int n_ctx;
4586 xmlChar * name; /* The name of the notation */
4587 int n_name;
4588 xmlChar * publicId; /* The public ID of the entity */
4589 int n_publicId;
4590 xmlChar * systemId; /* The system ID of the entity */
4591 int n_systemId;
4592
4593 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4594 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4595 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4596 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4597 mem_base = xmlMemBlocks();
4598 ctx = gen_void_ptr(n_ctx, 0);
4599 name = gen_const_xmlChar_ptr(n_name, 1);
4600 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4601 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4602
William M. Brackf13f77f2004-11-12 16:03:48 +00004603 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004604 call_tests++;
4605 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004606 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4607 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4608 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004609 xmlResetLastError();
4610 if (mem_base != xmlMemBlocks()) {
4611 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4612 xmlMemBlocks() - mem_base);
4613 test_ret++;
4614 printf(" %d", n_ctx);
4615 printf(" %d", n_name);
4616 printf(" %d", n_publicId);
4617 printf(" %d", n_systemId);
4618 printf("\n");
4619 }
4620 }
4621 }
4622 }
4623 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004624 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004625
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004626 return(test_ret);
4627}
4628
4629
4630static int
4631test_xmlSAX2ProcessingInstruction(void) {
4632 int test_ret = 0;
4633
4634 int mem_base;
4635 void * ctx; /* the user data (XML parser context) */
4636 int n_ctx;
4637 xmlChar * target; /* the target name */
4638 int n_target;
4639 xmlChar * data; /* the PI data's */
4640 int n_data;
4641
4642 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4643 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4644 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4645 mem_base = xmlMemBlocks();
4646 ctx = gen_void_ptr(n_ctx, 0);
4647 target = gen_const_xmlChar_ptr(n_target, 1);
4648 data = gen_const_xmlChar_ptr(n_data, 2);
4649
William M. Brackf13f77f2004-11-12 16:03:48 +00004650 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004651 call_tests++;
4652 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004653 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4654 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004655 xmlResetLastError();
4656 if (mem_base != xmlMemBlocks()) {
4657 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4658 xmlMemBlocks() - mem_base);
4659 test_ret++;
4660 printf(" %d", n_ctx);
4661 printf(" %d", n_target);
4662 printf(" %d", n_data);
4663 printf("\n");
4664 }
4665 }
4666 }
4667 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004669
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004670 return(test_ret);
4671}
4672
4673
4674static int
4675test_xmlSAX2Reference(void) {
4676 int test_ret = 0;
4677
4678 int mem_base;
4679 void * ctx; /* the user data (XML parser context) */
4680 int n_ctx;
4681 xmlChar * name; /* The entity name */
4682 int n_name;
4683
4684 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4685 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4686 mem_base = xmlMemBlocks();
4687 ctx = gen_void_ptr(n_ctx, 0);
4688 name = gen_const_xmlChar_ptr(n_name, 1);
4689
William M. Brackf13f77f2004-11-12 16:03:48 +00004690 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 call_tests++;
4692 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004693 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004694 xmlResetLastError();
4695 if (mem_base != xmlMemBlocks()) {
4696 printf("Leak of %d blocks found in xmlSAX2Reference",
4697 xmlMemBlocks() - mem_base);
4698 test_ret++;
4699 printf(" %d", n_ctx);
4700 printf(" %d", n_name);
4701 printf("\n");
4702 }
4703 }
4704 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004705 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004706
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004707 return(test_ret);
4708}
4709
4710
4711static int
4712test_xmlSAX2ResolveEntity(void) {
4713 int test_ret = 0;
4714
4715 int mem_base;
4716 xmlParserInputPtr ret_val;
4717 void * ctx; /* the user data (XML parser context) */
4718 int n_ctx;
4719 xmlChar * publicId; /* The public ID of the entity */
4720 int n_publicId;
4721 xmlChar * systemId; /* The system ID of the entity */
4722 int n_systemId;
4723
4724 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4725 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4726 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4727 mem_base = xmlMemBlocks();
4728 ctx = gen_void_ptr(n_ctx, 0);
4729 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4730 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4731
William M. Brackf13f77f2004-11-12 16:03:48 +00004732 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004733 desret_xmlParserInputPtr(ret_val);
4734 call_tests++;
4735 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004736 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4737 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004738 xmlResetLastError();
4739 if (mem_base != xmlMemBlocks()) {
4740 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4741 xmlMemBlocks() - mem_base);
4742 test_ret++;
4743 printf(" %d", n_ctx);
4744 printf(" %d", n_publicId);
4745 printf(" %d", n_systemId);
4746 printf("\n");
4747 }
4748 }
4749 }
4750 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004752
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004753 return(test_ret);
4754}
4755
4756
4757#define gen_nb_xmlSAXLocatorPtr 1
4758static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4759 return(NULL);
4760}
4761static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4762}
4763
4764static int
4765test_xmlSAX2SetDocumentLocator(void) {
4766 int test_ret = 0;
4767
4768 int mem_base;
4769 void * ctx; /* the user data (XML parser context) */
4770 int n_ctx;
4771 xmlSAXLocatorPtr loc; /* A SAX Locator */
4772 int n_loc;
4773
4774 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4775 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4776 mem_base = xmlMemBlocks();
4777 ctx = gen_void_ptr(n_ctx, 0);
4778 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4779
4780 xmlSAX2SetDocumentLocator(ctx, loc);
4781 call_tests++;
4782 des_void_ptr(n_ctx, ctx, 0);
4783 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4784 xmlResetLastError();
4785 if (mem_base != xmlMemBlocks()) {
4786 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4787 xmlMemBlocks() - mem_base);
4788 test_ret++;
4789 printf(" %d", n_ctx);
4790 printf(" %d", n_loc);
4791 printf("\n");
4792 }
4793 }
4794 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004796
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004797 return(test_ret);
4798}
4799
4800
4801static int
4802test_xmlSAX2StartDocument(void) {
4803 int test_ret = 0;
4804
4805 int mem_base;
4806 void * ctx; /* the user data (XML parser context) */
4807 int n_ctx;
4808
4809 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4810 mem_base = xmlMemBlocks();
4811 ctx = gen_void_ptr(n_ctx, 0);
4812
4813 xmlSAX2StartDocument(ctx);
4814 call_tests++;
4815 des_void_ptr(n_ctx, ctx, 0);
4816 xmlResetLastError();
4817 if (mem_base != xmlMemBlocks()) {
4818 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4819 xmlMemBlocks() - mem_base);
4820 test_ret++;
4821 printf(" %d", n_ctx);
4822 printf("\n");
4823 }
4824 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004825 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004826
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004827 return(test_ret);
4828}
4829
4830
4831static int
4832test_xmlSAX2StartElement(void) {
4833 int test_ret = 0;
4834
William M. Brack21e4ef22005-01-02 09:53:13 +00004835#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004836#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004837 int mem_base;
4838 void * ctx; /* the user data (XML parser context) */
4839 int n_ctx;
4840 xmlChar * fullname; /* The element name, including namespace prefix */
4841 int n_fullname;
4842 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4843 int n_atts;
4844
4845 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4846 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4847 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4848 mem_base = xmlMemBlocks();
4849 ctx = gen_void_ptr(n_ctx, 0);
4850 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4851 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4852
William M. Brackf13f77f2004-11-12 16:03:48 +00004853 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004854 call_tests++;
4855 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004856 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4857 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004858 xmlResetLastError();
4859 if (mem_base != xmlMemBlocks()) {
4860 printf("Leak of %d blocks found in xmlSAX2StartElement",
4861 xmlMemBlocks() - mem_base);
4862 test_ret++;
4863 printf(" %d", n_ctx);
4864 printf(" %d", n_fullname);
4865 printf(" %d", n_atts);
4866 printf("\n");
4867 }
4868 }
4869 }
4870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004871 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004872#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004873#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004874
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004875 return(test_ret);
4876}
4877
4878
4879static int
4880test_xmlSAX2StartElementNs(void) {
4881 int test_ret = 0;
4882
4883 int mem_base;
4884 void * ctx; /* the user data (XML parser context) */
4885 int n_ctx;
4886 xmlChar * localname; /* the local name of the element */
4887 int n_localname;
4888 xmlChar * prefix; /* the element namespace prefix if available */
4889 int n_prefix;
4890 xmlChar * URI; /* the element namespace name if available */
4891 int n_URI;
4892 int nb_namespaces; /* number of namespace definitions on that node */
4893 int n_nb_namespaces;
4894 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4895 int n_namespaces;
4896 int nb_attributes; /* the number of attributes on that node */
4897 int n_nb_attributes;
4898 int nb_defaulted; /* the number of defaulted attributes. */
4899 int n_nb_defaulted;
4900 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4901 int n_attributes;
4902
4903 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4904 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4905 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4906 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4907 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4908 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4909 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4910 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4911 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4912 mem_base = xmlMemBlocks();
4913 ctx = gen_void_ptr(n_ctx, 0);
4914 localname = gen_const_xmlChar_ptr(n_localname, 1);
4915 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4916 URI = gen_const_xmlChar_ptr(n_URI, 3);
4917 nb_namespaces = gen_int(n_nb_namespaces, 4);
4918 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4919 nb_attributes = gen_int(n_nb_attributes, 6);
4920 nb_defaulted = gen_int(n_nb_defaulted, 7);
4921 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4922
William M. Brackf13f77f2004-11-12 16:03:48 +00004923 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 +00004924 call_tests++;
4925 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004926 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4927 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4928 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004929 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004930 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004931 des_int(n_nb_attributes, nb_attributes, 6);
4932 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004933 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004934 xmlResetLastError();
4935 if (mem_base != xmlMemBlocks()) {
4936 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4937 xmlMemBlocks() - mem_base);
4938 test_ret++;
4939 printf(" %d", n_ctx);
4940 printf(" %d", n_localname);
4941 printf(" %d", n_prefix);
4942 printf(" %d", n_URI);
4943 printf(" %d", n_nb_namespaces);
4944 printf(" %d", n_namespaces);
4945 printf(" %d", n_nb_attributes);
4946 printf(" %d", n_nb_defaulted);
4947 printf(" %d", n_attributes);
4948 printf("\n");
4949 }
4950 }
4951 }
4952 }
4953 }
4954 }
4955 }
4956 }
4957 }
4958 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004959 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004960
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004961 return(test_ret);
4962}
4963
4964
4965static int
4966test_xmlSAX2UnparsedEntityDecl(void) {
4967 int test_ret = 0;
4968
4969 int mem_base;
4970 void * ctx; /* the user data (XML parser context) */
4971 int n_ctx;
4972 xmlChar * name; /* The name of the entity */
4973 int n_name;
4974 xmlChar * publicId; /* The public ID of the entity */
4975 int n_publicId;
4976 xmlChar * systemId; /* The system ID of the entity */
4977 int n_systemId;
4978 xmlChar * notationName; /* the name of the notation */
4979 int n_notationName;
4980
4981 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4982 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4983 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4984 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4985 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
4986 mem_base = xmlMemBlocks();
4987 ctx = gen_void_ptr(n_ctx, 0);
4988 name = gen_const_xmlChar_ptr(n_name, 1);
4989 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4990 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4991 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
4992
William M. Brackf13f77f2004-11-12 16:03:48 +00004993 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004994 call_tests++;
4995 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004996 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4997 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4998 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
4999 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005000 xmlResetLastError();
5001 if (mem_base != xmlMemBlocks()) {
5002 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5003 xmlMemBlocks() - mem_base);
5004 test_ret++;
5005 printf(" %d", n_ctx);
5006 printf(" %d", n_name);
5007 printf(" %d", n_publicId);
5008 printf(" %d", n_systemId);
5009 printf(" %d", n_notationName);
5010 printf("\n");
5011 }
5012 }
5013 }
5014 }
5015 }
5016 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005018
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005019 return(test_ret);
5020}
5021
5022
5023static int
5024test_xmlSAXDefaultVersion(void) {
5025 int test_ret = 0;
5026
William M. Brack21e4ef22005-01-02 09:53:13 +00005027#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005028#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005029 int mem_base;
5030 int ret_val;
5031 int version; /* the version, 1 or 2 */
5032 int n_version;
5033
5034 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5035 mem_base = xmlMemBlocks();
5036 version = gen_int(n_version, 0);
5037
5038 ret_val = xmlSAXDefaultVersion(version);
5039 desret_int(ret_val);
5040 call_tests++;
5041 des_int(n_version, version, 0);
5042 xmlResetLastError();
5043 if (mem_base != xmlMemBlocks()) {
5044 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5045 xmlMemBlocks() - mem_base);
5046 test_ret++;
5047 printf(" %d", n_version);
5048 printf("\n");
5049 }
5050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005051 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005052#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005053#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005055 return(test_ret);
5056}
5057
5058
5059static int
5060test_xmlSAXVersion(void) {
5061 int test_ret = 0;
5062
5063 int mem_base;
5064 int ret_val;
5065 xmlSAXHandler * hdlr; /* the SAX handler */
5066 int n_hdlr;
5067 int version; /* the version, 1 or 2 */
5068 int n_version;
5069
5070 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5071 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5072 mem_base = xmlMemBlocks();
5073 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5074 version = gen_int(n_version, 1);
5075
5076 ret_val = xmlSAXVersion(hdlr, version);
5077 desret_int(ret_val);
5078 call_tests++;
5079 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5080 des_int(n_version, version, 1);
5081 xmlResetLastError();
5082 if (mem_base != xmlMemBlocks()) {
5083 printf("Leak of %d blocks found in xmlSAXVersion",
5084 xmlMemBlocks() - mem_base);
5085 test_ret++;
5086 printf(" %d", n_hdlr);
5087 printf(" %d", n_version);
5088 printf("\n");
5089 }
5090 }
5091 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005093
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005094 return(test_ret);
5095}
5096
5097static int
5098test_SAX2(void) {
5099 int test_ret = 0;
5100
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005101 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005102 test_ret += test_docbDefaultSAXHandlerInit();
5103 test_ret += test_htmlDefaultSAXHandlerInit();
5104 test_ret += test_xmlDefaultSAXHandlerInit();
5105 test_ret += test_xmlSAX2AttributeDecl();
5106 test_ret += test_xmlSAX2CDataBlock();
5107 test_ret += test_xmlSAX2Characters();
5108 test_ret += test_xmlSAX2Comment();
5109 test_ret += test_xmlSAX2ElementDecl();
5110 test_ret += test_xmlSAX2EndDocument();
5111 test_ret += test_xmlSAX2EndElement();
5112 test_ret += test_xmlSAX2EndElementNs();
5113 test_ret += test_xmlSAX2EntityDecl();
5114 test_ret += test_xmlSAX2ExternalSubset();
5115 test_ret += test_xmlSAX2GetColumnNumber();
5116 test_ret += test_xmlSAX2GetEntity();
5117 test_ret += test_xmlSAX2GetLineNumber();
5118 test_ret += test_xmlSAX2GetParameterEntity();
5119 test_ret += test_xmlSAX2GetPublicId();
5120 test_ret += test_xmlSAX2GetSystemId();
5121 test_ret += test_xmlSAX2HasExternalSubset();
5122 test_ret += test_xmlSAX2HasInternalSubset();
5123 test_ret += test_xmlSAX2IgnorableWhitespace();
5124 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5125 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5126 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5127 test_ret += test_xmlSAX2InternalSubset();
5128 test_ret += test_xmlSAX2IsStandalone();
5129 test_ret += test_xmlSAX2NotationDecl();
5130 test_ret += test_xmlSAX2ProcessingInstruction();
5131 test_ret += test_xmlSAX2Reference();
5132 test_ret += test_xmlSAX2ResolveEntity();
5133 test_ret += test_xmlSAX2SetDocumentLocator();
5134 test_ret += test_xmlSAX2StartDocument();
5135 test_ret += test_xmlSAX2StartElement();
5136 test_ret += test_xmlSAX2StartElementNs();
5137 test_ret += test_xmlSAX2UnparsedEntityDecl();
5138 test_ret += test_xmlSAXDefaultVersion();
5139 test_ret += test_xmlSAXVersion();
5140
5141 if (test_ret != 0)
5142 printf("Module SAX2: %d errors\n", test_ret);
5143 return(test_ret);
5144}
5145
Daniel Veillarda82b1822004-11-08 16:24:57 +00005146static int
5147test_xmlC14NDocDumpMemory(void) {
5148 int test_ret = 0;
5149
William M. Brack21e4ef22005-01-02 09:53:13 +00005150#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005151 int mem_base;
5152 int ret_val;
5153 xmlDocPtr doc; /* the XML document for canonization */
5154 int n_doc;
5155 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5156 int n_nodes;
5157 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5158 int n_exclusive;
5159 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) */
5160 int n_inclusive_ns_prefixes;
5161 int with_comments; /* include comments in the result (!=0) or not (==0) */
5162 int n_with_comments;
5163 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 */
5164 int n_doc_txt_ptr;
5165
5166 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5167 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5168 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5169 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5170 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5171 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5172 mem_base = xmlMemBlocks();
5173 doc = gen_xmlDocPtr(n_doc, 0);
5174 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5175 exclusive = gen_int(n_exclusive, 2);
5176 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5177 with_comments = gen_int(n_with_comments, 4);
5178 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5179
5180 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5181 desret_int(ret_val);
5182 call_tests++;
5183 des_xmlDocPtr(n_doc, doc, 0);
5184 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5185 des_int(n_exclusive, exclusive, 2);
5186 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5187 des_int(n_with_comments, with_comments, 4);
5188 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5189 xmlResetLastError();
5190 if (mem_base != xmlMemBlocks()) {
5191 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5192 xmlMemBlocks() - mem_base);
5193 test_ret++;
5194 printf(" %d", n_doc);
5195 printf(" %d", n_nodes);
5196 printf(" %d", n_exclusive);
5197 printf(" %d", n_inclusive_ns_prefixes);
5198 printf(" %d", n_with_comments);
5199 printf(" %d", n_doc_txt_ptr);
5200 printf("\n");
5201 }
5202 }
5203 }
5204 }
5205 }
5206 }
5207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005208 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005209#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005210
Daniel Veillarda82b1822004-11-08 16:24:57 +00005211 return(test_ret);
5212}
5213
5214
5215static int
5216test_xmlC14NDocSave(void) {
5217 int test_ret = 0;
5218
William M. Brack21e4ef22005-01-02 09:53:13 +00005219#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005220 int mem_base;
5221 int ret_val;
5222 xmlDocPtr doc; /* the XML document for canonization */
5223 int n_doc;
5224 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5225 int n_nodes;
5226 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5227 int n_exclusive;
5228 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) */
5229 int n_inclusive_ns_prefixes;
5230 int with_comments; /* include comments in the result (!=0) or not (==0) */
5231 int n_with_comments;
5232 const char * filename; /* the filename to store canonical XML image */
5233 int n_filename;
5234 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5235 int n_compression;
5236
5237 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5238 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5239 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5240 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5241 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5242 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5243 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5244 mem_base = xmlMemBlocks();
5245 doc = gen_xmlDocPtr(n_doc, 0);
5246 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5247 exclusive = gen_int(n_exclusive, 2);
5248 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5249 with_comments = gen_int(n_with_comments, 4);
5250 filename = gen_fileoutput(n_filename, 5);
5251 compression = gen_int(n_compression, 6);
5252
5253 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5254 desret_int(ret_val);
5255 call_tests++;
5256 des_xmlDocPtr(n_doc, doc, 0);
5257 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5258 des_int(n_exclusive, exclusive, 2);
5259 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5260 des_int(n_with_comments, with_comments, 4);
5261 des_fileoutput(n_filename, filename, 5);
5262 des_int(n_compression, compression, 6);
5263 xmlResetLastError();
5264 if (mem_base != xmlMemBlocks()) {
5265 printf("Leak of %d blocks found in xmlC14NDocSave",
5266 xmlMemBlocks() - mem_base);
5267 test_ret++;
5268 printf(" %d", n_doc);
5269 printf(" %d", n_nodes);
5270 printf(" %d", n_exclusive);
5271 printf(" %d", n_inclusive_ns_prefixes);
5272 printf(" %d", n_with_comments);
5273 printf(" %d", n_filename);
5274 printf(" %d", n_compression);
5275 printf("\n");
5276 }
5277 }
5278 }
5279 }
5280 }
5281 }
5282 }
5283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005284 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005285#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005286
Daniel Veillarda82b1822004-11-08 16:24:57 +00005287 return(test_ret);
5288}
5289
5290
5291static int
5292test_xmlC14NDocSaveTo(void) {
5293 int test_ret = 0;
5294
William M. Brack21e4ef22005-01-02 09:53:13 +00005295#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005296 int mem_base;
5297 int ret_val;
5298 xmlDocPtr doc; /* the XML document for canonization */
5299 int n_doc;
5300 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5301 int n_nodes;
5302 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5303 int n_exclusive;
5304 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) */
5305 int n_inclusive_ns_prefixes;
5306 int with_comments; /* include comments in the result (!=0) or not (==0) */
5307 int n_with_comments;
5308 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5309 int n_buf;
5310
5311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5312 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5313 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5314 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5315 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5316 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5317 mem_base = xmlMemBlocks();
5318 doc = gen_xmlDocPtr(n_doc, 0);
5319 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5320 exclusive = gen_int(n_exclusive, 2);
5321 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5322 with_comments = gen_int(n_with_comments, 4);
5323 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5324
5325 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5326 desret_int(ret_val);
5327 call_tests++;
5328 des_xmlDocPtr(n_doc, doc, 0);
5329 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5330 des_int(n_exclusive, exclusive, 2);
5331 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5332 des_int(n_with_comments, with_comments, 4);
5333 des_xmlOutputBufferPtr(n_buf, buf, 5);
5334 xmlResetLastError();
5335 if (mem_base != xmlMemBlocks()) {
5336 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5337 xmlMemBlocks() - mem_base);
5338 test_ret++;
5339 printf(" %d", n_doc);
5340 printf(" %d", n_nodes);
5341 printf(" %d", n_exclusive);
5342 printf(" %d", n_inclusive_ns_prefixes);
5343 printf(" %d", n_with_comments);
5344 printf(" %d", n_buf);
5345 printf("\n");
5346 }
5347 }
5348 }
5349 }
5350 }
5351 }
5352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005353 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005354#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005355
Daniel Veillarda82b1822004-11-08 16:24:57 +00005356 return(test_ret);
5357}
5358
5359
5360static int
5361test_xmlC14NExecute(void) {
5362 int test_ret = 0;
5363
5364
5365 /* missing type support */
5366 return(test_ret);
5367}
5368
5369static int
5370test_c14n(void) {
5371 int test_ret = 0;
5372
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005373 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005374 test_ret += test_xmlC14NDocDumpMemory();
5375 test_ret += test_xmlC14NDocSave();
5376 test_ret += test_xmlC14NDocSaveTo();
5377 test_ret += test_xmlC14NExecute();
5378
5379 if (test_ret != 0)
5380 printf("Module c14n: %d errors\n", test_ret);
5381 return(test_ret);
5382}
Daniel Veillarda521d282004-11-09 14:59:59 +00005383#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005384
Daniel Veillardce682bc2004-11-05 17:22:25 +00005385#define gen_nb_xmlCatalogPtr 1
5386static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5387 return(NULL);
5388}
5389static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5390}
Daniel Veillarda521d282004-11-09 14:59:59 +00005391#endif
5392
Daniel Veillardce682bc2004-11-05 17:22:25 +00005393
Daniel Veillardd93f6252004-11-02 15:53:51 +00005394static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005395test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005397
William M. Brack21e4ef22005-01-02 09:53:13 +00005398#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005399 int mem_base;
5400 int ret_val;
5401 xmlCatalogPtr catal; /* a Catalog */
5402 int n_catal;
5403 xmlChar * type; /* the type of record to add to the catalog */
5404 int n_type;
5405 xmlChar * orig; /* the system, public or prefix to match */
5406 int n_orig;
5407 xmlChar * replace; /* the replacement value for the match */
5408 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005409
Daniel Veillardce682bc2004-11-05 17:22:25 +00005410 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5411 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5412 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5413 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5414 mem_base = xmlMemBlocks();
5415 catal = gen_xmlCatalogPtr(n_catal, 0);
5416 type = gen_const_xmlChar_ptr(n_type, 1);
5417 orig = gen_const_xmlChar_ptr(n_orig, 2);
5418 replace = gen_const_xmlChar_ptr(n_replace, 3);
5419
William M. Brackf13f77f2004-11-12 16:03:48 +00005420 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005421 desret_int(ret_val);
5422 call_tests++;
5423 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005424 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5425 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5426 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005427 xmlResetLastError();
5428 if (mem_base != xmlMemBlocks()) {
5429 printf("Leak of %d blocks found in xmlACatalogAdd",
5430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005431 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005432 printf(" %d", n_catal);
5433 printf(" %d", n_type);
5434 printf(" %d", n_orig);
5435 printf(" %d", n_replace);
5436 printf("\n");
5437 }
5438 }
5439 }
5440 }
5441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005442 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005443#endif
5444
Daniel Veillard42595322004-11-08 10:52:06 +00005445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005446}
5447
5448
5449static int
5450test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005452
William M. Brack21e4ef22005-01-02 09:53:13 +00005453#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005454 int mem_base;
5455 xmlCatalogPtr catal; /* a Catalog */
5456 int n_catal;
5457 FILE * out; /* the file. */
5458 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005459
Daniel Veillardce682bc2004-11-05 17:22:25 +00005460 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5461 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5462 mem_base = xmlMemBlocks();
5463 catal = gen_xmlCatalogPtr(n_catal, 0);
5464 out = gen_FILE_ptr(n_out, 1);
5465
5466 xmlACatalogDump(catal, out);
5467 call_tests++;
5468 des_xmlCatalogPtr(n_catal, catal, 0);
5469 des_FILE_ptr(n_out, out, 1);
5470 xmlResetLastError();
5471 if (mem_base != xmlMemBlocks()) {
5472 printf("Leak of %d blocks found in xmlACatalogDump",
5473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005475 printf(" %d", n_catal);
5476 printf(" %d", n_out);
5477 printf("\n");
5478 }
5479 }
5480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005481 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005482#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005483
Daniel Veillard42595322004-11-08 10:52:06 +00005484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005485}
5486
5487
5488static int
5489test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005491
William M. Brack21e4ef22005-01-02 09:53:13 +00005492#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005493 int mem_base;
5494 int ret_val;
5495 xmlCatalogPtr catal; /* a Catalog */
5496 int n_catal;
5497 xmlChar * value; /* the value to remove */
5498 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005499
Daniel Veillardce682bc2004-11-05 17:22:25 +00005500 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5501 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5502 mem_base = xmlMemBlocks();
5503 catal = gen_xmlCatalogPtr(n_catal, 0);
5504 value = gen_const_xmlChar_ptr(n_value, 1);
5505
William M. Brackf13f77f2004-11-12 16:03:48 +00005506 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005507 desret_int(ret_val);
5508 call_tests++;
5509 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005510 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 xmlResetLastError();
5512 if (mem_base != xmlMemBlocks()) {
5513 printf("Leak of %d blocks found in xmlACatalogRemove",
5514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005516 printf(" %d", n_catal);
5517 printf(" %d", n_value);
5518 printf("\n");
5519 }
5520 }
5521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005522 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005523#endif
5524
Daniel Veillard42595322004-11-08 10:52:06 +00005525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005526}
5527
5528
5529static int
5530test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005532
William M. Brack21e4ef22005-01-02 09:53:13 +00005533#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005534 int mem_base;
5535 xmlChar * ret_val;
5536 xmlCatalogPtr catal; /* a Catalog */
5537 int n_catal;
5538 xmlChar * pubID; /* the public ID string */
5539 int n_pubID;
5540 xmlChar * sysID; /* the system ID string */
5541 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005542
Daniel Veillardce682bc2004-11-05 17:22:25 +00005543 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5544 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5545 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5546 mem_base = xmlMemBlocks();
5547 catal = gen_xmlCatalogPtr(n_catal, 0);
5548 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5549 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5550
William M. Brackf13f77f2004-11-12 16:03:48 +00005551 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 desret_xmlChar_ptr(ret_val);
5553 call_tests++;
5554 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005555 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5556 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005557 xmlResetLastError();
5558 if (mem_base != xmlMemBlocks()) {
5559 printf("Leak of %d blocks found in xmlACatalogResolve",
5560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005561 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005562 printf(" %d", n_catal);
5563 printf(" %d", n_pubID);
5564 printf(" %d", n_sysID);
5565 printf("\n");
5566 }
5567 }
5568 }
5569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005570 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005571#endif
5572
Daniel Veillard42595322004-11-08 10:52:06 +00005573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005574}
5575
5576
5577static int
5578test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005580
William M. Brack21e4ef22005-01-02 09:53:13 +00005581#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005582 int mem_base;
5583 xmlChar * ret_val;
5584 xmlCatalogPtr catal; /* a Catalog */
5585 int n_catal;
5586 xmlChar * pubID; /* the public ID string */
5587 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005588
Daniel Veillardce682bc2004-11-05 17:22:25 +00005589 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5590 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5591 mem_base = xmlMemBlocks();
5592 catal = gen_xmlCatalogPtr(n_catal, 0);
5593 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5594
William M. Brackf13f77f2004-11-12 16:03:48 +00005595 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005596 desret_xmlChar_ptr(ret_val);
5597 call_tests++;
5598 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005599 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005600 xmlResetLastError();
5601 if (mem_base != xmlMemBlocks()) {
5602 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005604 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005605 printf(" %d", n_catal);
5606 printf(" %d", n_pubID);
5607 printf("\n");
5608 }
5609 }
5610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005611 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005612#endif
5613
Daniel Veillard42595322004-11-08 10:52:06 +00005614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005615}
5616
5617
5618static int
5619test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005621
William M. Brack21e4ef22005-01-02 09:53:13 +00005622#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005623 int mem_base;
5624 xmlChar * ret_val;
5625 xmlCatalogPtr catal; /* a Catalog */
5626 int n_catal;
5627 xmlChar * sysID; /* the system ID string */
5628 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005629
Daniel Veillardce682bc2004-11-05 17:22:25 +00005630 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5631 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5632 mem_base = xmlMemBlocks();
5633 catal = gen_xmlCatalogPtr(n_catal, 0);
5634 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5635
William M. Brackf13f77f2004-11-12 16:03:48 +00005636 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005637 desret_xmlChar_ptr(ret_val);
5638 call_tests++;
5639 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005640 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005641 xmlResetLastError();
5642 if (mem_base != xmlMemBlocks()) {
5643 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005646 printf(" %d", n_catal);
5647 printf(" %d", n_sysID);
5648 printf("\n");
5649 }
5650 }
5651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005653#endif
5654
Daniel Veillard42595322004-11-08 10:52:06 +00005655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005656}
5657
5658
5659static int
5660test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005662
William M. Brack21e4ef22005-01-02 09:53:13 +00005663#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005664 int mem_base;
5665 xmlChar * ret_val;
5666 xmlCatalogPtr catal; /* a Catalog */
5667 int n_catal;
5668 xmlChar * URI; /* the URI */
5669 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005670
Daniel Veillardce682bc2004-11-05 17:22:25 +00005671 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5672 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5673 mem_base = xmlMemBlocks();
5674 catal = gen_xmlCatalogPtr(n_catal, 0);
5675 URI = gen_const_xmlChar_ptr(n_URI, 1);
5676
William M. Brackf13f77f2004-11-12 16:03:48 +00005677 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005678 desret_xmlChar_ptr(ret_val);
5679 call_tests++;
5680 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005681 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005682 xmlResetLastError();
5683 if (mem_base != xmlMemBlocks()) {
5684 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005687 printf(" %d", n_catal);
5688 printf(" %d", n_URI);
5689 printf("\n");
5690 }
5691 }
5692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005693 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005694#endif
5695
Daniel Veillard42595322004-11-08 10:52:06 +00005696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005697}
5698
5699
5700static int
5701test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005703
William M. Brack21e4ef22005-01-02 09:53:13 +00005704#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005705 int mem_base;
5706 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005708 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005709 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005710 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005711 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005712 int n_replace;
5713
5714 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5715 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5716 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005718 type = gen_const_xmlChar_ptr(n_type, 0);
5719 orig = gen_const_xmlChar_ptr(n_orig, 1);
5720 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005721
William M. Brackf13f77f2004-11-12 16:03:48 +00005722 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005723 desret_int(ret_val);
5724 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005725 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5726 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5727 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005728 xmlResetLastError();
5729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005730 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005733 printf(" %d", n_type);
5734 printf(" %d", n_orig);
5735 printf(" %d", n_replace);
5736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005737 }
5738 }
5739 }
5740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005741 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005742#endif
5743
Daniel Veillard42595322004-11-08 10:52:06 +00005744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005745}
5746
5747
5748static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005749test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005751
William M. Brack21e4ef22005-01-02 09:53:13 +00005752#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005753
Daniel Veillardd93f6252004-11-02 15:53:51 +00005754
5755 xmlCatalogCleanup();
5756 call_tests++;
5757 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005758 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759#endif
5760
Daniel Veillard42595322004-11-08 10:52:06 +00005761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005762}
5763
5764
5765static int
5766test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005768
William M. Brack21e4ef22005-01-02 09:53:13 +00005769#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005770 int ret_val;
5771
5772
5773 ret_val = xmlCatalogConvert();
5774 desret_int(ret_val);
5775 call_tests++;
5776 xmlResetLastError();
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
5785test_xmlCatalogDump(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) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005789 int mem_base;
5790 FILE * out; /* the file. */
5791 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005792
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005793 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5794 mem_base = xmlMemBlocks();
5795 out = gen_FILE_ptr(n_out, 0);
5796
5797 xmlCatalogDump(out);
5798 call_tests++;
5799 des_FILE_ptr(n_out, out, 0);
5800 xmlResetLastError();
5801 if (mem_base != xmlMemBlocks()) {
5802 printf("Leak of %d blocks found in xmlCatalogDump",
5803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005804 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005805 printf(" %d", n_out);
5806 printf("\n");
5807 }
5808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005809 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005810#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005811
Daniel Veillard42595322004-11-08 10:52:06 +00005812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005813}
5814
5815
5816static int
5817test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005819
William M. Brack21e4ef22005-01-02 09:53:13 +00005820#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005821 int mem_base;
5822 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
Daniel Veillard57b25162004-11-06 14:50:18 +00005824 mem_base = xmlMemBlocks();
5825
5826 ret_val = xmlCatalogGetDefaults();
5827 desret_xmlCatalogAllow(ret_val);
5828 call_tests++;
5829 xmlResetLastError();
5830 if (mem_base != xmlMemBlocks()) {
5831 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005833 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005834 printf("\n");
5835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005836 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005837#endif
5838
Daniel Veillard42595322004-11-08 10:52:06 +00005839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005840}
5841
5842
5843static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005844test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005846
William M. Brack21e4ef22005-01-02 09:53:13 +00005847#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005848 int mem_base;
5849 int ret_val;
5850 xmlCatalogPtr catal; /* should this create an SGML catalog */
5851 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005852
Daniel Veillardce682bc2004-11-05 17:22:25 +00005853 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5854 mem_base = xmlMemBlocks();
5855 catal = gen_xmlCatalogPtr(n_catal, 0);
5856
5857 ret_val = xmlCatalogIsEmpty(catal);
5858 desret_int(ret_val);
5859 call_tests++;
5860 des_xmlCatalogPtr(n_catal, catal, 0);
5861 xmlResetLastError();
5862 if (mem_base != xmlMemBlocks()) {
5863 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005865 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005866 printf(" %d", n_catal);
5867 printf("\n");
5868 }
5869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005870 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005871#endif
5872
Daniel Veillard42595322004-11-08 10:52:06 +00005873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005874}
5875
5876
5877static int
5878test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880
William M. Brack21e4ef22005-01-02 09:53:13 +00005881#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005882 int mem_base;
5883 xmlChar * ret_val;
5884 void * catalogs; /* a document's list of catalogs */
5885 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005886 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005887 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005888 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005889 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005890
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005891 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5892 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5893 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005895 catalogs = gen_void_ptr(n_catalogs, 0);
5896 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5897 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005898
William M. Brackf13f77f2004-11-12 16:03:48 +00005899 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005900 desret_xmlChar_ptr(ret_val);
5901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005902 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005903 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5904 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005905 xmlResetLastError();
5906 if (mem_base != xmlMemBlocks()) {
5907 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005909 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005910 printf(" %d", n_catalogs);
5911 printf(" %d", n_pubID);
5912 printf(" %d", n_sysID);
5913 printf("\n");
5914 }
5915 }
5916 }
5917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005918 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005919#endif
5920
Daniel Veillard42595322004-11-08 10:52:06 +00005921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005922}
5923
5924
5925static int
5926test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005928
William M. Brack21e4ef22005-01-02 09:53:13 +00005929#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005930 int mem_base;
5931 xmlChar * ret_val;
5932 void * catalogs; /* a document's list of catalogs */
5933 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005934 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005935 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005937 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5938 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005940 catalogs = gen_void_ptr(n_catalogs, 0);
5941 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005942
William M. Brackf13f77f2004-11-12 16:03:48 +00005943 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005944 desret_xmlChar_ptr(ret_val);
5945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005946 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005947 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005948 xmlResetLastError();
5949 if (mem_base != xmlMemBlocks()) {
5950 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005952 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005953 printf(" %d", n_catalogs);
5954 printf(" %d", n_URI);
5955 printf("\n");
5956 }
5957 }
5958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005959 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005960#endif
5961
Daniel Veillard42595322004-11-08 10:52:06 +00005962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005963}
5964
5965
5966static int
5967test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005969
William M. Brack21e4ef22005-01-02 09:53:13 +00005970#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005971 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005972 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005973 int n_value;
5974
5975 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00005976 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005977
William M. Brackf13f77f2004-11-12 16:03:48 +00005978 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005979 desret_int(ret_val);
5980 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005981 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005982 xmlResetLastError();
5983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005984 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005985#endif
5986
Daniel Veillard42595322004-11-08 10:52:06 +00005987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005988}
5989
5990
5991static int
5992test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005994
William M. Brack21e4ef22005-01-02 09:53:13 +00005995#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005996 int mem_base;
5997 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005998 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005999 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006000 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006001 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006002
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006003 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6004 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006006 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6007 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006008
William M. Brackf13f77f2004-11-12 16:03:48 +00006009 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006010 desret_xmlChar_ptr(ret_val);
6011 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006012 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6013 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006014 xmlResetLastError();
6015 if (mem_base != xmlMemBlocks()) {
6016 printf("Leak of %d blocks found in xmlCatalogResolve",
6017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006018 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006019 printf(" %d", n_pubID);
6020 printf(" %d", n_sysID);
6021 printf("\n");
6022 }
6023 }
6024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006025 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006026#endif
6027
Daniel Veillard42595322004-11-08 10:52:06 +00006028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006029}
6030
6031
6032static int
6033test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006035
William M. Brack21e4ef22005-01-02 09:53:13 +00006036#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int mem_base;
6038 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006039 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006040 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006041
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006042 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006044 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006045
William M. Brackf13f77f2004-11-12 16:03:48 +00006046 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006047 desret_xmlChar_ptr(ret_val);
6048 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006049 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006050 xmlResetLastError();
6051 if (mem_base != xmlMemBlocks()) {
6052 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
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("\n");
6057 }
6058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006059 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006060#endif
6061
Daniel Veillard42595322004-11-08 10:52:06 +00006062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006063}
6064
6065
6066static int
6067test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006069
William M. Brack21e4ef22005-01-02 09:53:13 +00006070#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006071 int mem_base;
6072 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006073 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006074 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006075
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006078 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006079
William M. Brackf13f77f2004-11-12 16:03:48 +00006080 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081 desret_xmlChar_ptr(ret_val);
6082 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006083 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006084 xmlResetLastError();
6085 if (mem_base != xmlMemBlocks()) {
6086 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006088 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006089 printf(" %d", n_sysID);
6090 printf("\n");
6091 }
6092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006093 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006094#endif
6095
Daniel Veillard42595322004-11-08 10:52:06 +00006096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006097}
6098
6099
6100static int
6101test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006103
William M. Brack21e4ef22005-01-02 09:53:13 +00006104#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006105 int mem_base;
6106 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006107 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006108 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006109
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6111 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006112 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006113
William M. Brackf13f77f2004-11-12 16:03:48 +00006114 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115 desret_xmlChar_ptr(ret_val);
6116 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006117 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006118 xmlResetLastError();
6119 if (mem_base != xmlMemBlocks()) {
6120 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006122 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006123 printf(" %d", n_URI);
6124 printf("\n");
6125 }
6126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006127 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006128#endif
6129
Daniel Veillard42595322004-11-08 10:52:06 +00006130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006131}
6132
6133
6134static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006135test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006137
William M. Brack21e4ef22005-01-02 09:53:13 +00006138#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006139 int mem_base;
6140 xmlCatalogPrefer ret_val;
6141 xmlCatalogPrefer prefer; /* the default preference for delegation */
6142 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006143
Daniel Veillard57b25162004-11-06 14:50:18 +00006144 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6145 mem_base = xmlMemBlocks();
6146 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6147
6148 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6149 desret_xmlCatalogPrefer(ret_val);
6150 call_tests++;
6151 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6152 xmlResetLastError();
6153 if (mem_base != xmlMemBlocks()) {
6154 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006156 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006157 printf(" %d", n_prefer);
6158 printf("\n");
6159 }
6160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006161 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006162#endif
6163
Daniel Veillard42595322004-11-08 10:52:06 +00006164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006165}
6166
6167
6168static int
6169test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006171
William M. Brack21e4ef22005-01-02 09:53:13 +00006172#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006173 int mem_base;
6174 xmlCatalogAllow allow; /* what catalogs should be accepted */
6175 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006176
Daniel Veillard57b25162004-11-06 14:50:18 +00006177 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6178 mem_base = xmlMemBlocks();
6179 allow = gen_xmlCatalogAllow(n_allow, 0);
6180
6181 xmlCatalogSetDefaults(allow);
6182 call_tests++;
6183 des_xmlCatalogAllow(n_allow, allow, 0);
6184 xmlResetLastError();
6185 if (mem_base != xmlMemBlocks()) {
6186 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006188 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006189 printf(" %d", n_allow);
6190 printf("\n");
6191 }
6192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006193 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006194#endif
6195
Daniel Veillard42595322004-11-08 10:52:06 +00006196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006197}
6198
6199
6200static int
6201test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006203
William M. Brack21e4ef22005-01-02 09:53:13 +00006204#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006205 int mem_base;
6206 int ret_val;
6207 xmlCatalogPtr catal; /* the catalog */
6208 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006209
Daniel Veillardce682bc2004-11-05 17:22:25 +00006210 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6211 mem_base = xmlMemBlocks();
6212 catal = gen_xmlCatalogPtr(n_catal, 0);
6213
6214 ret_val = xmlConvertSGMLCatalog(catal);
6215 desret_int(ret_val);
6216 call_tests++;
6217 des_xmlCatalogPtr(n_catal, catal, 0);
6218 xmlResetLastError();
6219 if (mem_base != xmlMemBlocks()) {
6220 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006222 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006223 printf(" %d", n_catal);
6224 printf("\n");
6225 }
6226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006227 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006228#endif
6229
Daniel Veillard42595322004-11-08 10:52:06 +00006230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006231}
6232
6233
6234static int
6235test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006237
William M. Brack21e4ef22005-01-02 09:53:13 +00006238#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239 int mem_base;
6240
6241 mem_base = xmlMemBlocks();
6242
6243 xmlInitializeCatalog();
6244 call_tests++;
6245 xmlResetLastError();
6246 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006247 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006249 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006250 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006252 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006253#endif
6254
Daniel Veillard42595322004-11-08 10:52:06 +00006255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006256}
6257
6258
6259static int
6260test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006262
6263
6264 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006266}
6267
6268
6269static int
6270test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006272
William M. Brack21e4ef22005-01-02 09:53:13 +00006273#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006274 int ret_val;
6275 const char * filename; /* a file path */
6276 int n_filename;
6277
6278 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006279 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006280
6281 ret_val = xmlLoadCatalog(filename);
6282 desret_int(ret_val);
6283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006284 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006285 xmlResetLastError();
6286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006287 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006288#endif
6289
Daniel Veillard42595322004-11-08 10:52:06 +00006290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006291}
6292
6293
6294static int
6295test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006297
William M. Brack21e4ef22005-01-02 09:53:13 +00006298#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006299 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006300 int n_pathss;
6301
6302 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006303 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006304
William M. Brackf13f77f2004-11-12 16:03:48 +00006305 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006306 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006307 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308 xmlResetLastError();
6309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006310 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006311#endif
6312
Daniel Veillard42595322004-11-08 10:52:06 +00006313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006314}
6315
6316
6317static int
6318test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006320
6321
6322 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324}
6325
6326
6327static int
6328test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006330
6331
6332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006334}
6335
6336
6337static int
6338test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340
William M. Brack21e4ef22005-01-02 09:53:13 +00006341#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 int mem_base;
6343 xmlDocPtr ret_val;
6344 const char * filename; /* the filename */
6345 int n_filename;
6346
6347 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006349 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006350
6351 ret_val = xmlParseCatalogFile(filename);
6352 desret_xmlDocPtr(ret_val);
6353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006354 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355 xmlResetLastError();
6356 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006357 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006359 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006360 printf(" %d", n_filename);
6361 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006362 }
6363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006364 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006365#endif
6366
Daniel Veillard42595322004-11-08 10:52:06 +00006367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006368}
6369
6370static int
6371test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006373
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006374 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006375 test_ret += test_xmlACatalogAdd();
6376 test_ret += test_xmlACatalogDump();
6377 test_ret += test_xmlACatalogRemove();
6378 test_ret += test_xmlACatalogResolve();
6379 test_ret += test_xmlACatalogResolvePublic();
6380 test_ret += test_xmlACatalogResolveSystem();
6381 test_ret += test_xmlACatalogResolveURI();
6382 test_ret += test_xmlCatalogAdd();
6383 test_ret += test_xmlCatalogCleanup();
6384 test_ret += test_xmlCatalogConvert();
6385 test_ret += test_xmlCatalogDump();
6386 test_ret += test_xmlCatalogGetDefaults();
6387 test_ret += test_xmlCatalogIsEmpty();
6388 test_ret += test_xmlCatalogLocalResolve();
6389 test_ret += test_xmlCatalogLocalResolveURI();
6390 test_ret += test_xmlCatalogRemove();
6391 test_ret += test_xmlCatalogResolve();
6392 test_ret += test_xmlCatalogResolvePublic();
6393 test_ret += test_xmlCatalogResolveSystem();
6394 test_ret += test_xmlCatalogResolveURI();
6395 test_ret += test_xmlCatalogSetDefaultPrefer();
6396 test_ret += test_xmlCatalogSetDefaults();
6397 test_ret += test_xmlConvertSGMLCatalog();
6398 test_ret += test_xmlInitializeCatalog();
6399 test_ret += test_xmlLoadACatalog();
6400 test_ret += test_xmlLoadCatalog();
6401 test_ret += test_xmlLoadCatalogs();
6402 test_ret += test_xmlLoadSGMLSuperCatalog();
6403 test_ret += test_xmlNewCatalog();
6404 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006405
Daniel Veillard42595322004-11-08 10:52:06 +00006406 if (test_ret != 0)
6407 printf("Module catalog: %d errors\n", test_ret);
6408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006409}
6410
Daniel Veillardce682bc2004-11-05 17:22:25 +00006411#define gen_nb_const_xmlChRangeGroupPtr 1
6412static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6413 return(NULL);
6414}
6415static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6416}
6417
Daniel Veillardd93f6252004-11-02 15:53:51 +00006418static int
6419test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006421
Daniel Veillardce682bc2004-11-05 17:22:25 +00006422 int mem_base;
6423 int ret_val;
6424 unsigned int val; /* character to be validated */
6425 int n_val;
6426 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6427 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006428
Daniel Veillardce682bc2004-11-05 17:22:25 +00006429 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6430 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6431 mem_base = xmlMemBlocks();
6432 val = gen_unsigned_int(n_val, 0);
6433 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6434
William M. Brackf13f77f2004-11-12 16:03:48 +00006435 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006436 desret_int(ret_val);
6437 call_tests++;
6438 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006439 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006440 xmlResetLastError();
6441 if (mem_base != xmlMemBlocks()) {
6442 printf("Leak of %d blocks found in xmlCharInRange",
6443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006444 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006445 printf(" %d", n_val);
6446 printf(" %d", n_rptr);
6447 printf("\n");
6448 }
6449 }
6450 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006451 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006452
Daniel Veillard42595322004-11-08 10:52:06 +00006453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454}
6455
6456
6457static int
6458test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006460
Daniel Veillard3d97e662004-11-04 10:49:00 +00006461 int mem_base;
6462 int ret_val;
6463 unsigned int ch; /* character to validate */
6464 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006465
Daniel Veillard3d97e662004-11-04 10:49:00 +00006466 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6467 mem_base = xmlMemBlocks();
6468 ch = gen_unsigned_int(n_ch, 0);
6469
6470 ret_val = xmlIsBaseChar(ch);
6471 desret_int(ret_val);
6472 call_tests++;
6473 des_unsigned_int(n_ch, ch, 0);
6474 xmlResetLastError();
6475 if (mem_base != xmlMemBlocks()) {
6476 printf("Leak of %d blocks found in xmlIsBaseChar",
6477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006478 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006479 printf(" %d", n_ch);
6480 printf("\n");
6481 }
6482 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006484
Daniel Veillard42595322004-11-08 10:52:06 +00006485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006486}
6487
6488
6489static int
6490test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006492
Daniel Veillard3d97e662004-11-04 10:49:00 +00006493 int mem_base;
6494 int ret_val;
6495 unsigned int ch; /* character to validate */
6496 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006497
Daniel Veillard3d97e662004-11-04 10:49:00 +00006498 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6499 mem_base = xmlMemBlocks();
6500 ch = gen_unsigned_int(n_ch, 0);
6501
6502 ret_val = xmlIsBlank(ch);
6503 desret_int(ret_val);
6504 call_tests++;
6505 des_unsigned_int(n_ch, ch, 0);
6506 xmlResetLastError();
6507 if (mem_base != xmlMemBlocks()) {
6508 printf("Leak of %d blocks found in xmlIsBlank",
6509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006510 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006511 printf(" %d", n_ch);
6512 printf("\n");
6513 }
6514 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006516
Daniel Veillard42595322004-11-08 10:52:06 +00006517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006518}
6519
6520
6521static int
6522test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006524
Daniel Veillard3d97e662004-11-04 10:49:00 +00006525 int mem_base;
6526 int ret_val;
6527 unsigned int ch; /* character to validate */
6528 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006529
Daniel Veillard3d97e662004-11-04 10:49:00 +00006530 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6531 mem_base = xmlMemBlocks();
6532 ch = gen_unsigned_int(n_ch, 0);
6533
6534 ret_val = xmlIsChar(ch);
6535 desret_int(ret_val);
6536 call_tests++;
6537 des_unsigned_int(n_ch, ch, 0);
6538 xmlResetLastError();
6539 if (mem_base != xmlMemBlocks()) {
6540 printf("Leak of %d blocks found in xmlIsChar",
6541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006542 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006543 printf(" %d", n_ch);
6544 printf("\n");
6545 }
6546 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006548
Daniel Veillard42595322004-11-08 10:52:06 +00006549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006550}
6551
6552
6553static int
6554test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006556
Daniel Veillard3d97e662004-11-04 10:49:00 +00006557 int mem_base;
6558 int ret_val;
6559 unsigned int ch; /* character to validate */
6560 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006561
Daniel Veillard3d97e662004-11-04 10:49:00 +00006562 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6563 mem_base = xmlMemBlocks();
6564 ch = gen_unsigned_int(n_ch, 0);
6565
6566 ret_val = xmlIsCombining(ch);
6567 desret_int(ret_val);
6568 call_tests++;
6569 des_unsigned_int(n_ch, ch, 0);
6570 xmlResetLastError();
6571 if (mem_base != xmlMemBlocks()) {
6572 printf("Leak of %d blocks found in xmlIsCombining",
6573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006574 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006575 printf(" %d", n_ch);
6576 printf("\n");
6577 }
6578 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006580
Daniel Veillard42595322004-11-08 10:52:06 +00006581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006582}
6583
6584
6585static int
6586test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006588
Daniel Veillard3d97e662004-11-04 10:49:00 +00006589 int mem_base;
6590 int ret_val;
6591 unsigned int ch; /* character to validate */
6592 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006593
Daniel Veillard3d97e662004-11-04 10:49:00 +00006594 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6595 mem_base = xmlMemBlocks();
6596 ch = gen_unsigned_int(n_ch, 0);
6597
6598 ret_val = xmlIsDigit(ch);
6599 desret_int(ret_val);
6600 call_tests++;
6601 des_unsigned_int(n_ch, ch, 0);
6602 xmlResetLastError();
6603 if (mem_base != xmlMemBlocks()) {
6604 printf("Leak of %d blocks found in xmlIsDigit",
6605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006606 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006607 printf(" %d", n_ch);
6608 printf("\n");
6609 }
6610 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006612
Daniel Veillard42595322004-11-08 10:52:06 +00006613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006614}
6615
6616
6617static int
6618test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006620
Daniel Veillard3d97e662004-11-04 10:49:00 +00006621 int mem_base;
6622 int ret_val;
6623 unsigned int ch; /* character to validate */
6624 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006625
Daniel Veillard3d97e662004-11-04 10:49:00 +00006626 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6627 mem_base = xmlMemBlocks();
6628 ch = gen_unsigned_int(n_ch, 0);
6629
6630 ret_val = xmlIsExtender(ch);
6631 desret_int(ret_val);
6632 call_tests++;
6633 des_unsigned_int(n_ch, ch, 0);
6634 xmlResetLastError();
6635 if (mem_base != xmlMemBlocks()) {
6636 printf("Leak of %d blocks found in xmlIsExtender",
6637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006638 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006639 printf(" %d", n_ch);
6640 printf("\n");
6641 }
6642 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006644
Daniel Veillard42595322004-11-08 10:52:06 +00006645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006646}
6647
6648
6649static int
6650test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006652
Daniel Veillard3d97e662004-11-04 10:49:00 +00006653 int mem_base;
6654 int ret_val;
6655 unsigned int ch; /* character to validate */
6656 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006657
Daniel Veillard3d97e662004-11-04 10:49:00 +00006658 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6659 mem_base = xmlMemBlocks();
6660 ch = gen_unsigned_int(n_ch, 0);
6661
6662 ret_val = xmlIsIdeographic(ch);
6663 desret_int(ret_val);
6664 call_tests++;
6665 des_unsigned_int(n_ch, ch, 0);
6666 xmlResetLastError();
6667 if (mem_base != xmlMemBlocks()) {
6668 printf("Leak of %d blocks found in xmlIsIdeographic",
6669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006670 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006671 printf(" %d", n_ch);
6672 printf("\n");
6673 }
6674 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006676
Daniel Veillard42595322004-11-08 10:52:06 +00006677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006678}
6679
6680
6681static int
6682test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006684
Daniel Veillard3d97e662004-11-04 10:49:00 +00006685 int mem_base;
6686 int ret_val;
6687 unsigned int ch; /* character to validate */
6688 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006689
Daniel Veillard3d97e662004-11-04 10:49:00 +00006690 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6691 mem_base = xmlMemBlocks();
6692 ch = gen_unsigned_int(n_ch, 0);
6693
6694 ret_val = xmlIsPubidChar(ch);
6695 desret_int(ret_val);
6696 call_tests++;
6697 des_unsigned_int(n_ch, ch, 0);
6698 xmlResetLastError();
6699 if (mem_base != xmlMemBlocks()) {
6700 printf("Leak of %d blocks found in xmlIsPubidChar",
6701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006702 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006703 printf(" %d", n_ch);
6704 printf("\n");
6705 }
6706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006708
Daniel Veillard42595322004-11-08 10:52:06 +00006709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006710}
6711
6712static int
6713test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006715
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006716 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006717 test_ret += test_xmlCharInRange();
6718 test_ret += test_xmlIsBaseChar();
6719 test_ret += test_xmlIsBlank();
6720 test_ret += test_xmlIsChar();
6721 test_ret += test_xmlIsCombining();
6722 test_ret += test_xmlIsDigit();
6723 test_ret += test_xmlIsExtender();
6724 test_ret += test_xmlIsIdeographic();
6725 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006726
Daniel Veillard42595322004-11-08 10:52:06 +00006727 if (test_ret != 0)
6728 printf("Module chvalid: %d errors\n", test_ret);
6729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006730}
6731
6732static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006733test_xmlBoolToText(void) {
6734 int test_ret = 0;
6735
William M. Brack21e4ef22005-01-02 09:53:13 +00006736#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006737 int mem_base;
6738 const char * ret_val;
6739 int boolval; /* a bool to turn into text */
6740 int n_boolval;
6741
6742 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6743 mem_base = xmlMemBlocks();
6744 boolval = gen_int(n_boolval, 0);
6745
6746 ret_val = xmlBoolToText(boolval);
6747 desret_const_char_ptr(ret_val);
6748 call_tests++;
6749 des_int(n_boolval, boolval, 0);
6750 xmlResetLastError();
6751 if (mem_base != xmlMemBlocks()) {
6752 printf("Leak of %d blocks found in xmlBoolToText",
6753 xmlMemBlocks() - mem_base);
6754 test_ret++;
6755 printf(" %d", n_boolval);
6756 printf("\n");
6757 }
6758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006759 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006760#endif
6761
Daniel Veillarda82b1822004-11-08 16:24:57 +00006762 return(test_ret);
6763}
6764
6765
6766static int
6767test_xmlDebugCheckDocument(void) {
6768 int test_ret = 0;
6769
William M. Brack21e4ef22005-01-02 09:53:13 +00006770#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006771 int mem_base;
6772 int ret_val;
6773 FILE * output; /* the FILE * for the output */
6774 int n_output;
6775 xmlDocPtr doc; /* the document */
6776 int n_doc;
6777
6778 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6779 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6780 mem_base = xmlMemBlocks();
6781 output = gen_debug_FILE_ptr(n_output, 0);
6782 doc = gen_xmlDocPtr(n_doc, 1);
6783
6784 ret_val = xmlDebugCheckDocument(output, doc);
6785 desret_int(ret_val);
6786 call_tests++;
6787 des_debug_FILE_ptr(n_output, output, 0);
6788 des_xmlDocPtr(n_doc, doc, 1);
6789 xmlResetLastError();
6790 if (mem_base != xmlMemBlocks()) {
6791 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6792 xmlMemBlocks() - mem_base);
6793 test_ret++;
6794 printf(" %d", n_output);
6795 printf(" %d", n_doc);
6796 printf("\n");
6797 }
6798 }
6799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006800 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006801#endif
6802
Daniel Veillarda82b1822004-11-08 16:24:57 +00006803 return(test_ret);
6804}
6805
6806
6807static int
6808test_xmlDebugDumpAttr(void) {
6809 int test_ret = 0;
6810
William M. Brack21e4ef22005-01-02 09:53:13 +00006811#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006812 int mem_base;
6813 FILE * output; /* the FILE * for the output */
6814 int n_output;
6815 xmlAttrPtr attr; /* the attribute */
6816 int n_attr;
6817 int depth; /* the indentation level. */
6818 int n_depth;
6819
6820 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6821 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6822 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6823 mem_base = xmlMemBlocks();
6824 output = gen_debug_FILE_ptr(n_output, 0);
6825 attr = gen_xmlAttrPtr(n_attr, 1);
6826 depth = gen_int(n_depth, 2);
6827
6828 xmlDebugDumpAttr(output, attr, depth);
6829 call_tests++;
6830 des_debug_FILE_ptr(n_output, output, 0);
6831 des_xmlAttrPtr(n_attr, attr, 1);
6832 des_int(n_depth, depth, 2);
6833 xmlResetLastError();
6834 if (mem_base != xmlMemBlocks()) {
6835 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6836 xmlMemBlocks() - mem_base);
6837 test_ret++;
6838 printf(" %d", n_output);
6839 printf(" %d", n_attr);
6840 printf(" %d", n_depth);
6841 printf("\n");
6842 }
6843 }
6844 }
6845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006846 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006847#endif
6848
Daniel Veillarda82b1822004-11-08 16:24:57 +00006849 return(test_ret);
6850}
6851
6852
6853static int
6854test_xmlDebugDumpAttrList(void) {
6855 int test_ret = 0;
6856
William M. Brack21e4ef22005-01-02 09:53:13 +00006857#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006858 int mem_base;
6859 FILE * output; /* the FILE * for the output */
6860 int n_output;
6861 xmlAttrPtr attr; /* the attribute list */
6862 int n_attr;
6863 int depth; /* the indentation level. */
6864 int n_depth;
6865
6866 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6867 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6868 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6869 mem_base = xmlMemBlocks();
6870 output = gen_debug_FILE_ptr(n_output, 0);
6871 attr = gen_xmlAttrPtr(n_attr, 1);
6872 depth = gen_int(n_depth, 2);
6873
6874 xmlDebugDumpAttrList(output, attr, depth);
6875 call_tests++;
6876 des_debug_FILE_ptr(n_output, output, 0);
6877 des_xmlAttrPtr(n_attr, attr, 1);
6878 des_int(n_depth, depth, 2);
6879 xmlResetLastError();
6880 if (mem_base != xmlMemBlocks()) {
6881 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6882 xmlMemBlocks() - mem_base);
6883 test_ret++;
6884 printf(" %d", n_output);
6885 printf(" %d", n_attr);
6886 printf(" %d", n_depth);
6887 printf("\n");
6888 }
6889 }
6890 }
6891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006892 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006893#endif
6894
Daniel Veillarda82b1822004-11-08 16:24:57 +00006895 return(test_ret);
6896}
6897
6898
6899static int
6900test_xmlDebugDumpDTD(void) {
6901 int test_ret = 0;
6902
William M. Brack21e4ef22005-01-02 09:53:13 +00006903#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006904 int mem_base;
6905 FILE * output; /* the FILE * for the output */
6906 int n_output;
6907 xmlDtdPtr dtd; /* the DTD */
6908 int n_dtd;
6909
6910 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6911 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6912 mem_base = xmlMemBlocks();
6913 output = gen_debug_FILE_ptr(n_output, 0);
6914 dtd = gen_xmlDtdPtr(n_dtd, 1);
6915
6916 xmlDebugDumpDTD(output, dtd);
6917 call_tests++;
6918 des_debug_FILE_ptr(n_output, output, 0);
6919 des_xmlDtdPtr(n_dtd, dtd, 1);
6920 xmlResetLastError();
6921 if (mem_base != xmlMemBlocks()) {
6922 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6923 xmlMemBlocks() - mem_base);
6924 test_ret++;
6925 printf(" %d", n_output);
6926 printf(" %d", n_dtd);
6927 printf("\n");
6928 }
6929 }
6930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006931 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006932#endif
6933
Daniel Veillarda82b1822004-11-08 16:24:57 +00006934 return(test_ret);
6935}
6936
6937
6938static int
6939test_xmlDebugDumpDocument(void) {
6940 int test_ret = 0;
6941
William M. Brack21e4ef22005-01-02 09:53:13 +00006942#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006943 int mem_base;
6944 FILE * output; /* the FILE * for the output */
6945 int n_output;
6946 xmlDocPtr doc; /* the document */
6947 int n_doc;
6948
6949 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6950 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6951 mem_base = xmlMemBlocks();
6952 output = gen_debug_FILE_ptr(n_output, 0);
6953 doc = gen_xmlDocPtr(n_doc, 1);
6954
6955 xmlDebugDumpDocument(output, doc);
6956 call_tests++;
6957 des_debug_FILE_ptr(n_output, output, 0);
6958 des_xmlDocPtr(n_doc, doc, 1);
6959 xmlResetLastError();
6960 if (mem_base != xmlMemBlocks()) {
6961 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6962 xmlMemBlocks() - mem_base);
6963 test_ret++;
6964 printf(" %d", n_output);
6965 printf(" %d", n_doc);
6966 printf("\n");
6967 }
6968 }
6969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006970 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006971#endif
6972
Daniel Veillarda82b1822004-11-08 16:24:57 +00006973 return(test_ret);
6974}
6975
6976
6977static int
6978test_xmlDebugDumpDocumentHead(void) {
6979 int test_ret = 0;
6980
William M. Brack21e4ef22005-01-02 09:53:13 +00006981#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006982 int mem_base;
6983 FILE * output; /* the FILE * for the output */
6984 int n_output;
6985 xmlDocPtr doc; /* the document */
6986 int n_doc;
6987
6988 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6989 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6990 mem_base = xmlMemBlocks();
6991 output = gen_debug_FILE_ptr(n_output, 0);
6992 doc = gen_xmlDocPtr(n_doc, 1);
6993
6994 xmlDebugDumpDocumentHead(output, doc);
6995 call_tests++;
6996 des_debug_FILE_ptr(n_output, output, 0);
6997 des_xmlDocPtr(n_doc, doc, 1);
6998 xmlResetLastError();
6999 if (mem_base != xmlMemBlocks()) {
7000 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7001 xmlMemBlocks() - mem_base);
7002 test_ret++;
7003 printf(" %d", n_output);
7004 printf(" %d", n_doc);
7005 printf("\n");
7006 }
7007 }
7008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007009 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007010#endif
7011
Daniel Veillarda82b1822004-11-08 16:24:57 +00007012 return(test_ret);
7013}
7014
7015
7016static int
7017test_xmlDebugDumpEntities(void) {
7018 int test_ret = 0;
7019
William M. Brack21e4ef22005-01-02 09:53:13 +00007020#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007021 int mem_base;
7022 FILE * output; /* the FILE * for the output */
7023 int n_output;
7024 xmlDocPtr doc; /* the document */
7025 int n_doc;
7026
7027 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7028 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7029 mem_base = xmlMemBlocks();
7030 output = gen_debug_FILE_ptr(n_output, 0);
7031 doc = gen_xmlDocPtr(n_doc, 1);
7032
7033 xmlDebugDumpEntities(output, doc);
7034 call_tests++;
7035 des_debug_FILE_ptr(n_output, output, 0);
7036 des_xmlDocPtr(n_doc, doc, 1);
7037 xmlResetLastError();
7038 if (mem_base != xmlMemBlocks()) {
7039 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7040 xmlMemBlocks() - mem_base);
7041 test_ret++;
7042 printf(" %d", n_output);
7043 printf(" %d", n_doc);
7044 printf("\n");
7045 }
7046 }
7047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007049#endif
7050
Daniel Veillarda82b1822004-11-08 16:24:57 +00007051 return(test_ret);
7052}
7053
7054
7055static int
7056test_xmlDebugDumpNode(void) {
7057 int test_ret = 0;
7058
William M. Brack21e4ef22005-01-02 09:53:13 +00007059#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007060 int mem_base;
7061 FILE * output; /* the FILE * for the output */
7062 int n_output;
7063 xmlNodePtr node; /* the node */
7064 int n_node;
7065 int depth; /* the indentation level. */
7066 int n_depth;
7067
7068 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7069 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7070 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7071 mem_base = xmlMemBlocks();
7072 output = gen_debug_FILE_ptr(n_output, 0);
7073 node = gen_xmlNodePtr(n_node, 1);
7074 depth = gen_int(n_depth, 2);
7075
7076 xmlDebugDumpNode(output, node, depth);
7077 call_tests++;
7078 des_debug_FILE_ptr(n_output, output, 0);
7079 des_xmlNodePtr(n_node, node, 1);
7080 des_int(n_depth, depth, 2);
7081 xmlResetLastError();
7082 if (mem_base != xmlMemBlocks()) {
7083 printf("Leak of %d blocks found in xmlDebugDumpNode",
7084 xmlMemBlocks() - mem_base);
7085 test_ret++;
7086 printf(" %d", n_output);
7087 printf(" %d", n_node);
7088 printf(" %d", n_depth);
7089 printf("\n");
7090 }
7091 }
7092 }
7093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007095#endif
7096
Daniel Veillarda82b1822004-11-08 16:24:57 +00007097 return(test_ret);
7098}
7099
7100
7101static int
7102test_xmlDebugDumpNodeList(void) {
7103 int test_ret = 0;
7104
William M. Brack21e4ef22005-01-02 09:53:13 +00007105#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007106 int mem_base;
7107 FILE * output; /* the FILE * for the output */
7108 int n_output;
7109 xmlNodePtr node; /* the node list */
7110 int n_node;
7111 int depth; /* the indentation level. */
7112 int n_depth;
7113
7114 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7115 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7116 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7117 mem_base = xmlMemBlocks();
7118 output = gen_debug_FILE_ptr(n_output, 0);
7119 node = gen_xmlNodePtr(n_node, 1);
7120 depth = gen_int(n_depth, 2);
7121
7122 xmlDebugDumpNodeList(output, node, depth);
7123 call_tests++;
7124 des_debug_FILE_ptr(n_output, output, 0);
7125 des_xmlNodePtr(n_node, node, 1);
7126 des_int(n_depth, depth, 2);
7127 xmlResetLastError();
7128 if (mem_base != xmlMemBlocks()) {
7129 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7130 xmlMemBlocks() - mem_base);
7131 test_ret++;
7132 printf(" %d", n_output);
7133 printf(" %d", n_node);
7134 printf(" %d", n_depth);
7135 printf("\n");
7136 }
7137 }
7138 }
7139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007140 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007141#endif
7142
Daniel Veillarda82b1822004-11-08 16:24:57 +00007143 return(test_ret);
7144}
7145
7146
7147static int
7148test_xmlDebugDumpOneNode(void) {
7149 int test_ret = 0;
7150
William M. Brack21e4ef22005-01-02 09:53:13 +00007151#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007152 int mem_base;
7153 FILE * output; /* the FILE * for the output */
7154 int n_output;
7155 xmlNodePtr node; /* the node */
7156 int n_node;
7157 int depth; /* the indentation level. */
7158 int n_depth;
7159
7160 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7161 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7162 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7163 mem_base = xmlMemBlocks();
7164 output = gen_debug_FILE_ptr(n_output, 0);
7165 node = gen_xmlNodePtr(n_node, 1);
7166 depth = gen_int(n_depth, 2);
7167
7168 xmlDebugDumpOneNode(output, node, depth);
7169 call_tests++;
7170 des_debug_FILE_ptr(n_output, output, 0);
7171 des_xmlNodePtr(n_node, node, 1);
7172 des_int(n_depth, depth, 2);
7173 xmlResetLastError();
7174 if (mem_base != xmlMemBlocks()) {
7175 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7176 xmlMemBlocks() - mem_base);
7177 test_ret++;
7178 printf(" %d", n_output);
7179 printf(" %d", n_node);
7180 printf(" %d", n_depth);
7181 printf("\n");
7182 }
7183 }
7184 }
7185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007186 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007187#endif
7188
Daniel Veillarda82b1822004-11-08 16:24:57 +00007189 return(test_ret);
7190}
7191
7192
7193static int
7194test_xmlDebugDumpString(void) {
7195 int test_ret = 0;
7196
William M. Brack21e4ef22005-01-02 09:53:13 +00007197#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007198 int mem_base;
7199 FILE * output; /* the FILE * for the output */
7200 int n_output;
7201 xmlChar * str; /* the string */
7202 int n_str;
7203
7204 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7205 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7206 mem_base = xmlMemBlocks();
7207 output = gen_debug_FILE_ptr(n_output, 0);
7208 str = gen_const_xmlChar_ptr(n_str, 1);
7209
William M. Brackf13f77f2004-11-12 16:03:48 +00007210 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007211 call_tests++;
7212 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007213 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007214 xmlResetLastError();
7215 if (mem_base != xmlMemBlocks()) {
7216 printf("Leak of %d blocks found in xmlDebugDumpString",
7217 xmlMemBlocks() - mem_base);
7218 test_ret++;
7219 printf(" %d", n_output);
7220 printf(" %d", n_str);
7221 printf("\n");
7222 }
7223 }
7224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007225 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007226#endif
7227
Daniel Veillarda82b1822004-11-08 16:24:57 +00007228 return(test_ret);
7229}
7230
7231
7232static int
7233test_xmlLsCountNode(void) {
7234 int test_ret = 0;
7235
William M. Brack21e4ef22005-01-02 09:53:13 +00007236#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007237 int mem_base;
7238 int ret_val;
7239 xmlNodePtr node; /* the node to count */
7240 int n_node;
7241
7242 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7243 mem_base = xmlMemBlocks();
7244 node = gen_xmlNodePtr(n_node, 0);
7245
7246 ret_val = xmlLsCountNode(node);
7247 desret_int(ret_val);
7248 call_tests++;
7249 des_xmlNodePtr(n_node, node, 0);
7250 xmlResetLastError();
7251 if (mem_base != xmlMemBlocks()) {
7252 printf("Leak of %d blocks found in xmlLsCountNode",
7253 xmlMemBlocks() - mem_base);
7254 test_ret++;
7255 printf(" %d", n_node);
7256 printf("\n");
7257 }
7258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007259 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007260#endif
7261
Daniel Veillarda82b1822004-11-08 16:24:57 +00007262 return(test_ret);
7263}
7264
7265
7266static int
7267test_xmlLsOneNode(void) {
7268 int test_ret = 0;
7269
William M. Brack21e4ef22005-01-02 09:53:13 +00007270#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007271 int mem_base;
7272 FILE * output; /* the FILE * for the output */
7273 int n_output;
7274 xmlNodePtr node; /* the node to dump */
7275 int n_node;
7276
7277 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7278 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7279 mem_base = xmlMemBlocks();
7280 output = gen_debug_FILE_ptr(n_output, 0);
7281 node = gen_xmlNodePtr(n_node, 1);
7282
7283 xmlLsOneNode(output, node);
7284 call_tests++;
7285 des_debug_FILE_ptr(n_output, output, 0);
7286 des_xmlNodePtr(n_node, node, 1);
7287 xmlResetLastError();
7288 if (mem_base != xmlMemBlocks()) {
7289 printf("Leak of %d blocks found in xmlLsOneNode",
7290 xmlMemBlocks() - mem_base);
7291 test_ret++;
7292 printf(" %d", n_output);
7293 printf(" %d", n_node);
7294 printf("\n");
7295 }
7296 }
7297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007298 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007299#endif
7300
Daniel Veillarda82b1822004-11-08 16:24:57 +00007301 return(test_ret);
7302}
7303
7304
7305#define gen_nb_char_ptr 1
7306static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7307 return(NULL);
7308}
7309static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7310}
7311
7312static int
7313test_xmlShell(void) {
7314 int test_ret = 0;
7315
7316
7317 /* missing type support */
7318 return(test_ret);
7319}
7320
7321
Daniel Veillarda82b1822004-11-08 16:24:57 +00007322static int
7323test_xmlShellBase(void) {
7324 int test_ret = 0;
7325
William M. Brack21e4ef22005-01-02 09:53:13 +00007326#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007327 int mem_base;
7328 int ret_val;
7329 xmlShellCtxtPtr ctxt; /* the shell context */
7330 int n_ctxt;
7331 char * arg; /* unused */
7332 int n_arg;
7333 xmlNodePtr node; /* a node */
7334 int n_node;
7335 xmlNodePtr node2; /* unused */
7336 int n_node2;
7337
7338 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7339 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7340 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7341 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7342 mem_base = xmlMemBlocks();
7343 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7344 arg = gen_char_ptr(n_arg, 1);
7345 node = gen_xmlNodePtr(n_node, 2);
7346 node2 = gen_xmlNodePtr(n_node2, 3);
7347
7348 ret_val = xmlShellBase(ctxt, arg, node, node2);
7349 desret_int(ret_val);
7350 call_tests++;
7351 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7352 des_char_ptr(n_arg, arg, 1);
7353 des_xmlNodePtr(n_node, node, 2);
7354 des_xmlNodePtr(n_node2, node2, 3);
7355 xmlResetLastError();
7356 if (mem_base != xmlMemBlocks()) {
7357 printf("Leak of %d blocks found in xmlShellBase",
7358 xmlMemBlocks() - mem_base);
7359 test_ret++;
7360 printf(" %d", n_ctxt);
7361 printf(" %d", n_arg);
7362 printf(" %d", n_node);
7363 printf(" %d", n_node2);
7364 printf("\n");
7365 }
7366 }
7367 }
7368 }
7369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007370 function_tests++;
7371#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007372
Daniel Veillarda82b1822004-11-08 16:24:57 +00007373 return(test_ret);
7374}
7375
7376
7377static int
7378test_xmlShellCat(void) {
7379 int test_ret = 0;
7380
William M. Brack21e4ef22005-01-02 09:53:13 +00007381#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007382 int mem_base;
7383 int ret_val;
7384 xmlShellCtxtPtr ctxt; /* the shell context */
7385 int n_ctxt;
7386 char * arg; /* unused */
7387 int n_arg;
7388 xmlNodePtr node; /* a node */
7389 int n_node;
7390 xmlNodePtr node2; /* unused */
7391 int n_node2;
7392
7393 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7394 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7395 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7396 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7397 mem_base = xmlMemBlocks();
7398 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7399 arg = gen_char_ptr(n_arg, 1);
7400 node = gen_xmlNodePtr(n_node, 2);
7401 node2 = gen_xmlNodePtr(n_node2, 3);
7402
7403 ret_val = xmlShellCat(ctxt, arg, node, node2);
7404 desret_int(ret_val);
7405 call_tests++;
7406 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7407 des_char_ptr(n_arg, arg, 1);
7408 des_xmlNodePtr(n_node, node, 2);
7409 des_xmlNodePtr(n_node2, node2, 3);
7410 xmlResetLastError();
7411 if (mem_base != xmlMemBlocks()) {
7412 printf("Leak of %d blocks found in xmlShellCat",
7413 xmlMemBlocks() - mem_base);
7414 test_ret++;
7415 printf(" %d", n_ctxt);
7416 printf(" %d", n_arg);
7417 printf(" %d", n_node);
7418 printf(" %d", n_node2);
7419 printf("\n");
7420 }
7421 }
7422 }
7423 }
7424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007425 function_tests++;
7426#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007427
Daniel Veillarda82b1822004-11-08 16:24:57 +00007428 return(test_ret);
7429}
7430
7431
7432static int
7433test_xmlShellDir(void) {
7434 int test_ret = 0;
7435
William M. Brack21e4ef22005-01-02 09:53:13 +00007436#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007437 int mem_base;
7438 int ret_val;
7439 xmlShellCtxtPtr ctxt; /* the shell context */
7440 int n_ctxt;
7441 char * arg; /* unused */
7442 int n_arg;
7443 xmlNodePtr node; /* a node */
7444 int n_node;
7445 xmlNodePtr node2; /* unused */
7446 int n_node2;
7447
7448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7449 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7450 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7451 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7452 mem_base = xmlMemBlocks();
7453 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7454 arg = gen_char_ptr(n_arg, 1);
7455 node = gen_xmlNodePtr(n_node, 2);
7456 node2 = gen_xmlNodePtr(n_node2, 3);
7457
7458 ret_val = xmlShellDir(ctxt, arg, node, node2);
7459 desret_int(ret_val);
7460 call_tests++;
7461 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7462 des_char_ptr(n_arg, arg, 1);
7463 des_xmlNodePtr(n_node, node, 2);
7464 des_xmlNodePtr(n_node2, node2, 3);
7465 xmlResetLastError();
7466 if (mem_base != xmlMemBlocks()) {
7467 printf("Leak of %d blocks found in xmlShellDir",
7468 xmlMemBlocks() - mem_base);
7469 test_ret++;
7470 printf(" %d", n_ctxt);
7471 printf(" %d", n_arg);
7472 printf(" %d", n_node);
7473 printf(" %d", n_node2);
7474 printf("\n");
7475 }
7476 }
7477 }
7478 }
7479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007480 function_tests++;
7481#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007482
Daniel Veillarda82b1822004-11-08 16:24:57 +00007483 return(test_ret);
7484}
7485
7486
7487static int
7488test_xmlShellDu(void) {
7489 int test_ret = 0;
7490
William M. Brack21e4ef22005-01-02 09:53:13 +00007491#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007492 int mem_base;
7493 int ret_val;
7494 xmlShellCtxtPtr ctxt; /* the shell context */
7495 int n_ctxt;
7496 char * arg; /* unused */
7497 int n_arg;
7498 xmlNodePtr tree; /* a node defining a subtree */
7499 int n_tree;
7500 xmlNodePtr node2; /* unused */
7501 int n_node2;
7502
7503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7504 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7505 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7506 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7507 mem_base = xmlMemBlocks();
7508 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7509 arg = gen_char_ptr(n_arg, 1);
7510 tree = gen_xmlNodePtr(n_tree, 2);
7511 node2 = gen_xmlNodePtr(n_node2, 3);
7512
7513 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7514 desret_int(ret_val);
7515 call_tests++;
7516 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7517 des_char_ptr(n_arg, arg, 1);
7518 des_xmlNodePtr(n_tree, tree, 2);
7519 des_xmlNodePtr(n_node2, node2, 3);
7520 xmlResetLastError();
7521 if (mem_base != xmlMemBlocks()) {
7522 printf("Leak of %d blocks found in xmlShellDu",
7523 xmlMemBlocks() - mem_base);
7524 test_ret++;
7525 printf(" %d", n_ctxt);
7526 printf(" %d", n_arg);
7527 printf(" %d", n_tree);
7528 printf(" %d", n_node2);
7529 printf("\n");
7530 }
7531 }
7532 }
7533 }
7534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007535 function_tests++;
7536#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007537
Daniel Veillarda82b1822004-11-08 16:24:57 +00007538 return(test_ret);
7539}
7540
7541
7542static int
7543test_xmlShellList(void) {
7544 int test_ret = 0;
7545
William M. Brack21e4ef22005-01-02 09:53:13 +00007546#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007547 int mem_base;
7548 int ret_val;
7549 xmlShellCtxtPtr ctxt; /* the shell context */
7550 int n_ctxt;
7551 char * arg; /* unused */
7552 int n_arg;
7553 xmlNodePtr node; /* a node */
7554 int n_node;
7555 xmlNodePtr node2; /* unused */
7556 int n_node2;
7557
7558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7559 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7560 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7561 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7562 mem_base = xmlMemBlocks();
7563 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7564 arg = gen_char_ptr(n_arg, 1);
7565 node = gen_xmlNodePtr(n_node, 2);
7566 node2 = gen_xmlNodePtr(n_node2, 3);
7567
7568 ret_val = xmlShellList(ctxt, arg, node, node2);
7569 desret_int(ret_val);
7570 call_tests++;
7571 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7572 des_char_ptr(n_arg, arg, 1);
7573 des_xmlNodePtr(n_node, node, 2);
7574 des_xmlNodePtr(n_node2, node2, 3);
7575 xmlResetLastError();
7576 if (mem_base != xmlMemBlocks()) {
7577 printf("Leak of %d blocks found in xmlShellList",
7578 xmlMemBlocks() - mem_base);
7579 test_ret++;
7580 printf(" %d", n_ctxt);
7581 printf(" %d", n_arg);
7582 printf(" %d", n_node);
7583 printf(" %d", n_node2);
7584 printf("\n");
7585 }
7586 }
7587 }
7588 }
7589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007590 function_tests++;
7591#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007592
Daniel Veillarda82b1822004-11-08 16:24:57 +00007593 return(test_ret);
7594}
7595
7596
7597static int
7598test_xmlShellLoad(void) {
7599 int test_ret = 0;
7600
William M. Brack21e4ef22005-01-02 09:53:13 +00007601#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007602 int mem_base;
7603 int ret_val;
7604 xmlShellCtxtPtr ctxt; /* the shell context */
7605 int n_ctxt;
7606 char * filename; /* the file name */
7607 int n_filename;
7608 xmlNodePtr node; /* unused */
7609 int n_node;
7610 xmlNodePtr node2; /* unused */
7611 int n_node2;
7612
7613 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7614 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7615 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7616 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7617 mem_base = xmlMemBlocks();
7618 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7619 filename = gen_char_ptr(n_filename, 1);
7620 node = gen_xmlNodePtr(n_node, 2);
7621 node2 = gen_xmlNodePtr(n_node2, 3);
7622
7623 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7624 desret_int(ret_val);
7625 call_tests++;
7626 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7627 des_char_ptr(n_filename, filename, 1);
7628 des_xmlNodePtr(n_node, node, 2);
7629 des_xmlNodePtr(n_node2, node2, 3);
7630 xmlResetLastError();
7631 if (mem_base != xmlMemBlocks()) {
7632 printf("Leak of %d blocks found in xmlShellLoad",
7633 xmlMemBlocks() - mem_base);
7634 test_ret++;
7635 printf(" %d", n_ctxt);
7636 printf(" %d", n_filename);
7637 printf(" %d", n_node);
7638 printf(" %d", n_node2);
7639 printf("\n");
7640 }
7641 }
7642 }
7643 }
7644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007645 function_tests++;
7646#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007647
Daniel Veillarda82b1822004-11-08 16:24:57 +00007648 return(test_ret);
7649}
7650
7651
7652static int
7653test_xmlShellPrintXPathResult(void) {
7654 int test_ret = 0;
7655
William M. Brack21e4ef22005-01-02 09:53:13 +00007656#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007657 int mem_base;
7658 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7659 int n_list;
7660
7661 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7662 mem_base = xmlMemBlocks();
7663 list = gen_xmlXPathObjectPtr(n_list, 0);
7664
7665 xmlShellPrintXPathResult(list);
7666 call_tests++;
7667 des_xmlXPathObjectPtr(n_list, list, 0);
7668 xmlResetLastError();
7669 if (mem_base != xmlMemBlocks()) {
7670 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7671 xmlMemBlocks() - mem_base);
7672 test_ret++;
7673 printf(" %d", n_list);
7674 printf("\n");
7675 }
7676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007677 function_tests++;
7678#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007679
Daniel Veillarda82b1822004-11-08 16:24:57 +00007680 return(test_ret);
7681}
7682
7683
7684static int
7685test_xmlShellPwd(void) {
7686 int test_ret = 0;
7687
William M. Brack21e4ef22005-01-02 09:53:13 +00007688#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007689 int mem_base;
7690 int ret_val;
7691 xmlShellCtxtPtr ctxt; /* the shell context */
7692 int n_ctxt;
7693 char * buffer; /* the output buffer */
7694 int n_buffer;
7695 xmlNodePtr node; /* a node */
7696 int n_node;
7697 xmlNodePtr node2; /* unused */
7698 int n_node2;
7699
7700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7701 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7702 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7703 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7704 mem_base = xmlMemBlocks();
7705 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7706 buffer = gen_char_ptr(n_buffer, 1);
7707 node = gen_xmlNodePtr(n_node, 2);
7708 node2 = gen_xmlNodePtr(n_node2, 3);
7709
7710 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7711 desret_int(ret_val);
7712 call_tests++;
7713 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7714 des_char_ptr(n_buffer, buffer, 1);
7715 des_xmlNodePtr(n_node, node, 2);
7716 des_xmlNodePtr(n_node2, node2, 3);
7717 xmlResetLastError();
7718 if (mem_base != xmlMemBlocks()) {
7719 printf("Leak of %d blocks found in xmlShellPwd",
7720 xmlMemBlocks() - mem_base);
7721 test_ret++;
7722 printf(" %d", n_ctxt);
7723 printf(" %d", n_buffer);
7724 printf(" %d", n_node);
7725 printf(" %d", n_node2);
7726 printf("\n");
7727 }
7728 }
7729 }
7730 }
7731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007732 function_tests++;
7733#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007734
Daniel Veillarda82b1822004-11-08 16:24:57 +00007735 return(test_ret);
7736}
7737
7738
7739static int
7740test_xmlShellSave(void) {
7741 int test_ret = 0;
7742
William M. Brack21e4ef22005-01-02 09:53:13 +00007743#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007744 int mem_base;
7745 int ret_val;
7746 xmlShellCtxtPtr ctxt; /* the shell context */
7747 int n_ctxt;
7748 char * filename; /* the file name (optional) */
7749 int n_filename;
7750 xmlNodePtr node; /* unused */
7751 int n_node;
7752 xmlNodePtr node2; /* unused */
7753 int n_node2;
7754
7755 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7756 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7757 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7758 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7759 mem_base = xmlMemBlocks();
7760 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7761 filename = gen_char_ptr(n_filename, 1);
7762 node = gen_xmlNodePtr(n_node, 2);
7763 node2 = gen_xmlNodePtr(n_node2, 3);
7764
7765 ret_val = xmlShellSave(ctxt, filename, node, node2);
7766 desret_int(ret_val);
7767 call_tests++;
7768 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7769 des_char_ptr(n_filename, filename, 1);
7770 des_xmlNodePtr(n_node, node, 2);
7771 des_xmlNodePtr(n_node2, node2, 3);
7772 xmlResetLastError();
7773 if (mem_base != xmlMemBlocks()) {
7774 printf("Leak of %d blocks found in xmlShellSave",
7775 xmlMemBlocks() - mem_base);
7776 test_ret++;
7777 printf(" %d", n_ctxt);
7778 printf(" %d", n_filename);
7779 printf(" %d", n_node);
7780 printf(" %d", n_node2);
7781 printf("\n");
7782 }
7783 }
7784 }
7785 }
7786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007787 function_tests++;
7788#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007789
Daniel Veillarda82b1822004-11-08 16:24:57 +00007790 return(test_ret);
7791}
7792
7793
7794static int
7795test_xmlShellValidate(void) {
7796 int test_ret = 0;
7797
William M. Brack21e4ef22005-01-02 09:53:13 +00007798#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007799 int mem_base;
7800 int ret_val;
7801 xmlShellCtxtPtr ctxt; /* the shell context */
7802 int n_ctxt;
7803 char * dtd; /* the DTD URI (optional) */
7804 int n_dtd;
7805 xmlNodePtr node; /* unused */
7806 int n_node;
7807 xmlNodePtr node2; /* unused */
7808 int n_node2;
7809
7810 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7811 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7812 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7813 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7814 mem_base = xmlMemBlocks();
7815 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7816 dtd = gen_char_ptr(n_dtd, 1);
7817 node = gen_xmlNodePtr(n_node, 2);
7818 node2 = gen_xmlNodePtr(n_node2, 3);
7819
7820 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7821 desret_int(ret_val);
7822 call_tests++;
7823 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7824 des_char_ptr(n_dtd, dtd, 1);
7825 des_xmlNodePtr(n_node, node, 2);
7826 des_xmlNodePtr(n_node2, node2, 3);
7827 xmlResetLastError();
7828 if (mem_base != xmlMemBlocks()) {
7829 printf("Leak of %d blocks found in xmlShellValidate",
7830 xmlMemBlocks() - mem_base);
7831 test_ret++;
7832 printf(" %d", n_ctxt);
7833 printf(" %d", n_dtd);
7834 printf(" %d", n_node);
7835 printf(" %d", n_node2);
7836 printf("\n");
7837 }
7838 }
7839 }
7840 }
7841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007842 function_tests++;
7843#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007844
Daniel Veillarda82b1822004-11-08 16:24:57 +00007845 return(test_ret);
7846}
7847
7848
7849static int
7850test_xmlShellWrite(void) {
7851 int test_ret = 0;
7852
William M. Brack21e4ef22005-01-02 09:53:13 +00007853#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007854 int mem_base;
7855 int ret_val;
7856 xmlShellCtxtPtr ctxt; /* the shell context */
7857 int n_ctxt;
7858 char * filename; /* the file name */
7859 int n_filename;
7860 xmlNodePtr node; /* a node in the tree */
7861 int n_node;
7862 xmlNodePtr node2; /* unused */
7863 int n_node2;
7864
7865 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7866 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7867 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7868 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7869 mem_base = xmlMemBlocks();
7870 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7871 filename = gen_char_ptr(n_filename, 1);
7872 node = gen_xmlNodePtr(n_node, 2);
7873 node2 = gen_xmlNodePtr(n_node2, 3);
7874
7875 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7876 desret_int(ret_val);
7877 call_tests++;
7878 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7879 des_char_ptr(n_filename, filename, 1);
7880 des_xmlNodePtr(n_node, node, 2);
7881 des_xmlNodePtr(n_node2, node2, 3);
7882 xmlResetLastError();
7883 if (mem_base != xmlMemBlocks()) {
7884 printf("Leak of %d blocks found in xmlShellWrite",
7885 xmlMemBlocks() - mem_base);
7886 test_ret++;
7887 printf(" %d", n_ctxt);
7888 printf(" %d", n_filename);
7889 printf(" %d", n_node);
7890 printf(" %d", n_node2);
7891 printf("\n");
7892 }
7893 }
7894 }
7895 }
7896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007897 function_tests++;
7898#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007899
Daniel Veillarda82b1822004-11-08 16:24:57 +00007900 return(test_ret);
7901}
7902
7903static int
7904test_debugXML(void) {
7905 int test_ret = 0;
7906
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007907 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007908 test_ret += test_xmlBoolToText();
7909 test_ret += test_xmlDebugCheckDocument();
7910 test_ret += test_xmlDebugDumpAttr();
7911 test_ret += test_xmlDebugDumpAttrList();
7912 test_ret += test_xmlDebugDumpDTD();
7913 test_ret += test_xmlDebugDumpDocument();
7914 test_ret += test_xmlDebugDumpDocumentHead();
7915 test_ret += test_xmlDebugDumpEntities();
7916 test_ret += test_xmlDebugDumpNode();
7917 test_ret += test_xmlDebugDumpNodeList();
7918 test_ret += test_xmlDebugDumpOneNode();
7919 test_ret += test_xmlDebugDumpString();
7920 test_ret += test_xmlLsCountNode();
7921 test_ret += test_xmlLsOneNode();
7922 test_ret += test_xmlShell();
7923 test_ret += test_xmlShellBase();
7924 test_ret += test_xmlShellCat();
7925 test_ret += test_xmlShellDir();
7926 test_ret += test_xmlShellDu();
7927 test_ret += test_xmlShellList();
7928 test_ret += test_xmlShellLoad();
7929 test_ret += test_xmlShellPrintXPathResult();
7930 test_ret += test_xmlShellPwd();
7931 test_ret += test_xmlShellSave();
7932 test_ret += test_xmlShellValidate();
7933 test_ret += test_xmlShellWrite();
7934
7935 if (test_ret != 0)
7936 printf("Module debugXML: %d errors\n", test_ret);
7937 return(test_ret);
7938}
7939
7940static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007941test_xmlDictCleanup(void) {
7942 int test_ret = 0;
7943
7944 int mem_base;
7945
7946 mem_base = xmlMemBlocks();
7947
7948 xmlDictCleanup();
7949 call_tests++;
7950 xmlResetLastError();
7951 if (mem_base != xmlMemBlocks()) {
7952 printf("Leak of %d blocks found in xmlDictCleanup",
7953 xmlMemBlocks() - mem_base);
7954 test_ret++;
7955 printf("\n");
7956 }
7957 function_tests++;
7958
7959 return(test_ret);
7960}
7961
7962
7963static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007964test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007966
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007967 int mem_base;
7968 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007969
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007970 mem_base = xmlMemBlocks();
7971
7972 ret_val = xmlDictCreate();
7973 desret_xmlDictPtr(ret_val);
7974 call_tests++;
7975 xmlResetLastError();
7976 if (mem_base != xmlMemBlocks()) {
7977 printf("Leak of %d blocks found in xmlDictCreate",
7978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007979 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007980 printf("\n");
7981 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007982 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007983
Daniel Veillard42595322004-11-08 10:52:06 +00007984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007985}
7986
7987
7988static int
7989test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007991
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007992 int mem_base;
7993 xmlDictPtr ret_val;
7994 xmlDictPtr sub; /* an existing dictionnary */
7995 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007996
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007997 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
7998 mem_base = xmlMemBlocks();
7999 sub = gen_xmlDictPtr(n_sub, 0);
8000
8001 ret_val = xmlDictCreateSub(sub);
8002 desret_xmlDictPtr(ret_val);
8003 call_tests++;
8004 des_xmlDictPtr(n_sub, sub, 0);
8005 xmlResetLastError();
8006 if (mem_base != xmlMemBlocks()) {
8007 printf("Leak of %d blocks found in xmlDictCreateSub",
8008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008009 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008010 printf(" %d", n_sub);
8011 printf("\n");
8012 }
8013 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008015
Daniel Veillard42595322004-11-08 10:52:06 +00008016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008017}
8018
8019
8020static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008021test_xmlDictExists(void) {
8022 int test_ret = 0;
8023
8024 int mem_base;
8025 const xmlChar * ret_val;
8026 xmlDictPtr dict; /* the dictionnary */
8027 int n_dict;
8028 xmlChar * name; /* the name of the userdata */
8029 int n_name;
8030 int len; /* the length of the name, if -1 it is recomputed */
8031 int n_len;
8032
8033 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8034 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8035 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8036 mem_base = xmlMemBlocks();
8037 dict = gen_xmlDictPtr(n_dict, 0);
8038 name = gen_const_xmlChar_ptr(n_name, 1);
8039 len = gen_int(n_len, 2);
8040
8041 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8042 desret_const_xmlChar_ptr(ret_val);
8043 call_tests++;
8044 des_xmlDictPtr(n_dict, dict, 0);
8045 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8046 des_int(n_len, len, 2);
8047 xmlResetLastError();
8048 if (mem_base != xmlMemBlocks()) {
8049 printf("Leak of %d blocks found in xmlDictExists",
8050 xmlMemBlocks() - mem_base);
8051 test_ret++;
8052 printf(" %d", n_dict);
8053 printf(" %d", n_name);
8054 printf(" %d", n_len);
8055 printf("\n");
8056 }
8057 }
8058 }
8059 }
8060 function_tests++;
8061
8062 return(test_ret);
8063}
8064
8065
8066static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008067test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008069
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008070 int mem_base;
8071 const xmlChar * ret_val;
8072 xmlDictPtr dict; /* the dictionnary */
8073 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008074 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008075 int n_name;
8076 int len; /* the length of the name, if -1 it is recomputed */
8077 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008078
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008079 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8080 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8081 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8082 mem_base = xmlMemBlocks();
8083 dict = gen_xmlDictPtr(n_dict, 0);
8084 name = gen_const_xmlChar_ptr(n_name, 1);
8085 len = gen_int(n_len, 2);
8086
William M. Brackf13f77f2004-11-12 16:03:48 +00008087 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008088 desret_const_xmlChar_ptr(ret_val);
8089 call_tests++;
8090 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008091 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008092 des_int(n_len, len, 2);
8093 xmlResetLastError();
8094 if (mem_base != xmlMemBlocks()) {
8095 printf("Leak of %d blocks found in xmlDictLookup",
8096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008097 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008098 printf(" %d", n_dict);
8099 printf(" %d", n_name);
8100 printf(" %d", n_len);
8101 printf("\n");
8102 }
8103 }
8104 }
8105 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008106 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008107
Daniel Veillard42595322004-11-08 10:52:06 +00008108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008109}
8110
8111
8112static int
8113test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008115
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008116 int mem_base;
8117 int ret_val;
8118 xmlDictPtr dict; /* the dictionnary */
8119 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008120 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008121 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008122
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008123 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8124 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8125 mem_base = xmlMemBlocks();
8126 dict = gen_xmlDictPtr(n_dict, 0);
8127 str = gen_const_xmlChar_ptr(n_str, 1);
8128
William M. Brackf13f77f2004-11-12 16:03:48 +00008129 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008130 desret_int(ret_val);
8131 call_tests++;
8132 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008133 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 xmlResetLastError();
8135 if (mem_base != xmlMemBlocks()) {
8136 printf("Leak of %d blocks found in xmlDictOwns",
8137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008138 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008139 printf(" %d", n_dict);
8140 printf(" %d", n_str);
8141 printf("\n");
8142 }
8143 }
8144 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008145 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008146
Daniel Veillard42595322004-11-08 10:52:06 +00008147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008148}
8149
8150
8151static int
8152test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008154
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008155 int mem_base;
8156 const xmlChar * ret_val;
8157 xmlDictPtr dict; /* the dictionnary */
8158 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008159 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008160 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008161 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008162 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008163
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008164 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8165 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8166 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8167 mem_base = xmlMemBlocks();
8168 dict = gen_xmlDictPtr(n_dict, 0);
8169 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8170 name = gen_const_xmlChar_ptr(n_name, 2);
8171
William M. Brackf13f77f2004-11-12 16:03:48 +00008172 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008173 desret_const_xmlChar_ptr(ret_val);
8174 call_tests++;
8175 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008176 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8177 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 xmlResetLastError();
8179 if (mem_base != xmlMemBlocks()) {
8180 printf("Leak of %d blocks found in xmlDictQLookup",
8181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008182 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008183 printf(" %d", n_dict);
8184 printf(" %d", n_prefix);
8185 printf(" %d", n_name);
8186 printf("\n");
8187 }
8188 }
8189 }
8190 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008192
Daniel Veillard42595322004-11-08 10:52:06 +00008193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008194}
8195
8196
8197static int
8198test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008200
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008201 int mem_base;
8202 int ret_val;
8203 xmlDictPtr dict; /* the dictionnary */
8204 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008205
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008206 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8207 mem_base = xmlMemBlocks();
8208 dict = gen_xmlDictPtr(n_dict, 0);
8209
8210 ret_val = xmlDictReference(dict);
8211 xmlDictFree(dict);
8212 desret_int(ret_val);
8213 call_tests++;
8214 des_xmlDictPtr(n_dict, dict, 0);
8215 xmlResetLastError();
8216 if (mem_base != xmlMemBlocks()) {
8217 printf("Leak of %d blocks found in xmlDictReference",
8218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008219 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008220 printf(" %d", n_dict);
8221 printf("\n");
8222 }
8223 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008224 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008225
Daniel Veillard42595322004-11-08 10:52:06 +00008226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008227}
8228
8229
8230static int
8231test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008233
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008234 int mem_base;
8235 int ret_val;
8236 xmlDictPtr dict; /* the dictionnary */
8237 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008238
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008239 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8240 mem_base = xmlMemBlocks();
8241 dict = gen_xmlDictPtr(n_dict, 0);
8242
8243 ret_val = xmlDictSize(dict);
8244 desret_int(ret_val);
8245 call_tests++;
8246 des_xmlDictPtr(n_dict, dict, 0);
8247 xmlResetLastError();
8248 if (mem_base != xmlMemBlocks()) {
8249 printf("Leak of %d blocks found in xmlDictSize",
8250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008251 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008252 printf(" %d", n_dict);
8253 printf("\n");
8254 }
8255 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008256 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008257
Daniel Veillard42595322004-11-08 10:52:06 +00008258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008259}
8260
8261static int
8262test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008264
Daniel Veillard2ae13382005-01-25 23:45:06 +00008265 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8266 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008267 test_ret += test_xmlDictCreate();
8268 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008269 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008270 test_ret += test_xmlDictLookup();
8271 test_ret += test_xmlDictOwns();
8272 test_ret += test_xmlDictQLookup();
8273 test_ret += test_xmlDictReference();
8274 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008275
Daniel Veillard42595322004-11-08 10:52:06 +00008276 if (test_ret != 0)
8277 printf("Module dict: %d errors\n", test_ret);
8278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008279}
8280
8281static int
8282test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008284
William M. Brack21e4ef22005-01-02 09:53:13 +00008285#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008286#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008287 int mem_base;
8288 int ret_val;
8289 unsigned char * out; /* a pointer to an array of bytes to store the result */
8290 int n_out;
8291 int * outlen; /* the length of @out */
8292 int n_outlen;
8293 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8294 int n_in;
8295 int * inlen; /* the length of @in */
8296 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008297
Daniel Veillardce682bc2004-11-05 17:22:25 +00008298 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8299 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8300 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8301 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8302 mem_base = xmlMemBlocks();
8303 out = gen_unsigned_char_ptr(n_out, 0);
8304 outlen = gen_int_ptr(n_outlen, 1);
8305 in = gen_const_unsigned_char_ptr(n_in, 2);
8306 inlen = gen_int_ptr(n_inlen, 3);
8307
William M. Brackf13f77f2004-11-12 16:03:48 +00008308 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008309 desret_int(ret_val);
8310 call_tests++;
8311 des_unsigned_char_ptr(n_out, out, 0);
8312 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008313 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008314 des_int_ptr(n_inlen, inlen, 3);
8315 xmlResetLastError();
8316 if (mem_base != xmlMemBlocks()) {
8317 printf("Leak of %d blocks found in UTF8Toisolat1",
8318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008319 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008320 printf(" %d", n_out);
8321 printf(" %d", n_outlen);
8322 printf(" %d", n_in);
8323 printf(" %d", n_inlen);
8324 printf("\n");
8325 }
8326 }
8327 }
8328 }
8329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008330 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008331#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008332#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008333
Daniel Veillard42595322004-11-08 10:52:06 +00008334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008335}
8336
8337
8338static int
8339test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008341
Daniel Veillardce682bc2004-11-05 17:22:25 +00008342 int mem_base;
8343 int ret_val;
8344 unsigned char * out; /* a pointer to an array of bytes to store the result */
8345 int n_out;
8346 int * outlen; /* the length of @out */
8347 int n_outlen;
8348 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8349 int n_in;
8350 int * inlen; /* the length of @in */
8351 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008352
Daniel Veillardce682bc2004-11-05 17:22:25 +00008353 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8354 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8355 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8356 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8357 mem_base = xmlMemBlocks();
8358 out = gen_unsigned_char_ptr(n_out, 0);
8359 outlen = gen_int_ptr(n_outlen, 1);
8360 in = gen_const_unsigned_char_ptr(n_in, 2);
8361 inlen = gen_int_ptr(n_inlen, 3);
8362
William M. Brackf13f77f2004-11-12 16:03:48 +00008363 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008364 desret_int(ret_val);
8365 call_tests++;
8366 des_unsigned_char_ptr(n_out, out, 0);
8367 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008368 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008369 des_int_ptr(n_inlen, inlen, 3);
8370 xmlResetLastError();
8371 if (mem_base != xmlMemBlocks()) {
8372 printf("Leak of %d blocks found in isolat1ToUTF8",
8373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008374 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008375 printf(" %d", n_out);
8376 printf(" %d", n_outlen);
8377 printf(" %d", n_in);
8378 printf(" %d", n_inlen);
8379 printf("\n");
8380 }
8381 }
8382 }
8383 }
8384 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008385 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008386
Daniel Veillard42595322004-11-08 10:52:06 +00008387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008388}
8389
8390
8391static int
8392test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008394
8395 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008396 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008397 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008398 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008399 int n_alias;
8400
8401 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8402 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008403 name = gen_const_char_ptr(n_name, 0);
8404 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008405
William M. Brackf13f77f2004-11-12 16:03:48 +00008406 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008407 desret_int(ret_val);
8408 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008409 des_const_char_ptr(n_name, (const char *)name, 0);
8410 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411 xmlResetLastError();
8412 }
8413 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008414 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008415
Daniel Veillard42595322004-11-08 10:52:06 +00008416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008417}
8418
8419
Daniel Veillardce682bc2004-11-05 17:22:25 +00008420#define gen_nb_xmlCharEncodingHandler_ptr 1
8421static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8422 return(NULL);
8423}
8424static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8425}
8426
Daniel Veillardd93f6252004-11-02 15:53:51 +00008427static int
8428test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008430
Daniel Veillardce682bc2004-11-05 17:22:25 +00008431 int mem_base;
8432 int ret_val;
8433 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8434 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008435
Daniel Veillardce682bc2004-11-05 17:22:25 +00008436 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8437 mem_base = xmlMemBlocks();
8438 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8439
8440 ret_val = xmlCharEncCloseFunc(handler);
8441 desret_int(ret_val);
8442 call_tests++;
8443 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8444 xmlResetLastError();
8445 if (mem_base != xmlMemBlocks()) {
8446 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008448 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008449 printf(" %d", n_handler);
8450 printf("\n");
8451 }
8452 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008453 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008454
Daniel Veillard42595322004-11-08 10:52:06 +00008455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008456}
8457
8458
8459static int
8460test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008462
Daniel Veillardce682bc2004-11-05 17:22:25 +00008463 int mem_base;
8464 int ret_val;
8465 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8466 int n_handler;
8467 xmlBufferPtr out; /* an xmlBuffer for the output. */
8468 int n_out;
8469 xmlBufferPtr in; /* an xmlBuffer for the input */
8470 int n_in;
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 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8474 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8475 mem_base = xmlMemBlocks();
8476 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8477 out = gen_xmlBufferPtr(n_out, 1);
8478 in = gen_xmlBufferPtr(n_in, 2);
8479
8480 ret_val = xmlCharEncFirstLine(handler, out, in);
8481 desret_int(ret_val);
8482 call_tests++;
8483 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8484 des_xmlBufferPtr(n_out, out, 1);
8485 des_xmlBufferPtr(n_in, in, 2);
8486 xmlResetLastError();
8487 if (mem_base != xmlMemBlocks()) {
8488 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008490 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008491 printf(" %d", n_handler);
8492 printf(" %d", n_out);
8493 printf(" %d", n_in);
8494 printf("\n");
8495 }
8496 }
8497 }
8498 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008500
Daniel Veillard42595322004-11-08 10:52:06 +00008501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008502}
8503
8504
8505static int
8506test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008508
Daniel Veillardce682bc2004-11-05 17:22:25 +00008509 int mem_base;
8510 int ret_val;
8511 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8512 int n_handler;
8513 xmlBufferPtr out; /* an xmlBuffer for the output. */
8514 int n_out;
8515 xmlBufferPtr in; /* an xmlBuffer for the input */
8516 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008517
Daniel Veillardce682bc2004-11-05 17:22:25 +00008518 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8519 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8520 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8521 mem_base = xmlMemBlocks();
8522 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8523 out = gen_xmlBufferPtr(n_out, 1);
8524 in = gen_xmlBufferPtr(n_in, 2);
8525
8526 ret_val = xmlCharEncInFunc(handler, out, in);
8527 desret_int(ret_val);
8528 call_tests++;
8529 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8530 des_xmlBufferPtr(n_out, out, 1);
8531 des_xmlBufferPtr(n_in, in, 2);
8532 xmlResetLastError();
8533 if (mem_base != xmlMemBlocks()) {
8534 printf("Leak of %d blocks found in xmlCharEncInFunc",
8535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008536 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008537 printf(" %d", n_handler);
8538 printf(" %d", n_out);
8539 printf(" %d", n_in);
8540 printf("\n");
8541 }
8542 }
8543 }
8544 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008546
Daniel Veillard42595322004-11-08 10:52:06 +00008547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008548}
8549
8550
8551static int
8552test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008554
Daniel Veillardce682bc2004-11-05 17:22:25 +00008555 int mem_base;
8556 int ret_val;
8557 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8558 int n_handler;
8559 xmlBufferPtr out; /* an xmlBuffer for the output. */
8560 int n_out;
8561 xmlBufferPtr in; /* an xmlBuffer for the input */
8562 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008563
Daniel Veillardce682bc2004-11-05 17:22:25 +00008564 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8565 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8566 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8567 mem_base = xmlMemBlocks();
8568 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8569 out = gen_xmlBufferPtr(n_out, 1);
8570 in = gen_xmlBufferPtr(n_in, 2);
8571
8572 ret_val = xmlCharEncOutFunc(handler, out, in);
8573 desret_int(ret_val);
8574 call_tests++;
8575 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8576 des_xmlBufferPtr(n_out, out, 1);
8577 des_xmlBufferPtr(n_in, in, 2);
8578 xmlResetLastError();
8579 if (mem_base != xmlMemBlocks()) {
8580 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008583 printf(" %d", n_handler);
8584 printf(" %d", n_out);
8585 printf(" %d", n_in);
8586 printf("\n");
8587 }
8588 }
8589 }
8590 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008591 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008592
Daniel Veillard42595322004-11-08 10:52:06 +00008593 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008594}
8595
8596
8597static int
8598test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008599 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008600
8601
8602
8603 xmlCleanupCharEncodingHandlers();
8604 call_tests++;
8605 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008607
Daniel Veillard42595322004-11-08 10:52:06 +00008608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008609}
8610
8611
8612static int
8613test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615
8616 int mem_base;
8617
8618 mem_base = xmlMemBlocks();
8619
8620 xmlCleanupEncodingAliases();
8621 call_tests++;
8622 xmlResetLastError();
8623 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008624 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008626 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008627 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008628 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008629 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008630
Daniel Veillard42595322004-11-08 10:52:06 +00008631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008632}
8633
8634
8635static int
8636test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008638
8639 int mem_base;
8640 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008641 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008642 int n_alias;
8643
8644 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008646 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008647
William M. Brackf13f77f2004-11-12 16:03:48 +00008648 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008649 desret_int(ret_val);
8650 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008651 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008652 xmlResetLastError();
8653 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008654 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008656 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008657 printf(" %d", n_alias);
8658 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008659 }
8660 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008662
Daniel Veillard42595322004-11-08 10:52:06 +00008663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008664}
8665
8666
8667static int
8668test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008670
Daniel Veillardce682bc2004-11-05 17:22:25 +00008671 int mem_base;
8672 xmlCharEncoding ret_val;
8673 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). */
8674 int n_in;
8675 int len; /* pointer to the length of the buffer */
8676 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008677
Daniel Veillardce682bc2004-11-05 17:22:25 +00008678 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8679 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8680 mem_base = xmlMemBlocks();
8681 in = gen_const_unsigned_char_ptr(n_in, 0);
8682 len = gen_int(n_len, 1);
8683
William M. Brackf13f77f2004-11-12 16:03:48 +00008684 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008685 desret_xmlCharEncoding(ret_val);
8686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008687 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008688 des_int(n_len, len, 1);
8689 xmlResetLastError();
8690 if (mem_base != xmlMemBlocks()) {
8691 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008693 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008694 printf(" %d", n_in);
8695 printf(" %d", n_len);
8696 printf("\n");
8697 }
8698 }
8699 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008701
Daniel Veillard42595322004-11-08 10:52:06 +00008702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008703}
8704
8705
8706static int
8707test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008709
8710
8711 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008713}
8714
8715
8716static int
8717test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008719
8720
8721 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008723}
8724
8725
8726static int
8727test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008729
Daniel Veillard3d97e662004-11-04 10:49:00 +00008730 int mem_base;
8731 const char * ret_val;
8732 xmlCharEncoding enc; /* the encoding */
8733 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008734
Daniel Veillard3d97e662004-11-04 10:49:00 +00008735 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8736 mem_base = xmlMemBlocks();
8737 enc = gen_xmlCharEncoding(n_enc, 0);
8738
8739 ret_val = xmlGetCharEncodingName(enc);
8740 desret_const_char_ptr(ret_val);
8741 call_tests++;
8742 des_xmlCharEncoding(n_enc, enc, 0);
8743 xmlResetLastError();
8744 if (mem_base != xmlMemBlocks()) {
8745 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008747 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008748 printf(" %d", n_enc);
8749 printf("\n");
8750 }
8751 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008753
Daniel Veillard42595322004-11-08 10:52:06 +00008754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755}
8756
8757
8758static int
8759test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008761
8762 int mem_base;
8763 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008764 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765 int n_alias;
8766
8767 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008769 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008770
William M. Brackf13f77f2004-11-12 16:03:48 +00008771 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008772 desret_const_char_ptr(ret_val);
8773 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008774 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008775 xmlResetLastError();
8776 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008777 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008779 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008780 printf(" %d", n_alias);
8781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008782 }
8783 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008784 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008785
Daniel Veillard42595322004-11-08 10:52:06 +00008786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008787}
8788
8789
8790static int
8791test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008793
8794
8795
8796 xmlInitCharEncodingHandlers();
8797 call_tests++;
8798 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008800
Daniel Veillard42595322004-11-08 10:52:06 +00008801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008802}
8803
8804
8805static int
8806test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808
8809
8810 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008812}
8813
8814
8815static int
8816test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818
Daniel Veillard3d97e662004-11-04 10:49:00 +00008819 int mem_base;
8820 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008821 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008822 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008823
Daniel Veillard3d97e662004-11-04 10:49:00 +00008824 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8825 mem_base = xmlMemBlocks();
8826 name = gen_const_char_ptr(n_name, 0);
8827
William M. Brackf13f77f2004-11-12 16:03:48 +00008828 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008829 desret_xmlCharEncoding(ret_val);
8830 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008831 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008832 xmlResetLastError();
8833 if (mem_base != xmlMemBlocks()) {
8834 printf("Leak of %d blocks found in xmlParseCharEncoding",
8835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008836 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008837 printf(" %d", n_name);
8838 printf("\n");
8839 }
8840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008842
Daniel Veillard42595322004-11-08 10:52:06 +00008843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844}
8845
8846
Daniel Veillardce682bc2004-11-05 17:22:25 +00008847#define gen_nb_xmlCharEncodingHandlerPtr 1
8848static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8849 return(NULL);
8850}
8851static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8852}
8853
Daniel Veillardd93f6252004-11-02 15:53:51 +00008854static int
8855test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008857
Daniel Veillardce682bc2004-11-05 17:22:25 +00008858 int mem_base;
8859 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8860 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008861
Daniel Veillardce682bc2004-11-05 17:22:25 +00008862 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8863 mem_base = xmlMemBlocks();
8864 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8865
8866 xmlRegisterCharEncodingHandler(handler);
8867 call_tests++;
8868 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8869 xmlResetLastError();
8870 if (mem_base != xmlMemBlocks()) {
8871 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008873 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008874 printf(" %d", n_handler);
8875 printf("\n");
8876 }
8877 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008878 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008879
Daniel Veillard42595322004-11-08 10:52:06 +00008880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008881}
8882
8883static int
8884test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008886
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008887 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008888 test_ret += test_UTF8Toisolat1();
8889 test_ret += test_isolat1ToUTF8();
8890 test_ret += test_xmlAddEncodingAlias();
8891 test_ret += test_xmlCharEncCloseFunc();
8892 test_ret += test_xmlCharEncFirstLine();
8893 test_ret += test_xmlCharEncInFunc();
8894 test_ret += test_xmlCharEncOutFunc();
8895 test_ret += test_xmlCleanupCharEncodingHandlers();
8896 test_ret += test_xmlCleanupEncodingAliases();
8897 test_ret += test_xmlDelEncodingAlias();
8898 test_ret += test_xmlDetectCharEncoding();
8899 test_ret += test_xmlFindCharEncodingHandler();
8900 test_ret += test_xmlGetCharEncodingHandler();
8901 test_ret += test_xmlGetCharEncodingName();
8902 test_ret += test_xmlGetEncodingAlias();
8903 test_ret += test_xmlInitCharEncodingHandlers();
8904 test_ret += test_xmlNewCharEncodingHandler();
8905 test_ret += test_xmlParseCharEncoding();
8906 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907
Daniel Veillard42595322004-11-08 10:52:06 +00008908 if (test_ret != 0)
8909 printf("Module encoding: %d errors\n", test_ret);
8910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008911}
8912
8913static int
8914test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008916
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008917 int mem_base;
8918 xmlEntityPtr ret_val;
8919 xmlDocPtr doc; /* the document */
8920 int n_doc;
8921 xmlChar * name; /* the entity name */
8922 int n_name;
8923 int type; /* the entity type XML_xxx_yyy_ENTITY */
8924 int n_type;
8925 xmlChar * ExternalID; /* the entity external ID if available */
8926 int n_ExternalID;
8927 xmlChar * SystemID; /* the entity system ID if available */
8928 int n_SystemID;
8929 xmlChar * content; /* the entity content */
8930 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008931
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008932 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8933 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8934 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8935 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8936 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8937 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8938 mem_base = xmlMemBlocks();
8939 doc = gen_xmlDocPtr(n_doc, 0);
8940 name = gen_const_xmlChar_ptr(n_name, 1);
8941 type = gen_int(n_type, 2);
8942 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8943 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8944 content = gen_const_xmlChar_ptr(n_content, 5);
8945
William M. Brackf13f77f2004-11-12 16:03:48 +00008946 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008947 desret_xmlEntityPtr(ret_val);
8948 call_tests++;
8949 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008950 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008951 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008952 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8953 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8954 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008955 xmlResetLastError();
8956 if (mem_base != xmlMemBlocks()) {
8957 printf("Leak of %d blocks found in xmlAddDocEntity",
8958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008959 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008960 printf(" %d", n_doc);
8961 printf(" %d", n_name);
8962 printf(" %d", n_type);
8963 printf(" %d", n_ExternalID);
8964 printf(" %d", n_SystemID);
8965 printf(" %d", n_content);
8966 printf("\n");
8967 }
8968 }
8969 }
8970 }
8971 }
8972 }
8973 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008975
Daniel Veillard42595322004-11-08 10:52:06 +00008976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008977}
8978
8979
8980static int
8981test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008983
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008984 int mem_base;
8985 xmlEntityPtr ret_val;
8986 xmlDocPtr doc; /* the document */
8987 int n_doc;
8988 xmlChar * name; /* the entity name */
8989 int n_name;
8990 int type; /* the entity type XML_xxx_yyy_ENTITY */
8991 int n_type;
8992 xmlChar * ExternalID; /* the entity external ID if available */
8993 int n_ExternalID;
8994 xmlChar * SystemID; /* the entity system ID if available */
8995 int n_SystemID;
8996 xmlChar * content; /* the entity content */
8997 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008998
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008999 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9000 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9001 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9002 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9003 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9004 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9005 mem_base = xmlMemBlocks();
9006 doc = gen_xmlDocPtr(n_doc, 0);
9007 name = gen_const_xmlChar_ptr(n_name, 1);
9008 type = gen_int(n_type, 2);
9009 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9010 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9011 content = gen_const_xmlChar_ptr(n_content, 5);
9012
William M. Brackf13f77f2004-11-12 16:03:48 +00009013 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009014 desret_xmlEntityPtr(ret_val);
9015 call_tests++;
9016 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009017 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009018 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009019 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9020 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9021 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009022 xmlResetLastError();
9023 if (mem_base != xmlMemBlocks()) {
9024 printf("Leak of %d blocks found in xmlAddDtdEntity",
9025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009026 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009027 printf(" %d", n_doc);
9028 printf(" %d", n_name);
9029 printf(" %d", n_type);
9030 printf(" %d", n_ExternalID);
9031 printf(" %d", n_SystemID);
9032 printf(" %d", n_content);
9033 printf("\n");
9034 }
9035 }
9036 }
9037 }
9038 }
9039 }
9040 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009042
Daniel Veillard42595322004-11-08 10:52:06 +00009043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009044}
9045
9046
9047static int
9048test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009050
William M. Brack21e4ef22005-01-02 09:53:13 +00009051#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009052#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009053 int mem_base;
9054
9055 mem_base = xmlMemBlocks();
9056
9057 xmlCleanupPredefinedEntities();
9058 call_tests++;
9059 xmlResetLastError();
9060 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009061 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009063 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009064 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009066 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009067#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009068#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009069
Daniel Veillard42595322004-11-08 10:52:06 +00009070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009071}
9072
9073
Daniel Veillardce682bc2004-11-05 17:22:25 +00009074#define gen_nb_xmlEntitiesTablePtr 1
9075static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9076 return(NULL);
9077}
9078static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9079}
9080
Daniel Veillardd93f6252004-11-02 15:53:51 +00009081static int
9082test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009084
9085
9086 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009088}
9089
9090
9091static int
9092test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009094
9095
9096 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009098}
9099
9100
9101static int
9102test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009104
William M. Brack21e4ef22005-01-02 09:53:13 +00009105#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009106 int mem_base;
9107 xmlBufferPtr buf; /* An XML buffer. */
9108 int n_buf;
9109 xmlEntitiesTablePtr table; /* An entity table */
9110 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009111
Daniel Veillardce682bc2004-11-05 17:22:25 +00009112 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9113 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9114 mem_base = xmlMemBlocks();
9115 buf = gen_xmlBufferPtr(n_buf, 0);
9116 table = gen_xmlEntitiesTablePtr(n_table, 1);
9117
9118 xmlDumpEntitiesTable(buf, table);
9119 call_tests++;
9120 des_xmlBufferPtr(n_buf, buf, 0);
9121 des_xmlEntitiesTablePtr(n_table, table, 1);
9122 xmlResetLastError();
9123 if (mem_base != xmlMemBlocks()) {
9124 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009126 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009127 printf(" %d", n_buf);
9128 printf(" %d", n_table);
9129 printf("\n");
9130 }
9131 }
9132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009133 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009134#endif
9135
Daniel Veillard42595322004-11-08 10:52:06 +00009136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009137}
9138
9139
Daniel Veillardce682bc2004-11-05 17:22:25 +00009140#define gen_nb_xmlEntityPtr 1
9141static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9142 return(NULL);
9143}
9144static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9145}
9146
Daniel Veillardd93f6252004-11-02 15:53:51 +00009147static int
9148test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009150
William M. Brack21e4ef22005-01-02 09:53:13 +00009151#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009152 int mem_base;
9153 xmlBufferPtr buf; /* An XML buffer. */
9154 int n_buf;
9155 xmlEntityPtr ent; /* An entity table */
9156 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009157
Daniel Veillardce682bc2004-11-05 17:22:25 +00009158 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9159 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9160 mem_base = xmlMemBlocks();
9161 buf = gen_xmlBufferPtr(n_buf, 0);
9162 ent = gen_xmlEntityPtr(n_ent, 1);
9163
9164 xmlDumpEntityDecl(buf, ent);
9165 call_tests++;
9166 des_xmlBufferPtr(n_buf, buf, 0);
9167 des_xmlEntityPtr(n_ent, ent, 1);
9168 xmlResetLastError();
9169 if (mem_base != xmlMemBlocks()) {
9170 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009173 printf(" %d", n_buf);
9174 printf(" %d", n_ent);
9175 printf("\n");
9176 }
9177 }
9178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009179 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009180#endif
9181
Daniel Veillard42595322004-11-08 10:52:06 +00009182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009183}
9184
9185
9186static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009187test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009189
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009190 int mem_base;
9191 xmlChar * ret_val;
9192 xmlDocPtr doc; /* the document containing the string */
9193 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009195 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009196
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9198 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009200 doc = gen_xmlDocPtr(n_doc, 0);
9201 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009202
William M. Brackf13f77f2004-11-12 16:03:48 +00009203 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009204 desret_xmlChar_ptr(ret_val);
9205 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009206 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009207 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009208 xmlResetLastError();
9209 if (mem_base != xmlMemBlocks()) {
9210 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009212 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009213 printf(" %d", n_doc);
9214 printf(" %d", n_input);
9215 printf("\n");
9216 }
9217 }
9218 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009219 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009220
Daniel Veillard42595322004-11-08 10:52:06 +00009221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009222}
9223
9224
9225static int
9226test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009228
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009229 int mem_base;
9230 xmlChar * ret_val;
9231 xmlDocPtr doc; /* the document containing the string */
9232 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009233 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009234 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009235
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009236 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9237 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9238 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009239 doc = gen_xmlDocPtr(n_doc, 0);
9240 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009241
William M. Brackf13f77f2004-11-12 16:03:48 +00009242 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009243 desret_xmlChar_ptr(ret_val);
9244 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009245 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009246 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009247 xmlResetLastError();
9248 if (mem_base != xmlMemBlocks()) {
9249 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009251 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009252 printf(" %d", n_doc);
9253 printf(" %d", n_input);
9254 printf("\n");
9255 }
9256 }
9257 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009259
Daniel Veillard42595322004-11-08 10:52:06 +00009260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009261}
9262
9263
9264static int
9265test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009267
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009268 int mem_base;
9269 xmlEntityPtr ret_val;
9270 xmlDocPtr doc; /* the document referencing the entity */
9271 int n_doc;
9272 xmlChar * name; /* the entity name */
9273 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009274
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009275 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9276 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9277 mem_base = xmlMemBlocks();
9278 doc = gen_xmlDocPtr(n_doc, 0);
9279 name = gen_const_xmlChar_ptr(n_name, 1);
9280
William M. Brackf13f77f2004-11-12 16:03:48 +00009281 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009282 desret_xmlEntityPtr(ret_val);
9283 call_tests++;
9284 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009285 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009286 xmlResetLastError();
9287 if (mem_base != xmlMemBlocks()) {
9288 printf("Leak of %d blocks found in xmlGetDocEntity",
9289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009290 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009291 printf(" %d", n_doc);
9292 printf(" %d", n_name);
9293 printf("\n");
9294 }
9295 }
9296 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009297 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009298
Daniel Veillard42595322004-11-08 10:52:06 +00009299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009300}
9301
9302
9303static int
9304test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009306
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009307 int mem_base;
9308 xmlEntityPtr ret_val;
9309 xmlDocPtr doc; /* the document referencing the entity */
9310 int n_doc;
9311 xmlChar * name; /* the entity name */
9312 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009313
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009314 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9315 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9316 mem_base = xmlMemBlocks();
9317 doc = gen_xmlDocPtr(n_doc, 0);
9318 name = gen_const_xmlChar_ptr(n_name, 1);
9319
William M. Brackf13f77f2004-11-12 16:03:48 +00009320 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009321 desret_xmlEntityPtr(ret_val);
9322 call_tests++;
9323 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009324 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009325 xmlResetLastError();
9326 if (mem_base != xmlMemBlocks()) {
9327 printf("Leak of %d blocks found in xmlGetDtdEntity",
9328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009329 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009330 printf(" %d", n_doc);
9331 printf(" %d", n_name);
9332 printf("\n");
9333 }
9334 }
9335 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009336 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009337
Daniel Veillard42595322004-11-08 10:52:06 +00009338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009339}
9340
9341
9342static int
9343test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009345
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009346 int mem_base;
9347 xmlEntityPtr ret_val;
9348 xmlDocPtr doc; /* the document referencing the entity */
9349 int n_doc;
9350 xmlChar * name; /* the entity name */
9351 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009352
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009353 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9354 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9355 mem_base = xmlMemBlocks();
9356 doc = gen_xmlDocPtr(n_doc, 0);
9357 name = gen_const_xmlChar_ptr(n_name, 1);
9358
William M. Brackf13f77f2004-11-12 16:03:48 +00009359 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009360 desret_xmlEntityPtr(ret_val);
9361 call_tests++;
9362 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009363 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009364 xmlResetLastError();
9365 if (mem_base != xmlMemBlocks()) {
9366 printf("Leak of %d blocks found in xmlGetParameterEntity",
9367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009368 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009369 printf(" %d", n_doc);
9370 printf(" %d", n_name);
9371 printf("\n");
9372 }
9373 }
9374 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009375 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009376
Daniel Veillard42595322004-11-08 10:52:06 +00009377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009378}
9379
9380
9381static int
9382test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009384
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009385 int mem_base;
9386 xmlEntityPtr ret_val;
9387 xmlChar * name; /* the entity name */
9388 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009389
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9391 mem_base = xmlMemBlocks();
9392 name = gen_const_xmlChar_ptr(n_name, 0);
9393
William M. Brackf13f77f2004-11-12 16:03:48 +00009394 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009395 desret_xmlEntityPtr(ret_val);
9396 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009397 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009398 xmlResetLastError();
9399 if (mem_base != xmlMemBlocks()) {
9400 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009402 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009403 printf(" %d", n_name);
9404 printf("\n");
9405 }
9406 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009407 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009408
Daniel Veillard42595322004-11-08 10:52:06 +00009409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009410}
9411
9412
9413static int
9414test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009416
William M. Brack21e4ef22005-01-02 09:53:13 +00009417#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009418#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009419 int mem_base;
9420
9421 mem_base = xmlMemBlocks();
9422
9423 xmlInitializePredefinedEntities();
9424 call_tests++;
9425 xmlResetLastError();
9426 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009427 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009429 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009430 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009432 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009433#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009434#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009435
Daniel Veillard42595322004-11-08 10:52:06 +00009436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009437}
9438
9439static int
9440test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009442
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009443 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009444 test_ret += test_xmlAddDocEntity();
9445 test_ret += test_xmlAddDtdEntity();
9446 test_ret += test_xmlCleanupPredefinedEntities();
9447 test_ret += test_xmlCopyEntitiesTable();
9448 test_ret += test_xmlCreateEntitiesTable();
9449 test_ret += test_xmlDumpEntitiesTable();
9450 test_ret += test_xmlDumpEntityDecl();
9451 test_ret += test_xmlEncodeEntitiesReentrant();
9452 test_ret += test_xmlEncodeSpecialChars();
9453 test_ret += test_xmlGetDocEntity();
9454 test_ret += test_xmlGetDtdEntity();
9455 test_ret += test_xmlGetParameterEntity();
9456 test_ret += test_xmlGetPredefinedEntity();
9457 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009458
Daniel Veillard42595322004-11-08 10:52:06 +00009459 if (test_ret != 0)
9460 printf("Module entities: %d errors\n", test_ret);
9461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009462}
9463
9464static int
9465test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009468 int mem_base;
9469 int ret_val;
9470 xmlHashTablePtr table; /* the hash table */
9471 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009472 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009473 int n_name;
9474 void * userdata; /* a pointer to the userdata */
9475 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009476
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009477 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9478 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9479 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009481 table = gen_xmlHashTablePtr(n_table, 0);
9482 name = gen_const_xmlChar_ptr(n_name, 1);
9483 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009484
William M. Brackf13f77f2004-11-12 16:03:48 +00009485 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009486 desret_int(ret_val);
9487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009488 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009489 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009490 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009491 xmlResetLastError();
9492 if (mem_base != xmlMemBlocks()) {
9493 printf("Leak of %d blocks found in xmlHashAddEntry",
9494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009495 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009496 printf(" %d", n_table);
9497 printf(" %d", n_name);
9498 printf(" %d", n_userdata);
9499 printf("\n");
9500 }
9501 }
9502 }
9503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009505
Daniel Veillard42595322004-11-08 10:52:06 +00009506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009507}
9508
9509
9510static int
9511test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009513
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009514 int mem_base;
9515 int ret_val;
9516 xmlHashTablePtr table; /* the hash table */
9517 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009518 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009519 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009520 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009521 int n_name2;
9522 void * userdata; /* a pointer to the userdata */
9523 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009524
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009525 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9526 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9527 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9528 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9529 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009530 table = gen_xmlHashTablePtr(n_table, 0);
9531 name = gen_const_xmlChar_ptr(n_name, 1);
9532 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9533 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009534
William M. Brackf13f77f2004-11-12 16:03:48 +00009535 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009536 desret_int(ret_val);
9537 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009538 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009539 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9540 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009541 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009542 xmlResetLastError();
9543 if (mem_base != xmlMemBlocks()) {
9544 printf("Leak of %d blocks found in xmlHashAddEntry2",
9545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009546 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009547 printf(" %d", n_table);
9548 printf(" %d", n_name);
9549 printf(" %d", n_name2);
9550 printf(" %d", n_userdata);
9551 printf("\n");
9552 }
9553 }
9554 }
9555 }
9556 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009557 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009558
Daniel Veillard42595322004-11-08 10:52:06 +00009559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009560}
9561
9562
9563static int
9564test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009566
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009567 int mem_base;
9568 int ret_val;
9569 xmlHashTablePtr table; /* the hash table */
9570 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009571 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009572 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009573 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009574 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009575 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009576 int n_name3;
9577 void * userdata; /* a pointer to the userdata */
9578 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009579
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009580 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9581 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9582 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9583 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9584 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9585 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009586 table = gen_xmlHashTablePtr(n_table, 0);
9587 name = gen_const_xmlChar_ptr(n_name, 1);
9588 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9589 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9590 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009591
William M. Brackf13f77f2004-11-12 16:03:48 +00009592 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009593 desret_int(ret_val);
9594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009595 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009596 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9597 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9598 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009599 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009600 xmlResetLastError();
9601 if (mem_base != xmlMemBlocks()) {
9602 printf("Leak of %d blocks found in xmlHashAddEntry3",
9603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009604 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009605 printf(" %d", n_table);
9606 printf(" %d", n_name);
9607 printf(" %d", n_name2);
9608 printf(" %d", n_name3);
9609 printf(" %d", n_userdata);
9610 printf("\n");
9611 }
9612 }
9613 }
9614 }
9615 }
9616 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009618
Daniel Veillard42595322004-11-08 10:52:06 +00009619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009620}
9621
9622
9623static int
9624test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009626
9627
9628 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009630}
9631
9632
9633static int
9634test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009636
9637
9638 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009640}
9641
9642
9643static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009644test_xmlHashCreateDict(void) {
9645 int test_ret = 0;
9646
9647
9648 /* missing type support */
9649 return(test_ret);
9650}
9651
9652
9653static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009654test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009656
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009657 int mem_base;
9658 void * ret_val;
9659 xmlHashTablePtr table; /* the hash table */
9660 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009661 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009662 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009663
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009664 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9665 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009667 table = gen_xmlHashTablePtr(n_table, 0);
9668 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009669
William M. Brackf13f77f2004-11-12 16:03:48 +00009670 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009671 desret_void_ptr(ret_val);
9672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009673 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009674 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009675 xmlResetLastError();
9676 if (mem_base != xmlMemBlocks()) {
9677 printf("Leak of %d blocks found in xmlHashLookup",
9678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009679 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009680 printf(" %d", n_table);
9681 printf(" %d", n_name);
9682 printf("\n");
9683 }
9684 }
9685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009687
Daniel Veillard42595322004-11-08 10:52:06 +00009688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009689}
9690
9691
9692static int
9693test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009695
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009696 int mem_base;
9697 void * ret_val;
9698 xmlHashTablePtr table; /* the hash table */
9699 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009700 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009701 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009702 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009703 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009704
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009705 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9706 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9707 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009709 table = gen_xmlHashTablePtr(n_table, 0);
9710 name = gen_const_xmlChar_ptr(n_name, 1);
9711 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009712
William M. Brackf13f77f2004-11-12 16:03:48 +00009713 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009714 desret_void_ptr(ret_val);
9715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009716 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009717 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9718 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009719 xmlResetLastError();
9720 if (mem_base != xmlMemBlocks()) {
9721 printf("Leak of %d blocks found in xmlHashLookup2",
9722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009723 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009724 printf(" %d", n_table);
9725 printf(" %d", n_name);
9726 printf(" %d", n_name2);
9727 printf("\n");
9728 }
9729 }
9730 }
9731 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009733
Daniel Veillard42595322004-11-08 10:52:06 +00009734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009735}
9736
9737
9738static int
9739test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009741
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009742 int mem_base;
9743 void * ret_val;
9744 xmlHashTablePtr table; /* the hash table */
9745 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009746 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009747 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009748 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009749 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009750 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009751 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009752
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009753 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9754 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9755 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9756 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009758 table = gen_xmlHashTablePtr(n_table, 0);
9759 name = gen_const_xmlChar_ptr(n_name, 1);
9760 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9761 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009762
William M. Brackf13f77f2004-11-12 16:03:48 +00009763 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009764 desret_void_ptr(ret_val);
9765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009766 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009767 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9768 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9769 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009770 xmlResetLastError();
9771 if (mem_base != xmlMemBlocks()) {
9772 printf("Leak of %d blocks found in xmlHashLookup3",
9773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009774 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009775 printf(" %d", n_table);
9776 printf(" %d", n_name);
9777 printf(" %d", n_name2);
9778 printf(" %d", n_name3);
9779 printf("\n");
9780 }
9781 }
9782 }
9783 }
9784 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009786
Daniel Veillard42595322004-11-08 10:52:06 +00009787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009788}
9789
9790
9791static int
9792test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009794
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009795 int mem_base;
9796 void * ret_val;
9797 xmlHashTablePtr table; /* the hash table */
9798 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009799 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009800 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009801 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009802 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009803
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009804 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9805 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9806 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009808 table = gen_xmlHashTablePtr(n_table, 0);
9809 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9810 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811
William M. Brackf13f77f2004-11-12 16:03:48 +00009812 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009813 desret_void_ptr(ret_val);
9814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009815 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009816 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9817 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009818 xmlResetLastError();
9819 if (mem_base != xmlMemBlocks()) {
9820 printf("Leak of %d blocks found in xmlHashQLookup",
9821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009822 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009823 printf(" %d", n_table);
9824 printf(" %d", n_prefix);
9825 printf(" %d", n_name);
9826 printf("\n");
9827 }
9828 }
9829 }
9830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009832
Daniel Veillard42595322004-11-08 10:52:06 +00009833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009834}
9835
9836
9837static int
9838test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009840
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009841 int mem_base;
9842 void * ret_val;
9843 xmlHashTablePtr table; /* the hash table */
9844 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009845 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009846 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009847 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009848 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009849 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009850 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009851 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009852 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009853
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009854 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9855 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9856 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9857 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9858 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009860 table = gen_xmlHashTablePtr(n_table, 0);
9861 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9862 name = gen_const_xmlChar_ptr(n_name, 2);
9863 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9864 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009865
William M. Brackf13f77f2004-11-12 16:03:48 +00009866 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009867 desret_void_ptr(ret_val);
9868 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009869 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009870 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9871 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9872 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9873 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009874 xmlResetLastError();
9875 if (mem_base != xmlMemBlocks()) {
9876 printf("Leak of %d blocks found in xmlHashQLookup2",
9877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009878 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009879 printf(" %d", n_table);
9880 printf(" %d", n_prefix);
9881 printf(" %d", n_name);
9882 printf(" %d", n_prefix2);
9883 printf(" %d", n_name2);
9884 printf("\n");
9885 }
9886 }
9887 }
9888 }
9889 }
9890 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009891 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009892
Daniel Veillard42595322004-11-08 10:52:06 +00009893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009894}
9895
9896
9897static int
9898test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009900
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009901 int mem_base;
9902 void * ret_val;
9903 xmlHashTablePtr table; /* the hash table */
9904 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009905 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009906 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009907 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009908 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009909 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009911 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009912 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009913 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009914 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009915 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009916 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009917
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009918 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9919 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9920 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9921 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9922 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9923 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9924 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009926 table = gen_xmlHashTablePtr(n_table, 0);
9927 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9928 name = gen_const_xmlChar_ptr(n_name, 2);
9929 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9930 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9931 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9932 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009933
William M. Brackf13f77f2004-11-12 16:03:48 +00009934 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 +00009935 desret_void_ptr(ret_val);
9936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009937 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009938 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9939 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9940 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9941 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9942 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9943 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009944 xmlResetLastError();
9945 if (mem_base != xmlMemBlocks()) {
9946 printf("Leak of %d blocks found in xmlHashQLookup3",
9947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009948 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009949 printf(" %d", n_table);
9950 printf(" %d", n_prefix);
9951 printf(" %d", n_name);
9952 printf(" %d", n_prefix2);
9953 printf(" %d", n_name2);
9954 printf(" %d", n_prefix3);
9955 printf(" %d", n_name3);
9956 printf("\n");
9957 }
9958 }
9959 }
9960 }
9961 }
9962 }
9963 }
9964 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009965 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009966
Daniel Veillard42595322004-11-08 10:52:06 +00009967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009968}
9969
9970
9971static int
9972test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009974
Daniel Veillard42595322004-11-08 10:52:06 +00009975 int mem_base;
9976 int ret_val;
9977 xmlHashTablePtr table; /* the hash table */
9978 int n_table;
9979 xmlChar * name; /* the name of the userdata */
9980 int n_name;
9981 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9982 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009983
Daniel Veillard42595322004-11-08 10:52:06 +00009984 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9985 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9986 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9987 mem_base = xmlMemBlocks();
9988 table = gen_xmlHashTablePtr(n_table, 0);
9989 name = gen_const_xmlChar_ptr(n_name, 1);
9990 f = gen_xmlHashDeallocator(n_f, 2);
9991
William M. Brackf13f77f2004-11-12 16:03:48 +00009992 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +00009993 desret_int(ret_val);
9994 call_tests++;
9995 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009996 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00009997 des_xmlHashDeallocator(n_f, f, 2);
9998 xmlResetLastError();
9999 if (mem_base != xmlMemBlocks()) {
10000 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10001 xmlMemBlocks() - mem_base);
10002 test_ret++;
10003 printf(" %d", n_table);
10004 printf(" %d", n_name);
10005 printf(" %d", n_f);
10006 printf("\n");
10007 }
10008 }
10009 }
10010 }
Daniel Veillard42595322004-11-08 10:52:06 +000010011 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010012
Daniel Veillard42595322004-11-08 10:52:06 +000010013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010014}
10015
10016
10017static int
10018test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010020
Daniel Veillard42595322004-11-08 10:52:06 +000010021 int mem_base;
10022 int ret_val;
10023 xmlHashTablePtr table; /* the hash table */
10024 int n_table;
10025 xmlChar * name; /* the name of the userdata */
10026 int n_name;
10027 xmlChar * name2; /* a second name of the userdata */
10028 int n_name2;
10029 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10030 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010031
Daniel Veillard42595322004-11-08 10:52:06 +000010032 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10033 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10034 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10035 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10036 mem_base = xmlMemBlocks();
10037 table = gen_xmlHashTablePtr(n_table, 0);
10038 name = gen_const_xmlChar_ptr(n_name, 1);
10039 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10040 f = gen_xmlHashDeallocator(n_f, 3);
10041
William M. Brackf13f77f2004-11-12 16:03:48 +000010042 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010043 desret_int(ret_val);
10044 call_tests++;
10045 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010046 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10047 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010048 des_xmlHashDeallocator(n_f, f, 3);
10049 xmlResetLastError();
10050 if (mem_base != xmlMemBlocks()) {
10051 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10052 xmlMemBlocks() - mem_base);
10053 test_ret++;
10054 printf(" %d", n_table);
10055 printf(" %d", n_name);
10056 printf(" %d", n_name2);
10057 printf(" %d", n_f);
10058 printf("\n");
10059 }
10060 }
10061 }
10062 }
10063 }
Daniel Veillard42595322004-11-08 10:52:06 +000010064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010065
Daniel Veillard42595322004-11-08 10:52:06 +000010066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010067}
10068
10069
10070static int
10071test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010073
Daniel Veillard42595322004-11-08 10:52:06 +000010074 int mem_base;
10075 int ret_val;
10076 xmlHashTablePtr table; /* the hash table */
10077 int n_table;
10078 xmlChar * name; /* the name of the userdata */
10079 int n_name;
10080 xmlChar * name2; /* a second name of the userdata */
10081 int n_name2;
10082 xmlChar * name3; /* a third name of the userdata */
10083 int n_name3;
10084 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10085 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010086
Daniel Veillard42595322004-11-08 10:52:06 +000010087 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10088 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10089 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10090 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10091 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10092 mem_base = xmlMemBlocks();
10093 table = gen_xmlHashTablePtr(n_table, 0);
10094 name = gen_const_xmlChar_ptr(n_name, 1);
10095 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10096 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10097 f = gen_xmlHashDeallocator(n_f, 4);
10098
William M. Brackf13f77f2004-11-12 16:03:48 +000010099 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010100 desret_int(ret_val);
10101 call_tests++;
10102 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010103 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10104 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10105 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010106 des_xmlHashDeallocator(n_f, f, 4);
10107 xmlResetLastError();
10108 if (mem_base != xmlMemBlocks()) {
10109 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10110 xmlMemBlocks() - mem_base);
10111 test_ret++;
10112 printf(" %d", n_table);
10113 printf(" %d", n_name);
10114 printf(" %d", n_name2);
10115 printf(" %d", n_name3);
10116 printf(" %d", n_f);
10117 printf("\n");
10118 }
10119 }
10120 }
10121 }
10122 }
10123 }
Daniel Veillard42595322004-11-08 10:52:06 +000010124 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010125
Daniel Veillard42595322004-11-08 10:52:06 +000010126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010127}
10128
10129
10130static int
10131test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010133
10134
10135 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010137}
10138
10139
10140static int
10141test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010143
10144
10145 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010147}
10148
10149
10150static int
10151test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010153
10154
10155 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010157}
10158
10159
10160static int
10161test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010163
10164
10165 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010167}
10168
10169
10170static int
10171test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010173
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010174 int mem_base;
10175 int ret_val;
10176 xmlHashTablePtr table; /* the hash table */
10177 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010178
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010179 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010181 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010182
10183 ret_val = xmlHashSize(table);
10184 desret_int(ret_val);
10185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010186 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010187 xmlResetLastError();
10188 if (mem_base != xmlMemBlocks()) {
10189 printf("Leak of %d blocks found in xmlHashSize",
10190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010191 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010192 printf(" %d", n_table);
10193 printf("\n");
10194 }
10195 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010197
Daniel Veillard42595322004-11-08 10:52:06 +000010198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010199}
10200
10201
10202static int
10203test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010205
Daniel Veillard42595322004-11-08 10:52:06 +000010206 int mem_base;
10207 int ret_val;
10208 xmlHashTablePtr table; /* the hash table */
10209 int n_table;
10210 xmlChar * name; /* the name of the userdata */
10211 int n_name;
10212 void * userdata; /* a pointer to the userdata */
10213 int n_userdata;
10214 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10215 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010216
Daniel Veillard42595322004-11-08 10:52:06 +000010217 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10218 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10219 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10220 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10221 mem_base = xmlMemBlocks();
10222 table = gen_xmlHashTablePtr(n_table, 0);
10223 name = gen_const_xmlChar_ptr(n_name, 1);
10224 userdata = gen_userdata(n_userdata, 2);
10225 f = gen_xmlHashDeallocator(n_f, 3);
10226
William M. Brackf13f77f2004-11-12 16:03:48 +000010227 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010228 desret_int(ret_val);
10229 call_tests++;
10230 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010231 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010232 des_userdata(n_userdata, userdata, 2);
10233 des_xmlHashDeallocator(n_f, f, 3);
10234 xmlResetLastError();
10235 if (mem_base != xmlMemBlocks()) {
10236 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10237 xmlMemBlocks() - mem_base);
10238 test_ret++;
10239 printf(" %d", n_table);
10240 printf(" %d", n_name);
10241 printf(" %d", n_userdata);
10242 printf(" %d", n_f);
10243 printf("\n");
10244 }
10245 }
10246 }
10247 }
10248 }
Daniel Veillard42595322004-11-08 10:52:06 +000010249 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010250
Daniel Veillard42595322004-11-08 10:52:06 +000010251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010252}
10253
10254
10255static int
10256test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010258
Daniel Veillard42595322004-11-08 10:52:06 +000010259 int mem_base;
10260 int ret_val;
10261 xmlHashTablePtr table; /* the hash table */
10262 int n_table;
10263 xmlChar * name; /* the name of the userdata */
10264 int n_name;
10265 xmlChar * name2; /* a second name of the userdata */
10266 int n_name2;
10267 void * userdata; /* a pointer to the userdata */
10268 int n_userdata;
10269 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10270 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010271
Daniel Veillard42595322004-11-08 10:52:06 +000010272 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10273 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10274 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10275 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10276 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10277 mem_base = xmlMemBlocks();
10278 table = gen_xmlHashTablePtr(n_table, 0);
10279 name = gen_const_xmlChar_ptr(n_name, 1);
10280 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10281 userdata = gen_userdata(n_userdata, 3);
10282 f = gen_xmlHashDeallocator(n_f, 4);
10283
William M. Brackf13f77f2004-11-12 16:03:48 +000010284 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010285 desret_int(ret_val);
10286 call_tests++;
10287 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010288 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10289 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010290 des_userdata(n_userdata, userdata, 3);
10291 des_xmlHashDeallocator(n_f, f, 4);
10292 xmlResetLastError();
10293 if (mem_base != xmlMemBlocks()) {
10294 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10295 xmlMemBlocks() - mem_base);
10296 test_ret++;
10297 printf(" %d", n_table);
10298 printf(" %d", n_name);
10299 printf(" %d", n_name2);
10300 printf(" %d", n_userdata);
10301 printf(" %d", n_f);
10302 printf("\n");
10303 }
10304 }
10305 }
10306 }
10307 }
10308 }
Daniel Veillard42595322004-11-08 10:52:06 +000010309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010310
Daniel Veillard42595322004-11-08 10:52:06 +000010311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010312}
10313
10314
10315static int
10316test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010318
Daniel Veillard42595322004-11-08 10:52:06 +000010319 int mem_base;
10320 int ret_val;
10321 xmlHashTablePtr table; /* the hash table */
10322 int n_table;
10323 xmlChar * name; /* the name of the userdata */
10324 int n_name;
10325 xmlChar * name2; /* a second name of the userdata */
10326 int n_name2;
10327 xmlChar * name3; /* a third name of the userdata */
10328 int n_name3;
10329 void * userdata; /* a pointer to the userdata */
10330 int n_userdata;
10331 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10332 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010333
Daniel Veillard42595322004-11-08 10:52:06 +000010334 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10335 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10336 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10337 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10338 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10339 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10340 mem_base = xmlMemBlocks();
10341 table = gen_xmlHashTablePtr(n_table, 0);
10342 name = gen_const_xmlChar_ptr(n_name, 1);
10343 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10344 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10345 userdata = gen_userdata(n_userdata, 4);
10346 f = gen_xmlHashDeallocator(n_f, 5);
10347
William M. Brackf13f77f2004-11-12 16:03:48 +000010348 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010349 desret_int(ret_val);
10350 call_tests++;
10351 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010352 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10353 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10354 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010355 des_userdata(n_userdata, userdata, 4);
10356 des_xmlHashDeallocator(n_f, f, 5);
10357 xmlResetLastError();
10358 if (mem_base != xmlMemBlocks()) {
10359 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10360 xmlMemBlocks() - mem_base);
10361 test_ret++;
10362 printf(" %d", n_table);
10363 printf(" %d", n_name);
10364 printf(" %d", n_name2);
10365 printf(" %d", n_name3);
10366 printf(" %d", n_userdata);
10367 printf(" %d", n_f);
10368 printf("\n");
10369 }
10370 }
10371 }
10372 }
10373 }
10374 }
10375 }
Daniel Veillard42595322004-11-08 10:52:06 +000010376 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010377
Daniel Veillard42595322004-11-08 10:52:06 +000010378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010379}
10380
10381static int
10382test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010384
Daniel Veillard2ae13382005-01-25 23:45:06 +000010385 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010386 test_ret += test_xmlHashAddEntry();
10387 test_ret += test_xmlHashAddEntry2();
10388 test_ret += test_xmlHashAddEntry3();
10389 test_ret += test_xmlHashCopy();
10390 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010391 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010392 test_ret += test_xmlHashLookup();
10393 test_ret += test_xmlHashLookup2();
10394 test_ret += test_xmlHashLookup3();
10395 test_ret += test_xmlHashQLookup();
10396 test_ret += test_xmlHashQLookup2();
10397 test_ret += test_xmlHashQLookup3();
10398 test_ret += test_xmlHashRemoveEntry();
10399 test_ret += test_xmlHashRemoveEntry2();
10400 test_ret += test_xmlHashRemoveEntry3();
10401 test_ret += test_xmlHashScan();
10402 test_ret += test_xmlHashScan3();
10403 test_ret += test_xmlHashScanFull();
10404 test_ret += test_xmlHashScanFull3();
10405 test_ret += test_xmlHashSize();
10406 test_ret += test_xmlHashUpdateEntry();
10407 test_ret += test_xmlHashUpdateEntry2();
10408 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010409
Daniel Veillard42595322004-11-08 10:52:06 +000010410 if (test_ret != 0)
10411 printf("Module hash: %d errors\n", test_ret);
10412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010413}
10414
Daniel Veillardce682bc2004-11-05 17:22:25 +000010415#define gen_nb_xmlLinkPtr 1
10416static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10417 return(NULL);
10418}
10419static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10420}
10421
Daniel Veillardd93f6252004-11-02 15:53:51 +000010422static int
10423test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010425
Daniel Veillardce682bc2004-11-05 17:22:25 +000010426 int mem_base;
10427 void * ret_val;
10428 xmlLinkPtr lk; /* a link */
10429 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010430
Daniel Veillardce682bc2004-11-05 17:22:25 +000010431 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10432 mem_base = xmlMemBlocks();
10433 lk = gen_xmlLinkPtr(n_lk, 0);
10434
10435 ret_val = xmlLinkGetData(lk);
10436 desret_void_ptr(ret_val);
10437 call_tests++;
10438 des_xmlLinkPtr(n_lk, lk, 0);
10439 xmlResetLastError();
10440 if (mem_base != xmlMemBlocks()) {
10441 printf("Leak of %d blocks found in xmlLinkGetData",
10442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010443 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010444 printf(" %d", n_lk);
10445 printf("\n");
10446 }
10447 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010449
Daniel Veillard42595322004-11-08 10:52:06 +000010450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010451}
10452
10453
10454static int
10455test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010457
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010458 int mem_base;
10459 int ret_val;
10460 xmlListPtr l; /* a list */
10461 int n_l;
10462 void * data; /* the data */
10463 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010464
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010465 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10466 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010468 l = gen_xmlListPtr(n_l, 0);
10469 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010470
10471 ret_val = xmlListAppend(l, data);
10472 desret_int(ret_val);
10473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010474 des_xmlListPtr(n_l, l, 0);
10475 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010476 xmlResetLastError();
10477 if (mem_base != xmlMemBlocks()) {
10478 printf("Leak of %d blocks found in xmlListAppend",
10479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010480 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010481 printf(" %d", n_l);
10482 printf(" %d", n_data);
10483 printf("\n");
10484 }
10485 }
10486 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010488
Daniel Veillard42595322004-11-08 10:52:06 +000010489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010490}
10491
10492
10493static int
10494test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010496
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010497 int mem_base;
10498 xmlListPtr l; /* a list */
10499 int n_l;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010503 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010504
10505 xmlListClear(l);
10506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010507 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010508 xmlResetLastError();
10509 if (mem_base != xmlMemBlocks()) {
10510 printf("Leak of %d blocks found in xmlListClear",
10511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010512 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010513 printf(" %d", n_l);
10514 printf("\n");
10515 }
10516 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010517 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010518
Daniel Veillard42595322004-11-08 10:52:06 +000010519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010520}
10521
10522
Daniel Veillardce682bc2004-11-05 17:22:25 +000010523#define gen_nb_const_xmlListPtr 1
10524static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10525 return(NULL);
10526}
10527static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10528}
10529
Daniel Veillardd93f6252004-11-02 15:53:51 +000010530static int
10531test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010533
Daniel Veillardce682bc2004-11-05 17:22:25 +000010534 int mem_base;
10535 int ret_val;
10536 xmlListPtr cur; /* the new list */
10537 int n_cur;
10538 xmlListPtr old; /* the old list */
10539 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010540
Daniel Veillardce682bc2004-11-05 17:22:25 +000010541 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10542 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10543 mem_base = xmlMemBlocks();
10544 cur = gen_xmlListPtr(n_cur, 0);
10545 old = gen_const_xmlListPtr(n_old, 1);
10546
William M. Brackf13f77f2004-11-12 16:03:48 +000010547 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010548 desret_int(ret_val);
10549 call_tests++;
10550 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010551 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010552 xmlResetLastError();
10553 if (mem_base != xmlMemBlocks()) {
10554 printf("Leak of %d blocks found in xmlListCopy",
10555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010556 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010557 printf(" %d", n_cur);
10558 printf(" %d", n_old);
10559 printf("\n");
10560 }
10561 }
10562 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010563 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010564
Daniel Veillard42595322004-11-08 10:52:06 +000010565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010566}
10567
10568
10569static int
10570test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010572
10573
10574 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576}
10577
10578
10579static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010580test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010582
10583
10584 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010586}
10587
10588
10589static int
10590test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010592
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010593 int mem_base;
10594 int ret_val;
10595 xmlListPtr l; /* a list */
10596 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010597
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010598 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010600 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010601
10602 ret_val = xmlListEmpty(l);
10603 desret_int(ret_val);
10604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010605 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010606 xmlResetLastError();
10607 if (mem_base != xmlMemBlocks()) {
10608 printf("Leak of %d blocks found in xmlListEmpty",
10609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010610 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010611 printf(" %d", n_l);
10612 printf("\n");
10613 }
10614 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010616
Daniel Veillard42595322004-11-08 10:52:06 +000010617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010618}
10619
10620
10621static int
10622test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010624
10625
10626 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628}
10629
10630
10631static int
10632test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010634
10635
10636 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010638}
10639
10640
10641static int
10642test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010644
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010645 int mem_base;
10646 int ret_val;
10647 xmlListPtr l; /* a list */
10648 int n_l;
10649 void * data; /* the data */
10650 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010651
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010652 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10653 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010655 l = gen_xmlListPtr(n_l, 0);
10656 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010657
10658 ret_val = xmlListInsert(l, data);
10659 desret_int(ret_val);
10660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010661 des_xmlListPtr(n_l, l, 0);
10662 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010663 xmlResetLastError();
10664 if (mem_base != xmlMemBlocks()) {
10665 printf("Leak of %d blocks found in xmlListInsert",
10666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010667 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010668 printf(" %d", n_l);
10669 printf(" %d", n_data);
10670 printf("\n");
10671 }
10672 }
10673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010675
Daniel Veillard42595322004-11-08 10:52:06 +000010676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010677}
10678
10679
10680static int
10681test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010683
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010684 int mem_base;
10685 xmlListPtr l1; /* the original list */
10686 int n_l1;
10687 xmlListPtr l2; /* the new list */
10688 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010689
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010690 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10691 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10692 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010693 l1 = gen_xmlListPtr(n_l1, 0);
10694 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010695
10696 xmlListMerge(l1, l2);
10697 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010698 des_xmlListPtr(n_l1, l1, 0);
10699 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010700 xmlResetLastError();
10701 if (mem_base != xmlMemBlocks()) {
10702 printf("Leak of %d blocks found in xmlListMerge",
10703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010704 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010705 printf(" %d", n_l1);
10706 printf(" %d", n_l2);
10707 printf("\n");
10708 }
10709 }
10710 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010712
Daniel Veillard42595322004-11-08 10:52:06 +000010713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010714}
10715
10716
10717static int
10718test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010720
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010721 int mem_base;
10722 xmlListPtr l; /* a list */
10723 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010724
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010725 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010727 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010728
10729 xmlListPopBack(l);
10730 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010731 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010732 xmlResetLastError();
10733 if (mem_base != xmlMemBlocks()) {
10734 printf("Leak of %d blocks found in xmlListPopBack",
10735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010736 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010737 printf(" %d", n_l);
10738 printf("\n");
10739 }
10740 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010742
Daniel Veillard42595322004-11-08 10:52:06 +000010743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010744}
10745
10746
10747static int
10748test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010750
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010751 int mem_base;
10752 xmlListPtr l; /* a list */
10753 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010754
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010755 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10756 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010757 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010758
10759 xmlListPopFront(l);
10760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010761 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010762 xmlResetLastError();
10763 if (mem_base != xmlMemBlocks()) {
10764 printf("Leak of %d blocks found in xmlListPopFront",
10765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010766 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010767 printf(" %d", n_l);
10768 printf("\n");
10769 }
10770 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010772
Daniel Veillard42595322004-11-08 10:52:06 +000010773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010774}
10775
10776
10777static int
10778test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010781 int mem_base;
10782 int ret_val;
10783 xmlListPtr l; /* a list */
10784 int n_l;
10785 void * data; /* new data */
10786 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010787
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010788 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10789 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010791 l = gen_xmlListPtr(n_l, 0);
10792 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010793
10794 ret_val = xmlListPushBack(l, data);
10795 desret_int(ret_val);
10796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 des_xmlListPtr(n_l, l, 0);
10798 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010799 xmlResetLastError();
10800 if (mem_base != xmlMemBlocks()) {
10801 printf("Leak of %d blocks found in xmlListPushBack",
10802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010803 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010804 printf(" %d", n_l);
10805 printf(" %d", n_data);
10806 printf("\n");
10807 }
10808 }
10809 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010811
Daniel Veillard42595322004-11-08 10:52:06 +000010812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010813}
10814
10815
10816static int
10817test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010819
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010820 int mem_base;
10821 int ret_val;
10822 xmlListPtr l; /* a list */
10823 int n_l;
10824 void * data; /* new data */
10825 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010826
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010827 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10828 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010830 l = gen_xmlListPtr(n_l, 0);
10831 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010832
10833 ret_val = xmlListPushFront(l, data);
10834 desret_int(ret_val);
10835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010836 des_xmlListPtr(n_l, l, 0);
10837 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010838 xmlResetLastError();
10839 if (mem_base != xmlMemBlocks()) {
10840 printf("Leak of %d blocks found in xmlListPushFront",
10841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010842 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010843 printf(" %d", n_l);
10844 printf(" %d", n_data);
10845 printf("\n");
10846 }
10847 }
10848 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010849 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010850
Daniel Veillard42595322004-11-08 10:52:06 +000010851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010852}
10853
10854
10855static int
10856test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010858
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010859 int mem_base;
10860 int ret_val;
10861 xmlListPtr l; /* a list */
10862 int n_l;
10863 void * data; /* list data */
10864 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010865
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010866 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10867 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010869 l = gen_xmlListPtr(n_l, 0);
10870 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010871
10872 ret_val = xmlListRemoveAll(l, data);
10873 desret_int(ret_val);
10874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010875 des_xmlListPtr(n_l, l, 0);
10876 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010877 xmlResetLastError();
10878 if (mem_base != xmlMemBlocks()) {
10879 printf("Leak of %d blocks found in xmlListRemoveAll",
10880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010881 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010882 printf(" %d", n_l);
10883 printf(" %d", n_data);
10884 printf("\n");
10885 }
10886 }
10887 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010888 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010889
Daniel Veillard42595322004-11-08 10:52:06 +000010890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010891}
10892
10893
10894static int
10895test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010897
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010898 int mem_base;
10899 int ret_val;
10900 xmlListPtr l; /* a list */
10901 int n_l;
10902 void * data; /* list data */
10903 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010904
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010905 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10906 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10907 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010908 l = gen_xmlListPtr(n_l, 0);
10909 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010910
10911 ret_val = xmlListRemoveFirst(l, data);
10912 desret_int(ret_val);
10913 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010914 des_xmlListPtr(n_l, l, 0);
10915 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010916 xmlResetLastError();
10917 if (mem_base != xmlMemBlocks()) {
10918 printf("Leak of %d blocks found in xmlListRemoveFirst",
10919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010920 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010921 printf(" %d", n_l);
10922 printf(" %d", n_data);
10923 printf("\n");
10924 }
10925 }
10926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010928
Daniel Veillard42595322004-11-08 10:52:06 +000010929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010930}
10931
10932
10933static int
10934test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010936
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010937 int mem_base;
10938 int ret_val;
10939 xmlListPtr l; /* a list */
10940 int n_l;
10941 void * data; /* list data */
10942 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010943
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010944 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10945 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010947 l = gen_xmlListPtr(n_l, 0);
10948 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010949
10950 ret_val = xmlListRemoveLast(l, data);
10951 desret_int(ret_val);
10952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010953 des_xmlListPtr(n_l, l, 0);
10954 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010955 xmlResetLastError();
10956 if (mem_base != xmlMemBlocks()) {
10957 printf("Leak of %d blocks found in xmlListRemoveLast",
10958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010959 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010960 printf(" %d", n_l);
10961 printf(" %d", n_data);
10962 printf("\n");
10963 }
10964 }
10965 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010966 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010967
Daniel Veillard42595322004-11-08 10:52:06 +000010968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010969}
10970
10971
10972static int
10973test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010975
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010976 int mem_base;
10977 xmlListPtr l; /* a list */
10978 int n_l;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010982 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010983
10984 xmlListReverse(l);
10985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010986 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010987 xmlResetLastError();
10988 if (mem_base != xmlMemBlocks()) {
10989 printf("Leak of %d blocks found in xmlListReverse",
10990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010991 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010992 printf(" %d", n_l);
10993 printf("\n");
10994 }
10995 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010996 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010997
Daniel Veillard42595322004-11-08 10:52:06 +000010998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010999}
11000
11001
11002static int
11003test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011005
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011006 int mem_base;
11007 void * ret_val;
11008 xmlListPtr l; /* a list */
11009 int n_l;
11010 void * data; /* a search value */
11011 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011012
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011013 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11014 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011016 l = gen_xmlListPtr(n_l, 0);
11017 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011018
11019 ret_val = xmlListReverseSearch(l, data);
11020 desret_void_ptr(ret_val);
11021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011022 des_xmlListPtr(n_l, l, 0);
11023 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011024 xmlResetLastError();
11025 if (mem_base != xmlMemBlocks()) {
11026 printf("Leak of %d blocks found in xmlListReverseSearch",
11027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011028 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011029 printf(" %d", n_l);
11030 printf(" %d", n_data);
11031 printf("\n");
11032 }
11033 }
11034 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011035 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011036
Daniel Veillard42595322004-11-08 10:52:06 +000011037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011038}
11039
11040
11041static int
11042test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011044
11045
11046 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011048}
11049
11050
11051static int
11052test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011054
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011055 int mem_base;
11056 void * ret_val;
11057 xmlListPtr l; /* a list */
11058 int n_l;
11059 void * data; /* a search value */
11060 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011061
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011062 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11063 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011065 l = gen_xmlListPtr(n_l, 0);
11066 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011067
11068 ret_val = xmlListSearch(l, data);
11069 desret_void_ptr(ret_val);
11070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 des_xmlListPtr(n_l, l, 0);
11072 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011073 xmlResetLastError();
11074 if (mem_base != xmlMemBlocks()) {
11075 printf("Leak of %d blocks found in xmlListSearch",
11076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011077 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011078 printf(" %d", n_l);
11079 printf(" %d", n_data);
11080 printf("\n");
11081 }
11082 }
11083 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011084 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011085
Daniel Veillard42595322004-11-08 10:52:06 +000011086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011087}
11088
11089
11090static int
11091test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011093
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011094 int mem_base;
11095 int ret_val;
11096 xmlListPtr l; /* a list */
11097 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011098
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011099 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011102
11103 ret_val = xmlListSize(l);
11104 desret_int(ret_val);
11105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011106 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011107 xmlResetLastError();
11108 if (mem_base != xmlMemBlocks()) {
11109 printf("Leak of %d blocks found in xmlListSize",
11110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011111 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011112 printf(" %d", n_l);
11113 printf("\n");
11114 }
11115 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011116 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011117
Daniel Veillard42595322004-11-08 10:52:06 +000011118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011119}
11120
11121
11122static int
11123test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011125
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011126 int mem_base;
11127 xmlListPtr l; /* a list */
11128 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011130 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011132 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011133
11134 xmlListSort(l);
11135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011136 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011137 xmlResetLastError();
11138 if (mem_base != xmlMemBlocks()) {
11139 printf("Leak of %d blocks found in xmlListSort",
11140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011141 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011142 printf(" %d", n_l);
11143 printf("\n");
11144 }
11145 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011146 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011147
Daniel Veillard42595322004-11-08 10:52:06 +000011148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011149}
11150
11151
11152static int
11153test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011155
11156
11157 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011159}
11160
11161static int
11162test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011164
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011165 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011166 test_ret += test_xmlLinkGetData();
11167 test_ret += test_xmlListAppend();
11168 test_ret += test_xmlListClear();
11169 test_ret += test_xmlListCopy();
11170 test_ret += test_xmlListCreate();
11171 test_ret += test_xmlListDup();
11172 test_ret += test_xmlListEmpty();
11173 test_ret += test_xmlListEnd();
11174 test_ret += test_xmlListFront();
11175 test_ret += test_xmlListInsert();
11176 test_ret += test_xmlListMerge();
11177 test_ret += test_xmlListPopBack();
11178 test_ret += test_xmlListPopFront();
11179 test_ret += test_xmlListPushBack();
11180 test_ret += test_xmlListPushFront();
11181 test_ret += test_xmlListRemoveAll();
11182 test_ret += test_xmlListRemoveFirst();
11183 test_ret += test_xmlListRemoveLast();
11184 test_ret += test_xmlListReverse();
11185 test_ret += test_xmlListReverseSearch();
11186 test_ret += test_xmlListReverseWalk();
11187 test_ret += test_xmlListSearch();
11188 test_ret += test_xmlListSize();
11189 test_ret += test_xmlListSort();
11190 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011191
Daniel Veillard42595322004-11-08 10:52:06 +000011192 if (test_ret != 0)
11193 printf("Module list: %d errors\n", test_ret);
11194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011195}
11196
11197static int
11198test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011200
William M. Brack21e4ef22005-01-02 09:53:13 +000011201#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011202 int mem_base;
11203 int ret_val;
11204 void * ctx; /* an FTP context */
11205 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011206
Daniel Veillard27f20102004-11-05 11:50:11 +000011207 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11208 mem_base = xmlMemBlocks();
11209 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11210
11211 ret_val = xmlNanoFTPCheckResponse(ctx);
11212 desret_int(ret_val);
11213 call_tests++;
11214 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11215 xmlResetLastError();
11216 if (mem_base != xmlMemBlocks()) {
11217 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011219 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011220 printf(" %d", n_ctx);
11221 printf("\n");
11222 }
11223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011224 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011225#endif
11226
Daniel Veillard42595322004-11-08 10:52:06 +000011227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011228}
11229
11230
11231static int
11232test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011234
William M. Brack21e4ef22005-01-02 09:53:13 +000011235#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011236 int mem_base;
11237
11238 mem_base = xmlMemBlocks();
11239
11240 xmlNanoFTPCleanup();
11241 call_tests++;
11242 xmlResetLastError();
11243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011244 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011247 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011249 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011250#endif
11251
Daniel Veillard42595322004-11-08 10:52:06 +000011252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011253}
11254
11255
11256static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011257test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011259
William M. Brack21e4ef22005-01-02 09:53:13 +000011260#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011261 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011262 int ret_val;
11263 void * ctx; /* an FTP context */
11264 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011265
Daniel Veillard27f20102004-11-05 11:50:11 +000011266 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011267 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011268 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011269
Daniel Veillard27f20102004-11-05 11:50:11 +000011270 ret_val = xmlNanoFTPCloseConnection(ctx);
11271 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011272 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011273 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011274 xmlResetLastError();
11275 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011276 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011278 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011279 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011280 printf("\n");
11281 }
11282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011283 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011284#endif
11285
Daniel Veillard42595322004-11-08 10:52:06 +000011286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011287}
11288
11289
11290static int
11291test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293
William M. Brack21e4ef22005-01-02 09:53:13 +000011294#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011295 int mem_base;
11296 int ret_val;
11297 void * ctx; /* an FTP context */
11298 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011299 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011300 int n_directory;
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++) {
11303 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11304 mem_base = xmlMemBlocks();
11305 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11306 directory = gen_const_char_ptr(n_directory, 1);
11307
William M. Brackf13f77f2004-11-12 16:03:48 +000011308 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011309 desret_int(ret_val);
11310 call_tests++;
11311 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011312 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011313 xmlResetLastError();
11314 if (mem_base != xmlMemBlocks()) {
11315 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011317 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011318 printf(" %d", n_ctx);
11319 printf(" %d", n_directory);
11320 printf("\n");
11321 }
11322 }
11323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011324 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011325#endif
11326
Daniel Veillard42595322004-11-08 10:52:06 +000011327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011328}
11329
11330
11331static int
11332test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011334
William M. Brack21e4ef22005-01-02 09:53:13 +000011335#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011336 int mem_base;
11337 int ret_val;
11338 void * ctx; /* an FTP context */
11339 int n_ctx;
11340 const char * file; /* a file or directory on the server */
11341 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011342
Daniel Veillard27f20102004-11-05 11:50:11 +000011343 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11344 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11345 mem_base = xmlMemBlocks();
11346 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11347 file = gen_filepath(n_file, 1);
11348
11349 ret_val = xmlNanoFTPDele(ctx, file);
11350 desret_int(ret_val);
11351 call_tests++;
11352 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11353 des_filepath(n_file, file, 1);
11354 xmlResetLastError();
11355 if (mem_base != xmlMemBlocks()) {
11356 printf("Leak of %d blocks found in xmlNanoFTPDele",
11357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011358 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011359 printf(" %d", n_ctx);
11360 printf(" %d", n_file);
11361 printf("\n");
11362 }
11363 }
11364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011365 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011366#endif
11367
Daniel Veillard42595322004-11-08 10:52:06 +000011368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011369}
11370
11371
11372static int
11373test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011375
11376
11377 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011379}
11380
11381
11382static int
11383test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011385
William M. Brack21e4ef22005-01-02 09:53:13 +000011386#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011387 int mem_base;
11388 int ret_val;
11389 void * ctx; /* an FTP context */
11390 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011391
Daniel Veillard27f20102004-11-05 11:50:11 +000011392 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11393 mem_base = xmlMemBlocks();
11394 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11395
11396 ret_val = xmlNanoFTPGetConnection(ctx);
11397 desret_int(ret_val);
11398 call_tests++;
11399 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11400 xmlResetLastError();
11401 if (mem_base != xmlMemBlocks()) {
11402 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011404 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011405 printf(" %d", n_ctx);
11406 printf("\n");
11407 }
11408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011409 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011410#endif
11411
Daniel Veillard42595322004-11-08 10:52:06 +000011412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011413}
11414
11415
11416static int
11417test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011419
William M. Brack21e4ef22005-01-02 09:53:13 +000011420#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011421 int mem_base;
11422 int ret_val;
11423 void * ctx; /* an FTP context */
11424 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011425
Daniel Veillard27f20102004-11-05 11:50:11 +000011426 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11427 mem_base = xmlMemBlocks();
11428 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11429
11430 ret_val = xmlNanoFTPGetResponse(ctx);
11431 desret_int(ret_val);
11432 call_tests++;
11433 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11434 xmlResetLastError();
11435 if (mem_base != xmlMemBlocks()) {
11436 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011438 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011439 printf(" %d", n_ctx);
11440 printf("\n");
11441 }
11442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011443 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011444#endif
11445
Daniel Veillard42595322004-11-08 10:52:06 +000011446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011447}
11448
11449
11450static int
11451test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011453
William M. Brack21e4ef22005-01-02 09:53:13 +000011454#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011455 int mem_base;
11456 int ret_val;
11457 void * ctx; /* an FTP context */
11458 int n_ctx;
11459 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11460 int n_filename;
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 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11464 mem_base = xmlMemBlocks();
11465 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11466 filename = gen_filepath(n_filename, 1);
11467
11468 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11469 desret_int(ret_val);
11470 call_tests++;
11471 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11472 des_filepath(n_filename, filename, 1);
11473 xmlResetLastError();
11474 if (mem_base != xmlMemBlocks()) {
11475 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011477 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011478 printf(" %d", n_ctx);
11479 printf(" %d", n_filename);
11480 printf("\n");
11481 }
11482 }
11483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011484 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011485#endif
11486
Daniel Veillard42595322004-11-08 10:52:06 +000011487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011488}
11489
11490
11491static int
11492test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011494
William M. Brack21e4ef22005-01-02 09:53:13 +000011495#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011496 int mem_base;
11497
11498 mem_base = xmlMemBlocks();
11499
11500 xmlNanoFTPInit();
11501 call_tests++;
11502 xmlResetLastError();
11503 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011504 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011506 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011507 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011509 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011510#endif
11511
Daniel Veillard42595322004-11-08 10:52:06 +000011512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011513}
11514
11515
11516static int
11517test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011519
11520
11521 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011523}
11524
11525
11526static int
11527test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011529
11530
11531 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011533}
11534
11535
11536static int
11537test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011539
William M. Brack21e4ef22005-01-02 09:53:13 +000011540#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011541 int mem_base;
11542 void * ret_val;
11543 const char * URL; /* the URL to the resource */
11544 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011545
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011546 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11547 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011548 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011549
11550 ret_val = xmlNanoFTPOpen(URL);
11551 desret_void_ptr(ret_val);
11552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011553 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011554 xmlResetLastError();
11555 if (mem_base != xmlMemBlocks()) {
11556 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011558 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011559 printf(" %d", n_URL);
11560 printf("\n");
11561 }
11562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011563 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011564#endif
11565
Daniel Veillard42595322004-11-08 10:52:06 +000011566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011567}
11568
11569
11570static int
11571test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011573
William M. Brack21e4ef22005-01-02 09:53:13 +000011574#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011575 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576 int n_host;
11577 int port; /* the proxy port */
11578 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011579 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011580 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011581 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011582 int n_passwd;
11583 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11584 int n_type;
11585
11586 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11587 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11588 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11589 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11590 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011591 host = gen_const_char_ptr(n_host, 0);
11592 port = gen_int(n_port, 1);
11593 user = gen_const_char_ptr(n_user, 2);
11594 passwd = gen_const_char_ptr(n_passwd, 3);
11595 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011596
William M. Brackf13f77f2004-11-12 16:03:48 +000011597 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011598 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011599 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011600 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011601 des_const_char_ptr(n_user, (const char *)user, 2);
11602 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011603 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011604 xmlResetLastError();
11605 }
11606 }
11607 }
11608 }
11609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011610 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011611#endif
11612
Daniel Veillard42595322004-11-08 10:52:06 +000011613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011614}
11615
11616
11617static int
11618test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011620
William M. Brack21e4ef22005-01-02 09:53:13 +000011621#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011622 int mem_base;
11623 int ret_val;
11624 void * ctx; /* an FTP context */
11625 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011626
Daniel Veillard27f20102004-11-05 11:50:11 +000011627 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11628 mem_base = xmlMemBlocks();
11629 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11630
11631 ret_val = xmlNanoFTPQuit(ctx);
11632 desret_int(ret_val);
11633 call_tests++;
11634 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11635 xmlResetLastError();
11636 if (mem_base != xmlMemBlocks()) {
11637 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011639 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011640 printf(" %d", n_ctx);
11641 printf("\n");
11642 }
11643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011644 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011645#endif
11646
Daniel Veillard42595322004-11-08 10:52:06 +000011647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011648}
11649
11650
11651static int
11652test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011654
William M. Brack21e4ef22005-01-02 09:53:13 +000011655#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011656 int mem_base;
11657 int ret_val;
11658 void * ctx; /* the FTP context */
11659 int n_ctx;
11660 void * dest; /* a buffer */
11661 int n_dest;
11662 int len; /* the buffer length */
11663 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664
Daniel Veillard27f20102004-11-05 11:50:11 +000011665 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11666 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11667 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11668 mem_base = xmlMemBlocks();
11669 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11670 dest = gen_void_ptr(n_dest, 1);
11671 len = gen_int(n_len, 2);
11672
11673 ret_val = xmlNanoFTPRead(ctx, dest, len);
11674 desret_int(ret_val);
11675 call_tests++;
11676 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11677 des_void_ptr(n_dest, dest, 1);
11678 des_int(n_len, len, 2);
11679 xmlResetLastError();
11680 if (mem_base != xmlMemBlocks()) {
11681 printf("Leak of %d blocks found in xmlNanoFTPRead",
11682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011683 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011684 printf(" %d", n_ctx);
11685 printf(" %d", n_dest);
11686 printf(" %d", n_len);
11687 printf("\n");
11688 }
11689 }
11690 }
11691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011692 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011693#endif
11694
Daniel Veillard42595322004-11-08 10:52:06 +000011695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011696}
11697
11698
11699static int
11700test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011702
William M. Brack21e4ef22005-01-02 09:53:13 +000011703#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011704 const char * URL; /* The proxy URL used to initialize the proxy context */
11705 int n_URL;
11706
11707 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011708 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011709
11710 xmlNanoFTPScanProxy(URL);
11711 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011712 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011713 xmlResetLastError();
11714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011715 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011716#endif
11717
Daniel Veillard42595322004-11-08 10:52:06 +000011718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011719}
11720
11721
11722static int
11723test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011725
William M. Brack21e4ef22005-01-02 09:53:13 +000011726#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011727 int mem_base;
11728 int ret_val;
11729 void * ctx; /* an FTP context */
11730 int n_ctx;
11731 const char * URL; /* The URL used to update the context */
11732 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011733
Daniel Veillard27f20102004-11-05 11:50:11 +000011734 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11735 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11736 mem_base = xmlMemBlocks();
11737 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11738 URL = gen_filepath(n_URL, 1);
11739
11740 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11741 desret_int(ret_val);
11742 call_tests++;
11743 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11744 des_filepath(n_URL, URL, 1);
11745 xmlResetLastError();
11746 if (mem_base != xmlMemBlocks()) {
11747 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011749 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011750 printf(" %d", n_ctx);
11751 printf(" %d", n_URL);
11752 printf("\n");
11753 }
11754 }
11755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011756 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011757#endif
11758
Daniel Veillard42595322004-11-08 10:52:06 +000011759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011760}
11761
11762static int
11763test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011765
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011766 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011767 test_ret += test_xmlNanoFTPCheckResponse();
11768 test_ret += test_xmlNanoFTPCleanup();
11769 test_ret += test_xmlNanoFTPCloseConnection();
11770 test_ret += test_xmlNanoFTPCwd();
11771 test_ret += test_xmlNanoFTPDele();
11772 test_ret += test_xmlNanoFTPGet();
11773 test_ret += test_xmlNanoFTPGetConnection();
11774 test_ret += test_xmlNanoFTPGetResponse();
11775 test_ret += test_xmlNanoFTPGetSocket();
11776 test_ret += test_xmlNanoFTPInit();
11777 test_ret += test_xmlNanoFTPList();
11778 test_ret += test_xmlNanoFTPNewCtxt();
11779 test_ret += test_xmlNanoFTPOpen();
11780 test_ret += test_xmlNanoFTPProxy();
11781 test_ret += test_xmlNanoFTPQuit();
11782 test_ret += test_xmlNanoFTPRead();
11783 test_ret += test_xmlNanoFTPScanProxy();
11784 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011785
Daniel Veillard42595322004-11-08 10:52:06 +000011786 if (test_ret != 0)
11787 printf("Module nanoftp: %d errors\n", test_ret);
11788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011789}
11790
11791static int
11792test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011794
William M. Brack21e4ef22005-01-02 09:53:13 +000011795#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011796 int mem_base;
11797 const char * ret_val;
11798 void * ctx; /* the HTTP context */
11799 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011800
Daniel Veillard27f20102004-11-05 11:50:11 +000011801 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11802 mem_base = xmlMemBlocks();
11803 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11804
11805 ret_val = xmlNanoHTTPAuthHeader(ctx);
11806 desret_const_char_ptr(ret_val);
11807 call_tests++;
11808 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11809 xmlResetLastError();
11810 if (mem_base != xmlMemBlocks()) {
11811 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011813 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011814 printf(" %d", n_ctx);
11815 printf("\n");
11816 }
11817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011818 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011819#endif
11820
Daniel Veillard42595322004-11-08 10:52:06 +000011821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011822}
11823
11824
11825static int
11826test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011828
William M. Brack21e4ef22005-01-02 09:53:13 +000011829#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011830 int mem_base;
11831
11832 mem_base = xmlMemBlocks();
11833
11834 xmlNanoHTTPCleanup();
11835 call_tests++;
11836 xmlResetLastError();
11837 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011838 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011840 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011841 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011843 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011844#endif
11845
Daniel Veillard42595322004-11-08 10:52:06 +000011846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011847}
11848
11849
11850static int
11851test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011853
William M. Brack21e4ef22005-01-02 09:53:13 +000011854#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011855 int mem_base;
11856 void * ctx; /* the HTTP context */
11857 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011858
Daniel Veillard27f20102004-11-05 11:50:11 +000011859 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11860 mem_base = xmlMemBlocks();
11861 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11862
11863 xmlNanoHTTPClose(ctx);
11864 call_tests++;
11865 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11866 xmlResetLastError();
11867 if (mem_base != xmlMemBlocks()) {
11868 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011870 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011871 printf(" %d", n_ctx);
11872 printf("\n");
11873 }
11874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011875 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011876#endif
11877
Daniel Veillard42595322004-11-08 10:52:06 +000011878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011879}
11880
11881
11882static int
11883test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011885
William M. Brack21e4ef22005-01-02 09:53:13 +000011886#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011887 int mem_base;
11888 int ret_val;
11889 void * ctx; /* the HTTP context */
11890 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011891
Daniel Veillard27f20102004-11-05 11:50:11 +000011892 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11893 mem_base = xmlMemBlocks();
11894 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11895
11896 ret_val = xmlNanoHTTPContentLength(ctx);
11897 desret_int(ret_val);
11898 call_tests++;
11899 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11900 xmlResetLastError();
11901 if (mem_base != xmlMemBlocks()) {
11902 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011904 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011905 printf(" %d", n_ctx);
11906 printf("\n");
11907 }
11908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011909 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011910#endif
11911
Daniel Veillard42595322004-11-08 10:52:06 +000011912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011913}
11914
11915
11916static int
11917test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919
William M. Brack21e4ef22005-01-02 09:53:13 +000011920#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011921 int mem_base;
11922 const char * ret_val;
11923 void * ctx; /* the HTTP context */
11924 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011925
Daniel Veillard27f20102004-11-05 11:50:11 +000011926 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11927 mem_base = xmlMemBlocks();
11928 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11929
11930 ret_val = xmlNanoHTTPEncoding(ctx);
11931 desret_const_char_ptr(ret_val);
11932 call_tests++;
11933 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11934 xmlResetLastError();
11935 if (mem_base != xmlMemBlocks()) {
11936 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011938 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011939 printf(" %d", n_ctx);
11940 printf("\n");
11941 }
11942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011943 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011944#endif
11945
Daniel Veillard42595322004-11-08 10:52:06 +000011946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011947}
11948
11949
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011950#define gen_nb_char_ptr_ptr 1
11951static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11952 return(NULL);
11953}
11954static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11955}
11956
Daniel Veillardd93f6252004-11-02 15:53:51 +000011957static int
11958test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011960
William M. Brack21e4ef22005-01-02 09:53:13 +000011961#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011962 int mem_base;
11963 int ret_val;
11964 const char * URL; /* The URL to load */
11965 int n_URL;
11966 const char * filename; /* the filename where the content should be saved */
11967 int n_filename;
11968 char ** contentType; /* if available the Content-Type information will be returned at that location */
11969 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011970
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011971 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11972 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11973 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11974 mem_base = xmlMemBlocks();
11975 URL = gen_filepath(n_URL, 0);
11976 filename = gen_filepath(n_filename, 1);
11977 contentType = gen_char_ptr_ptr(n_contentType, 2);
11978
11979 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11980 desret_int(ret_val);
11981 call_tests++;
11982 des_filepath(n_URL, URL, 0);
11983 des_filepath(n_filename, filename, 1);
11984 des_char_ptr_ptr(n_contentType, contentType, 2);
11985 xmlResetLastError();
11986 if (mem_base != xmlMemBlocks()) {
11987 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011989 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011990 printf(" %d", n_URL);
11991 printf(" %d", n_filename);
11992 printf(" %d", n_contentType);
11993 printf("\n");
11994 }
11995 }
11996 }
11997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011998 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011999#endif
12000
Daniel Veillard42595322004-11-08 10:52:06 +000012001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012002}
12003
12004
12005static int
12006test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012008
William M. Brack21e4ef22005-01-02 09:53:13 +000012009#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012010 int mem_base;
12011
12012 mem_base = xmlMemBlocks();
12013
12014 xmlNanoHTTPInit();
12015 call_tests++;
12016 xmlResetLastError();
12017 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012018 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012020 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012021 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012023 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012024#endif
12025
Daniel Veillard42595322004-11-08 10:52:06 +000012026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012027}
12028
12029
12030static int
12031test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012033
William M. Brack21e4ef22005-01-02 09:53:13 +000012034#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012035 int mem_base;
12036 void * ret_val;
12037 const char * URL; /* The URL to load */
12038 int n_URL;
12039 char * method; /* the HTTP method to use */
12040 int n_method;
12041 char * input; /* the input string if any */
12042 int n_input;
12043 char ** contentType; /* the Content-Type information IN and OUT */
12044 int n_contentType;
12045 char * headers; /* the extra headers */
12046 int n_headers;
12047 int ilen; /* input length */
12048 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012049
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012050 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12051 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12052 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12053 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12054 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12055 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12056 mem_base = xmlMemBlocks();
12057 URL = gen_filepath(n_URL, 0);
12058 method = gen_const_char_ptr(n_method, 1);
12059 input = gen_const_char_ptr(n_input, 2);
12060 contentType = gen_char_ptr_ptr(n_contentType, 3);
12061 headers = gen_const_char_ptr(n_headers, 4);
12062 ilen = gen_int(n_ilen, 5);
12063
William M. Brackf13f77f2004-11-12 16:03:48 +000012064 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012065 desret_void_ptr(ret_val);
12066 call_tests++;
12067 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012068 des_const_char_ptr(n_method, (const char *)method, 1);
12069 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012070 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012071 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012072 des_int(n_ilen, ilen, 5);
12073 xmlResetLastError();
12074 if (mem_base != xmlMemBlocks()) {
12075 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012077 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012078 printf(" %d", n_URL);
12079 printf(" %d", n_method);
12080 printf(" %d", n_input);
12081 printf(" %d", n_contentType);
12082 printf(" %d", n_headers);
12083 printf(" %d", n_ilen);
12084 printf("\n");
12085 }
12086 }
12087 }
12088 }
12089 }
12090 }
12091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012092 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012093#endif
12094
Daniel Veillard42595322004-11-08 10:52:06 +000012095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012096}
12097
12098
12099static int
12100test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012102
William M. Brack21e4ef22005-01-02 09:53:13 +000012103#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012104 int mem_base;
12105 void * ret_val;
12106 const char * URL; /* The URL to load */
12107 int n_URL;
12108 char * method; /* the HTTP method to use */
12109 int n_method;
12110 char * input; /* the input string if any */
12111 int n_input;
12112 char ** contentType; /* the Content-Type information IN and OUT */
12113 int n_contentType;
12114 char ** redir; /* the redirected URL OUT */
12115 int n_redir;
12116 char * headers; /* the extra headers */
12117 int n_headers;
12118 int ilen; /* input length */
12119 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012120
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012121 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12122 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12123 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12124 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12125 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12126 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12127 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12128 mem_base = xmlMemBlocks();
12129 URL = gen_filepath(n_URL, 0);
12130 method = gen_const_char_ptr(n_method, 1);
12131 input = gen_const_char_ptr(n_input, 2);
12132 contentType = gen_char_ptr_ptr(n_contentType, 3);
12133 redir = gen_char_ptr_ptr(n_redir, 4);
12134 headers = gen_const_char_ptr(n_headers, 5);
12135 ilen = gen_int(n_ilen, 6);
12136
William M. Brackf13f77f2004-11-12 16:03:48 +000012137 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012138 desret_void_ptr(ret_val);
12139 call_tests++;
12140 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012141 des_const_char_ptr(n_method, (const char *)method, 1);
12142 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012143 des_char_ptr_ptr(n_contentType, contentType, 3);
12144 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012145 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012146 des_int(n_ilen, ilen, 6);
12147 xmlResetLastError();
12148 if (mem_base != xmlMemBlocks()) {
12149 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012151 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012152 printf(" %d", n_URL);
12153 printf(" %d", n_method);
12154 printf(" %d", n_input);
12155 printf(" %d", n_contentType);
12156 printf(" %d", n_redir);
12157 printf(" %d", n_headers);
12158 printf(" %d", n_ilen);
12159 printf("\n");
12160 }
12161 }
12162 }
12163 }
12164 }
12165 }
12166 }
12167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012168 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012169#endif
12170
Daniel Veillard42595322004-11-08 10:52:06 +000012171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012172}
12173
12174
12175static int
12176test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012178
William M. Brack21e4ef22005-01-02 09:53:13 +000012179#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012180 int mem_base;
12181 const char * ret_val;
12182 void * ctx; /* the HTTP context */
12183 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012184
Daniel Veillard27f20102004-11-05 11:50:11 +000012185 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12186 mem_base = xmlMemBlocks();
12187 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12188
12189 ret_val = xmlNanoHTTPMimeType(ctx);
12190 desret_const_char_ptr(ret_val);
12191 call_tests++;
12192 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12193 xmlResetLastError();
12194 if (mem_base != xmlMemBlocks()) {
12195 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012197 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012198 printf(" %d", n_ctx);
12199 printf("\n");
12200 }
12201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012202 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012203#endif
12204
Daniel Veillard42595322004-11-08 10:52:06 +000012205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012206}
12207
12208
12209static int
12210test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012212
William M. Brack21e4ef22005-01-02 09:53:13 +000012213#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012214 int mem_base;
12215 void * ret_val;
12216 const char * URL; /* The URL to load */
12217 int n_URL;
12218 char ** contentType; /* if available the Content-Type information will be returned at that location */
12219 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012220
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012221 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12222 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12223 mem_base = xmlMemBlocks();
12224 URL = gen_filepath(n_URL, 0);
12225 contentType = gen_char_ptr_ptr(n_contentType, 1);
12226
12227 ret_val = xmlNanoHTTPOpen(URL, contentType);
12228 desret_void_ptr(ret_val);
12229 call_tests++;
12230 des_filepath(n_URL, URL, 0);
12231 des_char_ptr_ptr(n_contentType, contentType, 1);
12232 xmlResetLastError();
12233 if (mem_base != xmlMemBlocks()) {
12234 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012236 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012237 printf(" %d", n_URL);
12238 printf(" %d", n_contentType);
12239 printf("\n");
12240 }
12241 }
12242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012243 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012244#endif
12245
Daniel Veillard42595322004-11-08 10:52:06 +000012246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012247}
12248
12249
12250static int
12251test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012253
William M. Brack21e4ef22005-01-02 09:53:13 +000012254#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012255 int mem_base;
12256 void * ret_val;
12257 const char * URL; /* The URL to load */
12258 int n_URL;
12259 char ** contentType; /* if available the Content-Type information will be returned at that location */
12260 int n_contentType;
12261 char ** redir; /* if available the redirected URL will be returned */
12262 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012263
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012264 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12265 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12266 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12267 mem_base = xmlMemBlocks();
12268 URL = gen_filepath(n_URL, 0);
12269 contentType = gen_char_ptr_ptr(n_contentType, 1);
12270 redir = gen_char_ptr_ptr(n_redir, 2);
12271
12272 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12273 desret_void_ptr(ret_val);
12274 call_tests++;
12275 des_filepath(n_URL, URL, 0);
12276 des_char_ptr_ptr(n_contentType, contentType, 1);
12277 des_char_ptr_ptr(n_redir, redir, 2);
12278 xmlResetLastError();
12279 if (mem_base != xmlMemBlocks()) {
12280 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012282 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012283 printf(" %d", n_URL);
12284 printf(" %d", n_contentType);
12285 printf(" %d", n_redir);
12286 printf("\n");
12287 }
12288 }
12289 }
12290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012291 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012292#endif
12293
Daniel Veillard42595322004-11-08 10:52:06 +000012294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012295}
12296
12297
12298static int
12299test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012301
William M. Brack21e4ef22005-01-02 09:53:13 +000012302#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012303 int mem_base;
12304 int ret_val;
12305 void * ctx; /* the HTTP context */
12306 int n_ctx;
12307 void * dest; /* a buffer */
12308 int n_dest;
12309 int len; /* the buffer length */
12310 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311
Daniel Veillard27f20102004-11-05 11:50:11 +000012312 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12313 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12314 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12315 mem_base = xmlMemBlocks();
12316 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12317 dest = gen_void_ptr(n_dest, 1);
12318 len = gen_int(n_len, 2);
12319
12320 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12321 desret_int(ret_val);
12322 call_tests++;
12323 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12324 des_void_ptr(n_dest, dest, 1);
12325 des_int(n_len, len, 2);
12326 xmlResetLastError();
12327 if (mem_base != xmlMemBlocks()) {
12328 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012330 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012331 printf(" %d", n_ctx);
12332 printf(" %d", n_dest);
12333 printf(" %d", n_len);
12334 printf("\n");
12335 }
12336 }
12337 }
12338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012339 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012340#endif
12341
Daniel Veillard42595322004-11-08 10:52:06 +000012342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012343}
12344
12345
12346static int
12347test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012349
12350
12351 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012353}
12354
12355
12356static int
12357test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359
William M. Brack21e4ef22005-01-02 09:53:13 +000012360#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012361 int mem_base;
12362 int ret_val;
12363 void * ctx; /* the HTTP context */
12364 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012365
Daniel Veillard27f20102004-11-05 11:50:11 +000012366 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12367 mem_base = xmlMemBlocks();
12368 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12369
12370 ret_val = xmlNanoHTTPReturnCode(ctx);
12371 desret_int(ret_val);
12372 call_tests++;
12373 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12374 xmlResetLastError();
12375 if (mem_base != xmlMemBlocks()) {
12376 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012378 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012379 printf(" %d", n_ctx);
12380 printf("\n");
12381 }
12382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012383 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012384#endif
12385
Daniel Veillard42595322004-11-08 10:52:06 +000012386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012387}
12388
12389
12390static int
12391test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012393
William M. Brack21e4ef22005-01-02 09:53:13 +000012394#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012395 int mem_base;
12396 int ret_val;
12397 void * ctxt; /* the HTTP context */
12398 int n_ctxt;
12399 const char * filename; /* the filename where the content should be saved */
12400 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012401
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012402 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12403 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012405 ctxt = gen_void_ptr(n_ctxt, 0);
12406 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012407
12408 ret_val = xmlNanoHTTPSave(ctxt, filename);
12409 desret_int(ret_val);
12410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012411 des_void_ptr(n_ctxt, ctxt, 0);
12412 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012413 xmlResetLastError();
12414 if (mem_base != xmlMemBlocks()) {
12415 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012417 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012418 printf(" %d", n_ctxt);
12419 printf(" %d", n_filename);
12420 printf("\n");
12421 }
12422 }
12423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012424 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012425#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012426
Daniel Veillard42595322004-11-08 10:52:06 +000012427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012428}
12429
12430
12431static int
12432test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012434
William M. Brack21e4ef22005-01-02 09:53:13 +000012435#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012436 const char * URL; /* The proxy URL used to initialize the proxy context */
12437 int n_URL;
12438
12439 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012440 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441
12442 xmlNanoHTTPScanProxy(URL);
12443 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012444 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012445 xmlResetLastError();
12446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012447 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012448#endif
12449
Daniel Veillard42595322004-11-08 10:52:06 +000012450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012451}
12452
12453static int
12454test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012457 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012458 test_ret += test_xmlNanoHTTPAuthHeader();
12459 test_ret += test_xmlNanoHTTPCleanup();
12460 test_ret += test_xmlNanoHTTPClose();
12461 test_ret += test_xmlNanoHTTPContentLength();
12462 test_ret += test_xmlNanoHTTPEncoding();
12463 test_ret += test_xmlNanoHTTPFetch();
12464 test_ret += test_xmlNanoHTTPInit();
12465 test_ret += test_xmlNanoHTTPMethod();
12466 test_ret += test_xmlNanoHTTPMethodRedir();
12467 test_ret += test_xmlNanoHTTPMimeType();
12468 test_ret += test_xmlNanoHTTPOpen();
12469 test_ret += test_xmlNanoHTTPOpenRedir();
12470 test_ret += test_xmlNanoHTTPRead();
12471 test_ret += test_xmlNanoHTTPRedir();
12472 test_ret += test_xmlNanoHTTPReturnCode();
12473 test_ret += test_xmlNanoHTTPSave();
12474 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012475
Daniel Veillard42595322004-11-08 10:52:06 +000012476 if (test_ret != 0)
12477 printf("Module nanohttp: %d errors\n", test_ret);
12478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012479}
12480
12481static int
12482test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012484
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012485 int mem_base;
12486 long ret_val;
12487 xmlParserCtxtPtr ctxt; /* an XML parser context */
12488 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012489
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12491 mem_base = xmlMemBlocks();
12492 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12493
12494 ret_val = xmlByteConsumed(ctxt);
12495 desret_long(ret_val);
12496 call_tests++;
12497 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12498 xmlResetLastError();
12499 if (mem_base != xmlMemBlocks()) {
12500 printf("Leak of %d blocks found in xmlByteConsumed",
12501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012502 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012503 printf(" %d", n_ctxt);
12504 printf("\n");
12505 }
12506 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012508
Daniel Veillard42595322004-11-08 10:52:06 +000012509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012510}
12511
12512
12513static int
12514test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012516
Daniel Veillardce682bc2004-11-05 17:22:25 +000012517 int mem_base;
12518 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12519 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012520
Daniel Veillardce682bc2004-11-05 17:22:25 +000012521 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12522 mem_base = xmlMemBlocks();
12523 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12524
12525 xmlClearNodeInfoSeq(seq);
12526 call_tests++;
12527 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12528 xmlResetLastError();
12529 if (mem_base != xmlMemBlocks()) {
12530 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012532 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012533 printf(" %d", n_seq);
12534 printf("\n");
12535 }
12536 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012537 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012538
Daniel Veillard42595322004-11-08 10:52:06 +000012539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012540}
12541
12542
12543static int
12544test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012546
12547 int mem_base;
12548 xmlParserCtxtPtr ctxt; /* an XML parser context */
12549 int n_ctxt;
12550
12551 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12552 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012553 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012554
12555 xmlClearParserCtxt(ctxt);
12556 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012557 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012558 xmlResetLastError();
12559 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012560 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012562 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012563 printf(" %d", n_ctxt);
12564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012565 }
12566 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012568
Daniel Veillard42595322004-11-08 10:52:06 +000012569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570}
12571
12572
12573static int
12574test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012576
Daniel Veillard34099b42004-11-04 17:34:35 +000012577 int mem_base;
12578 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012579 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012580 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012581
Daniel Veillard34099b42004-11-04 17:34:35 +000012582 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12583 mem_base = xmlMemBlocks();
12584 cur = gen_const_xmlChar_ptr(n_cur, 0);
12585
William M. Brackf13f77f2004-11-12 16:03:48 +000012586 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012587 desret_xmlParserCtxtPtr(ret_val);
12588 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012589 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012590 xmlResetLastError();
12591 if (mem_base != xmlMemBlocks()) {
12592 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012594 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012595 printf(" %d", n_cur);
12596 printf("\n");
12597 }
12598 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012599 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012600
Daniel Veillard42595322004-11-08 10:52:06 +000012601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012602}
12603
12604
12605static int
12606test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012608
William M. Brack21e4ef22005-01-02 09:53:13 +000012609#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012610 int mem_base;
12611 xmlParserCtxtPtr ret_val;
12612 xmlSAXHandlerPtr sax; /* a SAX handler */
12613 int n_sax;
12614 void * user_data; /* The user data returned on SAX callbacks */
12615 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012616 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012617 int n_chunk;
12618 int size; /* number of chars in the array */
12619 int n_size;
12620 const char * filename; /* an optional file name or URI */
12621 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012622
Daniel Veillard34099b42004-11-04 17:34:35 +000012623 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12624 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12625 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12626 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012627 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012628 mem_base = xmlMemBlocks();
12629 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12630 user_data = gen_userdata(n_user_data, 1);
12631 chunk = gen_const_char_ptr(n_chunk, 2);
12632 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012633 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012634
William M. Brackf13f77f2004-11-12 16:03:48 +000012635 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012636 desret_xmlParserCtxtPtr(ret_val);
12637 call_tests++;
12638 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12639 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012640 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012641 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012642 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012643 xmlResetLastError();
12644 if (mem_base != xmlMemBlocks()) {
12645 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012647 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012648 printf(" %d", n_sax);
12649 printf(" %d", n_user_data);
12650 printf(" %d", n_chunk);
12651 printf(" %d", n_size);
12652 printf(" %d", n_filename);
12653 printf("\n");
12654 }
12655 }
12656 }
12657 }
12658 }
12659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012660 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012661#endif
12662
Daniel Veillard42595322004-11-08 10:52:06 +000012663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012664}
12665
12666
12667static int
12668test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012670
12671 int mem_base;
12672 xmlDocPtr ret_val;
12673 xmlParserCtxtPtr ctxt; /* an XML parser context */
12674 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012675 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012676 int n_cur;
12677 const char * URL; /* the base URL to use for the document */
12678 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012679 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012680 int n_encoding;
12681 int options; /* a combination of xmlParserOption */
12682 int n_options;
12683
12684 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12685 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12686 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12687 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012688 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012690 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12691 cur = gen_const_xmlChar_ptr(n_cur, 1);
12692 URL = gen_filepath(n_URL, 2);
12693 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012694 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695
William M. Brackf13f77f2004-11-12 16:03:48 +000012696 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012697 desret_xmlDocPtr(ret_val);
12698 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012699 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012700 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012701 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012702 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012703 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012704 xmlResetLastError();
12705 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012706 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012708 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012709 printf(" %d", n_ctxt);
12710 printf(" %d", n_cur);
12711 printf(" %d", n_URL);
12712 printf(" %d", n_encoding);
12713 printf(" %d", n_options);
12714 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012715 }
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_xmlCtxtReadFile(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 xmlDocPtr ret_val;
12733 xmlParserCtxtPtr ctxt; /* an XML parser context */
12734 int n_ctxt;
12735 const char * filename; /* a file or URL */
12736 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012737 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012738 int n_encoding;
12739 int options; /* a combination of xmlParserOption */
12740 int n_options;
12741
12742 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12743 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12744 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012745 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012747 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12748 filename = gen_filepath(n_filename, 1);
12749 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012750 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012751
William M. Brackf13f77f2004-11-12 16:03:48 +000012752 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012753 desret_xmlDocPtr(ret_val);
12754 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012755 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12756 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012757 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012758 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012759 xmlResetLastError();
12760 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012761 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012763 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012764 printf(" %d", n_ctxt);
12765 printf(" %d", n_filename);
12766 printf(" %d", n_encoding);
12767 printf(" %d", n_options);
12768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012769 }
12770 }
12771 }
12772 }
12773 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012774 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012775
Daniel Veillard42595322004-11-08 10:52:06 +000012776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012777}
12778
12779
12780static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012781test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012783
12784 int mem_base;
12785 xmlDocPtr ret_val;
12786 xmlParserCtxtPtr ctxt; /* an XML parser context */
12787 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012788 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012789 int n_buffer;
12790 int size; /* the size of the array */
12791 int n_size;
12792 const char * URL; /* the base URL to use for the document */
12793 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012794 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012795 int n_encoding;
12796 int options; /* a combination of xmlParserOption */
12797 int n_options;
12798
12799 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12800 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12801 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12802 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12803 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012804 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012806 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12807 buffer = gen_const_char_ptr(n_buffer, 1);
12808 size = gen_int(n_size, 2);
12809 URL = gen_filepath(n_URL, 3);
12810 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012811 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012812
William M. Brackf13f77f2004-11-12 16:03:48 +000012813 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814 desret_xmlDocPtr(ret_val);
12815 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012816 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012817 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012818 des_int(n_size, size, 2);
12819 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012820 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012821 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012822 xmlResetLastError();
12823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012824 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012827 printf(" %d", n_ctxt);
12828 printf(" %d", n_buffer);
12829 printf(" %d", n_size);
12830 printf(" %d", n_URL);
12831 printf(" %d", n_encoding);
12832 printf(" %d", n_options);
12833 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834 }
12835 }
12836 }
12837 }
12838 }
12839 }
12840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012842
Daniel Veillard42595322004-11-08 10:52:06 +000012843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012844}
12845
12846
12847static int
12848test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012850
12851 int mem_base;
12852 xmlParserCtxtPtr ctxt; /* an XML parser context */
12853 int n_ctxt;
12854
12855 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012857 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012858
12859 xmlCtxtReset(ctxt);
12860 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012861 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012862 xmlResetLastError();
12863 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012864 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012866 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012867 printf(" %d", n_ctxt);
12868 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869 }
12870 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012871 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012872
Daniel Veillard42595322004-11-08 10:52:06 +000012873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012874}
12875
12876
12877static int
12878test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
12881 int mem_base;
12882 int ret_val;
12883 xmlParserCtxtPtr ctxt; /* an XML parser context */
12884 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012885 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012886 int n_chunk;
12887 int size; /* number of chars in the array */
12888 int n_size;
12889 const char * filename; /* an optional file name or URI */
12890 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012891 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012892 int n_encoding;
12893
12894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12895 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12896 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12897 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12898 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012900 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12901 chunk = gen_const_char_ptr(n_chunk, 1);
12902 size = gen_int(n_size, 2);
12903 filename = gen_filepath(n_filename, 3);
12904 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012905
William M. Brackf13f77f2004-11-12 16:03:48 +000012906 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012907 desret_int(ret_val);
12908 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012909 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012910 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012911 des_int(n_size, size, 2);
12912 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012913 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012914 xmlResetLastError();
12915 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012916 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012918 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012919 printf(" %d", n_ctxt);
12920 printf(" %d", n_chunk);
12921 printf(" %d", n_size);
12922 printf(" %d", n_filename);
12923 printf(" %d", n_encoding);
12924 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012925 }
12926 }
12927 }
12928 }
12929 }
12930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012932
Daniel Veillard42595322004-11-08 10:52:06 +000012933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012934}
12935
12936
12937static int
12938test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012940
12941 int mem_base;
12942 int ret_val;
12943 xmlParserCtxtPtr ctxt; /* an XML parser context */
12944 int n_ctxt;
12945 int options; /* a combination of xmlParserOption */
12946 int n_options;
12947
12948 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012949 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012951 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012952 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012953
12954 ret_val = xmlCtxtUseOptions(ctxt, options);
12955 desret_int(ret_val);
12956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012957 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012958 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012959 xmlResetLastError();
12960 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012961 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012963 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012964 printf(" %d", n_ctxt);
12965 printf(" %d", n_options);
12966 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012967 }
12968 }
12969 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012970 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012971
Daniel Veillard42595322004-11-08 10:52:06 +000012972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012973}
12974
12975
12976static int
12977test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012979
12980
12981 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012983}
12984
12985
12986static int
12987test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012989
William M. Brack21e4ef22005-01-02 09:53:13 +000012990#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012991#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012992 int mem_base;
12993 int ret_val;
12994 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12995 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012996 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012997 int n_name;
12998 void * result; /* location to store the result */
12999 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013000
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013001 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13002 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13003 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013005 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13006 name = gen_const_char_ptr(n_name, 1);
13007 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013008
William M. Brackf13f77f2004-11-12 16:03:48 +000013009 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013010 desret_int(ret_val);
13011 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013012 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013013 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013014 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013015 xmlResetLastError();
13016 if (mem_base != xmlMemBlocks()) {
13017 printf("Leak of %d blocks found in xmlGetFeature",
13018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013019 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013020 printf(" %d", n_ctxt);
13021 printf(" %d", n_name);
13022 printf(" %d", n_result);
13023 printf("\n");
13024 }
13025 }
13026 }
13027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013028 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013029#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013030#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013031
Daniel Veillard42595322004-11-08 10:52:06 +000013032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013033}
13034
13035
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013036#define gen_nb_const_char_ptr_ptr 1
13037static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13038 return(NULL);
13039}
13040static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13041}
13042
Daniel Veillardd93f6252004-11-02 15:53:51 +000013043static int
13044test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013046
William M. Brack21e4ef22005-01-02 09:53:13 +000013047#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013048#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013049 int mem_base;
13050 int ret_val;
13051 int * len; /* the length of the features name array (input/output) */
13052 int n_len;
13053 char ** result; /* an array of string to be filled with the features name. */
13054 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013055
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013056 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13057 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13058 mem_base = xmlMemBlocks();
13059 len = gen_int_ptr(n_len, 0);
13060 result = gen_const_char_ptr_ptr(n_result, 1);
13061
William M. Brackf13f77f2004-11-12 16:03:48 +000013062 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013063 desret_int(ret_val);
13064 call_tests++;
13065 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013066 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013067 xmlResetLastError();
13068 if (mem_base != xmlMemBlocks()) {
13069 printf("Leak of %d blocks found in xmlGetFeaturesList",
13070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013071 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013072 printf(" %d", n_len);
13073 printf(" %d", n_result);
13074 printf("\n");
13075 }
13076 }
13077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013078 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013079#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013080#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013081
Daniel Veillard42595322004-11-08 10:52:06 +000013082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013083}
13084
13085
13086static int
13087test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013089
William M. Brack21e4ef22005-01-02 09:53:13 +000013090#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013091#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013092 int mem_base;
13093 xmlDtdPtr ret_val;
13094 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13095 int n_sax;
13096 xmlParserInputBufferPtr input; /* an Input Buffer */
13097 int n_input;
13098 xmlCharEncoding enc; /* the charset encoding if known */
13099 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013100
Daniel Veillard34099b42004-11-04 17:34:35 +000013101 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13102 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13103 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13104 mem_base = xmlMemBlocks();
13105 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13106 input = gen_xmlParserInputBufferPtr(n_input, 1);
13107 enc = gen_xmlCharEncoding(n_enc, 2);
13108
13109 ret_val = xmlIOParseDTD(sax, input, enc);
13110 input = NULL;
13111 desret_xmlDtdPtr(ret_val);
13112 call_tests++;
13113 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13114 des_xmlParserInputBufferPtr(n_input, input, 1);
13115 des_xmlCharEncoding(n_enc, enc, 2);
13116 xmlResetLastError();
13117 if (mem_base != xmlMemBlocks()) {
13118 printf("Leak of %d blocks found in xmlIOParseDTD",
13119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013120 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013121 printf(" %d", n_sax);
13122 printf(" %d", n_input);
13123 printf(" %d", n_enc);
13124 printf("\n");
13125 }
13126 }
13127 }
13128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013129 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013130#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013131#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013132
Daniel Veillard42595322004-11-08 10:52:06 +000013133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013134}
13135
13136
13137static int
13138test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013140
Daniel Veillardce682bc2004-11-05 17:22:25 +000013141 int mem_base;
13142 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13143 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013144
Daniel Veillardce682bc2004-11-05 17:22:25 +000013145 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13146 mem_base = xmlMemBlocks();
13147 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13148
13149 xmlInitNodeInfoSeq(seq);
13150 call_tests++;
13151 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13152 xmlResetLastError();
13153 if (mem_base != xmlMemBlocks()) {
13154 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013156 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013157 printf(" %d", n_seq);
13158 printf("\n");
13159 }
13160 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013162
Daniel Veillard42595322004-11-08 10:52:06 +000013163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013164}
13165
13166
13167static int
13168test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013170
13171 int mem_base;
13172
13173 mem_base = xmlMemBlocks();
13174
13175 xmlInitParser();
13176 call_tests++;
13177 xmlResetLastError();
13178 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013179 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013181 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013182 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013183 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013184 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013185
Daniel Veillard42595322004-11-08 10:52:06 +000013186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013187}
13188
13189
13190static int
13191test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013193
13194 int mem_base;
13195 int ret_val;
13196 xmlParserCtxtPtr ctxt; /* an XML parser context */
13197 int n_ctxt;
13198
13199 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13200 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013201 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013202
13203 ret_val = xmlInitParserCtxt(ctxt);
13204 desret_int(ret_val);
13205 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013206 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013207 xmlResetLastError();
13208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013209 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013212 printf(" %d", n_ctxt);
13213 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013214 }
13215 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013216 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013217
Daniel Veillard42595322004-11-08 10:52:06 +000013218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013219}
13220
13221
13222static int
13223test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013225
13226 int mem_base;
13227 int ret_val;
13228 int val; /* int 0 or 1 */
13229 int n_val;
13230
13231 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13232 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013233 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013234
13235 ret_val = xmlKeepBlanksDefault(val);
13236 desret_int(ret_val);
13237 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013238 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013239 xmlResetLastError();
13240 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013241 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013243 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013244 printf(" %d", n_val);
13245 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013246 }
13247 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013248 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013249
Daniel Veillard42595322004-11-08 10:52:06 +000013250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013251}
13252
13253
13254static int
13255test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013257
13258 int mem_base;
13259 int ret_val;
13260 int val; /* int 0 or 1 */
13261 int n_val;
13262
13263 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013265 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013266
13267 ret_val = xmlLineNumbersDefault(val);
13268 desret_int(ret_val);
13269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013270 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013271 xmlResetLastError();
13272 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013273 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013275 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013276 printf(" %d", n_val);
13277 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013278 }
13279 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013280 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013281
Daniel Veillard42595322004-11-08 10:52:06 +000013282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013283}
13284
13285
13286static int
13287test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013289
Daniel Veillard42595322004-11-08 10:52:06 +000013290 int mem_base;
13291 xmlParserInputPtr ret_val;
13292 const char * URL; /* the URL for the entity to load */
13293 int n_URL;
13294 char * ID; /* the Public ID for the entity to load */
13295 int n_ID;
13296 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13297 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013298
Daniel Veillard42595322004-11-08 10:52:06 +000013299 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13300 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13302 mem_base = xmlMemBlocks();
13303 URL = gen_filepath(n_URL, 0);
13304 ID = gen_const_char_ptr(n_ID, 1);
13305 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13306
William M. Brackf13f77f2004-11-12 16:03:48 +000013307 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013308 desret_xmlParserInputPtr(ret_val);
13309 call_tests++;
13310 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013311 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013312 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13313 xmlResetLastError();
13314 if (mem_base != xmlMemBlocks()) {
13315 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13316 xmlMemBlocks() - mem_base);
13317 test_ret++;
13318 printf(" %d", n_URL);
13319 printf(" %d", n_ID);
13320 printf(" %d", n_ctxt);
13321 printf("\n");
13322 }
13323 }
13324 }
13325 }
Daniel Veillard42595322004-11-08 10:52:06 +000013326 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013327
Daniel Veillard42595322004-11-08 10:52:06 +000013328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013329}
13330
13331
13332static int
13333test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013335
Daniel Veillard42595322004-11-08 10:52:06 +000013336 int mem_base;
13337 xmlParserInputPtr ret_val;
13338 xmlParserCtxtPtr ctxt; /* an XML parser context */
13339 int n_ctxt;
13340 xmlParserInputBufferPtr input; /* an I/O Input */
13341 int n_input;
13342 xmlCharEncoding enc; /* the charset encoding if known */
13343 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013344
Daniel Veillard42595322004-11-08 10:52:06 +000013345 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13346 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13347 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13348 mem_base = xmlMemBlocks();
13349 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13350 input = gen_xmlParserInputBufferPtr(n_input, 1);
13351 enc = gen_xmlCharEncoding(n_enc, 2);
13352
13353 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13354 if (ret_val != NULL) input = NULL;
13355 desret_xmlParserInputPtr(ret_val);
13356 call_tests++;
13357 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13358 des_xmlParserInputBufferPtr(n_input, input, 1);
13359 des_xmlCharEncoding(n_enc, enc, 2);
13360 xmlResetLastError();
13361 if (mem_base != xmlMemBlocks()) {
13362 printf("Leak of %d blocks found in xmlNewIOInputStream",
13363 xmlMemBlocks() - mem_base);
13364 test_ret++;
13365 printf(" %d", n_ctxt);
13366 printf(" %d", n_input);
13367 printf(" %d", n_enc);
13368 printf("\n");
13369 }
13370 }
13371 }
13372 }
Daniel Veillard42595322004-11-08 10:52:06 +000013373 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013374
Daniel Veillard42595322004-11-08 10:52:06 +000013375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376}
13377
13378
13379static int
13380test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013382
Daniel Veillard34099b42004-11-04 17:34:35 +000013383 int mem_base;
13384 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013385
Daniel Veillard34099b42004-11-04 17:34:35 +000013386 mem_base = xmlMemBlocks();
13387
13388 ret_val = xmlNewParserCtxt();
13389 desret_xmlParserCtxtPtr(ret_val);
13390 call_tests++;
13391 xmlResetLastError();
13392 if (mem_base != xmlMemBlocks()) {
13393 printf("Leak of %d blocks found in xmlNewParserCtxt",
13394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013395 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013396 printf("\n");
13397 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013398 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013399
Daniel Veillard42595322004-11-08 10:52:06 +000013400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013401}
13402
13403
Daniel Veillardce682bc2004-11-05 17:22:25 +000013404#define gen_nb_xmlNodePtr_ptr 1
13405static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13406 return(NULL);
13407}
13408static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13409}
13410
Daniel Veillardd93f6252004-11-02 15:53:51 +000013411static int
13412test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013414
William M. Brack21e4ef22005-01-02 09:53:13 +000013415#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013416#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013417 int mem_base;
13418 int ret_val;
13419 xmlDocPtr doc; /* the document the chunk pertains to */
13420 int n_doc;
13421 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13422 int n_sax;
13423 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13424 int n_user_data;
13425 int depth; /* Used for loop detection, use 0 */
13426 int n_depth;
13427 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13428 int n_string;
13429 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13430 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013431
Daniel Veillardce682bc2004-11-05 17:22:25 +000013432 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13433 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13434 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13435 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13436 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13437 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13438 mem_base = xmlMemBlocks();
13439 doc = gen_xmlDocPtr(n_doc, 0);
13440 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13441 user_data = gen_userdata(n_user_data, 2);
13442 depth = gen_int(n_depth, 3);
13443 string = gen_const_xmlChar_ptr(n_string, 4);
13444 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013445
13446#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013447 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013448#endif
13449
Daniel Veillardce682bc2004-11-05 17:22:25 +000013450
William M. Brackf13f77f2004-11-12 16:03:48 +000013451 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013452 desret_int(ret_val);
13453 call_tests++;
13454 des_xmlDocPtr(n_doc, doc, 0);
13455 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13456 des_userdata(n_user_data, user_data, 2);
13457 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013458 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013459 des_xmlNodePtr_ptr(n_lst, lst, 5);
13460 xmlResetLastError();
13461 if (mem_base != xmlMemBlocks()) {
13462 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013464 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013465 printf(" %d", n_doc);
13466 printf(" %d", n_sax);
13467 printf(" %d", n_user_data);
13468 printf(" %d", n_depth);
13469 printf(" %d", n_string);
13470 printf(" %d", n_lst);
13471 printf("\n");
13472 }
13473 }
13474 }
13475 }
13476 }
13477 }
13478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013479 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013480#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013481#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013482
Daniel Veillard42595322004-11-08 10:52:06 +000013483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013484}
13485
13486
13487static int
13488test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013490
William M. Brack21e4ef22005-01-02 09:53:13 +000013491#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013492#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013493 int mem_base;
13494 int ret_val;
13495 xmlDocPtr doc; /* the document the chunk pertains to */
13496 int n_doc;
13497 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13498 int n_sax;
13499 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13500 int n_user_data;
13501 int depth; /* Used for loop detection, use 0 */
13502 int n_depth;
13503 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13504 int n_string;
13505 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13506 int n_lst;
13507 int recover; /* return nodes even if the data is broken (use 0) */
13508 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013509
Daniel Veillardce682bc2004-11-05 17:22:25 +000013510 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13511 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13512 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13513 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13514 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13515 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13516 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13517 mem_base = xmlMemBlocks();
13518 doc = gen_xmlDocPtr(n_doc, 0);
13519 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13520 user_data = gen_userdata(n_user_data, 2);
13521 depth = gen_int(n_depth, 3);
13522 string = gen_const_xmlChar_ptr(n_string, 4);
13523 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13524 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013525
13526#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013527 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013528#endif
13529
Daniel Veillardce682bc2004-11-05 17:22:25 +000013530
William M. Brackf13f77f2004-11-12 16:03:48 +000013531 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013532 desret_int(ret_val);
13533 call_tests++;
13534 des_xmlDocPtr(n_doc, doc, 0);
13535 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13536 des_userdata(n_user_data, user_data, 2);
13537 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013538 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013539 des_xmlNodePtr_ptr(n_lst, lst, 5);
13540 des_int(n_recover, recover, 6);
13541 xmlResetLastError();
13542 if (mem_base != xmlMemBlocks()) {
13543 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013545 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013546 printf(" %d", n_doc);
13547 printf(" %d", n_sax);
13548 printf(" %d", n_user_data);
13549 printf(" %d", n_depth);
13550 printf(" %d", n_string);
13551 printf(" %d", n_lst);
13552 printf(" %d", n_recover);
13553 printf("\n");
13554 }
13555 }
13556 }
13557 }
13558 }
13559 }
13560 }
13561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013562 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013563#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013564#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013565
Daniel Veillard42595322004-11-08 10:52:06 +000013566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013567}
13568
13569
13570static int
13571test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013573
William M. Brack21e4ef22005-01-02 09:53:13 +000013574#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013575 int mem_base;
13576 int ret_val;
13577 xmlParserCtxtPtr ctxt; /* an XML parser context */
13578 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013579 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013580 int n_chunk;
13581 int size; /* the size in byte of the chunk */
13582 int n_size;
13583 int terminate; /* last chunk indicator */
13584 int n_terminate;
13585
13586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13587 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13588 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13589 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013591 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13592 chunk = gen_const_char_ptr(n_chunk, 1);
13593 size = gen_int(n_size, 2);
13594 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013595
William M. Brackf13f77f2004-11-12 16:03:48 +000013596 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013597 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013598 desret_int(ret_val);
13599 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013600 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013601 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013602 des_int(n_size, size, 2);
13603 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013604 xmlResetLastError();
13605 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013606 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013608 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013609 printf(" %d", n_ctxt);
13610 printf(" %d", n_chunk);
13611 printf(" %d", n_size);
13612 printf(" %d", n_terminate);
13613 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013614 }
13615 }
13616 }
13617 }
13618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013619 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013620#endif
13621
Daniel Veillard42595322004-11-08 10:52:06 +000013622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013623}
13624
13625
13626static int
13627test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013629
Daniel Veillardce682bc2004-11-05 17:22:25 +000013630 int mem_base;
13631 int ret_val;
13632 xmlParserCtxtPtr ctx; /* the existing parsing context */
13633 int n_ctx;
13634 xmlChar * URL; /* the URL for the entity to load */
13635 int n_URL;
13636 xmlChar * ID; /* the System ID for the entity to load */
13637 int n_ID;
13638 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13639 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013640
Daniel Veillardce682bc2004-11-05 17:22:25 +000013641 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13642 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13643 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13644 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13645 mem_base = xmlMemBlocks();
13646 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13647 URL = gen_const_xmlChar_ptr(n_URL, 1);
13648 ID = gen_const_xmlChar_ptr(n_ID, 2);
13649 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13650
William M. Brackf13f77f2004-11-12 16:03:48 +000013651 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013652 desret_int(ret_val);
13653 call_tests++;
13654 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013655 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13656 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013657 des_xmlNodePtr_ptr(n_lst, lst, 3);
13658 xmlResetLastError();
13659 if (mem_base != xmlMemBlocks()) {
13660 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013662 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013663 printf(" %d", n_ctx);
13664 printf(" %d", n_URL);
13665 printf(" %d", n_ID);
13666 printf(" %d", n_lst);
13667 printf("\n");
13668 }
13669 }
13670 }
13671 }
13672 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013673 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013674
Daniel Veillard42595322004-11-08 10:52:06 +000013675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013676}
13677
13678
13679static int
13680test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013682
William M. Brack21e4ef22005-01-02 09:53:13 +000013683#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013684#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013685 int mem_base;
13686 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013687 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013688 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013689 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013690 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013691
Daniel Veillard34099b42004-11-04 17:34:35 +000013692 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13693 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13694 mem_base = xmlMemBlocks();
13695 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13696 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13697
William M. Brackf13f77f2004-11-12 16:03:48 +000013698 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013699 desret_xmlDtdPtr(ret_val);
13700 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013701 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13702 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013703 xmlResetLastError();
13704 if (mem_base != xmlMemBlocks()) {
13705 printf("Leak of %d blocks found in xmlParseDTD",
13706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013707 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013708 printf(" %d", n_ExternalID);
13709 printf(" %d", n_SystemID);
13710 printf("\n");
13711 }
13712 }
13713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013714 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013715#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013716#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013717
Daniel Veillard42595322004-11-08 10:52:06 +000013718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013719}
13720
13721
13722static int
13723test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013725
William M. Brack21e4ef22005-01-02 09:53:13 +000013726#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013727#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013728 int mem_base;
13729 xmlDocPtr ret_val;
13730 xmlChar * cur; /* a pointer to an array of xmlChar */
13731 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013732
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013733 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13734 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013735 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013736
13737 ret_val = xmlParseDoc(cur);
13738 desret_xmlDocPtr(ret_val);
13739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013740 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013741 xmlResetLastError();
13742 if (mem_base != xmlMemBlocks()) {
13743 printf("Leak of %d blocks found in xmlParseDoc",
13744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013745 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013746 printf(" %d", n_cur);
13747 printf("\n");
13748 }
13749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013750 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013751#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013752#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013753
Daniel Veillard42595322004-11-08 10:52:06 +000013754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013755}
13756
13757
13758static int
13759test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013761
13762 int mem_base;
13763 int ret_val;
13764 xmlParserCtxtPtr ctxt; /* an XML parser context */
13765 int n_ctxt;
13766
13767 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013769 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013770
13771 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013772 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013773 desret_int(ret_val);
13774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013775 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013776 xmlResetLastError();
13777 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013778 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013780 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013781 printf(" %d", n_ctxt);
13782 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013783 }
13784 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013786
Daniel Veillard42595322004-11-08 10:52:06 +000013787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013788}
13789
13790
13791static int
13792test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013794
William M. Brack21e4ef22005-01-02 09:53:13 +000013795#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013796#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013797 int mem_base;
13798 xmlDocPtr ret_val;
13799 const char * filename; /* the filename */
13800 int n_filename;
13801
13802 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013804 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013805
13806 ret_val = xmlParseEntity(filename);
13807 desret_xmlDocPtr(ret_val);
13808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013809 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013810 xmlResetLastError();
13811 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013812 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013814 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013815 printf(" %d", n_filename);
13816 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013817 }
13818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013819 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013820#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013821#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013822
Daniel Veillard42595322004-11-08 10:52:06 +000013823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013824}
13825
13826
13827static int
13828test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013830
13831 int mem_base;
13832 int ret_val;
13833 xmlParserCtxtPtr ctxt; /* an XML parser context */
13834 int n_ctxt;
13835
13836 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013838 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013839
13840 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013841 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013842 desret_int(ret_val);
13843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013844 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013845 xmlResetLastError();
13846 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013847 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013849 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013850 printf(" %d", n_ctxt);
13851 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013852 }
13853 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013855
Daniel Veillard42595322004-11-08 10:52:06 +000013856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857}
13858
13859
13860static int
13861test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013863
William M. Brack21e4ef22005-01-02 09:53:13 +000013864#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013865#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013866 int mem_base;
13867 int ret_val;
13868 xmlDocPtr doc; /* the document the chunk pertains to */
13869 int n_doc;
13870 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13871 int n_sax;
13872 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13873 int n_user_data;
13874 int depth; /* Used for loop detection, use 0 */
13875 int n_depth;
13876 xmlChar * URL; /* the URL for the entity to load */
13877 int n_URL;
13878 xmlChar * ID; /* the System ID for the entity to load */
13879 int n_ID;
13880 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13881 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013882
Daniel Veillardce682bc2004-11-05 17:22:25 +000013883 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13884 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13885 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13886 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13887 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13888 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13889 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13890 mem_base = xmlMemBlocks();
13891 doc = gen_xmlDocPtr(n_doc, 0);
13892 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13893 user_data = gen_userdata(n_user_data, 2);
13894 depth = gen_int(n_depth, 3);
13895 URL = gen_const_xmlChar_ptr(n_URL, 4);
13896 ID = gen_const_xmlChar_ptr(n_ID, 5);
13897 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13898
William M. Brackf13f77f2004-11-12 16:03:48 +000013899 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013900 desret_int(ret_val);
13901 call_tests++;
13902 des_xmlDocPtr(n_doc, doc, 0);
13903 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13904 des_userdata(n_user_data, user_data, 2);
13905 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013906 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13907 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013908 des_xmlNodePtr_ptr(n_lst, lst, 6);
13909 xmlResetLastError();
13910 if (mem_base != xmlMemBlocks()) {
13911 printf("Leak of %d blocks found in xmlParseExternalEntity",
13912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013913 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013914 printf(" %d", n_doc);
13915 printf(" %d", n_sax);
13916 printf(" %d", n_user_data);
13917 printf(" %d", n_depth);
13918 printf(" %d", n_URL);
13919 printf(" %d", n_ID);
13920 printf(" %d", n_lst);
13921 printf("\n");
13922 }
13923 }
13924 }
13925 }
13926 }
13927 }
13928 }
13929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013930 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013931#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013932#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013933
Daniel Veillard42595322004-11-08 10:52:06 +000013934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013935}
13936
13937
13938static int
13939test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013941
William M. Brack21e4ef22005-01-02 09:53:13 +000013942#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013943#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013944 int mem_base;
13945 xmlDocPtr ret_val;
13946 const char * filename; /* the filename */
13947 int n_filename;
13948
13949 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013951 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
13953 ret_val = xmlParseFile(filename);
13954 desret_xmlDocPtr(ret_val);
13955 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013956 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013957 xmlResetLastError();
13958 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013959 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013961 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013962 printf(" %d", n_filename);
13963 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013964 }
13965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013966 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013967#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013968#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013969
Daniel Veillard42595322004-11-08 10:52:06 +000013970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013971}
13972
13973
13974static int
13975test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013977
Daniel Veillard57b25162004-11-06 14:50:18 +000013978 int mem_base;
13979 xmlParserErrors ret_val;
13980 xmlNodePtr node; /* the context node */
13981 int n_node;
13982 char * data; /* the input string */
13983 int n_data;
13984 int datalen; /* the input string length in bytes */
13985 int n_datalen;
13986 int options; /* a combination of xmlParserOption */
13987 int n_options;
13988 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13989 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013990
Daniel Veillard57b25162004-11-06 14:50:18 +000013991 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13992 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13993 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013994 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013995 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13996 mem_base = xmlMemBlocks();
13997 node = gen_xmlNodePtr(n_node, 0);
13998 data = gen_const_char_ptr(n_data, 1);
13999 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014000 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014001 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14002
William M. Brackf13f77f2004-11-12 16:03:48 +000014003 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000014004 desret_xmlParserErrors(ret_val);
14005 call_tests++;
14006 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014007 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000014008 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014009 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014010 des_xmlNodePtr_ptr(n_lst, lst, 4);
14011 xmlResetLastError();
14012 if (mem_base != xmlMemBlocks()) {
14013 printf("Leak of %d blocks found in xmlParseInNodeContext",
14014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014015 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014016 printf(" %d", n_node);
14017 printf(" %d", n_data);
14018 printf(" %d", n_datalen);
14019 printf(" %d", n_options);
14020 printf(" %d", n_lst);
14021 printf("\n");
14022 }
14023 }
14024 }
14025 }
14026 }
14027 }
Daniel Veillard57b25162004-11-06 14:50:18 +000014028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014029
Daniel Veillard42595322004-11-08 10:52:06 +000014030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014031}
14032
14033
14034static int
14035test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014037
William M. Brack21e4ef22005-01-02 09:53:13 +000014038#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014039#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014040 int mem_base;
14041 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014042 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014043 int n_buffer;
14044 int size; /* the size of the array */
14045 int n_size;
14046
14047 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14048 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014050 buffer = gen_const_char_ptr(n_buffer, 0);
14051 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014052
William M. Brackf13f77f2004-11-12 16:03:48 +000014053 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014054 desret_xmlDocPtr(ret_val);
14055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014056 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014057 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014058 xmlResetLastError();
14059 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014060 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014062 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014063 printf(" %d", n_buffer);
14064 printf(" %d", n_size);
14065 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014066 }
14067 }
14068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014069 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014070#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014071#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014072
Daniel Veillard42595322004-11-08 10:52:06 +000014073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014074}
14075
14076
Daniel Veillardce682bc2004-11-05 17:22:25 +000014077#define gen_nb_const_xmlParserNodeInfoPtr 1
14078static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14079 return(NULL);
14080}
14081static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14082}
14083
Daniel Veillardd93f6252004-11-02 15:53:51 +000014084static int
14085test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014087
Daniel Veillardce682bc2004-11-05 17:22:25 +000014088 int mem_base;
14089 xmlParserCtxtPtr ctxt; /* an XML parser context */
14090 int n_ctxt;
14091 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14092 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014093
Daniel Veillardce682bc2004-11-05 17:22:25 +000014094 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14095 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14096 mem_base = xmlMemBlocks();
14097 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14098 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14099
William M. Brackf13f77f2004-11-12 16:03:48 +000014100 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014101 call_tests++;
14102 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014103 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014104 xmlResetLastError();
14105 if (mem_base != xmlMemBlocks()) {
14106 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014108 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014109 printf(" %d", n_ctxt);
14110 printf(" %d", n_info);
14111 printf("\n");
14112 }
14113 }
14114 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014115 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014116
Daniel Veillard42595322004-11-08 10:52:06 +000014117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014118}
14119
14120
Daniel Veillardce682bc2004-11-05 17:22:25 +000014121#define gen_nb_const_xmlParserCtxtPtr 1
14122static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14123 return(NULL);
14124}
14125static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14126}
14127
Daniel Veillarda521d282004-11-09 14:59:59 +000014128#define gen_nb_const_xmlNodePtr 1
14129static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14130 return(NULL);
14131}
14132static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14133}
14134
Daniel Veillardd93f6252004-11-02 15:53:51 +000014135static int
14136test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014138
William M. Brack094dd862004-11-14 14:28:34 +000014139 int mem_base;
14140 const xmlParserNodeInfo * ret_val;
14141 xmlParserCtxtPtr ctx; /* an XML parser context */
14142 int n_ctx;
14143 xmlNodePtr node; /* an XML node within the tree */
14144 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014145
William M. Brack094dd862004-11-14 14:28:34 +000014146 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14147 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14148 mem_base = xmlMemBlocks();
14149 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14150 node = gen_const_xmlNodePtr(n_node, 1);
14151
14152 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14153 desret_const_xmlParserNodeInfo_ptr(ret_val);
14154 call_tests++;
14155 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14156 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14157 xmlResetLastError();
14158 if (mem_base != xmlMemBlocks()) {
14159 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14160 xmlMemBlocks() - mem_base);
14161 test_ret++;
14162 printf(" %d", n_ctx);
14163 printf(" %d", n_node);
14164 printf("\n");
14165 }
14166 }
14167 }
14168 function_tests++;
14169
Daniel Veillard42595322004-11-08 10:52:06 +000014170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014171}
14172
14173
Daniel Veillardce682bc2004-11-05 17:22:25 +000014174#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14175static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14176 return(NULL);
14177}
14178static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14179}
14180
Daniel Veillardd93f6252004-11-02 15:53:51 +000014181static int
14182test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014184
William M. Brack094dd862004-11-14 14:28:34 +000014185 int mem_base;
14186 unsigned long ret_val;
14187 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14188 int n_seq;
14189 xmlNodePtr node; /* an XML node pointer */
14190 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014191
William M. Brack094dd862004-11-14 14:28:34 +000014192 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14193 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14194 mem_base = xmlMemBlocks();
14195 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14196 node = gen_const_xmlNodePtr(n_node, 1);
14197
14198 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14199 desret_unsigned_long(ret_val);
14200 call_tests++;
14201 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14202 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14203 xmlResetLastError();
14204 if (mem_base != xmlMemBlocks()) {
14205 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14206 xmlMemBlocks() - mem_base);
14207 test_ret++;
14208 printf(" %d", n_seq);
14209 printf(" %d", n_node);
14210 printf("\n");
14211 }
14212 }
14213 }
14214 function_tests++;
14215
Daniel Veillard42595322004-11-08 10:52:06 +000014216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014217}
14218
14219
Daniel Veillardce682bc2004-11-05 17:22:25 +000014220#define gen_nb_xmlParserInputPtr 1
14221static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14222 return(NULL);
14223}
14224static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14225}
14226
Daniel Veillardd93f6252004-11-02 15:53:51 +000014227static int
14228test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014230
Daniel Veillardce682bc2004-11-05 17:22:25 +000014231 int mem_base;
14232 int ret_val;
14233 xmlParserInputPtr in; /* an XML parser input */
14234 int n_in;
14235 int len; /* an indicative size for the lookahead */
14236 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014237
Daniel Veillardce682bc2004-11-05 17:22:25 +000014238 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14239 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14240 mem_base = xmlMemBlocks();
14241 in = gen_xmlParserInputPtr(n_in, 0);
14242 len = gen_int(n_len, 1);
14243
14244 ret_val = xmlParserInputGrow(in, len);
14245 desret_int(ret_val);
14246 call_tests++;
14247 des_xmlParserInputPtr(n_in, in, 0);
14248 des_int(n_len, len, 1);
14249 xmlResetLastError();
14250 if (mem_base != xmlMemBlocks()) {
14251 printf("Leak of %d blocks found in xmlParserInputGrow",
14252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014253 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014254 printf(" %d", n_in);
14255 printf(" %d", n_len);
14256 printf("\n");
14257 }
14258 }
14259 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014261
Daniel Veillard42595322004-11-08 10:52:06 +000014262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014263}
14264
14265
14266static int
14267test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014269
Daniel Veillardce682bc2004-11-05 17:22:25 +000014270 int mem_base;
14271 int ret_val;
14272 xmlParserInputPtr in; /* an XML parser input */
14273 int n_in;
14274 int len; /* an indicative size for the lookahead */
14275 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014276
Daniel Veillardce682bc2004-11-05 17:22:25 +000014277 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14278 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14279 mem_base = xmlMemBlocks();
14280 in = gen_xmlParserInputPtr(n_in, 0);
14281 len = gen_int(n_len, 1);
14282
14283 ret_val = xmlParserInputRead(in, len);
14284 desret_int(ret_val);
14285 call_tests++;
14286 des_xmlParserInputPtr(n_in, in, 0);
14287 des_int(n_len, len, 1);
14288 xmlResetLastError();
14289 if (mem_base != xmlMemBlocks()) {
14290 printf("Leak of %d blocks found in xmlParserInputRead",
14291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014292 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014293 printf(" %d", n_in);
14294 printf(" %d", n_len);
14295 printf("\n");
14296 }
14297 }
14298 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014300
Daniel Veillard42595322004-11-08 10:52:06 +000014301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014302}
14303
14304
14305static int
14306test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014308
14309 int mem_base;
14310 int ret_val;
14311 int val; /* int 0 or 1 */
14312 int n_val;
14313
14314 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14315 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014316 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014317
14318 ret_val = xmlPedanticParserDefault(val);
14319 desret_int(ret_val);
14320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014321 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014322 xmlResetLastError();
14323 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014324 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014326 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014327 printf(" %d", n_val);
14328 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329 }
14330 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014332
Daniel Veillard42595322004-11-08 10:52:06 +000014333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334}
14335
14336
14337static int
14338test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014340
14341 int mem_base;
14342 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014343 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344 int n_cur;
14345 const char * URL; /* the base URL to use for the document */
14346 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014347 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014348 int n_encoding;
14349 int options; /* a combination of xmlParserOption */
14350 int n_options;
14351
14352 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14353 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14354 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014355 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014356 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014357 cur = gen_const_xmlChar_ptr(n_cur, 0);
14358 URL = gen_filepath(n_URL, 1);
14359 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014360 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014361
William M. Brackf13f77f2004-11-12 16:03:48 +000014362 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014363 desret_xmlDocPtr(ret_val);
14364 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014365 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014366 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014367 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014368 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014369 xmlResetLastError();
14370 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014371 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014373 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014374 printf(" %d", n_cur);
14375 printf(" %d", n_URL);
14376 printf(" %d", n_encoding);
14377 printf(" %d", n_options);
14378 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014379 }
14380 }
14381 }
14382 }
14383 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014384 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014385
Daniel Veillard42595322004-11-08 10:52:06 +000014386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014387}
14388
14389
14390static int
14391test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014393
14394 int mem_base;
14395 xmlDocPtr ret_val;
14396 const char * filename; /* a file or URL */
14397 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014398 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014399 int n_encoding;
14400 int options; /* a combination of xmlParserOption */
14401 int n_options;
14402
14403 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14404 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014405 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014406 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014407 filename = gen_filepath(n_filename, 0);
14408 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014409 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014410
William M. Brackf13f77f2004-11-12 16:03:48 +000014411 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014412 desret_xmlDocPtr(ret_val);
14413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014414 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014415 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014416 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014417 xmlResetLastError();
14418 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014419 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014421 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014422 printf(" %d", n_filename);
14423 printf(" %d", n_encoding);
14424 printf(" %d", n_options);
14425 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014426 }
14427 }
14428 }
14429 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014431
Daniel Veillard42595322004-11-08 10:52:06 +000014432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014433}
14434
14435
14436static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014437test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439
14440 int mem_base;
14441 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014442 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014443 int n_buffer;
14444 int size; /* the size of the array */
14445 int n_size;
14446 const char * URL; /* the base URL to use for the document */
14447 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014448 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014449 int n_encoding;
14450 int options; /* a combination of xmlParserOption */
14451 int n_options;
14452
14453 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14454 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14455 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14456 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014457 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014458 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014459 buffer = gen_const_char_ptr(n_buffer, 0);
14460 size = gen_int(n_size, 1);
14461 URL = gen_filepath(n_URL, 2);
14462 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014463 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014464
William M. Brackf13f77f2004-11-12 16:03:48 +000014465 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466 desret_xmlDocPtr(ret_val);
14467 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014468 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014469 des_int(n_size, size, 1);
14470 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014471 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014472 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014473 xmlResetLastError();
14474 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014475 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014477 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014478 printf(" %d", n_buffer);
14479 printf(" %d", n_size);
14480 printf(" %d", n_URL);
14481 printf(" %d", n_encoding);
14482 printf(" %d", n_options);
14483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014484 }
14485 }
14486 }
14487 }
14488 }
14489 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014490 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014491
Daniel Veillard42595322004-11-08 10:52:06 +000014492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014493}
14494
14495
14496static int
14497test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014499
William M. Brack21e4ef22005-01-02 09:53:13 +000014500#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014501#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014502 int mem_base;
14503 xmlDocPtr ret_val;
14504 xmlChar * cur; /* a pointer to an array of xmlChar */
14505 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014506
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014507 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014509 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014510
14511 ret_val = xmlRecoverDoc(cur);
14512 desret_xmlDocPtr(ret_val);
14513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014514 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014515 xmlResetLastError();
14516 if (mem_base != xmlMemBlocks()) {
14517 printf("Leak of %d blocks found in xmlRecoverDoc",
14518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014519 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014520 printf(" %d", n_cur);
14521 printf("\n");
14522 }
14523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014524 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014525#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014526#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014527
Daniel Veillard42595322004-11-08 10:52:06 +000014528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014529}
14530
14531
14532static int
14533test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014535
William M. Brack21e4ef22005-01-02 09:53:13 +000014536#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014537#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538 int mem_base;
14539 xmlDocPtr ret_val;
14540 const char * filename; /* the filename */
14541 int n_filename;
14542
14543 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14544 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014545 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014546
14547 ret_val = xmlRecoverFile(filename);
14548 desret_xmlDocPtr(ret_val);
14549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014550 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014551 xmlResetLastError();
14552 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014553 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014555 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014556 printf(" %d", n_filename);
14557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014558 }
14559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014560 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014561#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014562#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014563
Daniel Veillard42595322004-11-08 10:52:06 +000014564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014565}
14566
14567
14568static int
14569test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014571
William M. Brack21e4ef22005-01-02 09:53:13 +000014572#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014573#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014574 int mem_base;
14575 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014576 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014577 int n_buffer;
14578 int size; /* the size of the array */
14579 int n_size;
14580
14581 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14582 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14583 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014584 buffer = gen_const_char_ptr(n_buffer, 0);
14585 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014586
William M. Brackf13f77f2004-11-12 16:03:48 +000014587 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014588 desret_xmlDocPtr(ret_val);
14589 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014590 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014591 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014592 xmlResetLastError();
14593 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014594 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014596 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014597 printf(" %d", n_buffer);
14598 printf(" %d", n_size);
14599 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014600 }
14601 }
14602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014603 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014604#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014605#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014606
Daniel Veillard42595322004-11-08 10:52:06 +000014607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014608}
14609
14610
14611static int
14612test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014614
William M. Brack21e4ef22005-01-02 09:53:13 +000014615#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014616#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014617 int mem_base;
14618 xmlDtdPtr ret_val;
14619 xmlSAXHandlerPtr sax; /* the SAX handler block */
14620 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014621 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014622 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014623 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014624 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014625
Daniel Veillard34099b42004-11-04 17:34:35 +000014626 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14627 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14628 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14629 mem_base = xmlMemBlocks();
14630 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14631 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14632 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14633
William M. Brackf13f77f2004-11-12 16:03:48 +000014634 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014635 desret_xmlDtdPtr(ret_val);
14636 call_tests++;
14637 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014638 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14639 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014640 xmlResetLastError();
14641 if (mem_base != xmlMemBlocks()) {
14642 printf("Leak of %d blocks found in xmlSAXParseDTD",
14643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014644 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014645 printf(" %d", n_sax);
14646 printf(" %d", n_ExternalID);
14647 printf(" %d", n_SystemID);
14648 printf("\n");
14649 }
14650 }
14651 }
14652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014653 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014654#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014655#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014656
Daniel Veillard42595322004-11-08 10:52:06 +000014657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014658}
14659
14660
14661static int
14662test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014664
William M. Brack21e4ef22005-01-02 09:53:13 +000014665#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014666#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014667 int mem_base;
14668 xmlDocPtr ret_val;
14669 xmlSAXHandlerPtr sax; /* the SAX handler block */
14670 int n_sax;
14671 xmlChar * cur; /* a pointer to an array of xmlChar */
14672 int n_cur;
14673 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14674 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014675
Daniel Veillard34099b42004-11-04 17:34:35 +000014676 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14677 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14678 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14679 mem_base = xmlMemBlocks();
14680 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14681 cur = gen_xmlChar_ptr(n_cur, 1);
14682 recovery = gen_int(n_recovery, 2);
14683
14684 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14685 desret_xmlDocPtr(ret_val);
14686 call_tests++;
14687 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14688 des_xmlChar_ptr(n_cur, cur, 1);
14689 des_int(n_recovery, recovery, 2);
14690 xmlResetLastError();
14691 if (mem_base != xmlMemBlocks()) {
14692 printf("Leak of %d blocks found in xmlSAXParseDoc",
14693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014694 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014695 printf(" %d", n_sax);
14696 printf(" %d", n_cur);
14697 printf(" %d", n_recovery);
14698 printf("\n");
14699 }
14700 }
14701 }
14702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014703 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014704#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014705#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014706
Daniel Veillard42595322004-11-08 10:52:06 +000014707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014708}
14709
14710
14711static int
14712test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014714
William M. Brack21e4ef22005-01-02 09:53:13 +000014715#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014716#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014717 int mem_base;
14718 xmlDocPtr ret_val;
14719 xmlSAXHandlerPtr sax; /* the SAX handler block */
14720 int n_sax;
14721 const char * filename; /* the filename */
14722 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014723
Daniel Veillard34099b42004-11-04 17:34:35 +000014724 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14725 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14726 mem_base = xmlMemBlocks();
14727 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14728 filename = gen_filepath(n_filename, 1);
14729
14730 ret_val = xmlSAXParseEntity(sax, filename);
14731 desret_xmlDocPtr(ret_val);
14732 call_tests++;
14733 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14734 des_filepath(n_filename, filename, 1);
14735 xmlResetLastError();
14736 if (mem_base != xmlMemBlocks()) {
14737 printf("Leak of %d blocks found in xmlSAXParseEntity",
14738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014739 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014740 printf(" %d", n_sax);
14741 printf(" %d", n_filename);
14742 printf("\n");
14743 }
14744 }
14745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014746 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014747#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014748#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014749
Daniel Veillard42595322004-11-08 10:52:06 +000014750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014751}
14752
14753
14754static int
14755test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014757
William M. Brack21e4ef22005-01-02 09:53:13 +000014758#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014759#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014760 int mem_base;
14761 xmlDocPtr ret_val;
14762 xmlSAXHandlerPtr sax; /* the SAX handler block */
14763 int n_sax;
14764 const char * filename; /* the filename */
14765 int n_filename;
14766 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14767 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014768
Daniel Veillard34099b42004-11-04 17:34:35 +000014769 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14770 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14771 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14772 mem_base = xmlMemBlocks();
14773 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14774 filename = gen_filepath(n_filename, 1);
14775 recovery = gen_int(n_recovery, 2);
14776
14777 ret_val = xmlSAXParseFile(sax, filename, recovery);
14778 desret_xmlDocPtr(ret_val);
14779 call_tests++;
14780 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14781 des_filepath(n_filename, filename, 1);
14782 des_int(n_recovery, recovery, 2);
14783 xmlResetLastError();
14784 if (mem_base != xmlMemBlocks()) {
14785 printf("Leak of %d blocks found in xmlSAXParseFile",
14786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014787 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014788 printf(" %d", n_sax);
14789 printf(" %d", n_filename);
14790 printf(" %d", n_recovery);
14791 printf("\n");
14792 }
14793 }
14794 }
14795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014796 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014797#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014798#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014799
Daniel Veillard42595322004-11-08 10:52:06 +000014800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801}
14802
14803
14804static int
14805test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014807
William M. Brack21e4ef22005-01-02 09:53:13 +000014808#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014809#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014810 int mem_base;
14811 xmlDocPtr ret_val;
14812 xmlSAXHandlerPtr sax; /* the SAX handler block */
14813 int n_sax;
14814 const char * filename; /* the filename */
14815 int n_filename;
14816 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14817 int n_recovery;
14818 void * data; /* the userdata */
14819 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014820
Daniel Veillard34099b42004-11-04 17:34:35 +000014821 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14822 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14823 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14824 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14825 mem_base = xmlMemBlocks();
14826 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14827 filename = gen_filepath(n_filename, 1);
14828 recovery = gen_int(n_recovery, 2);
14829 data = gen_userdata(n_data, 3);
14830
14831 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14832 desret_xmlDocPtr(ret_val);
14833 call_tests++;
14834 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14835 des_filepath(n_filename, filename, 1);
14836 des_int(n_recovery, recovery, 2);
14837 des_userdata(n_data, data, 3);
14838 xmlResetLastError();
14839 if (mem_base != xmlMemBlocks()) {
14840 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014842 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014843 printf(" %d", n_sax);
14844 printf(" %d", n_filename);
14845 printf(" %d", n_recovery);
14846 printf(" %d", n_data);
14847 printf("\n");
14848 }
14849 }
14850 }
14851 }
14852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014853 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014854#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014855#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014856
Daniel Veillard42595322004-11-08 10:52:06 +000014857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014858}
14859
14860
14861static int
14862test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014864
William M. Brack21e4ef22005-01-02 09:53:13 +000014865#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014866#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014867 int mem_base;
14868 xmlDocPtr ret_val;
14869 xmlSAXHandlerPtr sax; /* the SAX handler block */
14870 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014871 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014872 int n_buffer;
14873 int size; /* the size of the array */
14874 int n_size;
14875 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14876 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014877
Daniel Veillard34099b42004-11-04 17:34:35 +000014878 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14879 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14880 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14881 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14882 mem_base = xmlMemBlocks();
14883 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14884 buffer = gen_const_char_ptr(n_buffer, 1);
14885 size = gen_int(n_size, 2);
14886 recovery = gen_int(n_recovery, 3);
14887
William M. Brackf13f77f2004-11-12 16:03:48 +000014888 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014889 desret_xmlDocPtr(ret_val);
14890 call_tests++;
14891 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014892 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014893 des_int(n_size, size, 2);
14894 des_int(n_recovery, recovery, 3);
14895 xmlResetLastError();
14896 if (mem_base != xmlMemBlocks()) {
14897 printf("Leak of %d blocks found in xmlSAXParseMemory",
14898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014899 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014900 printf(" %d", n_sax);
14901 printf(" %d", n_buffer);
14902 printf(" %d", n_size);
14903 printf(" %d", n_recovery);
14904 printf("\n");
14905 }
14906 }
14907 }
14908 }
14909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014910 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014911#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014912#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014913
Daniel Veillard42595322004-11-08 10:52:06 +000014914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014915}
14916
14917
14918static int
14919test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014921
William M. Brack21e4ef22005-01-02 09:53:13 +000014922#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014923#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014924 int mem_base;
14925 xmlDocPtr ret_val;
14926 xmlSAXHandlerPtr sax; /* the SAX handler block */
14927 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014928 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014929 int n_buffer;
14930 int size; /* the size of the array */
14931 int n_size;
14932 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14933 int n_recovery;
14934 void * data; /* the userdata */
14935 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014936
Daniel Veillard34099b42004-11-04 17:34:35 +000014937 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14938 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14939 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14940 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14941 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14942 mem_base = xmlMemBlocks();
14943 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14944 buffer = gen_const_char_ptr(n_buffer, 1);
14945 size = gen_int(n_size, 2);
14946 recovery = gen_int(n_recovery, 3);
14947 data = gen_userdata(n_data, 4);
14948
William M. Brackf13f77f2004-11-12 16:03:48 +000014949 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 desret_xmlDocPtr(ret_val);
14951 call_tests++;
14952 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014953 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014954 des_int(n_size, size, 2);
14955 des_int(n_recovery, recovery, 3);
14956 des_userdata(n_data, data, 4);
14957 xmlResetLastError();
14958 if (mem_base != xmlMemBlocks()) {
14959 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014961 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014962 printf(" %d", n_sax);
14963 printf(" %d", n_buffer);
14964 printf(" %d", n_size);
14965 printf(" %d", n_recovery);
14966 printf(" %d", n_data);
14967 printf("\n");
14968 }
14969 }
14970 }
14971 }
14972 }
14973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014974 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014975#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014976#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014977
Daniel Veillard42595322004-11-08 10:52:06 +000014978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014979}
14980
14981
14982static int
14983test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014985
William M. Brack21e4ef22005-01-02 09:53:13 +000014986#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014987#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014988 int mem_base;
14989 int ret_val;
14990 xmlSAXHandlerPtr sax; /* a SAX handler */
14991 int n_sax;
14992 void * user_data; /* The user data returned on SAX callbacks */
14993 int n_user_data;
14994 const char * filename; /* a file name */
14995 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014996
Daniel Veillard34099b42004-11-04 17:34:35 +000014997 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14998 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14999 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15000 mem_base = xmlMemBlocks();
15001 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15002 user_data = gen_userdata(n_user_data, 1);
15003 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000015004
15005#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015006 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015007#endif
15008
Daniel Veillard34099b42004-11-04 17:34:35 +000015009
15010 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
15011 desret_int(ret_val);
15012 call_tests++;
15013 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15014 des_userdata(n_user_data, user_data, 1);
15015 des_filepath(n_filename, filename, 2);
15016 xmlResetLastError();
15017 if (mem_base != xmlMemBlocks()) {
15018 printf("Leak of %d blocks found in xmlSAXUserParseFile",
15019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015020 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015021 printf(" %d", n_sax);
15022 printf(" %d", n_user_data);
15023 printf(" %d", n_filename);
15024 printf("\n");
15025 }
15026 }
15027 }
15028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015029 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015030#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015031#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015032
Daniel Veillard42595322004-11-08 10:52:06 +000015033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015034}
15035
15036
15037static int
15038test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015040
William M. Brack21e4ef22005-01-02 09:53:13 +000015041#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015042#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015043 int mem_base;
15044 int ret_val;
15045 xmlSAXHandlerPtr sax; /* a SAX handler */
15046 int n_sax;
15047 void * user_data; /* The user data returned on SAX callbacks */
15048 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015049 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015050 int n_buffer;
15051 int size; /* the length of the XML document in bytes */
15052 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015053
Daniel Veillard34099b42004-11-04 17:34:35 +000015054 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15055 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15056 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15057 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15058 mem_base = xmlMemBlocks();
15059 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15060 user_data = gen_userdata(n_user_data, 1);
15061 buffer = gen_const_char_ptr(n_buffer, 2);
15062 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015063
15064#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015065 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015066#endif
15067
Daniel Veillard34099b42004-11-04 17:34:35 +000015068
William M. Brackf13f77f2004-11-12 16:03:48 +000015069 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015070 desret_int(ret_val);
15071 call_tests++;
15072 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15073 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015074 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015075 des_int(n_size, size, 3);
15076 xmlResetLastError();
15077 if (mem_base != xmlMemBlocks()) {
15078 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015080 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015081 printf(" %d", n_sax);
15082 printf(" %d", n_user_data);
15083 printf(" %d", n_buffer);
15084 printf(" %d", n_size);
15085 printf("\n");
15086 }
15087 }
15088 }
15089 }
15090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015091 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015092#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015093#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015094
Daniel Veillard42595322004-11-08 10:52:06 +000015095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015096}
15097
15098
15099static int
15100test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015102
15103
15104 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015106}
15107
15108
15109static int
15110test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015112
William M. Brack21e4ef22005-01-02 09:53:13 +000015113#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015114#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015115 int mem_base;
15116 int ret_val;
15117 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15118 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015119 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015120 int n_name;
15121 void * value; /* pointer to the location of the new value */
15122 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015123
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15125 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15126 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015128 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15129 name = gen_const_char_ptr(n_name, 1);
15130 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015131
William M. Brackf13f77f2004-11-12 16:03:48 +000015132 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015133 desret_int(ret_val);
15134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015135 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015136 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015137 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015138 xmlResetLastError();
15139 if (mem_base != xmlMemBlocks()) {
15140 printf("Leak of %d blocks found in xmlSetFeature",
15141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015142 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015143 printf(" %d", n_ctxt);
15144 printf(" %d", n_name);
15145 printf(" %d", n_value);
15146 printf("\n");
15147 }
15148 }
15149 }
15150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015151 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015152#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015153#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015154
Daniel Veillard42595322004-11-08 10:52:06 +000015155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015156}
15157
15158
15159static int
15160test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015162
William M. Brack21e4ef22005-01-02 09:53:13 +000015163#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015164#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015165 int mem_base;
15166 xmlParserCtxtPtr ctxt; /* an XML parser context */
15167 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015168 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169 int n_buffer;
15170 const char * filename; /* a file name */
15171 int n_filename;
15172
15173 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15174 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15175 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015177 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15178 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15179 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015180
William M. Brackf13f77f2004-11-12 16:03:48 +000015181 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015183 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015184 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015185 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015186 xmlResetLastError();
15187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015188 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015191 printf(" %d", n_ctxt);
15192 printf(" %d", n_buffer);
15193 printf(" %d", n_filename);
15194 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015195 }
15196 }
15197 }
15198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015199 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015200#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015201#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015202
Daniel Veillard42595322004-11-08 10:52:06 +000015203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015204}
15205
15206
15207static int
15208test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015210
William M. Brack21e4ef22005-01-02 09:53:13 +000015211#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015212#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015213 int mem_base;
15214 xmlParserCtxtPtr ctxt; /* an XML parser context */
15215 int n_ctxt;
15216
15217 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15218 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015219 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015220
15221 xmlStopParser(ctxt);
15222 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015223 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015224 xmlResetLastError();
15225 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015226 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015228 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015229 printf(" %d", n_ctxt);
15230 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015231 }
15232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015233 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015234#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015235#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015236
Daniel Veillard42595322004-11-08 10:52:06 +000015237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015238}
15239
15240
15241static int
15242test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015244
15245 int mem_base;
15246 int ret_val;
15247 int val; /* int 0 or 1 */
15248 int n_val;
15249
15250 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015252 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015253
15254 ret_val = xmlSubstituteEntitiesDefault(val);
15255 desret_int(ret_val);
15256 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015257 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015258 xmlResetLastError();
15259 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015260 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015262 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015263 printf(" %d", n_val);
15264 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015265 }
15266 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015267 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015268
Daniel Veillard42595322004-11-08 10:52:06 +000015269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015270}
15271
15272static int
15273test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015275
William M. Brack094dd862004-11-14 14:28:34 +000015276 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015277 test_ret += test_xmlByteConsumed();
15278 test_ret += test_xmlClearNodeInfoSeq();
15279 test_ret += test_xmlClearParserCtxt();
15280 test_ret += test_xmlCreateDocParserCtxt();
15281 test_ret += test_xmlCreatePushParserCtxt();
15282 test_ret += test_xmlCtxtReadDoc();
15283 test_ret += test_xmlCtxtReadFile();
15284 test_ret += test_xmlCtxtReadMemory();
15285 test_ret += test_xmlCtxtReset();
15286 test_ret += test_xmlCtxtResetPush();
15287 test_ret += test_xmlCtxtUseOptions();
15288 test_ret += test_xmlGetExternalEntityLoader();
15289 test_ret += test_xmlGetFeature();
15290 test_ret += test_xmlGetFeaturesList();
15291 test_ret += test_xmlIOParseDTD();
15292 test_ret += test_xmlInitNodeInfoSeq();
15293 test_ret += test_xmlInitParser();
15294 test_ret += test_xmlInitParserCtxt();
15295 test_ret += test_xmlKeepBlanksDefault();
15296 test_ret += test_xmlLineNumbersDefault();
15297 test_ret += test_xmlLoadExternalEntity();
15298 test_ret += test_xmlNewIOInputStream();
15299 test_ret += test_xmlNewParserCtxt();
15300 test_ret += test_xmlParseBalancedChunkMemory();
15301 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15302 test_ret += test_xmlParseChunk();
15303 test_ret += test_xmlParseCtxtExternalEntity();
15304 test_ret += test_xmlParseDTD();
15305 test_ret += test_xmlParseDoc();
15306 test_ret += test_xmlParseDocument();
15307 test_ret += test_xmlParseEntity();
15308 test_ret += test_xmlParseExtParsedEnt();
15309 test_ret += test_xmlParseExternalEntity();
15310 test_ret += test_xmlParseFile();
15311 test_ret += test_xmlParseInNodeContext();
15312 test_ret += test_xmlParseMemory();
15313 test_ret += test_xmlParserAddNodeInfo();
15314 test_ret += test_xmlParserFindNodeInfo();
15315 test_ret += test_xmlParserFindNodeInfoIndex();
15316 test_ret += test_xmlParserInputGrow();
15317 test_ret += test_xmlParserInputRead();
15318 test_ret += test_xmlPedanticParserDefault();
15319 test_ret += test_xmlReadDoc();
15320 test_ret += test_xmlReadFile();
15321 test_ret += test_xmlReadMemory();
15322 test_ret += test_xmlRecoverDoc();
15323 test_ret += test_xmlRecoverFile();
15324 test_ret += test_xmlRecoverMemory();
15325 test_ret += test_xmlSAXParseDTD();
15326 test_ret += test_xmlSAXParseDoc();
15327 test_ret += test_xmlSAXParseEntity();
15328 test_ret += test_xmlSAXParseFile();
15329 test_ret += test_xmlSAXParseFileWithData();
15330 test_ret += test_xmlSAXParseMemory();
15331 test_ret += test_xmlSAXParseMemoryWithData();
15332 test_ret += test_xmlSAXUserParseFile();
15333 test_ret += test_xmlSAXUserParseMemory();
15334 test_ret += test_xmlSetExternalEntityLoader();
15335 test_ret += test_xmlSetFeature();
15336 test_ret += test_xmlSetupParserForBuffer();
15337 test_ret += test_xmlStopParser();
15338 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015339
Daniel Veillard42595322004-11-08 10:52:06 +000015340 if (test_ret != 0)
15341 printf("Module parser: %d errors\n", test_ret);
15342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015343}
15344
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015345static int
15346test_htmlCreateFileParserCtxt(void) {
15347 int test_ret = 0;
15348
William M. Brack21e4ef22005-01-02 09:53:13 +000015349#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015350 int mem_base;
15351 htmlParserCtxtPtr ret_val;
15352 const char * filename; /* the filename */
15353 int n_filename;
15354 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15355 int n_encoding;
15356
15357 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15358 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15359 mem_base = xmlMemBlocks();
15360 filename = gen_fileoutput(n_filename, 0);
15361 encoding = gen_const_char_ptr(n_encoding, 1);
15362
William M. Brackf13f77f2004-11-12 16:03:48 +000015363 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015364 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015365 call_tests++;
15366 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015367 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015368 xmlResetLastError();
15369 if (mem_base != xmlMemBlocks()) {
15370 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15371 xmlMemBlocks() - mem_base);
15372 test_ret++;
15373 printf(" %d", n_filename);
15374 printf(" %d", n_encoding);
15375 printf("\n");
15376 }
15377 }
15378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015379 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015380#endif
15381
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015382 return(test_ret);
15383}
15384
15385
15386static int
15387test_htmlInitAutoClose(void) {
15388 int test_ret = 0;
15389
William M. Brack21e4ef22005-01-02 09:53:13 +000015390#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015391 int mem_base;
15392
15393 mem_base = xmlMemBlocks();
15394
15395 htmlInitAutoClose();
15396 call_tests++;
15397 xmlResetLastError();
15398 if (mem_base != xmlMemBlocks()) {
15399 printf("Leak of %d blocks found in htmlInitAutoClose",
15400 xmlMemBlocks() - mem_base);
15401 test_ret++;
15402 printf("\n");
15403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015404 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015405#endif
15406
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015407 return(test_ret);
15408}
15409
15410
15411static int
15412test_inputPop(void) {
15413 int test_ret = 0;
15414
15415 int mem_base;
15416 xmlParserInputPtr ret_val;
15417 xmlParserCtxtPtr ctxt; /* an XML parser context */
15418 int n_ctxt;
15419
15420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15421 mem_base = xmlMemBlocks();
15422 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15423
15424 ret_val = inputPop(ctxt);
15425 desret_xmlParserInputPtr(ret_val);
15426 call_tests++;
15427 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15428 xmlResetLastError();
15429 if (mem_base != xmlMemBlocks()) {
15430 printf("Leak of %d blocks found in inputPop",
15431 xmlMemBlocks() - mem_base);
15432 test_ret++;
15433 printf(" %d", n_ctxt);
15434 printf("\n");
15435 }
15436 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015437 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015438
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015439 return(test_ret);
15440}
15441
15442
15443static int
15444test_inputPush(void) {
15445 int test_ret = 0;
15446
15447 int mem_base;
15448 int ret_val;
15449 xmlParserCtxtPtr ctxt; /* an XML parser context */
15450 int n_ctxt;
15451 xmlParserInputPtr value; /* the parser input */
15452 int n_value;
15453
15454 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15455 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15456 mem_base = xmlMemBlocks();
15457 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15458 value = gen_xmlParserInputPtr(n_value, 1);
15459
15460 ret_val = inputPush(ctxt, value);
15461 desret_int(ret_val);
15462 call_tests++;
15463 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15464 des_xmlParserInputPtr(n_value, value, 1);
15465 xmlResetLastError();
15466 if (mem_base != xmlMemBlocks()) {
15467 printf("Leak of %d blocks found in inputPush",
15468 xmlMemBlocks() - mem_base);
15469 test_ret++;
15470 printf(" %d", n_ctxt);
15471 printf(" %d", n_value);
15472 printf("\n");
15473 }
15474 }
15475 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015476 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015477
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015478 return(test_ret);
15479}
15480
15481
15482static int
15483test_namePop(void) {
15484 int test_ret = 0;
15485
15486 int mem_base;
15487 const xmlChar * ret_val;
15488 xmlParserCtxtPtr ctxt; /* an XML parser context */
15489 int n_ctxt;
15490
15491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15492 mem_base = xmlMemBlocks();
15493 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15494
15495 ret_val = namePop(ctxt);
15496 desret_const_xmlChar_ptr(ret_val);
15497 call_tests++;
15498 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15499 xmlResetLastError();
15500 if (mem_base != xmlMemBlocks()) {
15501 printf("Leak of %d blocks found in namePop",
15502 xmlMemBlocks() - mem_base);
15503 test_ret++;
15504 printf(" %d", n_ctxt);
15505 printf("\n");
15506 }
15507 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015509
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015510 return(test_ret);
15511}
15512
15513
15514static int
15515test_namePush(void) {
15516 int test_ret = 0;
15517
15518 int mem_base;
15519 int ret_val;
15520 xmlParserCtxtPtr ctxt; /* an XML parser context */
15521 int n_ctxt;
15522 xmlChar * value; /* the element name */
15523 int n_value;
15524
15525 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15526 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15527 mem_base = xmlMemBlocks();
15528 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15529 value = gen_const_xmlChar_ptr(n_value, 1);
15530
William M. Brackf13f77f2004-11-12 16:03:48 +000015531 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015532 desret_int(ret_val);
15533 call_tests++;
15534 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015535 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015536 xmlResetLastError();
15537 if (mem_base != xmlMemBlocks()) {
15538 printf("Leak of %d blocks found in namePush",
15539 xmlMemBlocks() - mem_base);
15540 test_ret++;
15541 printf(" %d", n_ctxt);
15542 printf(" %d", n_value);
15543 printf("\n");
15544 }
15545 }
15546 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015547 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015548
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015549 return(test_ret);
15550}
15551
15552
15553static int
15554test_nodePop(void) {
15555 int test_ret = 0;
15556
15557 int mem_base;
15558 xmlNodePtr ret_val;
15559 xmlParserCtxtPtr ctxt; /* an XML parser context */
15560 int n_ctxt;
15561
15562 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15563 mem_base = xmlMemBlocks();
15564 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15565
15566 ret_val = nodePop(ctxt);
15567 desret_xmlNodePtr(ret_val);
15568 call_tests++;
15569 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15570 xmlResetLastError();
15571 if (mem_base != xmlMemBlocks()) {
15572 printf("Leak of %d blocks found in nodePop",
15573 xmlMemBlocks() - mem_base);
15574 test_ret++;
15575 printf(" %d", n_ctxt);
15576 printf("\n");
15577 }
15578 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015580
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015581 return(test_ret);
15582}
15583
15584
15585static int
15586test_nodePush(void) {
15587 int test_ret = 0;
15588
15589 int mem_base;
15590 int ret_val;
15591 xmlParserCtxtPtr ctxt; /* an XML parser context */
15592 int n_ctxt;
15593 xmlNodePtr value; /* the element node */
15594 int n_value;
15595
15596 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15597 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15598 mem_base = xmlMemBlocks();
15599 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15600 value = gen_xmlNodePtr(n_value, 1);
15601
15602 ret_val = nodePush(ctxt, value);
15603 desret_int(ret_val);
15604 call_tests++;
15605 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15606 des_xmlNodePtr(n_value, value, 1);
15607 xmlResetLastError();
15608 if (mem_base != xmlMemBlocks()) {
15609 printf("Leak of %d blocks found in nodePush",
15610 xmlMemBlocks() - mem_base);
15611 test_ret++;
15612 printf(" %d", n_ctxt);
15613 printf(" %d", n_value);
15614 printf("\n");
15615 }
15616 }
15617 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015618 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015619
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015620 return(test_ret);
15621}
15622
15623
15624static int
15625test_xmlCheckLanguageID(void) {
15626 int test_ret = 0;
15627
15628 int mem_base;
15629 int ret_val;
15630 xmlChar * lang; /* pointer to the string value */
15631 int n_lang;
15632
15633 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15634 mem_base = xmlMemBlocks();
15635 lang = gen_const_xmlChar_ptr(n_lang, 0);
15636
William M. Brackf13f77f2004-11-12 16:03:48 +000015637 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015638 desret_int(ret_val);
15639 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015640 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015641 xmlResetLastError();
15642 if (mem_base != xmlMemBlocks()) {
15643 printf("Leak of %d blocks found in xmlCheckLanguageID",
15644 xmlMemBlocks() - mem_base);
15645 test_ret++;
15646 printf(" %d", n_lang);
15647 printf("\n");
15648 }
15649 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015651
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015652 return(test_ret);
15653}
15654
15655
15656static int
15657test_xmlCopyChar(void) {
15658 int test_ret = 0;
15659
15660 int mem_base;
15661 int ret_val;
15662 int len; /* Ignored, compatibility */
15663 int n_len;
15664 xmlChar * out; /* pointer to an array of xmlChar */
15665 int n_out;
15666 int val; /* the char value */
15667 int n_val;
15668
15669 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15670 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15671 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15672 mem_base = xmlMemBlocks();
15673 len = gen_int(n_len, 0);
15674 out = gen_xmlChar_ptr(n_out, 1);
15675 val = gen_int(n_val, 2);
15676
15677 ret_val = xmlCopyChar(len, out, val);
15678 desret_int(ret_val);
15679 call_tests++;
15680 des_int(n_len, len, 0);
15681 des_xmlChar_ptr(n_out, out, 1);
15682 des_int(n_val, val, 2);
15683 xmlResetLastError();
15684 if (mem_base != xmlMemBlocks()) {
15685 printf("Leak of %d blocks found in xmlCopyChar",
15686 xmlMemBlocks() - mem_base);
15687 test_ret++;
15688 printf(" %d", n_len);
15689 printf(" %d", n_out);
15690 printf(" %d", n_val);
15691 printf("\n");
15692 }
15693 }
15694 }
15695 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015696 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015697
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015698 return(test_ret);
15699}
15700
15701
15702static int
15703test_xmlCopyCharMultiByte(void) {
15704 int test_ret = 0;
15705
15706 int mem_base;
15707 int ret_val;
15708 xmlChar * out; /* pointer to an array of xmlChar */
15709 int n_out;
15710 int val; /* the char value */
15711 int n_val;
15712
15713 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15714 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15715 mem_base = xmlMemBlocks();
15716 out = gen_xmlChar_ptr(n_out, 0);
15717 val = gen_int(n_val, 1);
15718
15719 ret_val = xmlCopyCharMultiByte(out, val);
15720 desret_int(ret_val);
15721 call_tests++;
15722 des_xmlChar_ptr(n_out, out, 0);
15723 des_int(n_val, val, 1);
15724 xmlResetLastError();
15725 if (mem_base != xmlMemBlocks()) {
15726 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15727 xmlMemBlocks() - mem_base);
15728 test_ret++;
15729 printf(" %d", n_out);
15730 printf(" %d", n_val);
15731 printf("\n");
15732 }
15733 }
15734 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015735 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015736
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015737 return(test_ret);
15738}
15739
15740
15741static int
15742test_xmlCreateEntityParserCtxt(void) {
15743 int test_ret = 0;
15744
15745 int mem_base;
15746 xmlParserCtxtPtr ret_val;
15747 xmlChar * URL; /* the entity URL */
15748 int n_URL;
15749 xmlChar * ID; /* the entity PUBLIC ID */
15750 int n_ID;
15751 xmlChar * base; /* a possible base for the target URI */
15752 int n_base;
15753
15754 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15755 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15756 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15757 mem_base = xmlMemBlocks();
15758 URL = gen_const_xmlChar_ptr(n_URL, 0);
15759 ID = gen_const_xmlChar_ptr(n_ID, 1);
15760 base = gen_const_xmlChar_ptr(n_base, 2);
15761
William M. Brackf13f77f2004-11-12 16:03:48 +000015762 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015763 desret_xmlParserCtxtPtr(ret_val);
15764 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015765 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15766 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15767 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015768 xmlResetLastError();
15769 if (mem_base != xmlMemBlocks()) {
15770 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15771 xmlMemBlocks() - mem_base);
15772 test_ret++;
15773 printf(" %d", n_URL);
15774 printf(" %d", n_ID);
15775 printf(" %d", n_base);
15776 printf("\n");
15777 }
15778 }
15779 }
15780 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015781 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015782
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015783 return(test_ret);
15784}
15785
15786
15787static int
15788test_xmlCreateFileParserCtxt(void) {
15789 int test_ret = 0;
15790
15791 int mem_base;
15792 xmlParserCtxtPtr ret_val;
15793 const char * filename; /* the filename */
15794 int n_filename;
15795
15796 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15797 mem_base = xmlMemBlocks();
15798 filename = gen_fileoutput(n_filename, 0);
15799
15800 ret_val = xmlCreateFileParserCtxt(filename);
15801 desret_xmlParserCtxtPtr(ret_val);
15802 call_tests++;
15803 des_fileoutput(n_filename, filename, 0);
15804 xmlResetLastError();
15805 if (mem_base != xmlMemBlocks()) {
15806 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15807 xmlMemBlocks() - mem_base);
15808 test_ret++;
15809 printf(" %d", n_filename);
15810 printf("\n");
15811 }
15812 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015813 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015814
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015815 return(test_ret);
15816}
15817
15818
15819static int
15820test_xmlCreateMemoryParserCtxt(void) {
15821 int test_ret = 0;
15822
15823 int mem_base;
15824 xmlParserCtxtPtr ret_val;
15825 char * buffer; /* a pointer to a char array */
15826 int n_buffer;
15827 int size; /* the size of the array */
15828 int n_size;
15829
15830 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15831 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15832 mem_base = xmlMemBlocks();
15833 buffer = gen_const_char_ptr(n_buffer, 0);
15834 size = gen_int(n_size, 1);
15835
William M. Brackf13f77f2004-11-12 16:03:48 +000015836 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015837 desret_xmlParserCtxtPtr(ret_val);
15838 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015839 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015840 des_int(n_size, size, 1);
15841 xmlResetLastError();
15842 if (mem_base != xmlMemBlocks()) {
15843 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15844 xmlMemBlocks() - mem_base);
15845 test_ret++;
15846 printf(" %d", n_buffer);
15847 printf(" %d", n_size);
15848 printf("\n");
15849 }
15850 }
15851 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015852 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015853
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015854 return(test_ret);
15855}
15856
15857
15858static int
15859test_xmlCreateURLParserCtxt(void) {
15860 int test_ret = 0;
15861
15862 int mem_base;
15863 xmlParserCtxtPtr ret_val;
15864 const char * filename; /* the filename or URL */
15865 int n_filename;
15866 int options; /* a combination of xmlParserOption */
15867 int n_options;
15868
15869 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15870 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15871 mem_base = xmlMemBlocks();
15872 filename = gen_fileoutput(n_filename, 0);
15873 options = gen_int(n_options, 1);
15874
15875 ret_val = xmlCreateURLParserCtxt(filename, options);
15876 desret_xmlParserCtxtPtr(ret_val);
15877 call_tests++;
15878 des_fileoutput(n_filename, filename, 0);
15879 des_int(n_options, options, 1);
15880 xmlResetLastError();
15881 if (mem_base != xmlMemBlocks()) {
15882 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15883 xmlMemBlocks() - mem_base);
15884 test_ret++;
15885 printf(" %d", n_filename);
15886 printf(" %d", n_options);
15887 printf("\n");
15888 }
15889 }
15890 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015891 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015892
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015893 return(test_ret);
15894}
15895
15896
15897static int
15898test_xmlCurrentChar(void) {
15899 int test_ret = 0;
15900
15901 int mem_base;
15902 int ret_val;
15903 xmlParserCtxtPtr ctxt; /* the XML parser context */
15904 int n_ctxt;
15905 int * len; /* pointer to the length of the char read */
15906 int n_len;
15907
15908 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15909 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15910 mem_base = xmlMemBlocks();
15911 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15912 len = gen_int_ptr(n_len, 1);
15913
15914 ret_val = xmlCurrentChar(ctxt, len);
15915 desret_int(ret_val);
15916 call_tests++;
15917 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15918 des_int_ptr(n_len, len, 1);
15919 xmlResetLastError();
15920 if (mem_base != xmlMemBlocks()) {
15921 printf("Leak of %d blocks found in xmlCurrentChar",
15922 xmlMemBlocks() - mem_base);
15923 test_ret++;
15924 printf(" %d", n_ctxt);
15925 printf(" %d", n_len);
15926 printf("\n");
15927 }
15928 }
15929 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015930 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015931
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015932 return(test_ret);
15933}
15934
15935
15936static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015937test_xmlErrMemory(void) {
15938 int test_ret = 0;
15939
15940 int mem_base;
15941 xmlParserCtxtPtr ctxt; /* an XML parser context */
15942 int n_ctxt;
15943 char * extra; /* extra informations */
15944 int n_extra;
15945
15946 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15947 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15948 mem_base = xmlMemBlocks();
15949 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15950 extra = gen_const_char_ptr(n_extra, 1);
15951
William M. Brackf13f77f2004-11-12 16:03:48 +000015952 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015953 call_tests++;
15954 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015955 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015956 xmlResetLastError();
15957 if (mem_base != xmlMemBlocks()) {
15958 printf("Leak of %d blocks found in xmlErrMemory",
15959 xmlMemBlocks() - mem_base);
15960 test_ret++;
15961 printf(" %d", n_ctxt);
15962 printf(" %d", n_extra);
15963 printf("\n");
15964 }
15965 }
15966 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015967 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015968
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015969 return(test_ret);
15970}
15971
15972
15973static int
15974test_xmlIsLetter(void) {
15975 int test_ret = 0;
15976
15977 int mem_base;
15978 int ret_val;
15979 int c; /* an unicode character (int) */
15980 int n_c;
15981
15982 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15983 mem_base = xmlMemBlocks();
15984 c = gen_int(n_c, 0);
15985
15986 ret_val = xmlIsLetter(c);
15987 desret_int(ret_val);
15988 call_tests++;
15989 des_int(n_c, c, 0);
15990 xmlResetLastError();
15991 if (mem_base != xmlMemBlocks()) {
15992 printf("Leak of %d blocks found in xmlIsLetter",
15993 xmlMemBlocks() - mem_base);
15994 test_ret++;
15995 printf(" %d", n_c);
15996 printf("\n");
15997 }
15998 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015999 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016000
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016001 return(test_ret);
16002}
16003
16004
16005static int
16006test_xmlNewEntityInputStream(void) {
16007 int test_ret = 0;
16008
16009 int mem_base;
16010 xmlParserInputPtr ret_val;
16011 xmlParserCtxtPtr ctxt; /* an XML parser context */
16012 int n_ctxt;
16013 xmlEntityPtr entity; /* an Entity pointer */
16014 int n_entity;
16015
16016 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16017 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
16018 mem_base = xmlMemBlocks();
16019 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16020 entity = gen_xmlEntityPtr(n_entity, 1);
16021
16022 ret_val = xmlNewEntityInputStream(ctxt, entity);
16023 desret_xmlParserInputPtr(ret_val);
16024 call_tests++;
16025 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16026 des_xmlEntityPtr(n_entity, entity, 1);
16027 xmlResetLastError();
16028 if (mem_base != xmlMemBlocks()) {
16029 printf("Leak of %d blocks found in xmlNewEntityInputStream",
16030 xmlMemBlocks() - mem_base);
16031 test_ret++;
16032 printf(" %d", n_ctxt);
16033 printf(" %d", n_entity);
16034 printf("\n");
16035 }
16036 }
16037 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016039
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016040 return(test_ret);
16041}
16042
16043
16044static int
16045test_xmlNewInputFromFile(void) {
16046 int test_ret = 0;
16047
16048 int mem_base;
16049 xmlParserInputPtr ret_val;
16050 xmlParserCtxtPtr ctxt; /* an XML parser context */
16051 int n_ctxt;
16052 const char * filename; /* the filename to use as entity */
16053 int n_filename;
16054
16055 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16056 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16057 mem_base = xmlMemBlocks();
16058 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16059 filename = gen_filepath(n_filename, 1);
16060
16061 ret_val = xmlNewInputFromFile(ctxt, filename);
16062 desret_xmlParserInputPtr(ret_val);
16063 call_tests++;
16064 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16065 des_filepath(n_filename, filename, 1);
16066 xmlResetLastError();
16067 if (mem_base != xmlMemBlocks()) {
16068 printf("Leak of %d blocks found in xmlNewInputFromFile",
16069 xmlMemBlocks() - mem_base);
16070 test_ret++;
16071 printf(" %d", n_ctxt);
16072 printf(" %d", n_filename);
16073 printf("\n");
16074 }
16075 }
16076 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016078
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016079 return(test_ret);
16080}
16081
16082
16083static int
16084test_xmlNewInputStream(void) {
16085 int test_ret = 0;
16086
16087 int mem_base;
16088 xmlParserInputPtr ret_val;
16089 xmlParserCtxtPtr ctxt; /* an XML parser context */
16090 int n_ctxt;
16091
16092 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16093 mem_base = xmlMemBlocks();
16094 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16095
16096 ret_val = xmlNewInputStream(ctxt);
16097 desret_xmlParserInputPtr(ret_val);
16098 call_tests++;
16099 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16100 xmlResetLastError();
16101 if (mem_base != xmlMemBlocks()) {
16102 printf("Leak of %d blocks found in xmlNewInputStream",
16103 xmlMemBlocks() - mem_base);
16104 test_ret++;
16105 printf(" %d", n_ctxt);
16106 printf("\n");
16107 }
16108 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016109 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016110
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016111 return(test_ret);
16112}
16113
16114
16115static int
16116test_xmlNewStringInputStream(void) {
16117 int test_ret = 0;
16118
16119 int mem_base;
16120 xmlParserInputPtr ret_val;
16121 xmlParserCtxtPtr ctxt; /* an XML parser context */
16122 int n_ctxt;
16123 xmlChar * buffer; /* an memory buffer */
16124 int n_buffer;
16125
16126 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16127 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16128 mem_base = xmlMemBlocks();
16129 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16130 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16131
William M. Brackf13f77f2004-11-12 16:03:48 +000016132 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016133 desret_xmlParserInputPtr(ret_val);
16134 call_tests++;
16135 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016136 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016137 xmlResetLastError();
16138 if (mem_base != xmlMemBlocks()) {
16139 printf("Leak of %d blocks found in xmlNewStringInputStream",
16140 xmlMemBlocks() - mem_base);
16141 test_ret++;
16142 printf(" %d", n_ctxt);
16143 printf(" %d", n_buffer);
16144 printf("\n");
16145 }
16146 }
16147 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016149
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016150 return(test_ret);
16151}
16152
16153
16154static int
16155test_xmlNextChar(void) {
16156 int test_ret = 0;
16157
16158 int mem_base;
16159 xmlParserCtxtPtr ctxt; /* the XML parser context */
16160 int n_ctxt;
16161
16162 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16163 mem_base = xmlMemBlocks();
16164 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16165
16166 xmlNextChar(ctxt);
16167 call_tests++;
16168 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16169 xmlResetLastError();
16170 if (mem_base != xmlMemBlocks()) {
16171 printf("Leak of %d blocks found in xmlNextChar",
16172 xmlMemBlocks() - mem_base);
16173 test_ret++;
16174 printf(" %d", n_ctxt);
16175 printf("\n");
16176 }
16177 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016179
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016180 return(test_ret);
16181}
16182
16183
16184static int
16185test_xmlParserInputShrink(void) {
16186 int test_ret = 0;
16187
16188 int mem_base;
16189 xmlParserInputPtr in; /* an XML parser input */
16190 int n_in;
16191
16192 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16193 mem_base = xmlMemBlocks();
16194 in = gen_xmlParserInputPtr(n_in, 0);
16195
16196 xmlParserInputShrink(in);
16197 call_tests++;
16198 des_xmlParserInputPtr(n_in, in, 0);
16199 xmlResetLastError();
16200 if (mem_base != xmlMemBlocks()) {
16201 printf("Leak of %d blocks found in xmlParserInputShrink",
16202 xmlMemBlocks() - mem_base);
16203 test_ret++;
16204 printf(" %d", n_in);
16205 printf("\n");
16206 }
16207 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016208 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016209
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016210 return(test_ret);
16211}
16212
16213
16214static int
16215test_xmlPopInput(void) {
16216 int test_ret = 0;
16217
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016218 int mem_base;
16219 xmlChar ret_val;
16220 xmlParserCtxtPtr ctxt; /* an XML parser context */
16221 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016222
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016223 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16224 mem_base = xmlMemBlocks();
16225 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16226
16227 ret_val = xmlPopInput(ctxt);
16228 desret_xmlChar(ret_val);
16229 call_tests++;
16230 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16231 xmlResetLastError();
16232 if (mem_base != xmlMemBlocks()) {
16233 printf("Leak of %d blocks found in xmlPopInput",
16234 xmlMemBlocks() - mem_base);
16235 test_ret++;
16236 printf(" %d", n_ctxt);
16237 printf("\n");
16238 }
16239 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016240 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016241
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016242 return(test_ret);
16243}
16244
16245
16246static int
16247test_xmlPushInput(void) {
16248 int test_ret = 0;
16249
16250 int mem_base;
16251 xmlParserCtxtPtr ctxt; /* an XML parser context */
16252 int n_ctxt;
16253 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16254 int n_input;
16255
16256 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16257 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16258 mem_base = xmlMemBlocks();
16259 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16260 input = gen_xmlParserInputPtr(n_input, 1);
16261
16262 xmlPushInput(ctxt, input);
16263 call_tests++;
16264 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16265 des_xmlParserInputPtr(n_input, input, 1);
16266 xmlResetLastError();
16267 if (mem_base != xmlMemBlocks()) {
16268 printf("Leak of %d blocks found in xmlPushInput",
16269 xmlMemBlocks() - mem_base);
16270 test_ret++;
16271 printf(" %d", n_ctxt);
16272 printf(" %d", n_input);
16273 printf("\n");
16274 }
16275 }
16276 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016277 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016278
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016279 return(test_ret);
16280}
16281
16282
16283static int
16284test_xmlSetEntityReferenceFunc(void) {
16285 int test_ret = 0;
16286
16287
16288 /* missing type support */
16289 return(test_ret);
16290}
16291
16292
16293static int
16294test_xmlSplitQName(void) {
16295 int test_ret = 0;
16296
16297 int mem_base;
16298 xmlChar * ret_val;
16299 xmlParserCtxtPtr ctxt; /* an XML parser context */
16300 int n_ctxt;
16301 xmlChar * name; /* an XML parser context */
16302 int n_name;
16303 xmlChar ** prefix; /* a xmlChar ** */
16304 int n_prefix;
16305
16306 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16307 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16308 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16309 mem_base = xmlMemBlocks();
16310 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16311 name = gen_const_xmlChar_ptr(n_name, 1);
16312 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16313
William M. Brackf13f77f2004-11-12 16:03:48 +000016314 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016315 desret_xmlChar_ptr(ret_val);
16316 call_tests++;
16317 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016318 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016319 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16320 xmlResetLastError();
16321 if (mem_base != xmlMemBlocks()) {
16322 printf("Leak of %d blocks found in xmlSplitQName",
16323 xmlMemBlocks() - mem_base);
16324 test_ret++;
16325 printf(" %d", n_ctxt);
16326 printf(" %d", n_name);
16327 printf(" %d", n_prefix);
16328 printf("\n");
16329 }
16330 }
16331 }
16332 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016334
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016335 return(test_ret);
16336}
16337
16338
16339static int
16340test_xmlStringCurrentChar(void) {
16341 int test_ret = 0;
16342
16343 int mem_base;
16344 int ret_val;
16345 xmlParserCtxtPtr ctxt; /* the XML parser context */
16346 int n_ctxt;
16347 xmlChar * cur; /* pointer to the beginning of the char */
16348 int n_cur;
16349 int * len; /* pointer to the length of the char read */
16350 int n_len;
16351
16352 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16353 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16354 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16355 mem_base = xmlMemBlocks();
16356 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16357 cur = gen_const_xmlChar_ptr(n_cur, 1);
16358 len = gen_int_ptr(n_len, 2);
16359
William M. Brackf13f77f2004-11-12 16:03:48 +000016360 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016361 desret_int(ret_val);
16362 call_tests++;
16363 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016364 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016365 des_int_ptr(n_len, len, 2);
16366 xmlResetLastError();
16367 if (mem_base != xmlMemBlocks()) {
16368 printf("Leak of %d blocks found in xmlStringCurrentChar",
16369 xmlMemBlocks() - mem_base);
16370 test_ret++;
16371 printf(" %d", n_ctxt);
16372 printf(" %d", n_cur);
16373 printf(" %d", n_len);
16374 printf("\n");
16375 }
16376 }
16377 }
16378 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016379 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016380
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016381 return(test_ret);
16382}
16383
16384
16385static int
16386test_xmlStringDecodeEntities(void) {
16387 int test_ret = 0;
16388
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016389 int mem_base;
16390 xmlChar * ret_val;
16391 xmlParserCtxtPtr ctxt; /* the parser context */
16392 int n_ctxt;
16393 xmlChar * str; /* the input string */
16394 int n_str;
16395 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16396 int n_what;
16397 xmlChar end; /* an end marker xmlChar, 0 if none */
16398 int n_end;
16399 xmlChar end2; /* an end marker xmlChar, 0 if none */
16400 int n_end2;
16401 xmlChar end3; /* an end marker xmlChar, 0 if none */
16402 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016403
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016404 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16405 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16406 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16407 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16408 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16409 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16410 mem_base = xmlMemBlocks();
16411 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16412 str = gen_const_xmlChar_ptr(n_str, 1);
16413 what = gen_int(n_what, 2);
16414 end = gen_xmlChar(n_end, 3);
16415 end2 = gen_xmlChar(n_end2, 4);
16416 end3 = gen_xmlChar(n_end3, 5);
16417
William M. Brackf13f77f2004-11-12 16:03:48 +000016418 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016419 desret_xmlChar_ptr(ret_val);
16420 call_tests++;
16421 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016422 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016423 des_int(n_what, what, 2);
16424 des_xmlChar(n_end, end, 3);
16425 des_xmlChar(n_end2, end2, 4);
16426 des_xmlChar(n_end3, end3, 5);
16427 xmlResetLastError();
16428 if (mem_base != xmlMemBlocks()) {
16429 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16430 xmlMemBlocks() - mem_base);
16431 test_ret++;
16432 printf(" %d", n_ctxt);
16433 printf(" %d", n_str);
16434 printf(" %d", n_what);
16435 printf(" %d", n_end);
16436 printf(" %d", n_end2);
16437 printf(" %d", n_end3);
16438 printf("\n");
16439 }
16440 }
16441 }
16442 }
16443 }
16444 }
16445 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016446 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016447
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016448 return(test_ret);
16449}
16450
16451
16452static int
16453test_xmlStringLenDecodeEntities(void) {
16454 int test_ret = 0;
16455
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016456 int mem_base;
16457 xmlChar * ret_val;
16458 xmlParserCtxtPtr ctxt; /* the parser context */
16459 int n_ctxt;
16460 xmlChar * str; /* the input string */
16461 int n_str;
16462 int len; /* the string length */
16463 int n_len;
16464 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16465 int n_what;
16466 xmlChar end; /* an end marker xmlChar, 0 if none */
16467 int n_end;
16468 xmlChar end2; /* an end marker xmlChar, 0 if none */
16469 int n_end2;
16470 xmlChar end3; /* an end marker xmlChar, 0 if none */
16471 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016472
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016473 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16474 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16475 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16476 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16477 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16478 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16479 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16480 mem_base = xmlMemBlocks();
16481 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16482 str = gen_const_xmlChar_ptr(n_str, 1);
16483 len = gen_int(n_len, 2);
16484 what = gen_int(n_what, 3);
16485 end = gen_xmlChar(n_end, 4);
16486 end2 = gen_xmlChar(n_end2, 5);
16487 end3 = gen_xmlChar(n_end3, 6);
16488
William M. Brackf13f77f2004-11-12 16:03:48 +000016489 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016490 desret_xmlChar_ptr(ret_val);
16491 call_tests++;
16492 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016493 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016494 des_int(n_len, len, 2);
16495 des_int(n_what, what, 3);
16496 des_xmlChar(n_end, end, 4);
16497 des_xmlChar(n_end2, end2, 5);
16498 des_xmlChar(n_end3, end3, 6);
16499 xmlResetLastError();
16500 if (mem_base != xmlMemBlocks()) {
16501 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16502 xmlMemBlocks() - mem_base);
16503 test_ret++;
16504 printf(" %d", n_ctxt);
16505 printf(" %d", n_str);
16506 printf(" %d", n_len);
16507 printf(" %d", n_what);
16508 printf(" %d", n_end);
16509 printf(" %d", n_end2);
16510 printf(" %d", n_end3);
16511 printf("\n");
16512 }
16513 }
16514 }
16515 }
16516 }
16517 }
16518 }
16519 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016520 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016521
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016522 return(test_ret);
16523}
16524
16525
16526static int
16527test_xmlSwitchEncoding(void) {
16528 int test_ret = 0;
16529
16530 int mem_base;
16531 int ret_val;
16532 xmlParserCtxtPtr ctxt; /* the parser context */
16533 int n_ctxt;
16534 xmlCharEncoding enc; /* the encoding value (number) */
16535 int n_enc;
16536
16537 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16538 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16539 mem_base = xmlMemBlocks();
16540 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16541 enc = gen_xmlCharEncoding(n_enc, 1);
16542
16543 ret_val = xmlSwitchEncoding(ctxt, enc);
16544 desret_int(ret_val);
16545 call_tests++;
16546 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16547 des_xmlCharEncoding(n_enc, enc, 1);
16548 xmlResetLastError();
16549 if (mem_base != xmlMemBlocks()) {
16550 printf("Leak of %d blocks found in xmlSwitchEncoding",
16551 xmlMemBlocks() - mem_base);
16552 test_ret++;
16553 printf(" %d", n_ctxt);
16554 printf(" %d", n_enc);
16555 printf("\n");
16556 }
16557 }
16558 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016559 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016560
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016561 return(test_ret);
16562}
16563
16564
16565static int
16566test_xmlSwitchInputEncoding(void) {
16567 int test_ret = 0;
16568
16569 int mem_base;
16570 int ret_val;
16571 xmlParserCtxtPtr ctxt; /* the parser context */
16572 int n_ctxt;
16573 xmlParserInputPtr input; /* the input stream */
16574 int n_input;
16575 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16576 int n_handler;
16577
16578 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16579 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16580 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16581 mem_base = xmlMemBlocks();
16582 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16583 input = gen_xmlParserInputPtr(n_input, 1);
16584 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16585
16586 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16587 desret_int(ret_val);
16588 call_tests++;
16589 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16590 des_xmlParserInputPtr(n_input, input, 1);
16591 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16592 xmlResetLastError();
16593 if (mem_base != xmlMemBlocks()) {
16594 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16595 xmlMemBlocks() - mem_base);
16596 test_ret++;
16597 printf(" %d", n_ctxt);
16598 printf(" %d", n_input);
16599 printf(" %d", n_handler);
16600 printf("\n");
16601 }
16602 }
16603 }
16604 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016605 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016606
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016607 return(test_ret);
16608}
16609
16610
16611static int
16612test_xmlSwitchToEncoding(void) {
16613 int test_ret = 0;
16614
16615 int mem_base;
16616 int ret_val;
16617 xmlParserCtxtPtr ctxt; /* the parser context */
16618 int n_ctxt;
16619 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16620 int n_handler;
16621
16622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16623 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16624 mem_base = xmlMemBlocks();
16625 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16626 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16627
16628 ret_val = xmlSwitchToEncoding(ctxt, handler);
16629 desret_int(ret_val);
16630 call_tests++;
16631 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16632 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16633 xmlResetLastError();
16634 if (mem_base != xmlMemBlocks()) {
16635 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16636 xmlMemBlocks() - mem_base);
16637 test_ret++;
16638 printf(" %d", n_ctxt);
16639 printf(" %d", n_handler);
16640 printf("\n");
16641 }
16642 }
16643 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016644 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016645
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016646 return(test_ret);
16647}
16648
16649static int
16650test_parserInternals(void) {
16651 int test_ret = 0;
16652
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016653 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016654 test_ret += test_htmlCreateFileParserCtxt();
16655 test_ret += test_htmlInitAutoClose();
16656 test_ret += test_inputPop();
16657 test_ret += test_inputPush();
16658 test_ret += test_namePop();
16659 test_ret += test_namePush();
16660 test_ret += test_nodePop();
16661 test_ret += test_nodePush();
16662 test_ret += test_xmlCheckLanguageID();
16663 test_ret += test_xmlCopyChar();
16664 test_ret += test_xmlCopyCharMultiByte();
16665 test_ret += test_xmlCreateEntityParserCtxt();
16666 test_ret += test_xmlCreateFileParserCtxt();
16667 test_ret += test_xmlCreateMemoryParserCtxt();
16668 test_ret += test_xmlCreateURLParserCtxt();
16669 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016670 test_ret += test_xmlErrMemory();
16671 test_ret += test_xmlIsLetter();
16672 test_ret += test_xmlNewEntityInputStream();
16673 test_ret += test_xmlNewInputFromFile();
16674 test_ret += test_xmlNewInputStream();
16675 test_ret += test_xmlNewStringInputStream();
16676 test_ret += test_xmlNextChar();
16677 test_ret += test_xmlParserInputShrink();
16678 test_ret += test_xmlPopInput();
16679 test_ret += test_xmlPushInput();
16680 test_ret += test_xmlSetEntityReferenceFunc();
16681 test_ret += test_xmlSplitQName();
16682 test_ret += test_xmlStringCurrentChar();
16683 test_ret += test_xmlStringDecodeEntities();
16684 test_ret += test_xmlStringLenDecodeEntities();
16685 test_ret += test_xmlSwitchEncoding();
16686 test_ret += test_xmlSwitchInputEncoding();
16687 test_ret += test_xmlSwitchToEncoding();
16688
16689 if (test_ret != 0)
16690 printf("Module parserInternals: %d errors\n", test_ret);
16691 return(test_ret);
16692}
16693
Daniel Veillardd93f6252004-11-02 15:53:51 +000016694static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016695test_xmlPatternGetStreamCtxt(void) {
16696 int test_ret = 0;
16697
16698
16699 /* missing type support */
16700 return(test_ret);
16701}
16702
16703
16704static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016705test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016707
William M. Brack21e4ef22005-01-02 09:53:13 +000016708#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016709 int mem_base;
16710 int ret_val;
16711 xmlPatternPtr comp; /* the precompiled pattern */
16712 int n_comp;
16713 xmlNodePtr node; /* a node */
16714 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016715
Daniel Veillardce682bc2004-11-05 17:22:25 +000016716 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16717 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16718 mem_base = xmlMemBlocks();
16719 comp = gen_xmlPatternPtr(n_comp, 0);
16720 node = gen_xmlNodePtr(n_node, 1);
16721
16722 ret_val = xmlPatternMatch(comp, node);
16723 desret_int(ret_val);
16724 call_tests++;
16725 des_xmlPatternPtr(n_comp, comp, 0);
16726 des_xmlNodePtr(n_node, node, 1);
16727 xmlResetLastError();
16728 if (mem_base != xmlMemBlocks()) {
16729 printf("Leak of %d blocks found in xmlPatternMatch",
16730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016731 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016732 printf(" %d", n_comp);
16733 printf(" %d", n_node);
16734 printf("\n");
16735 }
16736 }
16737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016738 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016739#endif
16740
Daniel Veillard42595322004-11-08 10:52:06 +000016741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016742}
16743
16744
16745static int
16746test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016748
16749
16750 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016752}
16753
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016754
16755#define gen_nb_xmlStreamCtxtPtr 1
16756static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16757 return(NULL);
16758}
16759static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16760}
16761
16762static int
16763test_xmlStreamPop(void) {
16764 int test_ret = 0;
16765
16766#if defined(LIBXML_PATTERN_ENABLED)
16767 int mem_base;
16768 int ret_val;
16769 xmlStreamCtxtPtr stream; /* the stream context */
16770 int n_stream;
16771
16772 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16773 mem_base = xmlMemBlocks();
16774 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16775
16776 ret_val = xmlStreamPop(stream);
16777 desret_int(ret_val);
16778 call_tests++;
16779 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16780 xmlResetLastError();
16781 if (mem_base != xmlMemBlocks()) {
16782 printf("Leak of %d blocks found in xmlStreamPop",
16783 xmlMemBlocks() - mem_base);
16784 test_ret++;
16785 printf(" %d", n_stream);
16786 printf("\n");
16787 }
16788 }
16789 function_tests++;
16790#endif
16791
16792 return(test_ret);
16793}
16794
16795
16796static int
16797test_xmlStreamPush(void) {
16798 int test_ret = 0;
16799
16800#if defined(LIBXML_PATTERN_ENABLED)
16801 int mem_base;
16802 int ret_val;
16803 xmlStreamCtxtPtr stream; /* the stream context */
16804 int n_stream;
16805 xmlChar * name; /* the current name */
16806 int n_name;
16807 xmlChar * ns; /* the namespace name */
16808 int n_ns;
16809
16810 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16811 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16812 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16813 mem_base = xmlMemBlocks();
16814 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16815 name = gen_const_xmlChar_ptr(n_name, 1);
16816 ns = gen_const_xmlChar_ptr(n_ns, 2);
16817
16818 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16819 desret_int(ret_val);
16820 call_tests++;
16821 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16822 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16823 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16824 xmlResetLastError();
16825 if (mem_base != xmlMemBlocks()) {
16826 printf("Leak of %d blocks found in xmlStreamPush",
16827 xmlMemBlocks() - mem_base);
16828 test_ret++;
16829 printf(" %d", n_stream);
16830 printf(" %d", n_name);
16831 printf(" %d", n_ns);
16832 printf("\n");
16833 }
16834 }
16835 }
16836 }
16837 function_tests++;
16838#endif
16839
16840 return(test_ret);
16841}
16842
Daniel Veillardd93f6252004-11-02 15:53:51 +000016843static int
16844test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016846
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016847 if (quiet == 0) printf("Testing pattern : 3 of 8 functions ...\n");
16848 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016849 test_ret += test_xmlPatternMatch();
16850 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016851 test_ret += test_xmlStreamPop();
16852 test_ret += test_xmlStreamPush();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016853
Daniel Veillard42595322004-11-08 10:52:06 +000016854 if (test_ret != 0)
16855 printf("Module pattern: %d errors\n", test_ret);
16856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016857}
Daniel Veillarda521d282004-11-09 14:59:59 +000016858#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016859
Daniel Veillardce682bc2004-11-05 17:22:25 +000016860#define gen_nb_xmlRelaxNGPtr 1
16861static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16862 return(NULL);
16863}
16864static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16865}
Daniel Veillarda521d282004-11-09 14:59:59 +000016866#endif
16867
Daniel Veillardce682bc2004-11-05 17:22:25 +000016868
Daniel Veillardd93f6252004-11-02 15:53:51 +000016869static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016870test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016872
William M. Brack21e4ef22005-01-02 09:53:13 +000016873#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016874 int mem_base;
16875 FILE * output; /* the file output */
16876 int n_output;
16877 xmlRelaxNGPtr schema; /* a schema structure */
16878 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016879
Daniel Veillardce682bc2004-11-05 17:22:25 +000016880 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16881 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16882 mem_base = xmlMemBlocks();
16883 output = gen_FILE_ptr(n_output, 0);
16884 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16885
16886 xmlRelaxNGDump(output, schema);
16887 call_tests++;
16888 des_FILE_ptr(n_output, output, 0);
16889 des_xmlRelaxNGPtr(n_schema, schema, 1);
16890 xmlResetLastError();
16891 if (mem_base != xmlMemBlocks()) {
16892 printf("Leak of %d blocks found in xmlRelaxNGDump",
16893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016894 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016895 printf(" %d", n_output);
16896 printf(" %d", n_schema);
16897 printf("\n");
16898 }
16899 }
16900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016901 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016902#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016903
Daniel Veillard42595322004-11-08 10:52:06 +000016904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016905}
16906
16907
16908static int
16909test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016911
William M. Brack21e4ef22005-01-02 09:53:13 +000016912#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016913 int mem_base;
16914 FILE * output; /* the file output */
16915 int n_output;
16916 xmlRelaxNGPtr schema; /* a schema structure */
16917 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016918
Daniel Veillardce682bc2004-11-05 17:22:25 +000016919 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16920 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16921 mem_base = xmlMemBlocks();
16922 output = gen_FILE_ptr(n_output, 0);
16923 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16924
16925 xmlRelaxNGDumpTree(output, schema);
16926 call_tests++;
16927 des_FILE_ptr(n_output, output, 0);
16928 des_xmlRelaxNGPtr(n_schema, schema, 1);
16929 xmlResetLastError();
16930 if (mem_base != xmlMemBlocks()) {
16931 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016933 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016934 printf(" %d", n_output);
16935 printf(" %d", n_schema);
16936 printf("\n");
16937 }
16938 }
16939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016940 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016941#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016942
Daniel Veillard42595322004-11-08 10:52:06 +000016943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016944}
16945
Daniel Veillarda521d282004-11-09 14:59:59 +000016946#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016947
Daniel Veillardce682bc2004-11-05 17:22:25 +000016948#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16949static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16950 return(NULL);
16951}
16952static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16953}
Daniel Veillarda521d282004-11-09 14:59:59 +000016954#endif
16955
16956#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016957
16958#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16959static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16960 return(NULL);
16961}
16962static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16963}
Daniel Veillarda521d282004-11-09 14:59:59 +000016964#endif
16965
16966#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016967
16968#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16969static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16970 return(NULL);
16971}
16972static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16973}
Daniel Veillarda521d282004-11-09 14:59:59 +000016974#endif
16975
16976#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016978#define gen_nb_void_ptr_ptr 1
16979static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16980 return(NULL);
16981}
16982static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16983}
Daniel Veillarda521d282004-11-09 14:59:59 +000016984#endif
16985
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016986
Daniel Veillardd93f6252004-11-02 15:53:51 +000016987static int
16988test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016990
William M. Brack21e4ef22005-01-02 09:53:13 +000016991#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016992 int mem_base;
16993 int ret_val;
16994 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16995 int n_ctxt;
16996 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16997 int n_err;
16998 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16999 int n_warn;
17000 void ** ctx; /* contextual data for the callbacks result */
17001 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017002
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017003 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17004 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17005 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17006 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17007 mem_base = xmlMemBlocks();
17008 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17009 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17010 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17011 ctx = gen_void_ptr_ptr(n_ctx, 3);
17012
17013 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17014 desret_int(ret_val);
17015 call_tests++;
17016 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17017 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17018 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17019 des_void_ptr_ptr(n_ctx, ctx, 3);
17020 xmlResetLastError();
17021 if (mem_base != xmlMemBlocks()) {
17022 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017024 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017025 printf(" %d", n_ctxt);
17026 printf(" %d", n_err);
17027 printf(" %d", n_warn);
17028 printf(" %d", n_ctx);
17029 printf("\n");
17030 }
17031 }
17032 }
17033 }
17034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017035 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017036#endif
17037
Daniel Veillard42595322004-11-08 10:52:06 +000017038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017039}
17040
Daniel Veillarda521d282004-11-09 14:59:59 +000017041#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017042
Daniel Veillardce682bc2004-11-05 17:22:25 +000017043#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17044static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17045 return(NULL);
17046}
17047static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17048}
Daniel Veillarda521d282004-11-09 14:59:59 +000017049#endif
17050
Daniel Veillardce682bc2004-11-05 17:22:25 +000017051
Daniel Veillardd93f6252004-11-02 15:53:51 +000017052static int
17053test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017055
William M. Brack21e4ef22005-01-02 09:53:13 +000017056#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017057 int mem_base;
17058 int ret_val;
17059 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17060 int n_ctxt;
17061 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17062 int n_err;
17063 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17064 int n_warn;
17065 void ** ctx; /* the functions context result */
17066 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017067
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017068 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17069 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17070 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17071 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17072 mem_base = xmlMemBlocks();
17073 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17074 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17075 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17076 ctx = gen_void_ptr_ptr(n_ctx, 3);
17077
17078 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17079 desret_int(ret_val);
17080 call_tests++;
17081 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17082 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17083 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17084 des_void_ptr_ptr(n_ctx, ctx, 3);
17085 xmlResetLastError();
17086 if (mem_base != xmlMemBlocks()) {
17087 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017089 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017090 printf(" %d", n_ctxt);
17091 printf(" %d", n_err);
17092 printf(" %d", n_warn);
17093 printf(" %d", n_ctx);
17094 printf("\n");
17095 }
17096 }
17097 }
17098 }
17099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017100 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017101#endif
17102
Daniel Veillard42595322004-11-08 10:52:06 +000017103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017104}
17105
17106
17107static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017108test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017109 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017110
William M. Brack21e4ef22005-01-02 09:53:13 +000017111#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017112 int mem_base;
17113 int ret_val;
17114
17115 mem_base = xmlMemBlocks();
17116
17117 ret_val = xmlRelaxNGInitTypes();
17118 desret_int(ret_val);
17119 call_tests++;
17120 xmlResetLastError();
17121 if (mem_base != xmlMemBlocks()) {
17122 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017124 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017125 printf("\n");
17126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017127 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017128#endif
17129
Daniel Veillard42595322004-11-08 10:52:06 +000017130 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017131}
17132
17133
17134static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017135test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017137
William M. Brack21e4ef22005-01-02 09:53:13 +000017138#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017139 int mem_base;
17140 xmlRelaxNGParserCtxtPtr ret_val;
17141 xmlDocPtr doc; /* a preparsed document tree */
17142 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017143
Daniel Veillard42595322004-11-08 10:52:06 +000017144 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17145 mem_base = xmlMemBlocks();
17146 doc = gen_xmlDocPtr(n_doc, 0);
17147
17148 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17149 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17150 call_tests++;
17151 des_xmlDocPtr(n_doc, doc, 0);
17152 xmlResetLastError();
17153 if (mem_base != xmlMemBlocks()) {
17154 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17155 xmlMemBlocks() - mem_base);
17156 test_ret++;
17157 printf(" %d", n_doc);
17158 printf("\n");
17159 }
17160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017161 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017162#endif
17163
Daniel Veillard42595322004-11-08 10:52:06 +000017164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017165}
17166
17167
17168static int
17169test_xmlRelaxNGNewMemParserCtxt(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 char * buffer; /* a pointer to a char array containing the schemas */
17176 int n_buffer;
17177 int size; /* the size of the array */
17178 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017179
Daniel Veillard42595322004-11-08 10:52:06 +000017180 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17181 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17182 mem_base = xmlMemBlocks();
17183 buffer = gen_const_char_ptr(n_buffer, 0);
17184 size = gen_int(n_size, 1);
17185
William M. Brackf13f77f2004-11-12 16:03:48 +000017186 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017187 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17188 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017189 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017190 des_int(n_size, size, 1);
17191 xmlResetLastError();
17192 if (mem_base != xmlMemBlocks()) {
17193 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17194 xmlMemBlocks() - mem_base);
17195 test_ret++;
17196 printf(" %d", n_buffer);
17197 printf(" %d", n_size);
17198 printf("\n");
17199 }
17200 }
17201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017202 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017203#endif
17204
Daniel Veillard42595322004-11-08 10:52:06 +000017205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017206}
17207
17208
17209static int
17210test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017212
William M. Brack21e4ef22005-01-02 09:53:13 +000017213#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017214 int mem_base;
17215 xmlRelaxNGParserCtxtPtr ret_val;
17216 char * URL; /* the location of the schema */
17217 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017218
Daniel Veillard42595322004-11-08 10:52:06 +000017219 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17220 mem_base = xmlMemBlocks();
17221 URL = gen_const_char_ptr(n_URL, 0);
17222
William M. Brackf13f77f2004-11-12 16:03:48 +000017223 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017224 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17225 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017226 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017227 xmlResetLastError();
17228 if (mem_base != xmlMemBlocks()) {
17229 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17230 xmlMemBlocks() - mem_base);
17231 test_ret++;
17232 printf(" %d", n_URL);
17233 printf("\n");
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_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017246
17247
17248 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017250}
17251
17252
17253static int
17254test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017256
17257
17258 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017260}
17261
17262
17263static int
17264test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017266
17267
17268 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017270}
17271
17272
17273static int
17274test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017276
17277
17278 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017280}
17281
17282
17283static int
17284test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017286
William M. Brack21e4ef22005-01-02 09:53:13 +000017287#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017288 int mem_base;
17289 int ret_val;
17290 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17291 int n_ctxt;
17292 xmlDocPtr doc; /* a parsed document tree */
17293 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017294
Daniel Veillardce682bc2004-11-05 17:22:25 +000017295 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17296 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17297 mem_base = xmlMemBlocks();
17298 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17299 doc = gen_xmlDocPtr(n_doc, 1);
17300
17301 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17302 desret_int(ret_val);
17303 call_tests++;
17304 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17305 des_xmlDocPtr(n_doc, doc, 1);
17306 xmlResetLastError();
17307 if (mem_base != xmlMemBlocks()) {
17308 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017310 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017311 printf(" %d", n_ctxt);
17312 printf(" %d", n_doc);
17313 printf("\n");
17314 }
17315 }
17316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017317 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017318#endif
17319
Daniel Veillard42595322004-11-08 10:52:06 +000017320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017321}
17322
17323
17324static int
17325test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017327
William M. Brack21e4ef22005-01-02 09:53:13 +000017328#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017329 int mem_base;
17330 int ret_val;
17331 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17332 int n_ctxt;
17333 xmlDocPtr doc; /* a document instance */
17334 int n_doc;
17335 xmlNodePtr elem; /* an element instance */
17336 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017337
Daniel Veillardce682bc2004-11-05 17:22:25 +000017338 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17339 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17340 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17341 mem_base = xmlMemBlocks();
17342 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17343 doc = gen_xmlDocPtr(n_doc, 1);
17344 elem = gen_xmlNodePtr(n_elem, 2);
17345
17346 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17347 desret_int(ret_val);
17348 call_tests++;
17349 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17350 des_xmlDocPtr(n_doc, doc, 1);
17351 des_xmlNodePtr(n_elem, elem, 2);
17352 xmlResetLastError();
17353 if (mem_base != xmlMemBlocks()) {
17354 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017356 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017357 printf(" %d", n_ctxt);
17358 printf(" %d", n_doc);
17359 printf(" %d", n_elem);
17360 printf("\n");
17361 }
17362 }
17363 }
17364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017365 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017366#endif
17367
Daniel Veillard42595322004-11-08 10:52:06 +000017368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017369}
17370
17371
17372static int
17373test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017375
William M. Brack21e4ef22005-01-02 09:53:13 +000017376#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017377 int mem_base;
17378 int ret_val;
17379 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17380 int n_ctxt;
17381 xmlDocPtr doc; /* a document instance */
17382 int n_doc;
17383 xmlNodePtr elem; /* an element instance */
17384 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017385
Daniel Veillardce682bc2004-11-05 17:22:25 +000017386 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17387 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17388 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17389 mem_base = xmlMemBlocks();
17390 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17391 doc = gen_xmlDocPtr(n_doc, 1);
17392 elem = gen_xmlNodePtr(n_elem, 2);
17393
17394 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17395 desret_int(ret_val);
17396 call_tests++;
17397 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17398 des_xmlDocPtr(n_doc, doc, 1);
17399 des_xmlNodePtr(n_elem, elem, 2);
17400 xmlResetLastError();
17401 if (mem_base != xmlMemBlocks()) {
17402 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017404 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017405 printf(" %d", n_ctxt);
17406 printf(" %d", n_doc);
17407 printf(" %d", n_elem);
17408 printf("\n");
17409 }
17410 }
17411 }
17412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017413 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017414#endif
17415
Daniel Veillard42595322004-11-08 10:52:06 +000017416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017417}
17418
17419
17420static int
17421test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017423
William M. Brack21e4ef22005-01-02 09:53:13 +000017424#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017425 int mem_base;
17426 int ret_val;
17427 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17428 int n_ctxt;
17429 xmlChar * data; /* some character data read */
17430 int n_data;
17431 int len; /* the lenght of the data */
17432 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017433
Daniel Veillardce682bc2004-11-05 17:22:25 +000017434 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17435 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17436 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17437 mem_base = xmlMemBlocks();
17438 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17439 data = gen_const_xmlChar_ptr(n_data, 1);
17440 len = gen_int(n_len, 2);
17441
William M. Brackf13f77f2004-11-12 16:03:48 +000017442 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017443 desret_int(ret_val);
17444 call_tests++;
17445 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017446 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017447 des_int(n_len, len, 2);
17448 xmlResetLastError();
17449 if (mem_base != xmlMemBlocks()) {
17450 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017453 printf(" %d", n_ctxt);
17454 printf(" %d", n_data);
17455 printf(" %d", n_len);
17456 printf("\n");
17457 }
17458 }
17459 }
17460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017461 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017462#endif
17463
Daniel Veillard42595322004-11-08 10:52:06 +000017464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017465}
17466
17467
17468static int
17469test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017471
William M. Brack21e4ef22005-01-02 09:53:13 +000017472#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017473 int mem_base;
17474 int ret_val;
17475 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17476 int n_ctxt;
17477 xmlDocPtr doc; /* a document instance */
17478 int n_doc;
17479 xmlNodePtr elem; /* an element instance */
17480 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481
Daniel Veillardce682bc2004-11-05 17:22:25 +000017482 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17483 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17484 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17485 mem_base = xmlMemBlocks();
17486 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17487 doc = gen_xmlDocPtr(n_doc, 1);
17488 elem = gen_xmlNodePtr(n_elem, 2);
17489
17490 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17491 desret_int(ret_val);
17492 call_tests++;
17493 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17494 des_xmlDocPtr(n_doc, doc, 1);
17495 des_xmlNodePtr(n_elem, elem, 2);
17496 xmlResetLastError();
17497 if (mem_base != xmlMemBlocks()) {
17498 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017500 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017501 printf(" %d", n_ctxt);
17502 printf(" %d", n_doc);
17503 printf(" %d", n_elem);
17504 printf("\n");
17505 }
17506 }
17507 }
17508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017509 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017510#endif
17511
Daniel Veillard42595322004-11-08 10:52:06 +000017512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017513}
17514
17515
17516static int
17517test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017519
William M. Brack21e4ef22005-01-02 09:53:13 +000017520#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017521 int mem_base;
17522 int ret_val;
17523 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17524 int n_ctxt;
17525 int flags; /* a set of flags values */
17526 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017527
Daniel Veillardce682bc2004-11-05 17:22:25 +000017528 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17529 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17530 mem_base = xmlMemBlocks();
17531 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17532 flags = gen_int(n_flags, 1);
17533
17534 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17535 desret_int(ret_val);
17536 call_tests++;
17537 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17538 des_int(n_flags, flags, 1);
17539 xmlResetLastError();
17540 if (mem_base != xmlMemBlocks()) {
17541 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017543 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017544 printf(" %d", n_ctxt);
17545 printf(" %d", n_flags);
17546 printf("\n");
17547 }
17548 }
17549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017550 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017551#endif
17552
Daniel Veillard42595322004-11-08 10:52:06 +000017553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017554}
17555
17556static int
17557test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017559
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017560 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017561 test_ret += test_xmlRelaxNGDump();
17562 test_ret += test_xmlRelaxNGDumpTree();
17563 test_ret += test_xmlRelaxNGGetParserErrors();
17564 test_ret += test_xmlRelaxNGGetValidErrors();
17565 test_ret += test_xmlRelaxNGInitTypes();
17566 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17567 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17568 test_ret += test_xmlRelaxNGNewParserCtxt();
17569 test_ret += test_xmlRelaxNGNewValidCtxt();
17570 test_ret += test_xmlRelaxNGParse();
17571 test_ret += test_xmlRelaxNGSetParserErrors();
17572 test_ret += test_xmlRelaxNGSetValidErrors();
17573 test_ret += test_xmlRelaxNGValidateDoc();
17574 test_ret += test_xmlRelaxNGValidateFullElement();
17575 test_ret += test_xmlRelaxNGValidatePopElement();
17576 test_ret += test_xmlRelaxNGValidatePushCData();
17577 test_ret += test_xmlRelaxNGValidatePushElement();
17578 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017579
Daniel Veillard42595322004-11-08 10:52:06 +000017580 if (test_ret != 0)
17581 printf("Module relaxng: %d errors\n", test_ret);
17582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017583}
17584static int
17585test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017587
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017588 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017589
Daniel Veillard42595322004-11-08 10:52:06 +000017590 if (test_ret != 0)
17591 printf("Module schemasInternals: %d errors\n", test_ret);
17592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017593}
17594
17595static int
17596test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017598
17599 int mem_base;
17600 xmlNodePtr ret_val;
17601 xmlNodePtr parent; /* the parent node */
17602 int n_parent;
17603 xmlNodePtr cur; /* the child node */
17604 int n_cur;
17605
Daniel Veillarda03e3652004-11-02 18:45:30 +000017606 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017607 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17608 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017609 parent = gen_xmlNodePtr(n_parent, 0);
17610 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017611
17612 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017613 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017614 desret_xmlNodePtr(ret_val);
17615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017616 des_xmlNodePtr(n_parent, parent, 0);
17617 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017618 xmlResetLastError();
17619 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017620 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017622 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017623 printf(" %d", n_parent);
17624 printf(" %d", n_cur);
17625 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017626 }
17627 }
17628 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017629 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017630
Daniel Veillard42595322004-11-08 10:52:06 +000017631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017632}
17633
17634
17635static int
17636test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017638
17639 int mem_base;
17640 xmlNodePtr ret_val;
17641 xmlNodePtr parent; /* the parent node */
17642 int n_parent;
17643 xmlNodePtr cur; /* the first node in the list */
17644 int n_cur;
17645
Daniel Veillarda03e3652004-11-02 18:45:30 +000017646 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017647 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17648 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017649 parent = gen_xmlNodePtr(n_parent, 0);
17650 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651
17652 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017653 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017654 desret_xmlNodePtr(ret_val);
17655 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017656 des_xmlNodePtr(n_parent, parent, 0);
17657 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017658 xmlResetLastError();
17659 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017660 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017663 printf(" %d", n_parent);
17664 printf(" %d", n_cur);
17665 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017666 }
17667 }
17668 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017669 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017670
Daniel Veillard42595322004-11-08 10:52:06 +000017671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017672}
17673
17674
17675static int
17676test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017678
17679 int mem_base;
17680 xmlNodePtr ret_val;
17681 xmlNodePtr cur; /* the child node */
17682 int n_cur;
17683 xmlNodePtr elem; /* the new node */
17684 int n_elem;
17685
17686 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017687 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017689 cur = gen_xmlNodePtr(n_cur, 0);
17690 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017691
17692 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017693 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017694 desret_xmlNodePtr(ret_val);
17695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017696 des_xmlNodePtr(n_cur, cur, 0);
17697 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017698 xmlResetLastError();
17699 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017700 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017702 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017703 printf(" %d", n_cur);
17704 printf(" %d", n_elem);
17705 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017706 }
17707 }
17708 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017709 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017710
Daniel Veillard42595322004-11-08 10:52:06 +000017711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712}
17713
17714
17715static int
17716test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017718
William M. Brack21e4ef22005-01-02 09:53:13 +000017719#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017720 int mem_base;
17721 xmlNodePtr ret_val;
17722 xmlNodePtr cur; /* the child node */
17723 int n_cur;
17724 xmlNodePtr elem; /* the new node */
17725 int n_elem;
17726
17727 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017728 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017729 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017730 cur = gen_xmlNodePtr(n_cur, 0);
17731 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017732
17733 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017734 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735 desret_xmlNodePtr(ret_val);
17736 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017737 des_xmlNodePtr(n_cur, cur, 0);
17738 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017739 xmlResetLastError();
17740 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017741 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017743 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017744 printf(" %d", n_cur);
17745 printf(" %d", n_elem);
17746 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017747 }
17748 }
17749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017750 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017751#endif
17752
Daniel Veillard42595322004-11-08 10:52:06 +000017753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017754}
17755
17756
17757static int
17758test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017760
17761 int mem_base;
17762 xmlNodePtr ret_val;
17763 xmlNodePtr cur; /* the child node */
17764 int n_cur;
17765 xmlNodePtr elem; /* the new node */
17766 int n_elem;
17767
17768 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017769 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017771 cur = gen_xmlNodePtr(n_cur, 0);
17772 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017773
17774 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017775 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017776 desret_xmlNodePtr(ret_val);
17777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017778 des_xmlNodePtr(n_cur, cur, 0);
17779 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017780 xmlResetLastError();
17781 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017782 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017784 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017785 printf(" %d", n_cur);
17786 printf(" %d", n_elem);
17787 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017788 }
17789 }
17790 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017791 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017792
Daniel Veillard42595322004-11-08 10:52:06 +000017793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017794}
17795
17796
17797static int
17798test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017800
William M. Brack21e4ef22005-01-02 09:53:13 +000017801#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017802#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017803 int mem_base;
17804 xmlBufferPtr buf; /* the XML buffer output */
17805 int n_buf;
17806 xmlDocPtr doc; /* the document */
17807 int n_doc;
17808 xmlAttrPtr attr; /* the attribute node */
17809 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017810 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017811 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017812
Daniel Veillardce244ad2004-11-05 10:03:46 +000017813 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17814 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17815 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17816 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17817 mem_base = xmlMemBlocks();
17818 buf = gen_xmlBufferPtr(n_buf, 0);
17819 doc = gen_xmlDocPtr(n_doc, 1);
17820 attr = gen_xmlAttrPtr(n_attr, 2);
17821 string = gen_const_xmlChar_ptr(n_string, 3);
17822
William M. Brackf13f77f2004-11-12 16:03:48 +000017823 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017824 call_tests++;
17825 des_xmlBufferPtr(n_buf, buf, 0);
17826 des_xmlDocPtr(n_doc, doc, 1);
17827 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017828 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017829 xmlResetLastError();
17830 if (mem_base != xmlMemBlocks()) {
17831 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017833 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017834 printf(" %d", n_buf);
17835 printf(" %d", n_doc);
17836 printf(" %d", n_attr);
17837 printf(" %d", n_string);
17838 printf("\n");
17839 }
17840 }
17841 }
17842 }
17843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017844 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017845#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017846#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017847
Daniel Veillard42595322004-11-08 10:52:06 +000017848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017849}
17850
17851
17852static int
17853test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017855
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017856 int mem_base;
17857 int ret_val;
17858 xmlBufferPtr buf; /* the buffer to dump */
17859 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017860 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017861 int n_str;
17862 int len; /* the number of #xmlChar to add */
17863 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017865 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17866 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17867 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017869 buf = gen_xmlBufferPtr(n_buf, 0);
17870 str = gen_const_xmlChar_ptr(n_str, 1);
17871 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017872
William M. Brackf13f77f2004-11-12 16:03:48 +000017873 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017874 desret_int(ret_val);
17875 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017876 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017877 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017878 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017879 xmlResetLastError();
17880 if (mem_base != xmlMemBlocks()) {
17881 printf("Leak of %d blocks found in xmlBufferAdd",
17882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017883 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017884 printf(" %d", n_buf);
17885 printf(" %d", n_str);
17886 printf(" %d", n_len);
17887 printf("\n");
17888 }
17889 }
17890 }
17891 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017893
Daniel Veillard42595322004-11-08 10:52:06 +000017894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017895}
17896
17897
17898static int
17899test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017902 int mem_base;
17903 int ret_val;
17904 xmlBufferPtr buf; /* the buffer */
17905 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017906 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017907 int n_str;
17908 int len; /* the number of #xmlChar to add */
17909 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017910
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017911 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17912 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17913 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17914 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017915 buf = gen_xmlBufferPtr(n_buf, 0);
17916 str = gen_const_xmlChar_ptr(n_str, 1);
17917 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017918
William M. Brackf13f77f2004-11-12 16:03:48 +000017919 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017920 desret_int(ret_val);
17921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017922 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017923 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017924 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017925 xmlResetLastError();
17926 if (mem_base != xmlMemBlocks()) {
17927 printf("Leak of %d blocks found in xmlBufferAddHead",
17928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017929 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017930 printf(" %d", n_buf);
17931 printf(" %d", n_str);
17932 printf(" %d", n_len);
17933 printf("\n");
17934 }
17935 }
17936 }
17937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017939
Daniel Veillard42595322004-11-08 10:52:06 +000017940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017941}
17942
17943
17944static int
17945test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017947
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017948 int mem_base;
17949 int ret_val;
17950 xmlBufferPtr buf; /* the buffer to dump */
17951 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017952 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017953 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017954
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017955 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17956 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017958 buf = gen_xmlBufferPtr(n_buf, 0);
17959 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017960
William M. Brackf13f77f2004-11-12 16:03:48 +000017961 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017962 desret_int(ret_val);
17963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017964 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017965 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017966 xmlResetLastError();
17967 if (mem_base != xmlMemBlocks()) {
17968 printf("Leak of %d blocks found in xmlBufferCCat",
17969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017970 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017971 printf(" %d", n_buf);
17972 printf(" %d", n_str);
17973 printf("\n");
17974 }
17975 }
17976 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017978
Daniel Veillard42595322004-11-08 10:52:06 +000017979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017980}
17981
17982
17983static int
17984test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017986
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017987 int mem_base;
17988 int ret_val;
17989 xmlBufferPtr buf; /* the buffer to add to */
17990 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017991 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017992 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017993
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017994 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17995 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017997 buf = gen_xmlBufferPtr(n_buf, 0);
17998 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017999
William M. Brackf13f77f2004-11-12 16:03:48 +000018000 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018001 desret_int(ret_val);
18002 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018003 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018004 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018005 xmlResetLastError();
18006 if (mem_base != xmlMemBlocks()) {
18007 printf("Leak of %d blocks found in xmlBufferCat",
18008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018009 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018010 printf(" %d", n_buf);
18011 printf(" %d", n_str);
18012 printf("\n");
18013 }
18014 }
18015 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018016 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018017
Daniel Veillard42595322004-11-08 10:52:06 +000018018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018019}
18020
18021
Daniel Veillardce682bc2004-11-05 17:22:25 +000018022#define gen_nb_const_xmlBufferPtr 1
18023static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18024 return(NULL);
18025}
18026static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18027}
18028
Daniel Veillardd93f6252004-11-02 15:53:51 +000018029static int
18030test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018032
Daniel Veillardce682bc2004-11-05 17:22:25 +000018033 int mem_base;
18034 const xmlChar * ret_val;
18035 xmlBufferPtr buf; /* the buffer */
18036 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018037
Daniel Veillardce682bc2004-11-05 17:22:25 +000018038 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18039 mem_base = xmlMemBlocks();
18040 buf = gen_const_xmlBufferPtr(n_buf, 0);
18041
William M. Brackf13f77f2004-11-12 16:03:48 +000018042 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018043 desret_const_xmlChar_ptr(ret_val);
18044 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018045 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018046 xmlResetLastError();
18047 if (mem_base != xmlMemBlocks()) {
18048 printf("Leak of %d blocks found in xmlBufferContent",
18049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018050 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018051 printf(" %d", n_buf);
18052 printf("\n");
18053 }
18054 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018055 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018056
Daniel Veillard42595322004-11-08 10:52:06 +000018057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018058}
18059
18060
18061static int
18062test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018064
Daniel Veillard3d95c732004-11-06 22:25:14 +000018065 int mem_base;
18066 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018067
Daniel Veillard3d95c732004-11-06 22:25:14 +000018068 mem_base = xmlMemBlocks();
18069
18070 ret_val = xmlBufferCreate();
18071 desret_xmlBufferPtr(ret_val);
18072 call_tests++;
18073 xmlResetLastError();
18074 if (mem_base != xmlMemBlocks()) {
18075 printf("Leak of %d blocks found in xmlBufferCreate",
18076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018077 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018078 printf("\n");
18079 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018080 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018081
Daniel Veillard42595322004-11-08 10:52:06 +000018082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018083}
18084
18085
18086static int
18087test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018089
18090
18091 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018093}
18094
18095
18096static int
18097test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018099
18100
18101 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018103}
18104
18105
18106static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018107test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018109
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018110 int mem_base;
18111 xmlBufferPtr buf; /* the buffer */
18112 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018113
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018114 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018116 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018117
18118 xmlBufferEmpty(buf);
18119 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018120 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018121 xmlResetLastError();
18122 if (mem_base != xmlMemBlocks()) {
18123 printf("Leak of %d blocks found in xmlBufferEmpty",
18124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018125 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018126 printf(" %d", n_buf);
18127 printf("\n");
18128 }
18129 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018130 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018131
Daniel Veillard42595322004-11-08 10:52:06 +000018132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018133}
18134
18135
18136static int
18137test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018139
Daniel Veillard3d97e662004-11-04 10:49:00 +000018140 int mem_base;
18141 int ret_val;
18142 xmlBufferPtr buf; /* the buffer */
18143 int n_buf;
18144 unsigned int len; /* the minimum free size to allocate */
18145 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
Daniel Veillard3d97e662004-11-04 10:49:00 +000018147 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18148 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18149 mem_base = xmlMemBlocks();
18150 buf = gen_xmlBufferPtr(n_buf, 0);
18151 len = gen_unsigned_int(n_len, 1);
18152
18153 ret_val = xmlBufferGrow(buf, len);
18154 desret_int(ret_val);
18155 call_tests++;
18156 des_xmlBufferPtr(n_buf, buf, 0);
18157 des_unsigned_int(n_len, len, 1);
18158 xmlResetLastError();
18159 if (mem_base != xmlMemBlocks()) {
18160 printf("Leak of %d blocks found in xmlBufferGrow",
18161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018162 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018163 printf(" %d", n_buf);
18164 printf(" %d", n_len);
18165 printf("\n");
18166 }
18167 }
18168 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018169 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018170
Daniel Veillard42595322004-11-08 10:52:06 +000018171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018172}
18173
18174
18175static int
18176test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018178
Daniel Veillardce682bc2004-11-05 17:22:25 +000018179 int mem_base;
18180 int ret_val;
18181 xmlBufferPtr buf; /* the buffer */
18182 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018183
Daniel Veillardce682bc2004-11-05 17:22:25 +000018184 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18185 mem_base = xmlMemBlocks();
18186 buf = gen_const_xmlBufferPtr(n_buf, 0);
18187
William M. Brackf13f77f2004-11-12 16:03:48 +000018188 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018189 desret_int(ret_val);
18190 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018191 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018192 xmlResetLastError();
18193 if (mem_base != xmlMemBlocks()) {
18194 printf("Leak of %d blocks found in xmlBufferLength",
18195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018196 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018197 printf(" %d", n_buf);
18198 printf("\n");
18199 }
18200 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018202
Daniel Veillard42595322004-11-08 10:52:06 +000018203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018204}
18205
18206
18207static int
18208test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018210
Daniel Veillard3d97e662004-11-04 10:49:00 +000018211 int mem_base;
18212 int ret_val;
18213 xmlBufferPtr buf; /* the buffer to resize */
18214 int n_buf;
18215 unsigned int size; /* the desired size */
18216 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018217
Daniel Veillard3d97e662004-11-04 10:49:00 +000018218 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18219 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18220 mem_base = xmlMemBlocks();
18221 buf = gen_xmlBufferPtr(n_buf, 0);
18222 size = gen_unsigned_int(n_size, 1);
18223
18224 ret_val = xmlBufferResize(buf, size);
18225 desret_int(ret_val);
18226 call_tests++;
18227 des_xmlBufferPtr(n_buf, buf, 0);
18228 des_unsigned_int(n_size, size, 1);
18229 xmlResetLastError();
18230 if (mem_base != xmlMemBlocks()) {
18231 printf("Leak of %d blocks found in xmlBufferResize",
18232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018233 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018234 printf(" %d", n_buf);
18235 printf(" %d", n_size);
18236 printf("\n");
18237 }
18238 }
18239 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018240 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018241
Daniel Veillard42595322004-11-08 10:52:06 +000018242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018243}
18244
18245
18246static int
18247test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018249
Daniel Veillard57b25162004-11-06 14:50:18 +000018250 int mem_base;
18251 xmlBufferPtr buf; /* the buffer to tune */
18252 int n_buf;
18253 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18254 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018255
Daniel Veillard57b25162004-11-06 14:50:18 +000018256 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18257 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18258 mem_base = xmlMemBlocks();
18259 buf = gen_xmlBufferPtr(n_buf, 0);
18260 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18261
18262 xmlBufferSetAllocationScheme(buf, scheme);
18263 call_tests++;
18264 des_xmlBufferPtr(n_buf, buf, 0);
18265 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18266 xmlResetLastError();
18267 if (mem_base != xmlMemBlocks()) {
18268 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018270 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018271 printf(" %d", n_buf);
18272 printf(" %d", n_scheme);
18273 printf("\n");
18274 }
18275 }
18276 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018277 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018278
Daniel Veillard42595322004-11-08 10:52:06 +000018279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018280}
18281
18282
18283static int
18284test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018286
Daniel Veillard3d97e662004-11-04 10:49:00 +000018287 int mem_base;
18288 int ret_val;
18289 xmlBufferPtr buf; /* the buffer to dump */
18290 int n_buf;
18291 unsigned int len; /* the number of xmlChar to remove */
18292 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018293
Daniel Veillard3d97e662004-11-04 10:49:00 +000018294 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18295 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18296 mem_base = xmlMemBlocks();
18297 buf = gen_xmlBufferPtr(n_buf, 0);
18298 len = gen_unsigned_int(n_len, 1);
18299
18300 ret_val = xmlBufferShrink(buf, len);
18301 desret_int(ret_val);
18302 call_tests++;
18303 des_xmlBufferPtr(n_buf, buf, 0);
18304 des_unsigned_int(n_len, len, 1);
18305 xmlResetLastError();
18306 if (mem_base != xmlMemBlocks()) {
18307 printf("Leak of %d blocks found in xmlBufferShrink",
18308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018309 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018310 printf(" %d", n_buf);
18311 printf(" %d", n_len);
18312 printf("\n");
18313 }
18314 }
18315 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018316 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018317
Daniel Veillard42595322004-11-08 10:52:06 +000018318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018319}
18320
18321
18322static int
18323test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018325
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018326 int mem_base;
18327 xmlBufferPtr buf; /* the XML buffer */
18328 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018329 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018330 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018331
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018332 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18333 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018335 buf = gen_xmlBufferPtr(n_buf, 0);
18336 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018337
William M. Brackf13f77f2004-11-12 16:03:48 +000018338 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018340 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018341 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018342 xmlResetLastError();
18343 if (mem_base != xmlMemBlocks()) {
18344 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018346 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018347 printf(" %d", n_buf);
18348 printf(" %d", n_string);
18349 printf("\n");
18350 }
18351 }
18352 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018353 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018354
Daniel Veillard42595322004-11-08 10:52:06 +000018355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018356}
18357
18358
18359static int
18360test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018362
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018363 int mem_base;
18364 xmlBufferPtr buf; /* the XML buffer output */
18365 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018366 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018367 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018368
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018369 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18370 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018372 buf = gen_xmlBufferPtr(n_buf, 0);
18373 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018374
William M. Brackf13f77f2004-11-12 16:03:48 +000018375 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018377 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018378 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018379 xmlResetLastError();
18380 if (mem_base != xmlMemBlocks()) {
18381 printf("Leak of %d blocks found in xmlBufferWriteChar",
18382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018383 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018384 printf(" %d", n_buf);
18385 printf(" %d", n_string);
18386 printf("\n");
18387 }
18388 }
18389 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018391
Daniel Veillard42595322004-11-08 10:52:06 +000018392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018393}
18394
18395
18396static int
18397test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018399
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018400 int mem_base;
18401 xmlBufferPtr buf; /* the XML buffer output */
18402 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018403 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018404 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018405
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018406 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18407 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018409 buf = gen_xmlBufferPtr(n_buf, 0);
18410 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018411
William M. Brackf13f77f2004-11-12 16:03:48 +000018412 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018414 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018415 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018416 xmlResetLastError();
18417 if (mem_base != xmlMemBlocks()) {
18418 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018420 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018421 printf(" %d", n_buf);
18422 printf(" %d", n_string);
18423 printf("\n");
18424 }
18425 }
18426 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018428
Daniel Veillard42595322004-11-08 10:52:06 +000018429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018430}
18431
18432
18433static int
18434test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018436
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018437 int mem_base;
18438 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018439 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018440 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018441 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018442 int n_prefix;
18443 xmlChar * memory; /* preallocated memory */
18444 int n_memory;
18445 int len; /* preallocated memory length */
18446 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018447
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018448 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18449 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18450 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18451 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018453 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18454 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18455 memory = gen_xmlChar_ptr(n_memory, 2);
18456 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018457
William M. Brackf13f77f2004-11-12 16:03:48 +000018458 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018459 if ((ret_val != NULL) && (ret_val != ncname) &&
18460 (ret_val != prefix) && (ret_val != memory))
18461 xmlFree(ret_val);
18462 ret_val = NULL;
18463 desret_xmlChar_ptr(ret_val);
18464 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018465 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18466 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018467 des_xmlChar_ptr(n_memory, memory, 2);
18468 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018469 xmlResetLastError();
18470 if (mem_base != xmlMemBlocks()) {
18471 printf("Leak of %d blocks found in xmlBuildQName",
18472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018473 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018474 printf(" %d", n_ncname);
18475 printf(" %d", n_prefix);
18476 printf(" %d", n_memory);
18477 printf(" %d", n_len);
18478 printf("\n");
18479 }
18480 }
18481 }
18482 }
18483 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018485
Daniel Veillard42595322004-11-08 10:52:06 +000018486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018487}
18488
18489
18490static int
18491test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018493
William M. Brack21e4ef22005-01-02 09:53:13 +000018494#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018495 int mem_base;
18496 xmlDocPtr ret_val;
18497 xmlDocPtr doc; /* the document */
18498 int n_doc;
18499 int recursive; /* if not zero do a recursive copy. */
18500 int n_recursive;
18501
18502 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18503 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18504 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018505 doc = gen_xmlDocPtr(n_doc, 0);
18506 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018507
18508 ret_val = xmlCopyDoc(doc, recursive);
18509 desret_xmlDocPtr(ret_val);
18510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018511 des_xmlDocPtr(n_doc, doc, 0);
18512 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018513 xmlResetLastError();
18514 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018515 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018517 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018518 printf(" %d", n_doc);
18519 printf(" %d", n_recursive);
18520 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018521 }
18522 }
18523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018524 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018525#endif
18526
Daniel Veillard42595322004-11-08 10:52:06 +000018527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018528}
18529
18530
18531static int
18532test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018534
William M. Brack21e4ef22005-01-02 09:53:13 +000018535#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018536 int mem_base;
18537 xmlDtdPtr ret_val;
18538 xmlDtdPtr dtd; /* the dtd */
18539 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018540
Daniel Veillard27f20102004-11-05 11:50:11 +000018541 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18542 mem_base = xmlMemBlocks();
18543 dtd = gen_xmlDtdPtr(n_dtd, 0);
18544
18545 ret_val = xmlCopyDtd(dtd);
18546 desret_xmlDtdPtr(ret_val);
18547 call_tests++;
18548 des_xmlDtdPtr(n_dtd, dtd, 0);
18549 xmlResetLastError();
18550 if (mem_base != xmlMemBlocks()) {
18551 printf("Leak of %d blocks found in xmlCopyDtd",
18552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018553 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018554 printf(" %d", n_dtd);
18555 printf("\n");
18556 }
18557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018558 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +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_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018568
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018569 int mem_base;
18570 xmlNsPtr ret_val;
18571 xmlNsPtr cur; /* the namespace */
18572 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018573
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018574 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18575 mem_base = xmlMemBlocks();
18576 cur = gen_xmlNsPtr(n_cur, 0);
18577
18578 ret_val = xmlCopyNamespace(cur);
18579 if (ret_val != NULL) xmlFreeNs(ret_val);
18580 desret_xmlNsPtr(ret_val);
18581 call_tests++;
18582 des_xmlNsPtr(n_cur, cur, 0);
18583 xmlResetLastError();
18584 if (mem_base != xmlMemBlocks()) {
18585 printf("Leak of %d blocks found in xmlCopyNamespace",
18586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018587 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018588 printf(" %d", n_cur);
18589 printf("\n");
18590 }
18591 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018592 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018593
Daniel Veillard42595322004-11-08 10:52:06 +000018594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018595}
18596
18597
18598static int
18599test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018600 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018601
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018602 int mem_base;
18603 xmlNsPtr ret_val;
18604 xmlNsPtr cur; /* the first namespace */
18605 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018606
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018607 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18608 mem_base = xmlMemBlocks();
18609 cur = gen_xmlNsPtr(n_cur, 0);
18610
18611 ret_val = xmlCopyNamespaceList(cur);
18612 if (ret_val != NULL) xmlFreeNsList(ret_val);
18613 desret_xmlNsPtr(ret_val);
18614 call_tests++;
18615 des_xmlNsPtr(n_cur, cur, 0);
18616 xmlResetLastError();
18617 if (mem_base != xmlMemBlocks()) {
18618 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018620 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018621 printf(" %d", n_cur);
18622 printf("\n");
18623 }
18624 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018625 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018626
Daniel Veillard42595322004-11-08 10:52:06 +000018627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018628}
18629
18630
18631static int
18632test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018634
Daniel Veillardce682bc2004-11-05 17:22:25 +000018635 int mem_base;
18636 xmlNodePtr ret_val;
18637 xmlNodePtr node; /* the node */
18638 int n_node;
18639 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18640 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018641
Daniel Veillardce682bc2004-11-05 17:22:25 +000018642 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18643 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18644 mem_base = xmlMemBlocks();
18645 node = gen_const_xmlNodePtr(n_node, 0);
18646 extended = gen_int(n_extended, 1);
18647
William M. Brackf13f77f2004-11-12 16:03:48 +000018648 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018649 desret_xmlNodePtr(ret_val);
18650 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018651 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018652 des_int(n_extended, extended, 1);
18653 xmlResetLastError();
18654 if (mem_base != xmlMemBlocks()) {
18655 printf("Leak of %d blocks found in xmlCopyNode",
18656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018657 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018658 printf(" %d", n_node);
18659 printf(" %d", n_extended);
18660 printf("\n");
18661 }
18662 }
18663 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018664 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018665
Daniel Veillard42595322004-11-08 10:52:06 +000018666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018667}
18668
18669
18670static int
18671test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018673
Daniel Veillardce682bc2004-11-05 17:22:25 +000018674 int mem_base;
18675 xmlNodePtr ret_val;
18676 xmlNodePtr node; /* the first node in the list. */
18677 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018678
Daniel Veillardce682bc2004-11-05 17:22:25 +000018679 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18680 mem_base = xmlMemBlocks();
18681 node = gen_const_xmlNodePtr(n_node, 0);
18682
William M. Brackf13f77f2004-11-12 16:03:48 +000018683 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018684 desret_xmlNodePtr(ret_val);
18685 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018686 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018687 xmlResetLastError();
18688 if (mem_base != xmlMemBlocks()) {
18689 printf("Leak of %d blocks found in xmlCopyNodeList",
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("\n");
18694 }
18695 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018696 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018697
Daniel Veillard42595322004-11-08 10:52:06 +000018698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018699}
18700
18701
18702static int
18703test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018705
Daniel Veillard57b25162004-11-06 14:50:18 +000018706 int mem_base;
18707 xmlAttrPtr ret_val;
18708 xmlNodePtr target; /* the element where the attribute will be grafted */
18709 int n_target;
18710 xmlAttrPtr cur; /* the attribute */
18711 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018712
Daniel Veillard57b25162004-11-06 14:50:18 +000018713 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18714 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18715 mem_base = xmlMemBlocks();
18716 target = gen_xmlNodePtr(n_target, 0);
18717 cur = gen_xmlAttrPtr(n_cur, 1);
18718
18719 ret_val = xmlCopyProp(target, cur);
18720 desret_xmlAttrPtr(ret_val);
18721 call_tests++;
18722 des_xmlNodePtr(n_target, target, 0);
18723 des_xmlAttrPtr(n_cur, cur, 1);
18724 xmlResetLastError();
18725 if (mem_base != xmlMemBlocks()) {
18726 printf("Leak of %d blocks found in xmlCopyProp",
18727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018728 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018729 printf(" %d", n_target);
18730 printf(" %d", n_cur);
18731 printf("\n");
18732 }
18733 }
18734 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018735 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018736
Daniel Veillard42595322004-11-08 10:52:06 +000018737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018738}
18739
18740
18741static int
18742test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018744
Daniel Veillard57b25162004-11-06 14:50:18 +000018745 int mem_base;
18746 xmlAttrPtr ret_val;
18747 xmlNodePtr target; /* the element where the attributes will be grafted */
18748 int n_target;
18749 xmlAttrPtr cur; /* the first attribute */
18750 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018751
Daniel Veillard57b25162004-11-06 14:50:18 +000018752 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18753 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18754 mem_base = xmlMemBlocks();
18755 target = gen_xmlNodePtr(n_target, 0);
18756 cur = gen_xmlAttrPtr(n_cur, 1);
18757
18758 ret_val = xmlCopyPropList(target, cur);
18759 desret_xmlAttrPtr(ret_val);
18760 call_tests++;
18761 des_xmlNodePtr(n_target, target, 0);
18762 des_xmlAttrPtr(n_cur, cur, 1);
18763 xmlResetLastError();
18764 if (mem_base != xmlMemBlocks()) {
18765 printf("Leak of %d blocks found in xmlCopyPropList",
18766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018767 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018768 printf(" %d", n_target);
18769 printf(" %d", n_cur);
18770 printf("\n");
18771 }
18772 }
18773 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018774 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018775
Daniel Veillard42595322004-11-08 10:52:06 +000018776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018777}
18778
18779
18780static int
18781test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018783
Daniel Veillard34099b42004-11-04 17:34:35 +000018784 int mem_base;
18785 xmlDtdPtr ret_val;
18786 xmlDocPtr doc; /* the document pointer */
18787 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018788 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018789 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018790 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018791 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018792 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018793 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018794
Daniel Veillard34099b42004-11-04 17:34:35 +000018795 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18796 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18797 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18798 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18799 mem_base = xmlMemBlocks();
18800 doc = gen_xmlDocPtr(n_doc, 0);
18801 name = gen_const_xmlChar_ptr(n_name, 1);
18802 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18803 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18804
William M. Brackf13f77f2004-11-12 16:03:48 +000018805 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018806 desret_xmlDtdPtr(ret_val);
18807 call_tests++;
18808 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018809 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18810 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18811 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018812 xmlResetLastError();
18813 if (mem_base != xmlMemBlocks()) {
18814 printf("Leak of %d blocks found in xmlCreateIntSubset",
18815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018816 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018817 printf(" %d", n_doc);
18818 printf(" %d", n_name);
18819 printf(" %d", n_ExternalID);
18820 printf(" %d", n_SystemID);
18821 printf("\n");
18822 }
18823 }
18824 }
18825 }
18826 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018828
Daniel Veillard42595322004-11-08 10:52:06 +000018829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018830}
18831
18832
18833static int
18834test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018836
Daniel Veillardce682bc2004-11-05 17:22:25 +000018837 int mem_base;
18838 xmlNodePtr ret_val;
18839 xmlNodePtr node; /* the node */
18840 int n_node;
18841 xmlDocPtr doc; /* the document */
18842 int n_doc;
18843 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18844 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018845
Daniel Veillardce682bc2004-11-05 17:22:25 +000018846 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18847 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18848 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18849 mem_base = xmlMemBlocks();
18850 node = gen_const_xmlNodePtr(n_node, 0);
18851 doc = gen_xmlDocPtr(n_doc, 1);
18852 extended = gen_int(n_extended, 2);
18853
William M. Brackf13f77f2004-11-12 16:03:48 +000018854 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018855 desret_xmlNodePtr(ret_val);
18856 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018857 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018858 des_xmlDocPtr(n_doc, doc, 1);
18859 des_int(n_extended, extended, 2);
18860 xmlResetLastError();
18861 if (mem_base != xmlMemBlocks()) {
18862 printf("Leak of %d blocks found in xmlDocCopyNode",
18863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018864 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018865 printf(" %d", n_node);
18866 printf(" %d", n_doc);
18867 printf(" %d", n_extended);
18868 printf("\n");
18869 }
18870 }
18871 }
18872 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018873 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018874
Daniel Veillard42595322004-11-08 10:52:06 +000018875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018876}
18877
18878
18879static int
18880test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018882
Daniel Veillardce682bc2004-11-05 17:22:25 +000018883 int mem_base;
18884 xmlNodePtr ret_val;
18885 xmlDocPtr doc; /* the target document */
18886 int n_doc;
18887 xmlNodePtr node; /* the first node in the list. */
18888 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018889
Daniel Veillardce682bc2004-11-05 17:22:25 +000018890 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18891 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18892 mem_base = xmlMemBlocks();
18893 doc = gen_xmlDocPtr(n_doc, 0);
18894 node = gen_const_xmlNodePtr(n_node, 1);
18895
William M. Brackf13f77f2004-11-12 16:03:48 +000018896 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018897 desret_xmlNodePtr(ret_val);
18898 call_tests++;
18899 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018900 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018901 xmlResetLastError();
18902 if (mem_base != xmlMemBlocks()) {
18903 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018905 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018906 printf(" %d", n_doc);
18907 printf(" %d", n_node);
18908 printf("\n");
18909 }
18910 }
18911 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018912 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018913
Daniel Veillard42595322004-11-08 10:52:06 +000018914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018915}
18916
18917
18918static int
18919test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018921
William M. Brack21e4ef22005-01-02 09:53:13 +000018922#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018923 int mem_base;
18924 int ret_val;
18925 FILE * f; /* the FILE* */
18926 int n_f;
18927 xmlDocPtr cur; /* the document */
18928 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018929
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018930 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18931 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18932 mem_base = xmlMemBlocks();
18933 f = gen_FILE_ptr(n_f, 0);
18934 cur = gen_xmlDocPtr(n_cur, 1);
18935
18936 ret_val = xmlDocDump(f, cur);
18937 desret_int(ret_val);
18938 call_tests++;
18939 des_FILE_ptr(n_f, f, 0);
18940 des_xmlDocPtr(n_cur, cur, 1);
18941 xmlResetLastError();
18942 if (mem_base != xmlMemBlocks()) {
18943 printf("Leak of %d blocks found in xmlDocDump",
18944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018945 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018946 printf(" %d", n_f);
18947 printf(" %d", n_cur);
18948 printf("\n");
18949 }
18950 }
18951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018952 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018953#endif
18954
Daniel Veillard42595322004-11-08 10:52:06 +000018955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018956}
18957
18958
18959static int
18960test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018962
William M. Brack21e4ef22005-01-02 09:53:13 +000018963#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018964 int mem_base;
18965 xmlDocPtr cur; /* the document */
18966 int n_cur;
18967 xmlChar ** mem; /* OUT: the memory pointer */
18968 int n_mem;
18969 int * size; /* OUT: the memory length */
18970 int n_size;
18971 int format; /* should formatting spaces been added */
18972 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018973
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018974 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18975 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18976 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18977 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18978 mem_base = xmlMemBlocks();
18979 cur = gen_xmlDocPtr(n_cur, 0);
18980 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18981 size = gen_int_ptr(n_size, 2);
18982 format = gen_int(n_format, 3);
18983
18984 xmlDocDumpFormatMemory(cur, mem, size, format);
18985 call_tests++;
18986 des_xmlDocPtr(n_cur, cur, 0);
18987 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18988 des_int_ptr(n_size, size, 2);
18989 des_int(n_format, format, 3);
18990 xmlResetLastError();
18991 if (mem_base != xmlMemBlocks()) {
18992 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018994 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018995 printf(" %d", n_cur);
18996 printf(" %d", n_mem);
18997 printf(" %d", n_size);
18998 printf(" %d", n_format);
18999 printf("\n");
19000 }
19001 }
19002 }
19003 }
19004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019005 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019006#endif
19007
Daniel Veillard42595322004-11-08 10:52:06 +000019008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019009}
19010
19011
19012static int
19013test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019015
William M. Brack21e4ef22005-01-02 09:53:13 +000019016#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019017 int mem_base;
19018 xmlDocPtr out_doc; /* Document to generate XML text from */
19019 int n_out_doc;
19020 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19021 int n_doc_txt_ptr;
19022 int * doc_txt_len; /* Length of the generated XML text */
19023 int n_doc_txt_len;
19024 char * txt_encoding; /* Character encoding to use when generating XML text */
19025 int n_txt_encoding;
19026 int format; /* should formatting spaces been added */
19027 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019028
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019029 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19030 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19031 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19032 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19033 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19034 mem_base = xmlMemBlocks();
19035 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19036 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19037 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19038 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19039 format = gen_int(n_format, 4);
19040
William M. Brackf13f77f2004-11-12 16:03:48 +000019041 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019042 call_tests++;
19043 des_xmlDocPtr(n_out_doc, out_doc, 0);
19044 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19045 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019046 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019047 des_int(n_format, format, 4);
19048 xmlResetLastError();
19049 if (mem_base != xmlMemBlocks()) {
19050 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019052 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019053 printf(" %d", n_out_doc);
19054 printf(" %d", n_doc_txt_ptr);
19055 printf(" %d", n_doc_txt_len);
19056 printf(" %d", n_txt_encoding);
19057 printf(" %d", n_format);
19058 printf("\n");
19059 }
19060 }
19061 }
19062 }
19063 }
19064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019065 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019066#endif
19067
Daniel Veillard42595322004-11-08 10:52:06 +000019068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019069}
19070
19071
19072static int
19073test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019075
William M. Brack21e4ef22005-01-02 09:53:13 +000019076#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019077 int mem_base;
19078 xmlDocPtr cur; /* the document */
19079 int n_cur;
19080 xmlChar ** mem; /* OUT: the memory pointer */
19081 int n_mem;
19082 int * size; /* OUT: the memory length */
19083 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019084
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019085 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19086 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19087 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19088 mem_base = xmlMemBlocks();
19089 cur = gen_xmlDocPtr(n_cur, 0);
19090 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19091 size = gen_int_ptr(n_size, 2);
19092
19093 xmlDocDumpMemory(cur, mem, size);
19094 call_tests++;
19095 des_xmlDocPtr(n_cur, cur, 0);
19096 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19097 des_int_ptr(n_size, size, 2);
19098 xmlResetLastError();
19099 if (mem_base != xmlMemBlocks()) {
19100 printf("Leak of %d blocks found in xmlDocDumpMemory",
19101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019102 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019103 printf(" %d", n_cur);
19104 printf(" %d", n_mem);
19105 printf(" %d", n_size);
19106 printf("\n");
19107 }
19108 }
19109 }
19110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019111 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019112#endif
19113
Daniel Veillard42595322004-11-08 10:52:06 +000019114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019115}
19116
19117
19118static int
19119test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019121
William M. Brack21e4ef22005-01-02 09:53:13 +000019122#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019123 int mem_base;
19124 xmlDocPtr out_doc; /* Document to generate XML text from */
19125 int n_out_doc;
19126 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19127 int n_doc_txt_ptr;
19128 int * doc_txt_len; /* Length of the generated XML text */
19129 int n_doc_txt_len;
19130 char * txt_encoding; /* Character encoding to use when generating XML text */
19131 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019132
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019133 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19134 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19135 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19136 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19137 mem_base = xmlMemBlocks();
19138 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19139 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19140 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19141 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19142
William M. Brackf13f77f2004-11-12 16:03:48 +000019143 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019144 call_tests++;
19145 des_xmlDocPtr(n_out_doc, out_doc, 0);
19146 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19147 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019148 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019149 xmlResetLastError();
19150 if (mem_base != xmlMemBlocks()) {
19151 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019153 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019154 printf(" %d", n_out_doc);
19155 printf(" %d", n_doc_txt_ptr);
19156 printf(" %d", n_doc_txt_len);
19157 printf(" %d", n_txt_encoding);
19158 printf("\n");
19159 }
19160 }
19161 }
19162 }
19163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019164 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019165#endif
19166
Daniel Veillard42595322004-11-08 10:52:06 +000019167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019168}
19169
19170
19171static int
19172test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019174
William M. Brack21e4ef22005-01-02 09:53:13 +000019175#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019176 int mem_base;
19177 int ret_val;
19178 FILE * f; /* the FILE* */
19179 int n_f;
19180 xmlDocPtr cur; /* the document */
19181 int n_cur;
19182 int format; /* should formatting spaces been added */
19183 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019184
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019185 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19186 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19187 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19188 mem_base = xmlMemBlocks();
19189 f = gen_FILE_ptr(n_f, 0);
19190 cur = gen_xmlDocPtr(n_cur, 1);
19191 format = gen_int(n_format, 2);
19192
19193 ret_val = xmlDocFormatDump(f, cur, format);
19194 desret_int(ret_val);
19195 call_tests++;
19196 des_FILE_ptr(n_f, f, 0);
19197 des_xmlDocPtr(n_cur, cur, 1);
19198 des_int(n_format, format, 2);
19199 xmlResetLastError();
19200 if (mem_base != xmlMemBlocks()) {
19201 printf("Leak of %d blocks found in xmlDocFormatDump",
19202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019203 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019204 printf(" %d", n_f);
19205 printf(" %d", n_cur);
19206 printf(" %d", n_format);
19207 printf("\n");
19208 }
19209 }
19210 }
19211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019212 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019213#endif
19214
Daniel Veillard42595322004-11-08 10:52:06 +000019215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019216}
19217
19218
19219static int
19220test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019222
19223 int mem_base;
19224 xmlNodePtr ret_val;
19225 xmlDocPtr doc; /* the document */
19226 int n_doc;
19227
19228 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019230 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019231
19232 ret_val = xmlDocGetRootElement(doc);
19233 desret_xmlNodePtr(ret_val);
19234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019235 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019236 xmlResetLastError();
19237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019238 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019241 printf(" %d", n_doc);
19242 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019243 }
19244 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019246
Daniel Veillard42595322004-11-08 10:52:06 +000019247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019248}
19249
19250
19251static int
19252test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019254
William M. Brack21e4ef22005-01-02 09:53:13 +000019255#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019256 int mem_base;
19257 xmlNodePtr ret_val;
19258 xmlDocPtr doc; /* the document */
19259 int n_doc;
19260 xmlNodePtr root; /* the new document root element */
19261 int n_root;
19262
19263 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019264 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019266 doc = gen_xmlDocPtr(n_doc, 0);
19267 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019268
19269 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019270 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019271 desret_xmlNodePtr(ret_val);
19272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019273 des_xmlDocPtr(n_doc, doc, 0);
19274 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019275 xmlResetLastError();
19276 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019277 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019279 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019280 printf(" %d", n_doc);
19281 printf(" %d", n_root);
19282 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019283 }
19284 }
19285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019286 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019287#endif
19288
Daniel Veillard42595322004-11-08 10:52:06 +000019289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290}
19291
19292
19293static int
19294test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019296
William M. Brack21e4ef22005-01-02 09:53:13 +000019297#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019298 int mem_base;
19299 FILE * f; /* the FILE * for the output */
19300 int n_f;
19301 xmlDocPtr doc; /* the document */
19302 int n_doc;
19303 xmlNodePtr cur; /* the current node */
19304 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019305
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019306 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19307 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19308 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19309 mem_base = xmlMemBlocks();
19310 f = gen_FILE_ptr(n_f, 0);
19311 doc = gen_xmlDocPtr(n_doc, 1);
19312 cur = gen_xmlNodePtr(n_cur, 2);
19313
19314 xmlElemDump(f, doc, cur);
19315 call_tests++;
19316 des_FILE_ptr(n_f, f, 0);
19317 des_xmlDocPtr(n_doc, doc, 1);
19318 des_xmlNodePtr(n_cur, cur, 2);
19319 xmlResetLastError();
19320 if (mem_base != xmlMemBlocks()) {
19321 printf("Leak of %d blocks found in xmlElemDump",
19322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019323 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019324 printf(" %d", n_f);
19325 printf(" %d", n_doc);
19326 printf(" %d", n_cur);
19327 printf("\n");
19328 }
19329 }
19330 }
19331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019332 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019333#endif
19334
Daniel Veillard42595322004-11-08 10:52:06 +000019335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019336}
19337
19338
19339static int
19340test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019342
Daniel Veillard57b25162004-11-06 14:50:18 +000019343 int mem_base;
19344 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019345
Daniel Veillard57b25162004-11-06 14:50:18 +000019346 mem_base = xmlMemBlocks();
19347
19348 ret_val = xmlGetBufferAllocationScheme();
19349 desret_xmlBufferAllocationScheme(ret_val);
19350 call_tests++;
19351 xmlResetLastError();
19352 if (mem_base != xmlMemBlocks()) {
19353 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019355 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019356 printf("\n");
19357 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019358 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019359
Daniel Veillard42595322004-11-08 10:52:06 +000019360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019361}
19362
19363
19364static int
19365test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019367
19368 int mem_base;
19369 int ret_val;
19370
19371 mem_base = xmlMemBlocks();
19372
19373 ret_val = xmlGetCompressMode();
19374 desret_int(ret_val);
19375 call_tests++;
19376 xmlResetLastError();
19377 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019378 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019380 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019381 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019382 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019383 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019384
Daniel Veillard42595322004-11-08 10:52:06 +000019385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019386}
19387
19388
19389static int
19390test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019392
19393 int mem_base;
19394 int ret_val;
19395 xmlDocPtr doc; /* the document */
19396 int n_doc;
19397
19398 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19399 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019400 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019401
19402 ret_val = xmlGetDocCompressMode(doc);
19403 desret_int(ret_val);
19404 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019405 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019406 xmlResetLastError();
19407 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019408 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019410 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019411 printf(" %d", n_doc);
19412 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019413 }
19414 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019415 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019416
Daniel Veillard42595322004-11-08 10:52:06 +000019417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418}
19419
19420
19421static int
19422test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019424
Daniel Veillard34099b42004-11-04 17:34:35 +000019425 int mem_base;
19426 xmlDtdPtr ret_val;
19427 xmlDocPtr doc; /* the document pointer */
19428 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019429
Daniel Veillard34099b42004-11-04 17:34:35 +000019430 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19431 mem_base = xmlMemBlocks();
19432 doc = gen_xmlDocPtr(n_doc, 0);
19433
19434 ret_val = xmlGetIntSubset(doc);
19435 desret_xmlDtdPtr(ret_val);
19436 call_tests++;
19437 des_xmlDocPtr(n_doc, doc, 0);
19438 xmlResetLastError();
19439 if (mem_base != xmlMemBlocks()) {
19440 printf("Leak of %d blocks found in xmlGetIntSubset",
19441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019442 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019443 printf(" %d", n_doc);
19444 printf("\n");
19445 }
19446 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019448
Daniel Veillard42595322004-11-08 10:52:06 +000019449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019450}
19451
19452
19453static int
19454test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019456
19457 int mem_base;
19458 xmlNodePtr ret_val;
19459 xmlNodePtr parent; /* the parent node */
19460 int n_parent;
19461
19462 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19463 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019464 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019465
19466 ret_val = xmlGetLastChild(parent);
19467 desret_xmlNodePtr(ret_val);
19468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019469 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019470 xmlResetLastError();
19471 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019472 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019474 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019475 printf(" %d", n_parent);
19476 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019477 }
19478 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019480
Daniel Veillard42595322004-11-08 10:52:06 +000019481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019482}
19483
19484
19485static int
19486test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019488
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019489 int mem_base;
19490 long ret_val;
19491 xmlNodePtr node; /* valid node */
19492 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019493
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019494 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19495 mem_base = xmlMemBlocks();
19496 node = gen_xmlNodePtr(n_node, 0);
19497
19498 ret_val = xmlGetLineNo(node);
19499 desret_long(ret_val);
19500 call_tests++;
19501 des_xmlNodePtr(n_node, node, 0);
19502 xmlResetLastError();
19503 if (mem_base != xmlMemBlocks()) {
19504 printf("Leak of %d blocks found in xmlGetLineNo",
19505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019506 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019507 printf(" %d", n_node);
19508 printf("\n");
19509 }
19510 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019511 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019512
Daniel Veillard42595322004-11-08 10:52:06 +000019513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019514}
19515
19516
19517static int
19518test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019520
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019521 int mem_base;
19522 xmlChar * ret_val;
19523 xmlNodePtr node; /* the node */
19524 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019525 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019526 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019527
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019528 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19529 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19530 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019531 node = gen_xmlNodePtr(n_node, 0);
19532 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019533
William M. Brackf13f77f2004-11-12 16:03:48 +000019534 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019535 desret_xmlChar_ptr(ret_val);
19536 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019537 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019538 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019539 xmlResetLastError();
19540 if (mem_base != xmlMemBlocks()) {
19541 printf("Leak of %d blocks found in xmlGetNoNsProp",
19542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019543 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019544 printf(" %d", n_node);
19545 printf(" %d", n_name);
19546 printf("\n");
19547 }
19548 }
19549 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019551
Daniel Veillard42595322004-11-08 10:52:06 +000019552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019553}
19554
19555
19556static int
19557test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019559
William M. Brack21e4ef22005-01-02 09:53:13 +000019560#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019561 int mem_base;
19562 xmlChar * ret_val;
19563 xmlNodePtr node; /* a node */
19564 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019565
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019566 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19567 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019568 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019569
19570 ret_val = xmlGetNodePath(node);
19571 desret_xmlChar_ptr(ret_val);
19572 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019573 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019574 xmlResetLastError();
19575 if (mem_base != xmlMemBlocks()) {
19576 printf("Leak of %d blocks found in xmlGetNodePath",
19577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019578 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019579 printf(" %d", n_node);
19580 printf("\n");
19581 }
19582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019583 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019584#endif
19585
Daniel Veillard42595322004-11-08 10:52:06 +000019586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019587}
19588
19589
19590static int
19591test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019593
19594
19595 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019597}
19598
19599
19600static int
19601test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019603
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019604 int mem_base;
19605 xmlChar * ret_val;
19606 xmlNodePtr node; /* the node */
19607 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019608 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019609 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019610 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019611 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019612
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019613 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19614 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19615 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19616 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019617 node = gen_xmlNodePtr(n_node, 0);
19618 name = gen_const_xmlChar_ptr(n_name, 1);
19619 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019620
William M. Brackf13f77f2004-11-12 16:03:48 +000019621 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019622 desret_xmlChar_ptr(ret_val);
19623 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019624 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019625 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19626 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019627 xmlResetLastError();
19628 if (mem_base != xmlMemBlocks()) {
19629 printf("Leak of %d blocks found in xmlGetNsProp",
19630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019631 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019632 printf(" %d", n_node);
19633 printf(" %d", n_name);
19634 printf(" %d", n_nameSpace);
19635 printf("\n");
19636 }
19637 }
19638 }
19639 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019641
Daniel Veillard42595322004-11-08 10:52:06 +000019642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019643}
19644
19645
19646static int
19647test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019649
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019650 int mem_base;
19651 xmlChar * ret_val;
19652 xmlNodePtr node; /* the node */
19653 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019654 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019655 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019656
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019657 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19658 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19659 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019660 node = gen_xmlNodePtr(n_node, 0);
19661 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019662
William M. Brackf13f77f2004-11-12 16:03:48 +000019663 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019664 desret_xmlChar_ptr(ret_val);
19665 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019666 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019667 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019668 xmlResetLastError();
19669 if (mem_base != xmlMemBlocks()) {
19670 printf("Leak of %d blocks found in xmlGetProp",
19671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019672 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019673 printf(" %d", n_node);
19674 printf(" %d", n_name);
19675 printf("\n");
19676 }
19677 }
19678 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019680
Daniel Veillard42595322004-11-08 10:52:06 +000019681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019682}
19683
19684
19685static int
19686test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019688
Daniel Veillard57b25162004-11-06 14:50:18 +000019689 int mem_base;
19690 xmlAttrPtr ret_val;
19691 xmlNodePtr node; /* the node */
19692 int n_node;
19693 xmlChar * name; /* the attribute name */
19694 int n_name;
19695 xmlChar * nameSpace; /* the URI of the namespace */
19696 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019697
Daniel Veillard57b25162004-11-06 14:50:18 +000019698 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19699 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19700 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19701 mem_base = xmlMemBlocks();
19702 node = gen_xmlNodePtr(n_node, 0);
19703 name = gen_const_xmlChar_ptr(n_name, 1);
19704 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19705
William M. Brackf13f77f2004-11-12 16:03:48 +000019706 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019707 desret_xmlAttrPtr(ret_val);
19708 call_tests++;
19709 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019710 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19711 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019712 xmlResetLastError();
19713 if (mem_base != xmlMemBlocks()) {
19714 printf("Leak of %d blocks found in xmlHasNsProp",
19715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019716 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019717 printf(" %d", n_node);
19718 printf(" %d", n_name);
19719 printf(" %d", n_nameSpace);
19720 printf("\n");
19721 }
19722 }
19723 }
19724 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019725 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019726
Daniel Veillard42595322004-11-08 10:52:06 +000019727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019728}
19729
19730
19731static int
19732test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734
Daniel Veillard57b25162004-11-06 14:50:18 +000019735 int mem_base;
19736 xmlAttrPtr ret_val;
19737 xmlNodePtr node; /* the node */
19738 int n_node;
19739 xmlChar * name; /* the attribute name */
19740 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019741
Daniel Veillard57b25162004-11-06 14:50:18 +000019742 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19743 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19744 mem_base = xmlMemBlocks();
19745 node = gen_xmlNodePtr(n_node, 0);
19746 name = gen_const_xmlChar_ptr(n_name, 1);
19747
William M. Brackf13f77f2004-11-12 16:03:48 +000019748 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019749 desret_xmlAttrPtr(ret_val);
19750 call_tests++;
19751 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019752 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019753 xmlResetLastError();
19754 if (mem_base != xmlMemBlocks()) {
19755 printf("Leak of %d blocks found in xmlHasProp",
19756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019757 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019758 printf(" %d", n_node);
19759 printf(" %d", n_name);
19760 printf("\n");
19761 }
19762 }
19763 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019764 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019765
Daniel Veillard42595322004-11-08 10:52:06 +000019766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019767}
19768
19769
19770static int
19771test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019773
19774 int mem_base;
19775 int ret_val;
19776 xmlNodePtr node; /* the node */
19777 int n_node;
19778
19779 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019781 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019782
19783 ret_val = xmlIsBlankNode(node);
19784 desret_int(ret_val);
19785 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019786 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019787 xmlResetLastError();
19788 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019789 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019791 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019792 printf(" %d", n_node);
19793 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019794 }
19795 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019796 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019797
Daniel Veillard42595322004-11-08 10:52:06 +000019798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019799}
19800
19801
19802static int
19803test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019805
19806 int mem_base;
19807 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019808 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019809 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019810 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019811 int n_publicID;
19812
19813 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19814 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019816 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19817 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019818
William M. Brackf13f77f2004-11-12 16:03:48 +000019819 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019820 desret_int(ret_val);
19821 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019822 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19823 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019824 xmlResetLastError();
19825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019826 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019829 printf(" %d", n_systemID);
19830 printf(" %d", n_publicID);
19831 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019832 }
19833 }
19834 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019836
Daniel Veillard42595322004-11-08 10:52:06 +000019837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019838}
19839
19840
19841static int
19842test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019844
19845 int mem_base;
19846 xmlNodePtr ret_val;
19847 xmlDocPtr doc; /* the document */
19848 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019849 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019850 int n_content;
19851 int len; /* the length of the block */
19852 int n_len;
19853
19854 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19855 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19856 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019858 doc = gen_xmlDocPtr(n_doc, 0);
19859 content = gen_const_xmlChar_ptr(n_content, 1);
19860 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019861
William M. Brackf13f77f2004-11-12 16:03:48 +000019862 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019863 desret_xmlNodePtr(ret_val);
19864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019865 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019866 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019867 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019868 xmlResetLastError();
19869 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019870 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019872 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019873 printf(" %d", n_doc);
19874 printf(" %d", n_content);
19875 printf(" %d", n_len);
19876 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019877 }
19878 }
19879 }
19880 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019881 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019882
Daniel Veillard42595322004-11-08 10:52:06 +000019883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019884}
19885
19886
19887static int
19888test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019890
19891 int mem_base;
19892 xmlNodePtr ret_val;
19893 xmlDocPtr doc; /* the document */
19894 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019895 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019896 int n_name;
19897
19898 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19899 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19900 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019901 doc = gen_xmlDocPtr(n_doc, 0);
19902 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019903
William M. Brackf13f77f2004-11-12 16:03:48 +000019904 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019905 desret_xmlNodePtr(ret_val);
19906 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019907 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019908 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019909 xmlResetLastError();
19910 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019911 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019913 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019914 printf(" %d", n_doc);
19915 printf(" %d", n_name);
19916 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019917 }
19918 }
19919 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019920 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019921
Daniel Veillard42595322004-11-08 10:52:06 +000019922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019923}
19924
19925
19926static int
19927test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019929
William M. Brack21e4ef22005-01-02 09:53:13 +000019930#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019931#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019932 int mem_base;
19933 xmlNodePtr ret_val;
19934 xmlNodePtr parent; /* the parent node */
19935 int n_parent;
19936 xmlNsPtr ns; /* a namespace if any */
19937 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019938 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019939 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019940 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019941 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019942
Daniel Veillard27f20102004-11-05 11:50:11 +000019943 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19944 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19945 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19946 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19947 mem_base = xmlMemBlocks();
19948 parent = gen_xmlNodePtr(n_parent, 0);
19949 ns = gen_xmlNsPtr(n_ns, 1);
19950 name = gen_const_xmlChar_ptr(n_name, 2);
19951 content = gen_const_xmlChar_ptr(n_content, 3);
19952
William M. Brackf13f77f2004-11-12 16:03:48 +000019953 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019954 desret_xmlNodePtr(ret_val);
19955 call_tests++;
19956 des_xmlNodePtr(n_parent, parent, 0);
19957 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019958 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19959 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019960 xmlResetLastError();
19961 if (mem_base != xmlMemBlocks()) {
19962 printf("Leak of %d blocks found in xmlNewChild",
19963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019964 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019965 printf(" %d", n_parent);
19966 printf(" %d", n_ns);
19967 printf(" %d", n_name);
19968 printf(" %d", n_content);
19969 printf("\n");
19970 }
19971 }
19972 }
19973 }
19974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019975 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019976#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000019977#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019978
Daniel Veillard42595322004-11-08 10:52:06 +000019979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019980}
19981
19982
19983static int
19984test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019986
19987 int mem_base;
19988 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019989 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019990 int n_content;
19991
19992 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19993 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019994 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019995
William M. Brackf13f77f2004-11-12 16:03:48 +000019996 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019997 desret_xmlNodePtr(ret_val);
19998 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019999 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020000 xmlResetLastError();
20001 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020002 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020004 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020005 printf(" %d", n_content);
20006 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020007 }
20008 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020009 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020010
Daniel Veillard42595322004-11-08 10:52:06 +000020011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020012}
20013
20014
20015static int
20016test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020018
20019 int mem_base;
20020 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020021 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020022 int n_version;
20023
20024 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20025 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020026 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020027
William M. Brackf13f77f2004-11-12 16:03:48 +000020028 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020029 desret_xmlDocPtr(ret_val);
20030 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020031 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020032 xmlResetLastError();
20033 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020034 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020036 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020037 printf(" %d", n_version);
20038 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020039 }
20040 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020042
Daniel Veillard42595322004-11-08 10:52:06 +000020043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020044}
20045
20046
20047static int
20048test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020050
20051 int mem_base;
20052 xmlNodePtr ret_val;
20053 xmlDocPtr doc; /* the document */
20054 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020055 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020056 int n_content;
20057
20058 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20059 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20060 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020061 doc = gen_xmlDocPtr(n_doc, 0);
20062 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020063
William M. Brackf13f77f2004-11-12 16:03:48 +000020064 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020065 desret_xmlNodePtr(ret_val);
20066 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020067 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020068 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069 xmlResetLastError();
20070 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020071 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020073 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020074 printf(" %d", n_doc);
20075 printf(" %d", n_content);
20076 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020077 }
20078 }
20079 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020080 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020081
Daniel Veillard42595322004-11-08 10:52:06 +000020082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020083}
20084
20085
20086static int
20087test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020089
William M. Brack21e4ef22005-01-02 09:53:13 +000020090#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000020091 int mem_base;
20092 xmlNodePtr ret_val;
20093 xmlDocPtr doc; /* the document owning the fragment */
20094 int n_doc;
20095
20096 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020098 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020099
20100 ret_val = xmlNewDocFragment(doc);
20101 desret_xmlNodePtr(ret_val);
20102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020103 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020104 xmlResetLastError();
20105 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020106 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020108 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020109 printf(" %d", n_doc);
20110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 }
20112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020113 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020114#endif
20115
Daniel Veillard42595322004-11-08 10:52:06 +000020116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020117}
20118
20119
20120static int
20121test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020123
Daniel Veillard27f20102004-11-05 11:50:11 +000020124 int mem_base;
20125 xmlNodePtr ret_val;
20126 xmlDocPtr doc; /* the document */
20127 int n_doc;
20128 xmlNsPtr ns; /* namespace if any */
20129 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020130 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020131 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020132 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020133 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020134
Daniel Veillard27f20102004-11-05 11:50:11 +000020135 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20136 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20138 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20139 mem_base = xmlMemBlocks();
20140 doc = gen_xmlDocPtr(n_doc, 0);
20141 ns = gen_xmlNsPtr(n_ns, 1);
20142 name = gen_const_xmlChar_ptr(n_name, 2);
20143 content = gen_const_xmlChar_ptr(n_content, 3);
20144
William M. Brackf13f77f2004-11-12 16:03:48 +000020145 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020146 desret_xmlNodePtr(ret_val);
20147 call_tests++;
20148 des_xmlDocPtr(n_doc, doc, 0);
20149 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020150 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20151 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020152 xmlResetLastError();
20153 if (mem_base != xmlMemBlocks()) {
20154 printf("Leak of %d blocks found in xmlNewDocNode",
20155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020156 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020157 printf(" %d", n_doc);
20158 printf(" %d", n_ns);
20159 printf(" %d", n_name);
20160 printf(" %d", n_content);
20161 printf("\n");
20162 }
20163 }
20164 }
20165 }
20166 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020168
Daniel Veillard42595322004-11-08 10:52:06 +000020169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020170}
20171
20172
20173static int
20174test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020176
Daniel Veillard27f20102004-11-05 11:50:11 +000020177 int mem_base;
20178 xmlNodePtr ret_val;
20179 xmlDocPtr doc; /* the document */
20180 int n_doc;
20181 xmlNsPtr ns; /* namespace if any */
20182 int n_ns;
20183 xmlChar * name; /* the node name */
20184 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020185 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020186 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020187
Daniel Veillard27f20102004-11-05 11:50:11 +000020188 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20189 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20190 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20191 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20192 mem_base = xmlMemBlocks();
20193 doc = gen_xmlDocPtr(n_doc, 0);
20194 ns = gen_xmlNsPtr(n_ns, 1);
20195 name = gen_eaten_name(n_name, 2);
20196 content = gen_const_xmlChar_ptr(n_content, 3);
20197
William M. Brackf13f77f2004-11-12 16:03:48 +000020198 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020199 desret_xmlNodePtr(ret_val);
20200 call_tests++;
20201 des_xmlDocPtr(n_doc, doc, 0);
20202 des_xmlNsPtr(n_ns, ns, 1);
20203 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020204 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020205 xmlResetLastError();
20206 if (mem_base != xmlMemBlocks()) {
20207 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020209 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020210 printf(" %d", n_doc);
20211 printf(" %d", n_ns);
20212 printf(" %d", n_name);
20213 printf(" %d", n_content);
20214 printf("\n");
20215 }
20216 }
20217 }
20218 }
20219 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020220 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020221
Daniel Veillard42595322004-11-08 10:52:06 +000020222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020223}
20224
20225
20226static int
20227test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020229
20230 int mem_base;
20231 xmlNodePtr ret_val;
20232 xmlDocPtr doc; /* the target document */
20233 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020234 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020235 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020236 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020237 int n_content;
20238
20239 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20240 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20241 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020243 doc = gen_xmlDocPtr(n_doc, 0);
20244 name = gen_const_xmlChar_ptr(n_name, 1);
20245 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020246
William M. Brackf13f77f2004-11-12 16:03:48 +000020247 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020248 desret_xmlNodePtr(ret_val);
20249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020250 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020251 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20252 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020253 xmlResetLastError();
20254 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020255 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020257 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020258 printf(" %d", n_doc);
20259 printf(" %d", n_name);
20260 printf(" %d", n_content);
20261 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020262 }
20263 }
20264 }
20265 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020266 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020267
Daniel Veillard42595322004-11-08 10:52:06 +000020268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020269}
20270
20271
20272static int
20273test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020275
Daniel Veillard57b25162004-11-06 14:50:18 +000020276 int mem_base;
20277 xmlAttrPtr ret_val;
20278 xmlDocPtr doc; /* the document */
20279 int n_doc;
20280 xmlChar * name; /* the name of the attribute */
20281 int n_name;
20282 xmlChar * value; /* the value of the attribute */
20283 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020284
Daniel Veillard57b25162004-11-06 14:50:18 +000020285 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20286 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20287 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20288 mem_base = xmlMemBlocks();
20289 doc = gen_xmlDocPtr(n_doc, 0);
20290 name = gen_const_xmlChar_ptr(n_name, 1);
20291 value = gen_const_xmlChar_ptr(n_value, 2);
20292
William M. Brackf13f77f2004-11-12 16:03:48 +000020293 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020294 desret_xmlAttrPtr(ret_val);
20295 call_tests++;
20296 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020297 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20298 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020299 xmlResetLastError();
20300 if (mem_base != xmlMemBlocks()) {
20301 printf("Leak of %d blocks found in xmlNewDocProp",
20302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020303 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020304 printf(" %d", n_doc);
20305 printf(" %d", n_name);
20306 printf(" %d", n_value);
20307 printf("\n");
20308 }
20309 }
20310 }
20311 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020312 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020313
Daniel Veillard42595322004-11-08 10:52:06 +000020314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020315}
20316
20317
20318static int
20319test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020321
William M. Brack21e4ef22005-01-02 09:53:13 +000020322#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020323#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020324 int mem_base;
20325 xmlNodePtr ret_val;
20326 xmlDocPtr doc; /* the document */
20327 int n_doc;
20328 xmlNsPtr ns; /* namespace if any */
20329 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020330 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020331 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020332 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020333 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020334
Daniel Veillard27f20102004-11-05 11:50:11 +000020335 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20336 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20337 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20338 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20339 mem_base = xmlMemBlocks();
20340 doc = gen_xmlDocPtr(n_doc, 0);
20341 ns = gen_xmlNsPtr(n_ns, 1);
20342 name = gen_const_xmlChar_ptr(n_name, 2);
20343 content = gen_const_xmlChar_ptr(n_content, 3);
20344
William M. Brackf13f77f2004-11-12 16:03:48 +000020345 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020346 desret_xmlNodePtr(ret_val);
20347 call_tests++;
20348 des_xmlDocPtr(n_doc, doc, 0);
20349 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020350 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20351 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020352 xmlResetLastError();
20353 if (mem_base != xmlMemBlocks()) {
20354 printf("Leak of %d blocks found in xmlNewDocRawNode",
20355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020356 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020357 printf(" %d", n_doc);
20358 printf(" %d", n_ns);
20359 printf(" %d", n_name);
20360 printf(" %d", n_content);
20361 printf("\n");
20362 }
20363 }
20364 }
20365 }
20366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020367 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020368#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020369#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020370
Daniel Veillard42595322004-11-08 10:52:06 +000020371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020372}
20373
20374
20375static int
20376test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020378
20379 int mem_base;
20380 xmlNodePtr ret_val;
20381 xmlDocPtr doc; /* the document */
20382 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020383 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020384 int n_content;
20385
20386 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20387 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020389 doc = gen_xmlDocPtr(n_doc, 0);
20390 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020391
William M. Brackf13f77f2004-11-12 16:03:48 +000020392 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020393 desret_xmlNodePtr(ret_val);
20394 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020395 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020396 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020397 xmlResetLastError();
20398 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020399 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020401 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020402 printf(" %d", n_doc);
20403 printf(" %d", n_content);
20404 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020405 }
20406 }
20407 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020408 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020409
Daniel Veillard42595322004-11-08 10:52:06 +000020410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020411}
20412
20413
20414static int
20415test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020417
20418 int mem_base;
20419 xmlNodePtr ret_val;
20420 xmlDocPtr doc; /* the document */
20421 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020422 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020423 int n_content;
20424 int len; /* the text len. */
20425 int n_len;
20426
20427 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20428 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20429 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20430 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020431 doc = gen_xmlDocPtr(n_doc, 0);
20432 content = gen_const_xmlChar_ptr(n_content, 1);
20433 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020434
William M. Brackf13f77f2004-11-12 16:03:48 +000020435 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020436 desret_xmlNodePtr(ret_val);
20437 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020438 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020439 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020440 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020441 xmlResetLastError();
20442 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020443 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020445 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020446 printf(" %d", n_doc);
20447 printf(" %d", n_content);
20448 printf(" %d", n_len);
20449 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020450 }
20451 }
20452 }
20453 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020454 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020455
Daniel Veillard42595322004-11-08 10:52:06 +000020456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020457}
20458
20459
20460static int
20461test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020463
Daniel Veillard34099b42004-11-04 17:34:35 +000020464 int mem_base;
20465 xmlDtdPtr ret_val;
20466 xmlDocPtr doc; /* the document pointer */
20467 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020468 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020469 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020470 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020471 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020472 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020473 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020474
Daniel Veillard34099b42004-11-04 17:34:35 +000020475 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20476 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20477 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20478 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20479 mem_base = xmlMemBlocks();
20480 doc = gen_xmlDocPtr(n_doc, 0);
20481 name = gen_const_xmlChar_ptr(n_name, 1);
20482 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20483 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20484
William M. Brackf13f77f2004-11-12 16:03:48 +000020485 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020486 desret_xmlDtdPtr(ret_val);
20487 call_tests++;
20488 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020489 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20490 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20491 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020492 xmlResetLastError();
20493 if (mem_base != xmlMemBlocks()) {
20494 printf("Leak of %d blocks found in xmlNewDtd",
20495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020496 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020497 printf(" %d", n_doc);
20498 printf(" %d", n_name);
20499 printf(" %d", n_ExternalID);
20500 printf(" %d", n_SystemID);
20501 printf("\n");
20502 }
20503 }
20504 }
20505 }
20506 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020508
Daniel Veillard42595322004-11-08 10:52:06 +000020509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020510}
20511
20512
20513static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020514test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020516
Daniel Veillard27f20102004-11-05 11:50:11 +000020517 int mem_base;
20518 xmlNodePtr ret_val;
20519 xmlNsPtr ns; /* namespace if any */
20520 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020521 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020522 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020523
Daniel Veillard27f20102004-11-05 11:50:11 +000020524 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20525 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20526 mem_base = xmlMemBlocks();
20527 ns = gen_xmlNsPtr(n_ns, 0);
20528 name = gen_const_xmlChar_ptr(n_name, 1);
20529
William M. Brackf13f77f2004-11-12 16:03:48 +000020530 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020531 desret_xmlNodePtr(ret_val);
20532 call_tests++;
20533 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020534 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020535 xmlResetLastError();
20536 if (mem_base != xmlMemBlocks()) {
20537 printf("Leak of %d blocks found in xmlNewNode",
20538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020539 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020540 printf(" %d", n_ns);
20541 printf(" %d", n_name);
20542 printf("\n");
20543 }
20544 }
20545 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020546 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020547
Daniel Veillard42595322004-11-08 10:52:06 +000020548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020549}
20550
20551
20552static int
20553test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020555
Daniel Veillard27f20102004-11-05 11:50:11 +000020556 int mem_base;
20557 xmlNodePtr ret_val;
20558 xmlNsPtr ns; /* namespace if any */
20559 int n_ns;
20560 xmlChar * name; /* the node name */
20561 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020562
Daniel Veillard27f20102004-11-05 11:50:11 +000020563 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20564 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20565 mem_base = xmlMemBlocks();
20566 ns = gen_xmlNsPtr(n_ns, 0);
20567 name = gen_eaten_name(n_name, 1);
20568
20569 ret_val = xmlNewNodeEatName(ns, name);
20570 desret_xmlNodePtr(ret_val);
20571 call_tests++;
20572 des_xmlNsPtr(n_ns, ns, 0);
20573 des_eaten_name(n_name, name, 1);
20574 xmlResetLastError();
20575 if (mem_base != xmlMemBlocks()) {
20576 printf("Leak of %d blocks found in xmlNewNodeEatName",
20577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020578 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020579 printf(" %d", n_ns);
20580 printf(" %d", n_name);
20581 printf("\n");
20582 }
20583 }
20584 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020585 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020586
Daniel Veillard42595322004-11-08 10:52:06 +000020587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020588}
20589
20590
20591static int
20592test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020594
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020595 int mem_base;
20596 xmlNsPtr ret_val;
20597 xmlNodePtr node; /* the element carrying the namespace */
20598 int n_node;
20599 xmlChar * href; /* the URI associated */
20600 int n_href;
20601 xmlChar * prefix; /* the prefix for the namespace */
20602 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020603
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020604 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20605 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20606 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20607 mem_base = xmlMemBlocks();
20608 node = gen_xmlNodePtr(n_node, 0);
20609 href = gen_const_xmlChar_ptr(n_href, 1);
20610 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20611
William M. Brackf13f77f2004-11-12 16:03:48 +000020612 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020613 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20614 desret_xmlNsPtr(ret_val);
20615 call_tests++;
20616 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020617 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20618 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020619 xmlResetLastError();
20620 if (mem_base != xmlMemBlocks()) {
20621 printf("Leak of %d blocks found in xmlNewNs",
20622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020623 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020624 printf(" %d", n_node);
20625 printf(" %d", n_href);
20626 printf(" %d", n_prefix);
20627 printf("\n");
20628 }
20629 }
20630 }
20631 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020632 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020633
Daniel Veillard42595322004-11-08 10:52:06 +000020634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020635}
20636
20637
20638static int
20639test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020641
Daniel Veillard57b25162004-11-06 14:50:18 +000020642 int mem_base;
20643 xmlAttrPtr ret_val;
20644 xmlNodePtr node; /* the holding node */
20645 int n_node;
20646 xmlNsPtr ns; /* the namespace */
20647 int n_ns;
20648 xmlChar * name; /* the name of the attribute */
20649 int n_name;
20650 xmlChar * value; /* the value of the attribute */
20651 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020652
Daniel Veillard57b25162004-11-06 14:50:18 +000020653 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20654 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20655 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20656 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20657 mem_base = xmlMemBlocks();
20658 node = gen_xmlNodePtr(n_node, 0);
20659 ns = gen_xmlNsPtr(n_ns, 1);
20660 name = gen_const_xmlChar_ptr(n_name, 2);
20661 value = gen_const_xmlChar_ptr(n_value, 3);
20662
William M. Brackf13f77f2004-11-12 16:03:48 +000020663 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020664 desret_xmlAttrPtr(ret_val);
20665 call_tests++;
20666 des_xmlNodePtr(n_node, node, 0);
20667 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020668 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20669 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020670 xmlResetLastError();
20671 if (mem_base != xmlMemBlocks()) {
20672 printf("Leak of %d blocks found in xmlNewNsProp",
20673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020674 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020675 printf(" %d", n_node);
20676 printf(" %d", n_ns);
20677 printf(" %d", n_name);
20678 printf(" %d", n_value);
20679 printf("\n");
20680 }
20681 }
20682 }
20683 }
20684 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020686
Daniel Veillard42595322004-11-08 10:52:06 +000020687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020688}
20689
20690
20691static int
20692test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020694
Daniel Veillard57b25162004-11-06 14:50:18 +000020695 int mem_base;
20696 xmlAttrPtr ret_val;
20697 xmlNodePtr node; /* the holding node */
20698 int n_node;
20699 xmlNsPtr ns; /* the namespace */
20700 int n_ns;
20701 xmlChar * name; /* the name of the attribute */
20702 int n_name;
20703 xmlChar * value; /* the value of the attribute */
20704 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705
Daniel Veillard57b25162004-11-06 14:50:18 +000020706 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20707 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20708 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20709 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20710 mem_base = xmlMemBlocks();
20711 node = gen_xmlNodePtr(n_node, 0);
20712 ns = gen_xmlNsPtr(n_ns, 1);
20713 name = gen_eaten_name(n_name, 2);
20714 value = gen_const_xmlChar_ptr(n_value, 3);
20715
William M. Brackf13f77f2004-11-12 16:03:48 +000020716 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020717 desret_xmlAttrPtr(ret_val);
20718 call_tests++;
20719 des_xmlNodePtr(n_node, node, 0);
20720 des_xmlNsPtr(n_ns, ns, 1);
20721 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020722 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020723 xmlResetLastError();
20724 if (mem_base != xmlMemBlocks()) {
20725 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020727 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020728 printf(" %d", n_node);
20729 printf(" %d", n_ns);
20730 printf(" %d", n_name);
20731 printf(" %d", n_value);
20732 printf("\n");
20733 }
20734 }
20735 }
20736 }
20737 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020738 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020739
Daniel Veillard42595322004-11-08 10:52:06 +000020740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020741}
20742
20743
20744static int
20745test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020747
20748 int mem_base;
20749 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020750 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020751 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020752 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020753 int n_content;
20754
20755 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20756 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020758 name = gen_const_xmlChar_ptr(n_name, 0);
20759 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020760
William M. Brackf13f77f2004-11-12 16:03:48 +000020761 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020762 desret_xmlNodePtr(ret_val);
20763 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020764 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20765 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020766 xmlResetLastError();
20767 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020768 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020770 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020771 printf(" %d", n_name);
20772 printf(" %d", n_content);
20773 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020774 }
20775 }
20776 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020778
Daniel Veillard42595322004-11-08 10:52:06 +000020779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020780}
20781
20782
20783static int
20784test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020786
William M. Brack21e4ef22005-01-02 09:53:13 +000020787#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020788#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020789 int mem_base;
20790 xmlAttrPtr ret_val;
20791 xmlNodePtr node; /* the holding node */
20792 int n_node;
20793 xmlChar * name; /* the name of the attribute */
20794 int n_name;
20795 xmlChar * value; /* the value of the attribute */
20796 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020797
Daniel Veillard57b25162004-11-06 14:50:18 +000020798 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20799 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20800 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20801 mem_base = xmlMemBlocks();
20802 node = gen_xmlNodePtr(n_node, 0);
20803 name = gen_const_xmlChar_ptr(n_name, 1);
20804 value = gen_const_xmlChar_ptr(n_value, 2);
20805
William M. Brackf13f77f2004-11-12 16:03:48 +000020806 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020807 desret_xmlAttrPtr(ret_val);
20808 call_tests++;
20809 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020810 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20811 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020812 xmlResetLastError();
20813 if (mem_base != xmlMemBlocks()) {
20814 printf("Leak of %d blocks found in xmlNewProp",
20815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020816 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020817 printf(" %d", n_node);
20818 printf(" %d", n_name);
20819 printf(" %d", n_value);
20820 printf("\n");
20821 }
20822 }
20823 }
20824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020825 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020826#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020827#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020828
Daniel Veillard42595322004-11-08 10:52:06 +000020829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020830}
20831
20832
20833static int
20834test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020836
20837 int mem_base;
20838 xmlNodePtr ret_val;
20839 xmlDocPtr doc; /* the document */
20840 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020841 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020842 int n_name;
20843
20844 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20845 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020847 doc = gen_xmlDocPtr(n_doc, 0);
20848 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020849
William M. Brackf13f77f2004-11-12 16:03:48 +000020850 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020851 desret_xmlNodePtr(ret_val);
20852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020853 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020854 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020855 xmlResetLastError();
20856 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020857 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020859 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020860 printf(" %d", n_doc);
20861 printf(" %d", n_name);
20862 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020863 }
20864 }
20865 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020867
Daniel Veillard42595322004-11-08 10:52:06 +000020868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020869}
20870
20871
20872static int
20873test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020875
20876 int mem_base;
20877 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020878 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020879 int n_content;
20880
20881 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020883 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020884
William M. Brackf13f77f2004-11-12 16:03:48 +000020885 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020886 desret_xmlNodePtr(ret_val);
20887 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020888 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
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 xmlNewText",
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_content);
20895 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020896 }
20897 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020898 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020899
Daniel Veillard42595322004-11-08 10:52:06 +000020900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020901}
20902
20903
20904static int
20905test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020907
William M. Brack21e4ef22005-01-02 09:53:13 +000020908#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020909#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020910 int mem_base;
20911 xmlNodePtr ret_val;
20912 xmlNodePtr parent; /* the parent node */
20913 int n_parent;
20914 xmlNsPtr ns; /* a namespace if any */
20915 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020916 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020917 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020918 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020919 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020920
Daniel Veillard27f20102004-11-05 11:50:11 +000020921 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20922 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20923 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20924 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20925 mem_base = xmlMemBlocks();
20926 parent = gen_xmlNodePtr(n_parent, 0);
20927 ns = gen_xmlNsPtr(n_ns, 1);
20928 name = gen_const_xmlChar_ptr(n_name, 2);
20929 content = gen_const_xmlChar_ptr(n_content, 3);
20930
William M. Brackf13f77f2004-11-12 16:03:48 +000020931 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020932 desret_xmlNodePtr(ret_val);
20933 call_tests++;
20934 des_xmlNodePtr(n_parent, parent, 0);
20935 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020936 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20937 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020938 xmlResetLastError();
20939 if (mem_base != xmlMemBlocks()) {
20940 printf("Leak of %d blocks found in xmlNewTextChild",
20941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020942 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020943 printf(" %d", n_parent);
20944 printf(" %d", n_ns);
20945 printf(" %d", n_name);
20946 printf(" %d", n_content);
20947 printf("\n");
20948 }
20949 }
20950 }
20951 }
20952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020953 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020954#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020955#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020956
Daniel Veillard42595322004-11-08 10:52:06 +000020957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020958}
20959
20960
20961static int
20962test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020964
20965 int mem_base;
20966 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020967 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020968 int n_content;
20969 int len; /* the text len. */
20970 int n_len;
20971
20972 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20973 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020975 content = gen_const_xmlChar_ptr(n_content, 0);
20976 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020977
William M. Brackf13f77f2004-11-12 16:03:48 +000020978 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020979 desret_xmlNodePtr(ret_val);
20980 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020981 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020982 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020983 xmlResetLastError();
20984 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020985 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020987 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020988 printf(" %d", n_content);
20989 printf(" %d", n_len);
20990 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020991 }
20992 }
20993 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020994 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020995
Daniel Veillard42595322004-11-08 10:52:06 +000020996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020997}
20998
20999
21000static int
21001test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021003
21004 int mem_base;
21005 xmlNodePtr cur; /* the node being modified */
21006 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021007 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021008 int n_content;
21009
21010 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21011 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21012 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021013 cur = gen_xmlNodePtr(n_cur, 0);
21014 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021015
William M. Brackf13f77f2004-11-12 16:03:48 +000021016 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021018 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021019 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021020 xmlResetLastError();
21021 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021022 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021024 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021025 printf(" %d", n_cur);
21026 printf(" %d", n_content);
21027 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021028 }
21029 }
21030 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021031 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021032
Daniel Veillard42595322004-11-08 10:52:06 +000021033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021034}
21035
21036
21037static int
21038test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021040
21041 int mem_base;
21042 xmlNodePtr cur; /* the node being modified */
21043 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021044 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021045 int n_content;
21046 int len; /* the size of @content */
21047 int n_len;
21048
21049 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21050 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21051 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21052 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021053 cur = gen_xmlNodePtr(n_cur, 0);
21054 content = gen_const_xmlChar_ptr(n_content, 1);
21055 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021056
William M. Brackf13f77f2004-11-12 16:03:48 +000021057 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021059 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021060 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021061 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021062 xmlResetLastError();
21063 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021064 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021066 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021067 printf(" %d", n_cur);
21068 printf(" %d", n_content);
21069 printf(" %d", n_len);
21070 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021071 }
21072 }
21073 }
21074 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021076
Daniel Veillard42595322004-11-08 10:52:06 +000021077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021078}
21079
21080
21081static int
21082test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021084
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021085 int mem_base;
21086 int ret_val;
21087 xmlBufferPtr buffer; /* a buffer */
21088 int n_buffer;
21089 xmlNodePtr cur; /* the node being read */
21090 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021091
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021092 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21093 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021095 buffer = gen_xmlBufferPtr(n_buffer, 0);
21096 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021097
21098 ret_val = xmlNodeBufGetContent(buffer, cur);
21099 desret_int(ret_val);
21100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021101 des_xmlBufferPtr(n_buffer, buffer, 0);
21102 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021103 xmlResetLastError();
21104 if (mem_base != xmlMemBlocks()) {
21105 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021107 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021108 printf(" %d", n_buffer);
21109 printf(" %d", n_cur);
21110 printf("\n");
21111 }
21112 }
21113 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021114 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021115
Daniel Veillard42595322004-11-08 10:52:06 +000021116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021117}
21118
21119
21120static int
21121test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021123
William M. Brack21e4ef22005-01-02 09:53:13 +000021124#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021125 int mem_base;
21126 int ret_val;
21127 xmlBufferPtr buf; /* the XML buffer output */
21128 int n_buf;
21129 xmlDocPtr doc; /* the document */
21130 int n_doc;
21131 xmlNodePtr cur; /* the current node */
21132 int n_cur;
21133 int level; /* the imbrication level for indenting */
21134 int n_level;
21135 int format; /* is formatting allowed */
21136 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021137
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021138 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21139 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21140 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21141 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21142 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021144 buf = gen_xmlBufferPtr(n_buf, 0);
21145 doc = gen_xmlDocPtr(n_doc, 1);
21146 cur = gen_xmlNodePtr(n_cur, 2);
21147 level = gen_int(n_level, 3);
21148 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021149
21150 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21151 desret_int(ret_val);
21152 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021153 des_xmlBufferPtr(n_buf, buf, 0);
21154 des_xmlDocPtr(n_doc, doc, 1);
21155 des_xmlNodePtr(n_cur, cur, 2);
21156 des_int(n_level, level, 3);
21157 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021158 xmlResetLastError();
21159 if (mem_base != xmlMemBlocks()) {
21160 printf("Leak of %d blocks found in xmlNodeDump",
21161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021162 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021163 printf(" %d", n_buf);
21164 printf(" %d", n_doc);
21165 printf(" %d", n_cur);
21166 printf(" %d", n_level);
21167 printf(" %d", n_format);
21168 printf("\n");
21169 }
21170 }
21171 }
21172 }
21173 }
21174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021175 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021176#endif
21177
Daniel Veillard42595322004-11-08 10:52:06 +000021178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021179}
21180
21181
21182static int
21183test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021185
William M. Brack21e4ef22005-01-02 09:53:13 +000021186#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021187 int mem_base;
21188 xmlOutputBufferPtr buf; /* the XML buffer output */
21189 int n_buf;
21190 xmlDocPtr doc; /* the document */
21191 int n_doc;
21192 xmlNodePtr cur; /* the current node */
21193 int n_cur;
21194 int level; /* the imbrication level for indenting */
21195 int n_level;
21196 int format; /* is formatting allowed */
21197 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021198 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021199 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021200
Daniel Veillard3d97e662004-11-04 10:49:00 +000021201 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21203 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21204 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21205 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21206 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21207 mem_base = xmlMemBlocks();
21208 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21209 doc = gen_xmlDocPtr(n_doc, 1);
21210 cur = gen_xmlNodePtr(n_cur, 2);
21211 level = gen_int(n_level, 3);
21212 format = gen_int(n_format, 4);
21213 encoding = gen_const_char_ptr(n_encoding, 5);
21214
William M. Brackf13f77f2004-11-12 16:03:48 +000021215 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021216 call_tests++;
21217 des_xmlOutputBufferPtr(n_buf, buf, 0);
21218 des_xmlDocPtr(n_doc, doc, 1);
21219 des_xmlNodePtr(n_cur, cur, 2);
21220 des_int(n_level, level, 3);
21221 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021222 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021223 xmlResetLastError();
21224 if (mem_base != xmlMemBlocks()) {
21225 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021227 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021228 printf(" %d", n_buf);
21229 printf(" %d", n_doc);
21230 printf(" %d", n_cur);
21231 printf(" %d", n_level);
21232 printf(" %d", n_format);
21233 printf(" %d", n_encoding);
21234 printf("\n");
21235 }
21236 }
21237 }
21238 }
21239 }
21240 }
21241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021242 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021243#endif
21244
Daniel Veillard42595322004-11-08 10:52:06 +000021245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021246}
21247
21248
21249static int
21250test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021252
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021253 int mem_base;
21254 xmlChar * ret_val;
21255 xmlDocPtr doc; /* the document the node pertains to */
21256 int n_doc;
21257 xmlNodePtr cur; /* the node being checked */
21258 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021259
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021260 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21261 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021263 doc = gen_xmlDocPtr(n_doc, 0);
21264 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021265
21266 ret_val = xmlNodeGetBase(doc, cur);
21267 desret_xmlChar_ptr(ret_val);
21268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021269 des_xmlDocPtr(n_doc, doc, 0);
21270 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021271 xmlResetLastError();
21272 if (mem_base != xmlMemBlocks()) {
21273 printf("Leak of %d blocks found in xmlNodeGetBase",
21274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021275 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021276 printf(" %d", n_doc);
21277 printf(" %d", n_cur);
21278 printf("\n");
21279 }
21280 }
21281 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021282 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021283
Daniel Veillard42595322004-11-08 10:52:06 +000021284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021285}
21286
21287
21288static int
21289test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021291
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021292 int mem_base;
21293 xmlChar * ret_val;
21294 xmlNodePtr cur; /* the node being read */
21295 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021296
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021297 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021299 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021300
21301 ret_val = xmlNodeGetContent(cur);
21302 desret_xmlChar_ptr(ret_val);
21303 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021304 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021305 xmlResetLastError();
21306 if (mem_base != xmlMemBlocks()) {
21307 printf("Leak of %d blocks found in xmlNodeGetContent",
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_cur);
21311 printf("\n");
21312 }
21313 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021315
Daniel Veillard42595322004-11-08 10:52:06 +000021316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021317}
21318
21319
21320static int
21321test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021323
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021324 int mem_base;
21325 xmlChar * ret_val;
21326 xmlNodePtr cur; /* the node being checked */
21327 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021328
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021329 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21330 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021331 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021332
21333 ret_val = xmlNodeGetLang(cur);
21334 desret_xmlChar_ptr(ret_val);
21335 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021336 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021337 xmlResetLastError();
21338 if (mem_base != xmlMemBlocks()) {
21339 printf("Leak of %d blocks found in xmlNodeGetLang",
21340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021341 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021342 printf(" %d", n_cur);
21343 printf("\n");
21344 }
21345 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021347
Daniel Veillard42595322004-11-08 10:52:06 +000021348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021349}
21350
21351
21352static int
21353test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021355
21356 int mem_base;
21357 int ret_val;
21358 xmlNodePtr cur; /* the node being checked */
21359 int n_cur;
21360
21361 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021363 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021364
21365 ret_val = xmlNodeGetSpacePreserve(cur);
21366 desret_int(ret_val);
21367 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021368 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021369 xmlResetLastError();
21370 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021371 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021373 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021374 printf(" %d", n_cur);
21375 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021376 }
21377 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021378 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021379
Daniel Veillard42595322004-11-08 10:52:06 +000021380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021381}
21382
21383
21384static int
21385test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021387
21388 int mem_base;
21389 int ret_val;
21390 xmlNodePtr node; /* the node */
21391 int n_node;
21392
21393 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21394 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021395 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021396
21397 ret_val = xmlNodeIsText(node);
21398 desret_int(ret_val);
21399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021400 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021401 xmlResetLastError();
21402 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021403 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021405 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021406 printf(" %d", n_node);
21407 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021408 }
21409 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021410 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021411
Daniel Veillard42595322004-11-08 10:52:06 +000021412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021413}
21414
21415
21416static int
21417test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021419
William M. Brack21e4ef22005-01-02 09:53:13 +000021420#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021421 int mem_base;
21422 xmlChar * ret_val;
21423 xmlDocPtr doc; /* the document */
21424 int n_doc;
21425 xmlNodePtr list; /* a Node list */
21426 int n_list;
21427 int inLine; /* should we replace entity contents or show their external form */
21428 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021430 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21431 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21432 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21433 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021434 doc = gen_xmlDocPtr(n_doc, 0);
21435 list = gen_xmlNodePtr(n_list, 1);
21436 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021437
21438 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21439 desret_xmlChar_ptr(ret_val);
21440 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021441 des_xmlDocPtr(n_doc, doc, 0);
21442 des_xmlNodePtr(n_list, list, 1);
21443 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021444 xmlResetLastError();
21445 if (mem_base != xmlMemBlocks()) {
21446 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021448 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021449 printf(" %d", n_doc);
21450 printf(" %d", n_list);
21451 printf(" %d", n_inLine);
21452 printf("\n");
21453 }
21454 }
21455 }
21456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021457 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021458#endif
21459
Daniel Veillard42595322004-11-08 10:52:06 +000021460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021461}
21462
21463
21464static int
21465test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021467
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021468 int mem_base;
21469 xmlChar * ret_val;
21470 xmlDocPtr doc; /* the document */
21471 int n_doc;
21472 xmlNodePtr list; /* a Node list */
21473 int n_list;
21474 int inLine; /* should we replace entity contents or show their external form */
21475 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021476
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021477 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21478 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21479 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021481 doc = gen_xmlDocPtr(n_doc, 0);
21482 list = gen_xmlNodePtr(n_list, 1);
21483 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021484
21485 ret_val = xmlNodeListGetString(doc, list, inLine);
21486 desret_xmlChar_ptr(ret_val);
21487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021488 des_xmlDocPtr(n_doc, doc, 0);
21489 des_xmlNodePtr(n_list, list, 1);
21490 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021491 xmlResetLastError();
21492 if (mem_base != xmlMemBlocks()) {
21493 printf("Leak of %d blocks found in xmlNodeListGetString",
21494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021495 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021496 printf(" %d", n_doc);
21497 printf(" %d", n_list);
21498 printf(" %d", n_inLine);
21499 printf("\n");
21500 }
21501 }
21502 }
21503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021505
Daniel Veillard42595322004-11-08 10:52:06 +000021506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021507}
21508
21509
21510static int
21511test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513
William M. Brack21e4ef22005-01-02 09:53:13 +000021514#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021515 int mem_base;
21516 xmlNodePtr cur; /* the node being changed */
21517 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021518 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021519 int n_uri;
21520
21521 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21522 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021524 cur = gen_xmlNodePtr(n_cur, 0);
21525 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021526
William M. Brackf13f77f2004-11-12 16:03:48 +000021527 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021529 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021530 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021531 xmlResetLastError();
21532 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021533 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021535 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021536 printf(" %d", n_cur);
21537 printf(" %d", n_uri);
21538 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539 }
21540 }
21541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021542 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021543#endif
21544
Daniel Veillard42595322004-11-08 10:52:06 +000021545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021546}
21547
21548
21549static int
21550test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552
21553 int mem_base;
21554 xmlNodePtr cur; /* the node being modified */
21555 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021556 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021557 int n_content;
21558
21559 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21560 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021562 cur = gen_xmlNodePtr(n_cur, 0);
21563 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021564
William M. Brackf13f77f2004-11-12 16:03:48 +000021565 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021567 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021568 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021569 xmlResetLastError();
21570 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021571 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021574 printf(" %d", n_cur);
21575 printf(" %d", n_content);
21576 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021577 }
21578 }
21579 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021581
Daniel Veillard42595322004-11-08 10:52:06 +000021582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583}
21584
21585
21586static int
21587test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021589
William M. Brack21e4ef22005-01-02 09:53:13 +000021590#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591 int mem_base;
21592 xmlNodePtr cur; /* the node being modified */
21593 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021594 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021595 int n_content;
21596 int len; /* the size of @content */
21597 int n_len;
21598
21599 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21600 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21601 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021603 cur = gen_xmlNodePtr(n_cur, 0);
21604 content = gen_const_xmlChar_ptr(n_content, 1);
21605 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606
William M. Brackf13f77f2004-11-12 16:03:48 +000021607 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021609 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021610 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021611 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021612 xmlResetLastError();
21613 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021614 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021616 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021617 printf(" %d", n_cur);
21618 printf(" %d", n_content);
21619 printf(" %d", n_len);
21620 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021621 }
21622 }
21623 }
21624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021625 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021626#endif
21627
Daniel Veillard42595322004-11-08 10:52:06 +000021628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629}
21630
21631
21632static int
21633test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021635
William M. Brack21e4ef22005-01-02 09:53:13 +000021636#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021637 int mem_base;
21638 xmlNodePtr cur; /* the node being changed */
21639 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021640 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021641 int n_lang;
21642
21643 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21644 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021646 cur = gen_xmlNodePtr(n_cur, 0);
21647 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021648
William M. Brackf13f77f2004-11-12 16:03:48 +000021649 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021650 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021651 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021652 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021653 xmlResetLastError();
21654 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021655 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021657 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021658 printf(" %d", n_cur);
21659 printf(" %d", n_lang);
21660 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021661 }
21662 }
21663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021664 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021665#endif
21666
Daniel Veillard42595322004-11-08 10:52:06 +000021667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021668}
21669
21670
21671static int
21672test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021674
William M. Brack21e4ef22005-01-02 09:53:13 +000021675#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021676 int mem_base;
21677 xmlNodePtr cur; /* the node being changed */
21678 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021679 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021680 int n_name;
21681
21682 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21683 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21684 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021685 cur = gen_xmlNodePtr(n_cur, 0);
21686 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687
William M. Brackf13f77f2004-11-12 16:03:48 +000021688 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021689 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021690 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021691 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021692 xmlResetLastError();
21693 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021694 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021696 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021697 printf(" %d", n_cur);
21698 printf(" %d", n_name);
21699 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021700 }
21701 }
21702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021703 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021704#endif
21705
Daniel Veillard42595322004-11-08 10:52:06 +000021706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021707}
21708
21709
21710static int
21711test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021713
William M. Brack21e4ef22005-01-02 09:53:13 +000021714#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021715 int mem_base;
21716 xmlNodePtr cur; /* the node being changed */
21717 int n_cur;
21718 int val; /* the xml:space value ("0": default, 1: "preserve") */
21719 int n_val;
21720
21721 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21722 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021724 cur = gen_xmlNodePtr(n_cur, 0);
21725 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021726
21727 xmlNodeSetSpacePreserve(cur, val);
21728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021729 des_xmlNodePtr(n_cur, cur, 0);
21730 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021731 xmlResetLastError();
21732 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021733 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021735 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021736 printf(" %d", n_cur);
21737 printf(" %d", n_val);
21738 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021739 }
21740 }
21741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021742 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743#endif
21744
Daniel Veillard42595322004-11-08 10:52:06 +000021745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021746}
21747
21748
21749static int
21750test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021752
William M. Brack21e4ef22005-01-02 09:53:13 +000021753#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021754#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021755 int mem_base;
21756 int ret_val;
21757 xmlDocPtr doc; /* the document */
21758 int n_doc;
21759 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21760 int n_tree;
21761
21762 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21763 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021765 doc = gen_xmlDocPtr(n_doc, 0);
21766 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021767
21768 ret_val = xmlReconciliateNs(doc, tree);
21769 desret_int(ret_val);
21770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021771 des_xmlDocPtr(n_doc, doc, 0);
21772 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773 xmlResetLastError();
21774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021775 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021778 printf(" %d", n_doc);
21779 printf(" %d", n_tree);
21780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021781 }
21782 }
21783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021784 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021785#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021786#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021787
Daniel Veillard42595322004-11-08 10:52:06 +000021788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021789}
21790
21791
21792static int
21793test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021795
William M. Brack21e4ef22005-01-02 09:53:13 +000021796#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021797 int mem_base;
21798 int ret_val;
21799 xmlAttrPtr cur; /* an attribute */
21800 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021801
Daniel Veillardce244ad2004-11-05 10:03:46 +000021802 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21803 mem_base = xmlMemBlocks();
21804 cur = gen_xmlAttrPtr(n_cur, 0);
21805
21806 ret_val = xmlRemoveProp(cur);
21807 cur = NULL;
21808 desret_int(ret_val);
21809 call_tests++;
21810 des_xmlAttrPtr(n_cur, cur, 0);
21811 xmlResetLastError();
21812 if (mem_base != xmlMemBlocks()) {
21813 printf("Leak of %d blocks found in xmlRemoveProp",
21814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021815 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021816 printf(" %d", n_cur);
21817 printf("\n");
21818 }
21819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021820 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021821#endif
21822
Daniel Veillard42595322004-11-08 10:52:06 +000021823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021824}
21825
21826
21827static int
21828test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021830
William M. Brack21e4ef22005-01-02 09:53:13 +000021831#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021832 int mem_base;
21833 xmlNodePtr ret_val;
21834 xmlNodePtr old; /* the old node */
21835 int n_old;
21836 xmlNodePtr cur; /* the node */
21837 int n_cur;
21838
21839 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021840 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021841 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021842 old = gen_xmlNodePtr(n_old, 0);
21843 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021844
21845 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021846 if (cur != NULL) {
21847 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021848 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021849 if (old != NULL) {
21850 xmlUnlinkNode(old);
21851 xmlFreeNode(old) ; old = NULL ; }
21852 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021853 desret_xmlNodePtr(ret_val);
21854 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021855 des_xmlNodePtr(n_old, old, 0);
21856 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021857 xmlResetLastError();
21858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021859 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021862 printf(" %d", n_old);
21863 printf(" %d", n_cur);
21864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021865 }
21866 }
21867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021868 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021869#endif
21870
Daniel Veillard42595322004-11-08 10:52:06 +000021871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021872}
21873
21874
21875static int
21876test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021878
William M. Brack21e4ef22005-01-02 09:53:13 +000021879#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021880 int mem_base;
21881 int ret_val;
21882 const char * filename; /* the filename (or URL) */
21883 int n_filename;
21884 xmlDocPtr cur; /* the document */
21885 int n_cur;
21886
21887 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21888 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21889 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021890 filename = gen_fileoutput(n_filename, 0);
21891 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021892
21893 ret_val = xmlSaveFile(filename, cur);
21894 desret_int(ret_val);
21895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021896 des_fileoutput(n_filename, filename, 0);
21897 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021898 xmlResetLastError();
21899 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021900 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021902 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021903 printf(" %d", n_filename);
21904 printf(" %d", n_cur);
21905 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021906 }
21907 }
21908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021909 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021910#endif
21911
Daniel Veillard42595322004-11-08 10:52:06 +000021912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021913}
21914
21915
21916static int
21917test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021919
William M. Brack21e4ef22005-01-02 09:53:13 +000021920#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021921 int mem_base;
21922 int ret_val;
21923 const char * filename; /* the filename (or URL) */
21924 int n_filename;
21925 xmlDocPtr cur; /* the document */
21926 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021927 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021928 int n_encoding;
21929
21930 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21931 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21932 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021934 filename = gen_fileoutput(n_filename, 0);
21935 cur = gen_xmlDocPtr(n_cur, 1);
21936 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021937
William M. Brackf13f77f2004-11-12 16:03:48 +000021938 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021939 desret_int(ret_val);
21940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021941 des_fileoutput(n_filename, filename, 0);
21942 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021943 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021944 xmlResetLastError();
21945 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021946 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021948 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021949 printf(" %d", n_filename);
21950 printf(" %d", n_cur);
21951 printf(" %d", n_encoding);
21952 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021953 }
21954 }
21955 }
21956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021957 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021958#endif
21959
Daniel Veillard42595322004-11-08 10:52:06 +000021960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021961}
21962
21963
21964static int
21965test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021967
William M. Brack21e4ef22005-01-02 09:53:13 +000021968#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021969 int mem_base;
21970 int ret_val;
21971 xmlOutputBufferPtr buf; /* an output I/O buffer */
21972 int n_buf;
21973 xmlDocPtr cur; /* the document */
21974 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021975 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021976 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021977
Daniel Veillard3d97e662004-11-04 10:49:00 +000021978 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21979 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21980 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21981 mem_base = xmlMemBlocks();
21982 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21983 cur = gen_xmlDocPtr(n_cur, 1);
21984 encoding = gen_const_char_ptr(n_encoding, 2);
21985
William M. Brackf13f77f2004-11-12 16:03:48 +000021986 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021987 buf = NULL;
21988 desret_int(ret_val);
21989 call_tests++;
21990 des_xmlOutputBufferPtr(n_buf, buf, 0);
21991 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021992 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021993 xmlResetLastError();
21994 if (mem_base != xmlMemBlocks()) {
21995 printf("Leak of %d blocks found in xmlSaveFileTo",
21996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021997 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021998 printf(" %d", n_buf);
21999 printf(" %d", n_cur);
22000 printf(" %d", n_encoding);
22001 printf("\n");
22002 }
22003 }
22004 }
22005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022006 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022007#endif
22008
Daniel Veillard42595322004-11-08 10:52:06 +000022009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022010}
22011
22012
22013static int
22014test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022016
William M. Brack21e4ef22005-01-02 09:53:13 +000022017#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022018 int mem_base;
22019 int ret_val;
22020 const char * filename; /* the filename (or URL) */
22021 int n_filename;
22022 xmlDocPtr cur; /* the document */
22023 int n_cur;
22024 int format; /* should formatting spaces been added */
22025 int n_format;
22026
22027 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22028 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22029 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022031 filename = gen_fileoutput(n_filename, 0);
22032 cur = gen_xmlDocPtr(n_cur, 1);
22033 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022034
22035 ret_val = xmlSaveFormatFile(filename, cur, format);
22036 desret_int(ret_val);
22037 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022038 des_fileoutput(n_filename, filename, 0);
22039 des_xmlDocPtr(n_cur, cur, 1);
22040 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022041 xmlResetLastError();
22042 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022043 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022045 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022046 printf(" %d", n_filename);
22047 printf(" %d", n_cur);
22048 printf(" %d", n_format);
22049 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022050 }
22051 }
22052 }
22053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022054 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022055#endif
22056
Daniel Veillard42595322004-11-08 10:52:06 +000022057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022058}
22059
22060
22061static int
22062test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022064
William M. Brack21e4ef22005-01-02 09:53:13 +000022065#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022066 int mem_base;
22067 int ret_val;
22068 const char * filename; /* the filename or URL to output */
22069 int n_filename;
22070 xmlDocPtr cur; /* the document being saved */
22071 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022072 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022073 int n_encoding;
22074 int format; /* should formatting spaces be added. */
22075 int n_format;
22076
22077 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22078 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22079 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22080 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022082 filename = gen_fileoutput(n_filename, 0);
22083 cur = gen_xmlDocPtr(n_cur, 1);
22084 encoding = gen_const_char_ptr(n_encoding, 2);
22085 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022086
William M. Brackf13f77f2004-11-12 16:03:48 +000022087 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022088 desret_int(ret_val);
22089 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022090 des_fileoutput(n_filename, filename, 0);
22091 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022092 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022093 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022094 xmlResetLastError();
22095 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022096 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022098 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022099 printf(" %d", n_filename);
22100 printf(" %d", n_cur);
22101 printf(" %d", n_encoding);
22102 printf(" %d", n_format);
22103 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022104 }
22105 }
22106 }
22107 }
22108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022109 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022110#endif
22111
Daniel Veillard42595322004-11-08 10:52:06 +000022112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022113}
22114
22115
22116static int
22117test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022119
William M. Brack21e4ef22005-01-02 09:53:13 +000022120#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022121 int mem_base;
22122 int ret_val;
22123 xmlOutputBufferPtr buf; /* an output I/O buffer */
22124 int n_buf;
22125 xmlDocPtr cur; /* the document */
22126 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022127 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022128 int n_encoding;
22129 int format; /* should formatting spaces been added */
22130 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131
Daniel Veillard3d97e662004-11-04 10:49:00 +000022132 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22133 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22134 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22135 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22136 mem_base = xmlMemBlocks();
22137 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22138 cur = gen_xmlDocPtr(n_cur, 1);
22139 encoding = gen_const_char_ptr(n_encoding, 2);
22140 format = gen_int(n_format, 3);
22141
William M. Brackf13f77f2004-11-12 16:03:48 +000022142 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022143 buf = NULL;
22144 desret_int(ret_val);
22145 call_tests++;
22146 des_xmlOutputBufferPtr(n_buf, buf, 0);
22147 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022148 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022149 des_int(n_format, format, 3);
22150 xmlResetLastError();
22151 if (mem_base != xmlMemBlocks()) {
22152 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022154 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022155 printf(" %d", n_buf);
22156 printf(" %d", n_cur);
22157 printf(" %d", n_encoding);
22158 printf(" %d", n_format);
22159 printf("\n");
22160 }
22161 }
22162 }
22163 }
22164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022165 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022166#endif
22167
Daniel Veillard42595322004-11-08 10:52:06 +000022168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022169}
22170
22171
22172static int
22173test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022175
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022176 int mem_base;
22177 xmlNsPtr ret_val;
22178 xmlDocPtr doc; /* the document */
22179 int n_doc;
22180 xmlNodePtr node; /* the current node */
22181 int n_node;
22182 xmlChar * nameSpace; /* the namespace prefix */
22183 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022184
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022185 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22186 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22187 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22188 mem_base = xmlMemBlocks();
22189 doc = gen_xmlDocPtr(n_doc, 0);
22190 node = gen_xmlNodePtr(n_node, 1);
22191 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22192
William M. Brackf13f77f2004-11-12 16:03:48 +000022193 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022194 desret_xmlNsPtr(ret_val);
22195 call_tests++;
22196 des_xmlDocPtr(n_doc, doc, 0);
22197 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022198 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022199 xmlResetLastError();
22200 if (mem_base != xmlMemBlocks()) {
22201 printf("Leak of %d blocks found in xmlSearchNs",
22202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022203 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022204 printf(" %d", n_doc);
22205 printf(" %d", n_node);
22206 printf(" %d", n_nameSpace);
22207 printf("\n");
22208 }
22209 }
22210 }
22211 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022212 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022213
Daniel Veillard42595322004-11-08 10:52:06 +000022214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022215}
22216
22217
22218static int
22219test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022221
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022222 int mem_base;
22223 xmlNsPtr ret_val;
22224 xmlDocPtr doc; /* the document */
22225 int n_doc;
22226 xmlNodePtr node; /* the current node */
22227 int n_node;
22228 xmlChar * href; /* the namespace value */
22229 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022230
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022231 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22232 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22233 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22234 mem_base = xmlMemBlocks();
22235 doc = gen_xmlDocPtr(n_doc, 0);
22236 node = gen_xmlNodePtr(n_node, 1);
22237 href = gen_const_xmlChar_ptr(n_href, 2);
22238
William M. Brackf13f77f2004-11-12 16:03:48 +000022239 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022240 desret_xmlNsPtr(ret_val);
22241 call_tests++;
22242 des_xmlDocPtr(n_doc, doc, 0);
22243 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022244 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022245 xmlResetLastError();
22246 if (mem_base != xmlMemBlocks()) {
22247 printf("Leak of %d blocks found in xmlSearchNsByHref",
22248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022249 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022250 printf(" %d", n_doc);
22251 printf(" %d", n_node);
22252 printf(" %d", n_href);
22253 printf("\n");
22254 }
22255 }
22256 }
22257 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022259
Daniel Veillard42595322004-11-08 10:52:06 +000022260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022261}
22262
22263
22264static int
22265test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022267
Daniel Veillard57b25162004-11-06 14:50:18 +000022268 int mem_base;
22269 xmlBufferAllocationScheme scheme; /* allocation method to use */
22270 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022271
Daniel Veillard57b25162004-11-06 14:50:18 +000022272 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22273 mem_base = xmlMemBlocks();
22274 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22275
22276 xmlSetBufferAllocationScheme(scheme);
22277 call_tests++;
22278 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22279 xmlResetLastError();
22280 if (mem_base != xmlMemBlocks()) {
22281 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022283 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022284 printf(" %d", n_scheme);
22285 printf("\n");
22286 }
22287 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022288 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022289
Daniel Veillard42595322004-11-08 10:52:06 +000022290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022291}
22292
22293
22294static int
22295test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022297
22298 int mem_base;
22299 int mode; /* the compression ratio */
22300 int n_mode;
22301
22302 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22303 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022304 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022305
22306 xmlSetCompressMode(mode);
22307 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022308 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022309 xmlResetLastError();
22310 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022311 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022313 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022314 printf(" %d", n_mode);
22315 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022316 }
22317 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022318 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022319
Daniel Veillard42595322004-11-08 10:52:06 +000022320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022321}
22322
22323
22324static int
22325test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022327
22328 int mem_base;
22329 xmlDocPtr doc; /* the document */
22330 int n_doc;
22331 int mode; /* the compression ratio */
22332 int n_mode;
22333
22334 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22335 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22336 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022337 doc = gen_xmlDocPtr(n_doc, 0);
22338 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339
22340 xmlSetDocCompressMode(doc, mode);
22341 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022342 des_xmlDocPtr(n_doc, doc, 0);
22343 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022344 xmlResetLastError();
22345 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022346 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022348 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022349 printf(" %d", n_doc);
22350 printf(" %d", n_mode);
22351 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022352 }
22353 }
22354 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022355 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022356
Daniel Veillard42595322004-11-08 10:52:06 +000022357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022358}
22359
22360
22361static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022362test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022364
Daniel Veillard27f20102004-11-05 11:50:11 +000022365 int mem_base;
22366 xmlNodePtr node; /* a node in the document */
22367 int n_node;
22368 xmlNsPtr ns; /* a namespace pointer */
22369 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022370
Daniel Veillard27f20102004-11-05 11:50:11 +000022371 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22372 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22373 mem_base = xmlMemBlocks();
22374 node = gen_xmlNodePtr(n_node, 0);
22375 ns = gen_xmlNsPtr(n_ns, 1);
22376
22377 xmlSetNs(node, ns);
22378 call_tests++;
22379 des_xmlNodePtr(n_node, node, 0);
22380 des_xmlNsPtr(n_ns, ns, 1);
22381 xmlResetLastError();
22382 if (mem_base != xmlMemBlocks()) {
22383 printf("Leak of %d blocks found in xmlSetNs",
22384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022385 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022386 printf(" %d", n_node);
22387 printf(" %d", n_ns);
22388 printf("\n");
22389 }
22390 }
22391 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022393
Daniel Veillard42595322004-11-08 10:52:06 +000022394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022395}
22396
22397
22398static int
22399test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022401
William M. Brack21e4ef22005-01-02 09:53:13 +000022402#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022403 int mem_base;
22404 xmlAttrPtr ret_val;
22405 xmlNodePtr node; /* the node */
22406 int n_node;
22407 xmlNsPtr ns; /* the namespace definition */
22408 int n_ns;
22409 xmlChar * name; /* the attribute name */
22410 int n_name;
22411 xmlChar * value; /* the attribute value */
22412 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022413
Daniel Veillard57b25162004-11-06 14:50:18 +000022414 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22415 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22416 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22417 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22418 mem_base = xmlMemBlocks();
22419 node = gen_xmlNodePtr(n_node, 0);
22420 ns = gen_xmlNsPtr(n_ns, 1);
22421 name = gen_const_xmlChar_ptr(n_name, 2);
22422 value = gen_const_xmlChar_ptr(n_value, 3);
22423
William M. Brackf13f77f2004-11-12 16:03:48 +000022424 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022425 desret_xmlAttrPtr(ret_val);
22426 call_tests++;
22427 des_xmlNodePtr(n_node, node, 0);
22428 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022429 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22430 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022431 xmlResetLastError();
22432 if (mem_base != xmlMemBlocks()) {
22433 printf("Leak of %d blocks found in xmlSetNsProp",
22434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022435 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022436 printf(" %d", n_node);
22437 printf(" %d", n_ns);
22438 printf(" %d", n_name);
22439 printf(" %d", n_value);
22440 printf("\n");
22441 }
22442 }
22443 }
22444 }
22445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022446 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022447#endif
22448
Daniel Veillard42595322004-11-08 10:52:06 +000022449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022450}
22451
22452
22453static int
22454test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022456
William M. Brack21e4ef22005-01-02 09:53:13 +000022457#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022458 int mem_base;
22459 xmlAttrPtr ret_val;
22460 xmlNodePtr node; /* the node */
22461 int n_node;
22462 xmlChar * name; /* the attribute name */
22463 int n_name;
22464 xmlChar * value; /* the attribute value */
22465 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022466
Daniel Veillard57b25162004-11-06 14:50:18 +000022467 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22468 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22469 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22470 mem_base = xmlMemBlocks();
22471 node = gen_xmlNodePtr(n_node, 0);
22472 name = gen_const_xmlChar_ptr(n_name, 1);
22473 value = gen_const_xmlChar_ptr(n_value, 2);
22474
William M. Brackf13f77f2004-11-12 16:03:48 +000022475 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022476 desret_xmlAttrPtr(ret_val);
22477 call_tests++;
22478 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022479 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22480 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022481 xmlResetLastError();
22482 if (mem_base != xmlMemBlocks()) {
22483 printf("Leak of %d blocks found in xmlSetProp",
22484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022485 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022486 printf(" %d", n_node);
22487 printf(" %d", n_name);
22488 printf(" %d", n_value);
22489 printf("\n");
22490 }
22491 }
22492 }
22493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022494 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022495#endif
22496
Daniel Veillard42595322004-11-08 10:52:06 +000022497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022498}
22499
22500
22501static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022502test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022504
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022505 int mem_base;
22506 xmlChar * ret_val;
22507 xmlChar * name; /* the full QName */
22508 int n_name;
22509 xmlChar ** prefix; /* a xmlChar ** */
22510 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022511
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022512 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22513 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22514 mem_base = xmlMemBlocks();
22515 name = gen_const_xmlChar_ptr(n_name, 0);
22516 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22517
William M. Brackf13f77f2004-11-12 16:03:48 +000022518 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022519 desret_xmlChar_ptr(ret_val);
22520 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022521 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022522 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22523 xmlResetLastError();
22524 if (mem_base != xmlMemBlocks()) {
22525 printf("Leak of %d blocks found in xmlSplitQName2",
22526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022527 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022528 printf(" %d", n_name);
22529 printf(" %d", n_prefix);
22530 printf("\n");
22531 }
22532 }
22533 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022534 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022535
Daniel Veillard42595322004-11-08 10:52:06 +000022536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022537}
22538
22539
22540static int
22541test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022543
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022544 int mem_base;
22545 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022546 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022547 int n_name;
22548 int * len; /* an int * */
22549 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022550
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022551 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22552 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22553 mem_base = xmlMemBlocks();
22554 name = gen_const_xmlChar_ptr(n_name, 0);
22555 len = gen_int_ptr(n_len, 1);
22556
William M. Brackf13f77f2004-11-12 16:03:48 +000022557 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022558 desret_const_xmlChar_ptr(ret_val);
22559 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022560 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022561 des_int_ptr(n_len, len, 1);
22562 xmlResetLastError();
22563 if (mem_base != xmlMemBlocks()) {
22564 printf("Leak of %d blocks found in xmlSplitQName3",
22565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022566 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022567 printf(" %d", n_name);
22568 printf(" %d", n_len);
22569 printf("\n");
22570 }
22571 }
22572 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022574
Daniel Veillard42595322004-11-08 10:52:06 +000022575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022576}
22577
22578
22579static int
22580test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022582
22583 int mem_base;
22584 xmlNodePtr ret_val;
22585 xmlDocPtr doc; /* the document */
22586 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022587 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022588 int n_value;
22589
22590 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22591 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022593 doc = gen_xmlDocPtr(n_doc, 0);
22594 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022595
William M. Brackf13f77f2004-11-12 16:03:48 +000022596 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022597 desret_xmlNodePtr(ret_val);
22598 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022599 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022600 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022601 xmlResetLastError();
22602 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022603 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022605 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022606 printf(" %d", n_doc);
22607 printf(" %d", n_value);
22608 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022609 }
22610 }
22611 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022612 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022613
Daniel Veillard42595322004-11-08 10:52:06 +000022614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022615}
22616
22617
22618static int
22619test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022621
22622 int mem_base;
22623 xmlNodePtr ret_val;
22624 xmlDocPtr doc; /* the document */
22625 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022626 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022627 int n_value;
22628 int len; /* the length of the string value */
22629 int n_len;
22630
22631 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22632 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22633 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22634 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022635 doc = gen_xmlDocPtr(n_doc, 0);
22636 value = gen_const_xmlChar_ptr(n_value, 1);
22637 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638
William M. Brackf13f77f2004-11-12 16:03:48 +000022639 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022640 desret_xmlNodePtr(ret_val);
22641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022642 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022643 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022644 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022645 xmlResetLastError();
22646 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022647 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022649 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022650 printf(" %d", n_doc);
22651 printf(" %d", n_value);
22652 printf(" %d", n_len);
22653 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022654 }
22655 }
22656 }
22657 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022658 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022659
Daniel Veillard42595322004-11-08 10:52:06 +000022660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022661}
22662
22663
22664static int
22665test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022667
22668 int mem_base;
22669 int ret_val;
22670 xmlNodePtr node; /* the node */
22671 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022672 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022673 int n_content;
22674 int len; /* @content length */
22675 int n_len;
22676
22677 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22678 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22679 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022681 node = gen_xmlNodePtr(n_node, 0);
22682 content = gen_const_xmlChar_ptr(n_content, 1);
22683 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022684
William M. Brackf13f77f2004-11-12 16:03:48 +000022685 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022686 desret_int(ret_val);
22687 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022688 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022689 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022690 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022691 xmlResetLastError();
22692 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022693 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022695 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022696 printf(" %d", n_node);
22697 printf(" %d", n_content);
22698 printf(" %d", n_len);
22699 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022700 }
22701 }
22702 }
22703 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022704 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022705
Daniel Veillard42595322004-11-08 10:52:06 +000022706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707}
22708
22709
22710static int
22711test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022713
22714 int mem_base;
22715 xmlNodePtr ret_val;
22716 xmlNodePtr first; /* the first text node */
22717 int n_first;
22718 xmlNodePtr second; /* the second text node being merged */
22719 int n_second;
22720
Daniel Veillarda03e3652004-11-02 18:45:30 +000022721 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22722 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022724 first = gen_xmlNodePtr_in(n_first, 0);
22725 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022726
22727 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022728 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022729 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022731 desret_xmlNodePtr(ret_val);
22732 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022733 des_xmlNodePtr_in(n_first, first, 0);
22734 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022735 xmlResetLastError();
22736 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022737 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022739 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022740 printf(" %d", n_first);
22741 printf(" %d", n_second);
22742 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022743 }
22744 }
22745 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022747
Daniel Veillard42595322004-11-08 10:52:06 +000022748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022749}
22750
22751
22752static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022753test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022755
William M. Brack21e4ef22005-01-02 09:53:13 +000022756#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022757 int mem_base;
22758 int ret_val;
22759 xmlNodePtr node; /* the node */
22760 int n_node;
22761 xmlNsPtr ns; /* the namespace definition */
22762 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022763 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022764 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022765
Daniel Veillard27f20102004-11-05 11:50:11 +000022766 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22767 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22768 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22769 mem_base = xmlMemBlocks();
22770 node = gen_xmlNodePtr(n_node, 0);
22771 ns = gen_xmlNsPtr(n_ns, 1);
22772 name = gen_const_xmlChar_ptr(n_name, 2);
22773
William M. Brackf13f77f2004-11-12 16:03:48 +000022774 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022775 desret_int(ret_val);
22776 call_tests++;
22777 des_xmlNodePtr(n_node, node, 0);
22778 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022779 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022780 xmlResetLastError();
22781 if (mem_base != xmlMemBlocks()) {
22782 printf("Leak of %d blocks found in xmlUnsetNsProp",
22783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022784 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022785 printf(" %d", n_node);
22786 printf(" %d", n_ns);
22787 printf(" %d", n_name);
22788 printf("\n");
22789 }
22790 }
22791 }
22792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022793 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022794#endif
22795
Daniel Veillard42595322004-11-08 10:52:06 +000022796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022797}
22798
22799
22800static int
22801test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022803
William M. Brack21e4ef22005-01-02 09:53:13 +000022804#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022805 int mem_base;
22806 int ret_val;
22807 xmlNodePtr node; /* the node */
22808 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022809 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810 int n_name;
22811
22812 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22813 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022815 node = gen_xmlNodePtr(n_node, 0);
22816 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022817
William M. Brackf13f77f2004-11-12 16:03:48 +000022818 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819 desret_int(ret_val);
22820 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022821 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022822 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022823 xmlResetLastError();
22824 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022825 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022827 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022828 printf(" %d", n_node);
22829 printf(" %d", n_name);
22830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022831 }
22832 }
22833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022834 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022835#endif
22836
Daniel Veillard42595322004-11-08 10:52:06 +000022837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022838}
22839
22840
22841static int
22842test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022844
William M. Brack21e4ef22005-01-02 09:53:13 +000022845#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022846#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022847 int mem_base;
22848 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022849 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022850 int n_value;
22851 int space; /* allow spaces in front and end of the string */
22852 int n_space;
22853
22854 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22855 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022857 value = gen_const_xmlChar_ptr(n_value, 0);
22858 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022859
William M. Brackf13f77f2004-11-12 16:03:48 +000022860 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022861 desret_int(ret_val);
22862 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022863 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022864 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865 xmlResetLastError();
22866 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022867 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022869 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022870 printf(" %d", n_value);
22871 printf(" %d", n_space);
22872 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022873 }
22874 }
22875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022876 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022877#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022878#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022879
Daniel Veillard42595322004-11-08 10:52:06 +000022880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022881}
22882
22883
22884static int
22885test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022887
William M. Brack21e4ef22005-01-02 09:53:13 +000022888#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022889#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022890 int mem_base;
22891 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022892 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022893 int n_value;
22894 int space; /* allow spaces in front and end of the string */
22895 int n_space;
22896
22897 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22898 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022900 value = gen_const_xmlChar_ptr(n_value, 0);
22901 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022902
William M. Brackf13f77f2004-11-12 16:03:48 +000022903 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022904 desret_int(ret_val);
22905 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022906 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022907 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022908 xmlResetLastError();
22909 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022910 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022912 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022913 printf(" %d", n_value);
22914 printf(" %d", n_space);
22915 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022916 }
22917 }
22918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022919 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022920#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022921#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022922
Daniel Veillard42595322004-11-08 10:52:06 +000022923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022924}
22925
22926
22927static int
22928test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022930
William M. Brack21e4ef22005-01-02 09:53:13 +000022931#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022932#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022933 int mem_base;
22934 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022935 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022936 int n_value;
22937 int space; /* allow spaces in front and end of the string */
22938 int n_space;
22939
22940 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22941 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22942 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022943 value = gen_const_xmlChar_ptr(n_value, 0);
22944 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022945
William M. Brackf13f77f2004-11-12 16:03:48 +000022946 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022947 desret_int(ret_val);
22948 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022949 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022950 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022951 xmlResetLastError();
22952 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022953 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022955 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022956 printf(" %d", n_value);
22957 printf(" %d", n_space);
22958 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022959 }
22960 }
22961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022962 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022963#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022964#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022965
Daniel Veillard42595322004-11-08 10:52:06 +000022966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022967}
22968
22969
22970static int
22971test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022973
William M. Brack21e4ef22005-01-02 09:53:13 +000022974#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022975#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022976 int mem_base;
22977 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022978 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022979 int n_value;
22980 int space; /* allow spaces in front and end of the string */
22981 int n_space;
22982
22983 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22984 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22985 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022986 value = gen_const_xmlChar_ptr(n_value, 0);
22987 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022988
William M. Brackf13f77f2004-11-12 16:03:48 +000022989 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022990 desret_int(ret_val);
22991 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022992 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022993 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022994 xmlResetLastError();
22995 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022996 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022998 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022999 printf(" %d", n_value);
23000 printf(" %d", n_space);
23001 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023002 }
23003 }
23004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023005 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023006#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023007#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023008
Daniel Veillard42595322004-11-08 10:52:06 +000023009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023010}
23011
23012static int
23013test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023015
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023016 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023017 test_ret += test_xmlAddChild();
23018 test_ret += test_xmlAddChildList();
23019 test_ret += test_xmlAddNextSibling();
23020 test_ret += test_xmlAddPrevSibling();
23021 test_ret += test_xmlAddSibling();
23022 test_ret += test_xmlAttrSerializeTxtContent();
23023 test_ret += test_xmlBufferAdd();
23024 test_ret += test_xmlBufferAddHead();
23025 test_ret += test_xmlBufferCCat();
23026 test_ret += test_xmlBufferCat();
23027 test_ret += test_xmlBufferContent();
23028 test_ret += test_xmlBufferCreate();
23029 test_ret += test_xmlBufferCreateSize();
23030 test_ret += test_xmlBufferCreateStatic();
23031 test_ret += test_xmlBufferEmpty();
23032 test_ret += test_xmlBufferGrow();
23033 test_ret += test_xmlBufferLength();
23034 test_ret += test_xmlBufferResize();
23035 test_ret += test_xmlBufferSetAllocationScheme();
23036 test_ret += test_xmlBufferShrink();
23037 test_ret += test_xmlBufferWriteCHAR();
23038 test_ret += test_xmlBufferWriteChar();
23039 test_ret += test_xmlBufferWriteQuotedString();
23040 test_ret += test_xmlBuildQName();
23041 test_ret += test_xmlCopyDoc();
23042 test_ret += test_xmlCopyDtd();
23043 test_ret += test_xmlCopyNamespace();
23044 test_ret += test_xmlCopyNamespaceList();
23045 test_ret += test_xmlCopyNode();
23046 test_ret += test_xmlCopyNodeList();
23047 test_ret += test_xmlCopyProp();
23048 test_ret += test_xmlCopyPropList();
23049 test_ret += test_xmlCreateIntSubset();
23050 test_ret += test_xmlDocCopyNode();
23051 test_ret += test_xmlDocCopyNodeList();
23052 test_ret += test_xmlDocDump();
23053 test_ret += test_xmlDocDumpFormatMemory();
23054 test_ret += test_xmlDocDumpFormatMemoryEnc();
23055 test_ret += test_xmlDocDumpMemory();
23056 test_ret += test_xmlDocDumpMemoryEnc();
23057 test_ret += test_xmlDocFormatDump();
23058 test_ret += test_xmlDocGetRootElement();
23059 test_ret += test_xmlDocSetRootElement();
23060 test_ret += test_xmlElemDump();
23061 test_ret += test_xmlGetBufferAllocationScheme();
23062 test_ret += test_xmlGetCompressMode();
23063 test_ret += test_xmlGetDocCompressMode();
23064 test_ret += test_xmlGetIntSubset();
23065 test_ret += test_xmlGetLastChild();
23066 test_ret += test_xmlGetLineNo();
23067 test_ret += test_xmlGetNoNsProp();
23068 test_ret += test_xmlGetNodePath();
23069 test_ret += test_xmlGetNsList();
23070 test_ret += test_xmlGetNsProp();
23071 test_ret += test_xmlGetProp();
23072 test_ret += test_xmlHasNsProp();
23073 test_ret += test_xmlHasProp();
23074 test_ret += test_xmlIsBlankNode();
23075 test_ret += test_xmlIsXHTML();
23076 test_ret += test_xmlNewCDataBlock();
23077 test_ret += test_xmlNewCharRef();
23078 test_ret += test_xmlNewChild();
23079 test_ret += test_xmlNewComment();
23080 test_ret += test_xmlNewDoc();
23081 test_ret += test_xmlNewDocComment();
23082 test_ret += test_xmlNewDocFragment();
23083 test_ret += test_xmlNewDocNode();
23084 test_ret += test_xmlNewDocNodeEatName();
23085 test_ret += test_xmlNewDocPI();
23086 test_ret += test_xmlNewDocProp();
23087 test_ret += test_xmlNewDocRawNode();
23088 test_ret += test_xmlNewDocText();
23089 test_ret += test_xmlNewDocTextLen();
23090 test_ret += test_xmlNewDtd();
23091 test_ret += test_xmlNewNode();
23092 test_ret += test_xmlNewNodeEatName();
23093 test_ret += test_xmlNewNs();
23094 test_ret += test_xmlNewNsProp();
23095 test_ret += test_xmlNewNsPropEatName();
23096 test_ret += test_xmlNewPI();
23097 test_ret += test_xmlNewProp();
23098 test_ret += test_xmlNewReference();
23099 test_ret += test_xmlNewText();
23100 test_ret += test_xmlNewTextChild();
23101 test_ret += test_xmlNewTextLen();
23102 test_ret += test_xmlNodeAddContent();
23103 test_ret += test_xmlNodeAddContentLen();
23104 test_ret += test_xmlNodeBufGetContent();
23105 test_ret += test_xmlNodeDump();
23106 test_ret += test_xmlNodeDumpOutput();
23107 test_ret += test_xmlNodeGetBase();
23108 test_ret += test_xmlNodeGetContent();
23109 test_ret += test_xmlNodeGetLang();
23110 test_ret += test_xmlNodeGetSpacePreserve();
23111 test_ret += test_xmlNodeIsText();
23112 test_ret += test_xmlNodeListGetRawString();
23113 test_ret += test_xmlNodeListGetString();
23114 test_ret += test_xmlNodeSetBase();
23115 test_ret += test_xmlNodeSetContent();
23116 test_ret += test_xmlNodeSetContentLen();
23117 test_ret += test_xmlNodeSetLang();
23118 test_ret += test_xmlNodeSetName();
23119 test_ret += test_xmlNodeSetSpacePreserve();
23120 test_ret += test_xmlReconciliateNs();
23121 test_ret += test_xmlRemoveProp();
23122 test_ret += test_xmlReplaceNode();
23123 test_ret += test_xmlSaveFile();
23124 test_ret += test_xmlSaveFileEnc();
23125 test_ret += test_xmlSaveFileTo();
23126 test_ret += test_xmlSaveFormatFile();
23127 test_ret += test_xmlSaveFormatFileEnc();
23128 test_ret += test_xmlSaveFormatFileTo();
23129 test_ret += test_xmlSearchNs();
23130 test_ret += test_xmlSearchNsByHref();
23131 test_ret += test_xmlSetBufferAllocationScheme();
23132 test_ret += test_xmlSetCompressMode();
23133 test_ret += test_xmlSetDocCompressMode();
23134 test_ret += test_xmlSetNs();
23135 test_ret += test_xmlSetNsProp();
23136 test_ret += test_xmlSetProp();
23137 test_ret += test_xmlSplitQName2();
23138 test_ret += test_xmlSplitQName3();
23139 test_ret += test_xmlStringGetNodeList();
23140 test_ret += test_xmlStringLenGetNodeList();
23141 test_ret += test_xmlTextConcat();
23142 test_ret += test_xmlTextMerge();
23143 test_ret += test_xmlUnsetNsProp();
23144 test_ret += test_xmlUnsetProp();
23145 test_ret += test_xmlValidateNCName();
23146 test_ret += test_xmlValidateNMToken();
23147 test_ret += test_xmlValidateName();
23148 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023149
Daniel Veillard42595322004-11-08 10:52:06 +000023150 if (test_ret != 0)
23151 printf("Module tree: %d errors\n", test_ret);
23152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023153}
23154
23155static int
23156test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023158
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023159 int mem_base;
23160 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023161 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023162 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023163 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023164 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023165
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023166 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23167 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023169 URI = gen_const_xmlChar_ptr(n_URI, 0);
23170 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023171
William M. Brackf13f77f2004-11-12 16:03:48 +000023172 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023173 desret_xmlChar_ptr(ret_val);
23174 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023175 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23176 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023177 xmlResetLastError();
23178 if (mem_base != xmlMemBlocks()) {
23179 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023181 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023182 printf(" %d", n_URI);
23183 printf(" %d", n_base);
23184 printf("\n");
23185 }
23186 }
23187 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023188 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023189
Daniel Veillard42595322004-11-08 10:52:06 +000023190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023191}
23192
23193
23194static int
23195test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023197
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023198 int mem_base;
23199 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023200 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023201 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023202 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023203 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023204
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023205 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23206 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23207 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023208 URI = gen_const_xmlChar_ptr(n_URI, 0);
23209 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023210
William M. Brackf13f77f2004-11-12 16:03:48 +000023211 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023212 desret_xmlChar_ptr(ret_val);
23213 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023214 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23215 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023216 xmlResetLastError();
23217 if (mem_base != xmlMemBlocks()) {
23218 printf("Leak of %d blocks found in xmlBuildURI",
23219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023220 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023221 printf(" %d", n_URI);
23222 printf(" %d", n_base);
23223 printf("\n");
23224 }
23225 }
23226 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023228
Daniel Veillard42595322004-11-08 10:52:06 +000023229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023230}
23231
23232
23233static int
23234test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023236
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023237 int mem_base;
23238 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023239 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023240 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023241
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023242 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023244 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023245
William M. Brackf13f77f2004-11-12 16:03:48 +000023246 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023247 desret_xmlChar_ptr(ret_val);
23248 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023249 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023250 xmlResetLastError();
23251 if (mem_base != xmlMemBlocks()) {
23252 printf("Leak of %d blocks found in xmlCanonicPath",
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_path);
23256 printf("\n");
23257 }
23258 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023259 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023260
Daniel Veillard42595322004-11-08 10:52:06 +000023261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023262}
23263
23264
23265static int
23266test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023268
23269
23270 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023272}
23273
23274
23275static int
23276test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023278
Daniel Veillardce682bc2004-11-05 17:22:25 +000023279 int mem_base;
23280 int ret_val;
23281 char * path; /* pointer to the path string */
23282 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023283
Daniel Veillardce682bc2004-11-05 17:22:25 +000023284 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23285 mem_base = xmlMemBlocks();
23286 path = gen_char_ptr(n_path, 0);
23287
23288 ret_val = xmlNormalizeURIPath(path);
23289 desret_int(ret_val);
23290 call_tests++;
23291 des_char_ptr(n_path, path, 0);
23292 xmlResetLastError();
23293 if (mem_base != xmlMemBlocks()) {
23294 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023296 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023297 printf(" %d", n_path);
23298 printf("\n");
23299 }
23300 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023301 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023302
Daniel Veillard42595322004-11-08 10:52:06 +000023303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023304}
23305
23306
23307static int
23308test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023310
23311
23312 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023314}
23315
23316
Daniel Veillardce682bc2004-11-05 17:22:25 +000023317#define gen_nb_xmlURIPtr 1
23318static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23319 return(NULL);
23320}
23321static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23322}
23323
Daniel Veillardd93f6252004-11-02 15:53:51 +000023324static int
23325test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023327
Daniel Veillardce682bc2004-11-05 17:22:25 +000023328 int mem_base;
23329 int ret_val;
23330 xmlURIPtr uri; /* pointer to an URI structure */
23331 int n_uri;
23332 char * str; /* the string to analyze */
23333 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023334
Daniel Veillardce682bc2004-11-05 17:22:25 +000023335 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23336 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23337 mem_base = xmlMemBlocks();
23338 uri = gen_xmlURIPtr(n_uri, 0);
23339 str = gen_const_char_ptr(n_str, 1);
23340
William M. Brackf13f77f2004-11-12 16:03:48 +000023341 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023342 desret_int(ret_val);
23343 call_tests++;
23344 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023345 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023346 xmlResetLastError();
23347 if (mem_base != xmlMemBlocks()) {
23348 printf("Leak of %d blocks found in xmlParseURIReference",
23349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023350 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023351 printf(" %d", n_uri);
23352 printf(" %d", n_str);
23353 printf("\n");
23354 }
23355 }
23356 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023357 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023358
Daniel Veillard42595322004-11-08 10:52:06 +000023359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023360}
23361
23362
23363static int
23364test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366
Daniel Veillardce682bc2004-11-05 17:22:25 +000023367 int mem_base;
23368 FILE * stream; /* a FILE* for the output */
23369 int n_stream;
23370 xmlURIPtr uri; /* pointer to an xmlURI */
23371 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023372
Daniel Veillardce682bc2004-11-05 17:22:25 +000023373 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23374 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23375 mem_base = xmlMemBlocks();
23376 stream = gen_FILE_ptr(n_stream, 0);
23377 uri = gen_xmlURIPtr(n_uri, 1);
23378
23379 xmlPrintURI(stream, uri);
23380 call_tests++;
23381 des_FILE_ptr(n_stream, stream, 0);
23382 des_xmlURIPtr(n_uri, uri, 1);
23383 xmlResetLastError();
23384 if (mem_base != xmlMemBlocks()) {
23385 printf("Leak of %d blocks found in xmlPrintURI",
23386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023387 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023388 printf(" %d", n_stream);
23389 printf(" %d", n_uri);
23390 printf("\n");
23391 }
23392 }
23393 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023395
Daniel Veillard42595322004-11-08 10:52:06 +000023396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023397}
23398
23399
23400static int
23401test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023403
Daniel Veillardce682bc2004-11-05 17:22:25 +000023404 int mem_base;
23405 xmlChar * ret_val;
23406 xmlURIPtr uri; /* pointer to an xmlURI */
23407 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023408
Daniel Veillardce682bc2004-11-05 17:22:25 +000023409 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23410 mem_base = xmlMemBlocks();
23411 uri = gen_xmlURIPtr(n_uri, 0);
23412
23413 ret_val = xmlSaveUri(uri);
23414 desret_xmlChar_ptr(ret_val);
23415 call_tests++;
23416 des_xmlURIPtr(n_uri, uri, 0);
23417 xmlResetLastError();
23418 if (mem_base != xmlMemBlocks()) {
23419 printf("Leak of %d blocks found in xmlSaveUri",
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_uri);
23423 printf("\n");
23424 }
23425 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023427
Daniel Veillard42595322004-11-08 10:52:06 +000023428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023429}
23430
23431
23432static int
23433test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023435
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023436 int mem_base;
23437 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023438 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023439 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023440
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023441 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023443 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023444
William M. Brackf13f77f2004-11-12 16:03:48 +000023445 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023446 desret_xmlChar_ptr(ret_val);
23447 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023448 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023449 xmlResetLastError();
23450 if (mem_base != xmlMemBlocks()) {
23451 printf("Leak of %d blocks found in xmlURIEscape",
23452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023453 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023454 printf(" %d", n_str);
23455 printf("\n");
23456 }
23457 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023458 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023459
Daniel Veillard42595322004-11-08 10:52:06 +000023460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023461}
23462
23463
23464static int
23465test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023467
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023468 int mem_base;
23469 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023470 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023471 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023472 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023473 int n_list;
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 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023478 str = gen_const_xmlChar_ptr(n_str, 0);
23479 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023480
William M. Brackf13f77f2004-11-12 16:03:48 +000023481 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023482 desret_xmlChar_ptr(ret_val);
23483 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023484 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23485 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023486 xmlResetLastError();
23487 if (mem_base != xmlMemBlocks()) {
23488 printf("Leak of %d blocks found in xmlURIEscapeStr",
23489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023490 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023491 printf(" %d", n_str);
23492 printf(" %d", n_list);
23493 printf("\n");
23494 }
23495 }
23496 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023497 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023498
Daniel Veillard42595322004-11-08 10:52:06 +000023499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023500}
23501
23502
23503static int
23504test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023506
23507
23508 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023510}
23511
23512static int
23513test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023515
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023516 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023517 test_ret += test_xmlBuildRelativeURI();
23518 test_ret += test_xmlBuildURI();
23519 test_ret += test_xmlCanonicPath();
23520 test_ret += test_xmlCreateURI();
23521 test_ret += test_xmlNormalizeURIPath();
23522 test_ret += test_xmlParseURI();
23523 test_ret += test_xmlParseURIReference();
23524 test_ret += test_xmlPrintURI();
23525 test_ret += test_xmlSaveUri();
23526 test_ret += test_xmlURIEscape();
23527 test_ret += test_xmlURIEscapeStr();
23528 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023529
Daniel Veillard42595322004-11-08 10:52:06 +000023530 if (test_ret != 0)
23531 printf("Module uri: %d errors\n", test_ret);
23532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023533}
23534
23535static int
23536test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023538
Daniel Veillard42595322004-11-08 10:52:06 +000023539 int mem_base;
23540 xmlAttributePtr ret_val;
23541 xmlValidCtxtPtr ctxt; /* the validation context */
23542 int n_ctxt;
23543 xmlDtdPtr dtd; /* pointer to the DTD */
23544 int n_dtd;
23545 xmlChar * elem; /* the element name */
23546 int n_elem;
23547 xmlChar * name; /* the attribute name */
23548 int n_name;
23549 xmlChar * ns; /* the attribute namespace prefix */
23550 int n_ns;
23551 xmlAttributeType type; /* the attribute type */
23552 int n_type;
23553 xmlAttributeDefault def; /* the attribute default type */
23554 int n_def;
23555 xmlChar * defaultValue; /* the attribute default value */
23556 int n_defaultValue;
23557 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23558 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023559
Daniel Veillard42595322004-11-08 10:52:06 +000023560 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23561 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23562 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23563 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23564 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23565 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23566 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23567 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23568 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23569 mem_base = xmlMemBlocks();
23570 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23571 dtd = gen_xmlDtdPtr(n_dtd, 1);
23572 elem = gen_const_xmlChar_ptr(n_elem, 2);
23573 name = gen_const_xmlChar_ptr(n_name, 3);
23574 ns = gen_const_xmlChar_ptr(n_ns, 4);
23575 type = gen_xmlAttributeType(n_type, 5);
23576 def = gen_xmlAttributeDefault(n_def, 6);
23577 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23578 tree = gen_xmlEnumerationPtr(n_tree, 8);
23579
William M. Brackf13f77f2004-11-12 16:03:48 +000023580 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 +000023581 desret_xmlAttributePtr(ret_val);
23582 call_tests++;
23583 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23584 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023585 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23586 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23587 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023588 des_xmlAttributeType(n_type, type, 5);
23589 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023590 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023591 des_xmlEnumerationPtr(n_tree, tree, 8);
23592 xmlResetLastError();
23593 if (mem_base != xmlMemBlocks()) {
23594 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23595 xmlMemBlocks() - mem_base);
23596 test_ret++;
23597 printf(" %d", n_ctxt);
23598 printf(" %d", n_dtd);
23599 printf(" %d", n_elem);
23600 printf(" %d", n_name);
23601 printf(" %d", n_ns);
23602 printf(" %d", n_type);
23603 printf(" %d", n_def);
23604 printf(" %d", n_defaultValue);
23605 printf(" %d", n_tree);
23606 printf("\n");
23607 }
23608 }
23609 }
23610 }
23611 }
23612 }
23613 }
23614 }
23615 }
23616 }
Daniel Veillard42595322004-11-08 10:52:06 +000023617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023618
Daniel Veillard42595322004-11-08 10:52:06 +000023619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023620}
23621
23622
23623static int
23624test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023626
Daniel Veillard42595322004-11-08 10:52:06 +000023627 int mem_base;
23628 xmlElementPtr ret_val;
23629 xmlValidCtxtPtr ctxt; /* the validation context */
23630 int n_ctxt;
23631 xmlDtdPtr dtd; /* pointer to the DTD */
23632 int n_dtd;
23633 xmlChar * name; /* the entity name */
23634 int n_name;
23635 xmlElementTypeVal type; /* the element type */
23636 int n_type;
23637 xmlElementContentPtr content; /* the element content tree or NULL */
23638 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023639
Daniel Veillard42595322004-11-08 10:52:06 +000023640 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23641 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23642 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23643 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23644 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23645 mem_base = xmlMemBlocks();
23646 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23647 dtd = gen_xmlDtdPtr(n_dtd, 1);
23648 name = gen_const_xmlChar_ptr(n_name, 2);
23649 type = gen_xmlElementTypeVal(n_type, 3);
23650 content = gen_xmlElementContentPtr(n_content, 4);
23651
William M. Brackf13f77f2004-11-12 16:03:48 +000023652 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023653 desret_xmlElementPtr(ret_val);
23654 call_tests++;
23655 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23656 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023657 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023658 des_xmlElementTypeVal(n_type, type, 3);
23659 des_xmlElementContentPtr(n_content, content, 4);
23660 xmlResetLastError();
23661 if (mem_base != xmlMemBlocks()) {
23662 printf("Leak of %d blocks found in xmlAddElementDecl",
23663 xmlMemBlocks() - mem_base);
23664 test_ret++;
23665 printf(" %d", n_ctxt);
23666 printf(" %d", n_dtd);
23667 printf(" %d", n_name);
23668 printf(" %d", n_type);
23669 printf(" %d", n_content);
23670 printf("\n");
23671 }
23672 }
23673 }
23674 }
23675 }
23676 }
Daniel Veillard42595322004-11-08 10:52:06 +000023677 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023678
Daniel Veillard42595322004-11-08 10:52:06 +000023679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023680}
23681
23682
23683static int
23684test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023686
23687
23688 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023690}
23691
23692
23693static int
23694test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023696
23697
23698 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023700}
23701
23702
23703static int
23704test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023706
23707
23708 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023710}
23711
23712
Daniel Veillardce682bc2004-11-05 17:22:25 +000023713#define gen_nb_xmlAttributeTablePtr 1
23714static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23715 return(NULL);
23716}
23717static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23718}
23719
Daniel Veillardd93f6252004-11-02 15:53:51 +000023720static int
23721test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023723
23724
23725 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023727}
23728
23729
23730static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023731test_xmlCopyDocElementContent(void) {
23732 int test_ret = 0;
23733
23734 int mem_base;
23735 xmlElementContentPtr ret_val;
23736 xmlDocPtr doc; /* the document owning the element declaration */
23737 int n_doc;
23738 xmlElementContentPtr cur; /* An element content pointer. */
23739 int n_cur;
23740
23741 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23742 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23743 mem_base = xmlMemBlocks();
23744 doc = gen_xmlDocPtr(n_doc, 0);
23745 cur = gen_xmlElementContentPtr(n_cur, 1);
23746
23747 ret_val = xmlCopyDocElementContent(doc, cur);
23748 desret_xmlElementContentPtr(ret_val);
23749 call_tests++;
23750 des_xmlDocPtr(n_doc, doc, 0);
23751 des_xmlElementContentPtr(n_cur, cur, 1);
23752 xmlResetLastError();
23753 if (mem_base != xmlMemBlocks()) {
23754 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23755 xmlMemBlocks() - mem_base);
23756 test_ret++;
23757 printf(" %d", n_doc);
23758 printf(" %d", n_cur);
23759 printf("\n");
23760 }
23761 }
23762 }
23763 function_tests++;
23764
23765 return(test_ret);
23766}
23767
23768
23769static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023770test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023772
William M. Brack094dd862004-11-14 14:28:34 +000023773 int mem_base;
23774 xmlElementContentPtr ret_val;
23775 xmlElementContentPtr cur; /* An element content pointer. */
23776 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023777
William M. Brack094dd862004-11-14 14:28:34 +000023778 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23779 mem_base = xmlMemBlocks();
23780 cur = gen_xmlElementContentPtr(n_cur, 0);
23781
23782 ret_val = xmlCopyElementContent(cur);
23783 desret_xmlElementContentPtr(ret_val);
23784 call_tests++;
23785 des_xmlElementContentPtr(n_cur, cur, 0);
23786 xmlResetLastError();
23787 if (mem_base != xmlMemBlocks()) {
23788 printf("Leak of %d blocks found in xmlCopyElementContent",
23789 xmlMemBlocks() - mem_base);
23790 test_ret++;
23791 printf(" %d", n_cur);
23792 printf("\n");
23793 }
23794 }
23795 function_tests++;
23796
Daniel Veillard42595322004-11-08 10:52:06 +000023797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023798}
23799
23800
Daniel Veillardce682bc2004-11-05 17:22:25 +000023801#define gen_nb_xmlElementTablePtr 1
23802static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23803 return(NULL);
23804}
23805static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23806}
23807
Daniel Veillardd93f6252004-11-02 15:53:51 +000023808static int
23809test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023811
23812
23813 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023815}
23816
23817
23818static int
23819test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023821
23822
23823 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023825}
23826
23827
Daniel Veillardce682bc2004-11-05 17:22:25 +000023828#define gen_nb_xmlNotationTablePtr 1
23829static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23830 return(NULL);
23831}
23832static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23833}
23834
Daniel Veillardd93f6252004-11-02 15:53:51 +000023835static int
23836test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023838
23839
23840 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023842}
23843
23844
23845static int
23846test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848
23849
23850 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023852}
23853
23854
Daniel Veillardce682bc2004-11-05 17:22:25 +000023855#define gen_nb_xmlAttributePtr 1
23856static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23857 return(NULL);
23858}
23859static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23860}
23861
Daniel Veillardd93f6252004-11-02 15:53:51 +000023862static int
23863test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023865
William M. Brack21e4ef22005-01-02 09:53:13 +000023866#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023867 int mem_base;
23868 xmlBufferPtr buf; /* the XML buffer output */
23869 int n_buf;
23870 xmlAttributePtr attr; /* An attribute declaration */
23871 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872
Daniel Veillardce682bc2004-11-05 17:22:25 +000023873 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23874 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23875 mem_base = xmlMemBlocks();
23876 buf = gen_xmlBufferPtr(n_buf, 0);
23877 attr = gen_xmlAttributePtr(n_attr, 1);
23878
23879 xmlDumpAttributeDecl(buf, attr);
23880 call_tests++;
23881 des_xmlBufferPtr(n_buf, buf, 0);
23882 des_xmlAttributePtr(n_attr, attr, 1);
23883 xmlResetLastError();
23884 if (mem_base != xmlMemBlocks()) {
23885 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023887 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023888 printf(" %d", n_buf);
23889 printf(" %d", n_attr);
23890 printf("\n");
23891 }
23892 }
23893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023894 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023895#endif
23896
Daniel Veillard42595322004-11-08 10:52:06 +000023897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023898}
23899
23900
23901static int
23902test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023904
William M. Brack21e4ef22005-01-02 09:53:13 +000023905#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023906 int mem_base;
23907 xmlBufferPtr buf; /* the XML buffer output */
23908 int n_buf;
23909 xmlAttributeTablePtr table; /* An attribute table */
23910 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023911
Daniel Veillardce682bc2004-11-05 17:22:25 +000023912 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23913 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23914 mem_base = xmlMemBlocks();
23915 buf = gen_xmlBufferPtr(n_buf, 0);
23916 table = gen_xmlAttributeTablePtr(n_table, 1);
23917
23918 xmlDumpAttributeTable(buf, table);
23919 call_tests++;
23920 des_xmlBufferPtr(n_buf, buf, 0);
23921 des_xmlAttributeTablePtr(n_table, table, 1);
23922 xmlResetLastError();
23923 if (mem_base != xmlMemBlocks()) {
23924 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023926 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023927 printf(" %d", n_buf);
23928 printf(" %d", n_table);
23929 printf("\n");
23930 }
23931 }
23932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023933 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023934#endif
23935
Daniel Veillard42595322004-11-08 10:52:06 +000023936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023937}
23938
23939
Daniel Veillardce682bc2004-11-05 17:22:25 +000023940#define gen_nb_xmlElementPtr 1
23941static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23942 return(NULL);
23943}
23944static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23945}
23946
Daniel Veillardd93f6252004-11-02 15:53:51 +000023947static int
23948test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023950
William M. Brack21e4ef22005-01-02 09:53:13 +000023951#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023952 int mem_base;
23953 xmlBufferPtr buf; /* the XML buffer output */
23954 int n_buf;
23955 xmlElementPtr elem; /* An element table */
23956 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023957
Daniel Veillardce682bc2004-11-05 17:22:25 +000023958 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23959 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23960 mem_base = xmlMemBlocks();
23961 buf = gen_xmlBufferPtr(n_buf, 0);
23962 elem = gen_xmlElementPtr(n_elem, 1);
23963
23964 xmlDumpElementDecl(buf, elem);
23965 call_tests++;
23966 des_xmlBufferPtr(n_buf, buf, 0);
23967 des_xmlElementPtr(n_elem, elem, 1);
23968 xmlResetLastError();
23969 if (mem_base != xmlMemBlocks()) {
23970 printf("Leak of %d blocks found in xmlDumpElementDecl",
23971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023972 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023973 printf(" %d", n_buf);
23974 printf(" %d", n_elem);
23975 printf("\n");
23976 }
23977 }
23978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023979 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023980#endif
23981
Daniel Veillard42595322004-11-08 10:52:06 +000023982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023983}
23984
23985
23986static int
23987test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023989
William M. Brack21e4ef22005-01-02 09:53:13 +000023990#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023991 int mem_base;
23992 xmlBufferPtr buf; /* the XML buffer output */
23993 int n_buf;
23994 xmlElementTablePtr table; /* An element table */
23995 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023996
Daniel Veillardce682bc2004-11-05 17:22:25 +000023997 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23998 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23999 mem_base = xmlMemBlocks();
24000 buf = gen_xmlBufferPtr(n_buf, 0);
24001 table = gen_xmlElementTablePtr(n_table, 1);
24002
24003 xmlDumpElementTable(buf, table);
24004 call_tests++;
24005 des_xmlBufferPtr(n_buf, buf, 0);
24006 des_xmlElementTablePtr(n_table, table, 1);
24007 xmlResetLastError();
24008 if (mem_base != xmlMemBlocks()) {
24009 printf("Leak of %d blocks found in xmlDumpElementTable",
24010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024011 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024012 printf(" %d", n_buf);
24013 printf(" %d", n_table);
24014 printf("\n");
24015 }
24016 }
24017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024018 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024019#endif
24020
Daniel Veillard42595322004-11-08 10:52:06 +000024021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024022}
24023
24024
Daniel Veillardce682bc2004-11-05 17:22:25 +000024025#define gen_nb_xmlNotationPtr 1
24026static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24027 return(NULL);
24028}
24029static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24030}
24031
Daniel Veillardd93f6252004-11-02 15:53:51 +000024032static int
24033test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024035
William M. Brack21e4ef22005-01-02 09:53:13 +000024036#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024037 int mem_base;
24038 xmlBufferPtr buf; /* the XML buffer output */
24039 int n_buf;
24040 xmlNotationPtr nota; /* A notation declaration */
24041 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024042
Daniel Veillardce682bc2004-11-05 17:22:25 +000024043 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24044 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24045 mem_base = xmlMemBlocks();
24046 buf = gen_xmlBufferPtr(n_buf, 0);
24047 nota = gen_xmlNotationPtr(n_nota, 1);
24048
24049 xmlDumpNotationDecl(buf, nota);
24050 call_tests++;
24051 des_xmlBufferPtr(n_buf, buf, 0);
24052 des_xmlNotationPtr(n_nota, nota, 1);
24053 xmlResetLastError();
24054 if (mem_base != xmlMemBlocks()) {
24055 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024057 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024058 printf(" %d", n_buf);
24059 printf(" %d", n_nota);
24060 printf("\n");
24061 }
24062 }
24063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024064 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024065#endif
24066
Daniel Veillard42595322004-11-08 10:52:06 +000024067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024068}
24069
24070
24071static int
24072test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024074
William M. Brack21e4ef22005-01-02 09:53:13 +000024075#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024076 int mem_base;
24077 xmlBufferPtr buf; /* the XML buffer output */
24078 int n_buf;
24079 xmlNotationTablePtr table; /* A notation table */
24080 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024081
Daniel Veillardce682bc2004-11-05 17:22:25 +000024082 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24083 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24084 mem_base = xmlMemBlocks();
24085 buf = gen_xmlBufferPtr(n_buf, 0);
24086 table = gen_xmlNotationTablePtr(n_table, 1);
24087
24088 xmlDumpNotationTable(buf, table);
24089 call_tests++;
24090 des_xmlBufferPtr(n_buf, buf, 0);
24091 des_xmlNotationTablePtr(n_table, table, 1);
24092 xmlResetLastError();
24093 if (mem_base != xmlMemBlocks()) {
24094 printf("Leak of %d blocks found in xmlDumpNotationTable",
24095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024096 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024097 printf(" %d", n_buf);
24098 printf(" %d", n_table);
24099 printf("\n");
24100 }
24101 }
24102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024103 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024104#endif
24105
Daniel Veillard42595322004-11-08 10:52:06 +000024106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024107}
24108
24109
24110static int
24111test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024113
Daniel Veillard42595322004-11-08 10:52:06 +000024114 int mem_base;
24115 xmlAttributePtr ret_val;
24116 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24117 int n_dtd;
24118 xmlChar * elem; /* the element name */
24119 int n_elem;
24120 xmlChar * name; /* the attribute name */
24121 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024122
Daniel Veillard42595322004-11-08 10:52:06 +000024123 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24124 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24125 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24126 mem_base = xmlMemBlocks();
24127 dtd = gen_xmlDtdPtr(n_dtd, 0);
24128 elem = gen_const_xmlChar_ptr(n_elem, 1);
24129 name = gen_const_xmlChar_ptr(n_name, 2);
24130
William M. Brackf13f77f2004-11-12 16:03:48 +000024131 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024132 desret_xmlAttributePtr(ret_val);
24133 call_tests++;
24134 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024135 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24136 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024137 xmlResetLastError();
24138 if (mem_base != xmlMemBlocks()) {
24139 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24140 xmlMemBlocks() - mem_base);
24141 test_ret++;
24142 printf(" %d", n_dtd);
24143 printf(" %d", n_elem);
24144 printf(" %d", n_name);
24145 printf("\n");
24146 }
24147 }
24148 }
24149 }
Daniel Veillard42595322004-11-08 10:52:06 +000024150 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024151
Daniel Veillard42595322004-11-08 10:52:06 +000024152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024153}
24154
24155
24156static int
24157test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024159
Daniel Veillard42595322004-11-08 10:52:06 +000024160 int mem_base;
24161 xmlElementPtr ret_val;
24162 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24163 int n_dtd;
24164 xmlChar * name; /* the element name */
24165 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024166
Daniel Veillard42595322004-11-08 10:52:06 +000024167 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24168 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24169 mem_base = xmlMemBlocks();
24170 dtd = gen_xmlDtdPtr(n_dtd, 0);
24171 name = gen_const_xmlChar_ptr(n_name, 1);
24172
William M. Brackf13f77f2004-11-12 16:03:48 +000024173 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024174 desret_xmlElementPtr(ret_val);
24175 call_tests++;
24176 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024177 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024178 xmlResetLastError();
24179 if (mem_base != xmlMemBlocks()) {
24180 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24181 xmlMemBlocks() - mem_base);
24182 test_ret++;
24183 printf(" %d", n_dtd);
24184 printf(" %d", n_name);
24185 printf("\n");
24186 }
24187 }
24188 }
Daniel Veillard42595322004-11-08 10:52:06 +000024189 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024190
Daniel Veillard42595322004-11-08 10:52:06 +000024191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024192}
24193
24194
24195static int
24196test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024198
24199
24200 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024202}
24203
24204
24205static int
24206test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024208
Daniel Veillard42595322004-11-08 10:52:06 +000024209 int mem_base;
24210 xmlAttributePtr ret_val;
24211 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24212 int n_dtd;
24213 xmlChar * elem; /* the element name */
24214 int n_elem;
24215 xmlChar * name; /* the attribute name */
24216 int n_name;
24217 xmlChar * prefix; /* the attribute namespace prefix */
24218 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024219
Daniel Veillard42595322004-11-08 10:52:06 +000024220 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24221 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24222 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24223 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24224 mem_base = xmlMemBlocks();
24225 dtd = gen_xmlDtdPtr(n_dtd, 0);
24226 elem = gen_const_xmlChar_ptr(n_elem, 1);
24227 name = gen_const_xmlChar_ptr(n_name, 2);
24228 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24229
William M. Brackf13f77f2004-11-12 16:03:48 +000024230 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024231 desret_xmlAttributePtr(ret_val);
24232 call_tests++;
24233 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024234 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24235 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24236 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024237 xmlResetLastError();
24238 if (mem_base != xmlMemBlocks()) {
24239 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24240 xmlMemBlocks() - mem_base);
24241 test_ret++;
24242 printf(" %d", n_dtd);
24243 printf(" %d", n_elem);
24244 printf(" %d", n_name);
24245 printf(" %d", n_prefix);
24246 printf("\n");
24247 }
24248 }
24249 }
24250 }
24251 }
Daniel Veillard42595322004-11-08 10:52:06 +000024252 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024253
Daniel Veillard42595322004-11-08 10:52:06 +000024254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024255}
24256
24257
24258static int
24259test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024261
Daniel Veillard42595322004-11-08 10:52:06 +000024262 int mem_base;
24263 xmlElementPtr ret_val;
24264 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24265 int n_dtd;
24266 xmlChar * name; /* the element name */
24267 int n_name;
24268 xmlChar * prefix; /* the element namespace prefix */
24269 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024270
Daniel Veillard42595322004-11-08 10:52:06 +000024271 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24272 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24273 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24274 mem_base = xmlMemBlocks();
24275 dtd = gen_xmlDtdPtr(n_dtd, 0);
24276 name = gen_const_xmlChar_ptr(n_name, 1);
24277 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24278
William M. Brackf13f77f2004-11-12 16:03:48 +000024279 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024280 desret_xmlElementPtr(ret_val);
24281 call_tests++;
24282 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024283 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24284 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024285 xmlResetLastError();
24286 if (mem_base != xmlMemBlocks()) {
24287 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24288 xmlMemBlocks() - mem_base);
24289 test_ret++;
24290 printf(" %d", n_dtd);
24291 printf(" %d", n_name);
24292 printf(" %d", n_prefix);
24293 printf("\n");
24294 }
24295 }
24296 }
24297 }
Daniel Veillard42595322004-11-08 10:52:06 +000024298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024299
Daniel Veillard42595322004-11-08 10:52:06 +000024300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024301}
24302
24303
24304static int
24305test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024307
Daniel Veillard57b25162004-11-06 14:50:18 +000024308 int mem_base;
24309 xmlAttrPtr ret_val;
24310 xmlDocPtr doc; /* pointer to the document */
24311 int n_doc;
24312 xmlChar * ID; /* the ID value */
24313 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024314
Daniel Veillard57b25162004-11-06 14:50:18 +000024315 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24316 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24317 mem_base = xmlMemBlocks();
24318 doc = gen_xmlDocPtr(n_doc, 0);
24319 ID = gen_const_xmlChar_ptr(n_ID, 1);
24320
William M. Brackf13f77f2004-11-12 16:03:48 +000024321 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024322 desret_xmlAttrPtr(ret_val);
24323 call_tests++;
24324 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024325 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024326 xmlResetLastError();
24327 if (mem_base != xmlMemBlocks()) {
24328 printf("Leak of %d blocks found in xmlGetID",
24329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024330 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024331 printf(" %d", n_doc);
24332 printf(" %d", n_ID);
24333 printf("\n");
24334 }
24335 }
24336 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024337 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024338
Daniel Veillard42595322004-11-08 10:52:06 +000024339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024340}
24341
24342
24343static int
24344test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024346
24347
24348 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024350}
24351
24352
24353static int
24354test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024356
Daniel Veillardce244ad2004-11-05 10:03:46 +000024357 int mem_base;
24358 int ret_val;
24359 xmlDocPtr doc; /* the document */
24360 int n_doc;
24361 xmlNodePtr elem; /* the element carrying the attribute */
24362 int n_elem;
24363 xmlAttrPtr attr; /* the attribute */
24364 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024365
Daniel Veillardce244ad2004-11-05 10:03:46 +000024366 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24367 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24368 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24369 mem_base = xmlMemBlocks();
24370 doc = gen_xmlDocPtr(n_doc, 0);
24371 elem = gen_xmlNodePtr(n_elem, 1);
24372 attr = gen_xmlAttrPtr(n_attr, 2);
24373
24374 ret_val = xmlIsID(doc, elem, attr);
24375 desret_int(ret_val);
24376 call_tests++;
24377 des_xmlDocPtr(n_doc, doc, 0);
24378 des_xmlNodePtr(n_elem, elem, 1);
24379 des_xmlAttrPtr(n_attr, attr, 2);
24380 xmlResetLastError();
24381 if (mem_base != xmlMemBlocks()) {
24382 printf("Leak of %d blocks found in xmlIsID",
24383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024384 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024385 printf(" %d", n_doc);
24386 printf(" %d", n_elem);
24387 printf(" %d", n_attr);
24388 printf("\n");
24389 }
24390 }
24391 }
24392 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024393 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024394
Daniel Veillard42595322004-11-08 10:52:06 +000024395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024396}
24397
24398
24399static int
24400test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024402
24403 int mem_base;
24404 int ret_val;
24405 xmlDocPtr doc; /* the document */
24406 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024407 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024408 int n_name;
24409
24410 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24411 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24412 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024413 doc = gen_xmlDocPtr(n_doc, 0);
24414 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024415
William M. Brackf13f77f2004-11-12 16:03:48 +000024416 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024417 desret_int(ret_val);
24418 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024419 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024420 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024421 xmlResetLastError();
24422 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024423 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024425 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024426 printf(" %d", n_doc);
24427 printf(" %d", n_name);
24428 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024429 }
24430 }
24431 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024433
Daniel Veillard42595322004-11-08 10:52:06 +000024434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024435}
24436
24437
24438static int
24439test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024441
Daniel Veillardce244ad2004-11-05 10:03:46 +000024442 int mem_base;
24443 int ret_val;
24444 xmlDocPtr doc; /* the document */
24445 int n_doc;
24446 xmlNodePtr elem; /* the element carrying the attribute */
24447 int n_elem;
24448 xmlAttrPtr attr; /* the attribute */
24449 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024450
Daniel Veillardce244ad2004-11-05 10:03:46 +000024451 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24452 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24453 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24454 mem_base = xmlMemBlocks();
24455 doc = gen_xmlDocPtr(n_doc, 0);
24456 elem = gen_xmlNodePtr(n_elem, 1);
24457 attr = gen_xmlAttrPtr(n_attr, 2);
24458
24459 ret_val = xmlIsRef(doc, elem, attr);
24460 desret_int(ret_val);
24461 call_tests++;
24462 des_xmlDocPtr(n_doc, doc, 0);
24463 des_xmlNodePtr(n_elem, elem, 1);
24464 des_xmlAttrPtr(n_attr, attr, 2);
24465 xmlResetLastError();
24466 if (mem_base != xmlMemBlocks()) {
24467 printf("Leak of %d blocks found in xmlIsRef",
24468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024469 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024470 printf(" %d", n_doc);
24471 printf(" %d", n_elem);
24472 printf(" %d", n_attr);
24473 printf("\n");
24474 }
24475 }
24476 }
24477 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024478 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024479
Daniel Veillard42595322004-11-08 10:52:06 +000024480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024481}
24482
24483
24484static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024485test_xmlNewDocElementContent(void) {
24486 int test_ret = 0;
24487
24488 int mem_base;
24489 xmlElementContentPtr ret_val;
24490 xmlDocPtr doc; /* the document */
24491 int n_doc;
24492 xmlChar * name; /* the subelement name or NULL */
24493 int n_name;
24494 xmlElementContentType type; /* the type of element content decl */
24495 int n_type;
24496
24497 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24498 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24499 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24500 mem_base = xmlMemBlocks();
24501 doc = gen_xmlDocPtr(n_doc, 0);
24502 name = gen_const_xmlChar_ptr(n_name, 1);
24503 type = gen_xmlElementContentType(n_type, 2);
24504
24505 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024506 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024507 desret_xmlElementContentPtr(ret_val);
24508 call_tests++;
24509 des_xmlDocPtr(n_doc, doc, 0);
24510 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24511 des_xmlElementContentType(n_type, type, 2);
24512 xmlResetLastError();
24513 if (mem_base != xmlMemBlocks()) {
24514 printf("Leak of %d blocks found in xmlNewDocElementContent",
24515 xmlMemBlocks() - mem_base);
24516 test_ret++;
24517 printf(" %d", n_doc);
24518 printf(" %d", n_name);
24519 printf(" %d", n_type);
24520 printf("\n");
24521 }
24522 }
24523 }
24524 }
24525 function_tests++;
24526
24527 return(test_ret);
24528}
24529
24530
24531static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024532test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024534
William M. Brack094dd862004-11-14 14:28:34 +000024535 int mem_base;
24536 xmlElementContentPtr ret_val;
24537 xmlChar * name; /* the subelement name or NULL */
24538 int n_name;
24539 xmlElementContentType type; /* the type of element content decl */
24540 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024541
William M. Brack094dd862004-11-14 14:28:34 +000024542 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24543 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24544 mem_base = xmlMemBlocks();
24545 name = gen_const_xmlChar_ptr(n_name, 0);
24546 type = gen_xmlElementContentType(n_type, 1);
24547
24548 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24549 desret_xmlElementContentPtr(ret_val);
24550 call_tests++;
24551 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24552 des_xmlElementContentType(n_type, type, 1);
24553 xmlResetLastError();
24554 if (mem_base != xmlMemBlocks()) {
24555 printf("Leak of %d blocks found in xmlNewElementContent",
24556 xmlMemBlocks() - mem_base);
24557 test_ret++;
24558 printf(" %d", n_name);
24559 printf(" %d", n_type);
24560 printf("\n");
24561 }
24562 }
24563 }
24564 function_tests++;
24565
Daniel Veillard42595322004-11-08 10:52:06 +000024566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024567}
24568
24569
24570static int
24571test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024573
24574
24575 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024577}
24578
24579
24580static int
24581test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024583
Daniel Veillardce244ad2004-11-05 10:03:46 +000024584 int mem_base;
24585 int ret_val;
24586 xmlDocPtr doc; /* the document */
24587 int n_doc;
24588 xmlAttrPtr attr; /* the attribute */
24589 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024590
Daniel Veillardce244ad2004-11-05 10:03:46 +000024591 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24592 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24593 mem_base = xmlMemBlocks();
24594 doc = gen_xmlDocPtr(n_doc, 0);
24595 attr = gen_xmlAttrPtr(n_attr, 1);
24596
24597 ret_val = xmlRemoveID(doc, attr);
24598 desret_int(ret_val);
24599 call_tests++;
24600 des_xmlDocPtr(n_doc, doc, 0);
24601 des_xmlAttrPtr(n_attr, attr, 1);
24602 xmlResetLastError();
24603 if (mem_base != xmlMemBlocks()) {
24604 printf("Leak of %d blocks found in xmlRemoveID",
24605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024606 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024607 printf(" %d", n_doc);
24608 printf(" %d", n_attr);
24609 printf("\n");
24610 }
24611 }
24612 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024613 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024614
Daniel Veillard42595322004-11-08 10:52:06 +000024615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024616}
24617
24618
24619static int
24620test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024622
Daniel Veillardce244ad2004-11-05 10:03:46 +000024623 int mem_base;
24624 int ret_val;
24625 xmlDocPtr doc; /* the document */
24626 int n_doc;
24627 xmlAttrPtr attr; /* the attribute */
24628 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024629
Daniel Veillardce244ad2004-11-05 10:03:46 +000024630 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24631 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24632 mem_base = xmlMemBlocks();
24633 doc = gen_xmlDocPtr(n_doc, 0);
24634 attr = gen_xmlAttrPtr(n_attr, 1);
24635
24636 ret_val = xmlRemoveRef(doc, attr);
24637 desret_int(ret_val);
24638 call_tests++;
24639 des_xmlDocPtr(n_doc, doc, 0);
24640 des_xmlAttrPtr(n_attr, attr, 1);
24641 xmlResetLastError();
24642 if (mem_base != xmlMemBlocks()) {
24643 printf("Leak of %d blocks found in xmlRemoveRef",
24644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024645 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024646 printf(" %d", n_doc);
24647 printf(" %d", n_attr);
24648 printf("\n");
24649 }
24650 }
24651 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024653
Daniel Veillard42595322004-11-08 10:52:06 +000024654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024655}
24656
24657
24658static int
24659test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024661
Daniel Veillardce682bc2004-11-05 17:22:25 +000024662 int mem_base;
24663 char * buf; /* an output buffer */
24664 int n_buf;
24665 int size; /* the buffer size */
24666 int n_size;
24667 xmlElementContentPtr content; /* An element table */
24668 int n_content;
24669 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24670 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024671
Daniel Veillardce682bc2004-11-05 17:22:25 +000024672 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24673 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24674 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24675 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24676 mem_base = xmlMemBlocks();
24677 buf = gen_char_ptr(n_buf, 0);
24678 size = gen_int(n_size, 1);
24679 content = gen_xmlElementContentPtr(n_content, 2);
24680 glob = gen_int(n_glob, 3);
24681
24682 xmlSnprintfElementContent(buf, size, content, glob);
24683 call_tests++;
24684 des_char_ptr(n_buf, buf, 0);
24685 des_int(n_size, size, 1);
24686 des_xmlElementContentPtr(n_content, content, 2);
24687 des_int(n_glob, glob, 3);
24688 xmlResetLastError();
24689 if (mem_base != xmlMemBlocks()) {
24690 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024692 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024693 printf(" %d", n_buf);
24694 printf(" %d", n_size);
24695 printf(" %d", n_content);
24696 printf(" %d", n_glob);
24697 printf("\n");
24698 }
24699 }
24700 }
24701 }
24702 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024703 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024704
Daniel Veillard42595322004-11-08 10:52:06 +000024705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024706}
24707
24708
24709static int
24710test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024712
William M. Brack21e4ef22005-01-02 09:53:13 +000024713#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024714#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024715 int mem_base;
24716 char * buf; /* an output buffer */
24717 int n_buf;
24718 xmlElementContentPtr content; /* An element table */
24719 int n_content;
24720 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24721 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024722
Daniel Veillardce682bc2004-11-05 17:22:25 +000024723 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24724 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24725 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24726 mem_base = xmlMemBlocks();
24727 buf = gen_char_ptr(n_buf, 0);
24728 content = gen_xmlElementContentPtr(n_content, 1);
24729 glob = gen_int(n_glob, 2);
24730
24731 xmlSprintfElementContent(buf, content, glob);
24732 call_tests++;
24733 des_char_ptr(n_buf, buf, 0);
24734 des_xmlElementContentPtr(n_content, content, 1);
24735 des_int(n_glob, glob, 2);
24736 xmlResetLastError();
24737 if (mem_base != xmlMemBlocks()) {
24738 printf("Leak of %d blocks found in xmlSprintfElementContent",
24739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024740 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024741 printf(" %d", n_buf);
24742 printf(" %d", n_content);
24743 printf(" %d", n_glob);
24744 printf("\n");
24745 }
24746 }
24747 }
24748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024749 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024750#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024751#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024752
Daniel Veillard42595322004-11-08 10:52:06 +000024753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024754}
24755
24756
24757static int
24758test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024760
William M. Brack21e4ef22005-01-02 09:53:13 +000024761#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024762 int mem_base;
24763 int ret_val;
24764 xmlValidCtxtPtr ctxt; /* a validation context */
24765 int n_ctxt;
24766 xmlElementPtr elem; /* an element declaration node */
24767 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024768
Daniel Veillardce682bc2004-11-05 17:22:25 +000024769 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24770 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24771 mem_base = xmlMemBlocks();
24772 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24773 elem = gen_xmlElementPtr(n_elem, 1);
24774
24775 ret_val = xmlValidBuildContentModel(ctxt, elem);
24776 desret_int(ret_val);
24777 call_tests++;
24778 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24779 des_xmlElementPtr(n_elem, elem, 1);
24780 xmlResetLastError();
24781 if (mem_base != xmlMemBlocks()) {
24782 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024784 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024785 printf(" %d", n_ctxt);
24786 printf(" %d", n_elem);
24787 printf("\n");
24788 }
24789 }
24790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024791 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024792#endif
24793
Daniel Veillard42595322004-11-08 10:52:06 +000024794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024795}
24796
24797
24798static int
24799test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024801
William M. Brack21e4ef22005-01-02 09:53:13 +000024802#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024803 int mem_base;
24804 xmlChar * ret_val;
24805 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24806 int n_ctxt;
24807 xmlDocPtr doc; /* the document */
24808 int n_doc;
24809 xmlNodePtr elem; /* the parent */
24810 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024811 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024812 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024813 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024814 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024815
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024816 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24817 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24818 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24819 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24820 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024822 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24823 doc = gen_xmlDocPtr(n_doc, 1);
24824 elem = gen_xmlNodePtr(n_elem, 2);
24825 name = gen_const_xmlChar_ptr(n_name, 3);
24826 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024827
William M. Brackf13f77f2004-11-12 16:03:48 +000024828 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024829 desret_xmlChar_ptr(ret_val);
24830 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024831 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24832 des_xmlDocPtr(n_doc, doc, 1);
24833 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024834 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24835 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024836 xmlResetLastError();
24837 if (mem_base != xmlMemBlocks()) {
24838 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024840 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024841 printf(" %d", n_ctxt);
24842 printf(" %d", n_doc);
24843 printf(" %d", n_elem);
24844 printf(" %d", n_name);
24845 printf(" %d", n_value);
24846 printf("\n");
24847 }
24848 }
24849 }
24850 }
24851 }
24852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024853 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024854#endif
24855
Daniel Veillard42595322004-11-08 10:52:06 +000024856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024857}
24858
24859
Daniel Veillardce682bc2004-11-05 17:22:25 +000024860#define gen_nb_xmlElementContent_ptr 1
24861static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24862 return(NULL);
24863}
24864static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24865}
24866
Daniel Veillardd93f6252004-11-02 15:53:51 +000024867static int
24868test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024870
William M. Brack21e4ef22005-01-02 09:53:13 +000024871#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024872#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024873 int mem_base;
24874 int ret_val;
24875 xmlElementContent * ctree; /* an element content tree */
24876 int n_ctree;
24877 xmlChar ** list; /* an array to store the list of child names */
24878 int n_list;
24879 int * len; /* a pointer to the number of element in the list */
24880 int n_len;
24881 int max; /* the size of the array */
24882 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024883
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024884 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24885 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24886 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24887 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24888 mem_base = xmlMemBlocks();
24889 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24890 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24891 len = gen_int_ptr(n_len, 2);
24892 max = gen_int(n_max, 3);
24893
William M. Brackf13f77f2004-11-12 16:03:48 +000024894 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024895 desret_int(ret_val);
24896 call_tests++;
24897 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024898 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024899 des_int_ptr(n_len, len, 2);
24900 des_int(n_max, max, 3);
24901 xmlResetLastError();
24902 if (mem_base != xmlMemBlocks()) {
24903 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024905 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024906 printf(" %d", n_ctree);
24907 printf(" %d", n_list);
24908 printf(" %d", n_len);
24909 printf(" %d", n_max);
24910 printf("\n");
24911 }
24912 }
24913 }
24914 }
24915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024916 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024917#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024918#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024919
Daniel Veillard42595322004-11-08 10:52:06 +000024920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024921}
24922
24923
24924static int
24925test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024927
William M. Brack21e4ef22005-01-02 09:53:13 +000024928#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024929#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024930 int mem_base;
24931 int ret_val;
24932 xmlNode * prev; /* an element to insert after */
24933 int n_prev;
24934 xmlNode * next; /* an element to insert next */
24935 int n_next;
24936 xmlChar ** names; /* an array to store the list of child names */
24937 int n_names;
24938 int max; /* the size of the array */
24939 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024940
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024941 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24942 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24943 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24944 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24945 mem_base = xmlMemBlocks();
24946 prev = gen_xmlNodePtr(n_prev, 0);
24947 next = gen_xmlNodePtr(n_next, 1);
24948 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24949 max = gen_int(n_max, 3);
24950
William M. Brackf13f77f2004-11-12 16:03:48 +000024951 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024952 desret_int(ret_val);
24953 call_tests++;
24954 des_xmlNodePtr(n_prev, prev, 0);
24955 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024956 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024957 des_int(n_max, max, 3);
24958 xmlResetLastError();
24959 if (mem_base != xmlMemBlocks()) {
24960 printf("Leak of %d blocks found in xmlValidGetValidElements",
24961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024962 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024963 printf(" %d", n_prev);
24964 printf(" %d", n_next);
24965 printf(" %d", n_names);
24966 printf(" %d", n_max);
24967 printf("\n");
24968 }
24969 }
24970 }
24971 }
24972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024973 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024974#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024975#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024976
Daniel Veillard42595322004-11-08 10:52:06 +000024977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024978}
24979
24980
24981static int
24982test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024984
William M. Brack21e4ef22005-01-02 09:53:13 +000024985#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024986 int mem_base;
24987 xmlChar * ret_val;
24988 xmlDocPtr doc; /* the document */
24989 int n_doc;
24990 xmlNodePtr elem; /* the parent */
24991 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024992 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024993 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024994 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024995 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024996
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024997 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24998 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24999 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25000 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25001 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025002 doc = gen_xmlDocPtr(n_doc, 0);
25003 elem = gen_xmlNodePtr(n_elem, 1);
25004 name = gen_const_xmlChar_ptr(n_name, 2);
25005 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025006
William M. Brackf13f77f2004-11-12 16:03:48 +000025007 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025008 desret_xmlChar_ptr(ret_val);
25009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025010 des_xmlDocPtr(n_doc, doc, 0);
25011 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025012 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
25013 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025014 xmlResetLastError();
25015 if (mem_base != xmlMemBlocks()) {
25016 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
25017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025018 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025019 printf(" %d", n_doc);
25020 printf(" %d", n_elem);
25021 printf(" %d", n_name);
25022 printf(" %d", n_value);
25023 printf("\n");
25024 }
25025 }
25026 }
25027 }
25028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025029 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025030#endif
25031
Daniel Veillard42595322004-11-08 10:52:06 +000025032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025033}
25034
25035
25036static int
25037test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025039
William M. Brack21e4ef22005-01-02 09:53:13 +000025040#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025041 int mem_base;
25042 int ret_val;
25043 xmlValidCtxtPtr ctxt; /* the validation context */
25044 int n_ctxt;
25045 xmlDocPtr doc; /* a document instance */
25046 int n_doc;
25047 xmlAttributePtr attr; /* an attribute definition */
25048 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025049
Daniel Veillardce682bc2004-11-05 17:22:25 +000025050 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25051 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25052 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25053 mem_base = xmlMemBlocks();
25054 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25055 doc = gen_xmlDocPtr(n_doc, 1);
25056 attr = gen_xmlAttributePtr(n_attr, 2);
25057
25058 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25059 desret_int(ret_val);
25060 call_tests++;
25061 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25062 des_xmlDocPtr(n_doc, doc, 1);
25063 des_xmlAttributePtr(n_attr, attr, 2);
25064 xmlResetLastError();
25065 if (mem_base != xmlMemBlocks()) {
25066 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025068 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025069 printf(" %d", n_ctxt);
25070 printf(" %d", n_doc);
25071 printf(" %d", n_attr);
25072 printf("\n");
25073 }
25074 }
25075 }
25076 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025077 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025078#endif
25079
Daniel Veillard42595322004-11-08 10:52:06 +000025080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025081}
25082
25083
25084static int
25085test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025087
William M. Brack21e4ef22005-01-02 09:53:13 +000025088#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000025089 int mem_base;
25090 int ret_val;
25091 xmlAttributeType type; /* an attribute type */
25092 int n_type;
25093 xmlChar * value; /* an attribute value */
25094 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025095
Daniel Veillard57b25162004-11-06 14:50:18 +000025096 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25097 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25098 mem_base = xmlMemBlocks();
25099 type = gen_xmlAttributeType(n_type, 0);
25100 value = gen_const_xmlChar_ptr(n_value, 1);
25101
William M. Brackf13f77f2004-11-12 16:03:48 +000025102 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025103 desret_int(ret_val);
25104 call_tests++;
25105 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025106 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025107 xmlResetLastError();
25108 if (mem_base != xmlMemBlocks()) {
25109 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025111 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025112 printf(" %d", n_type);
25113 printf(" %d", n_value);
25114 printf("\n");
25115 }
25116 }
25117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025118 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025119#endif
25120
Daniel Veillard42595322004-11-08 10:52:06 +000025121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025122}
25123
25124
25125static int
25126test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025128
William M. Brack21e4ef22005-01-02 09:53:13 +000025129#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025130 int mem_base;
25131 int ret_val;
25132 xmlValidCtxtPtr ctxt; /* the validation context */
25133 int n_ctxt;
25134 xmlDocPtr doc; /* a document instance */
25135 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025136
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025137 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25138 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25139 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025140 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25141 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025142
25143 ret_val = xmlValidateDocument(ctxt, doc);
25144 desret_int(ret_val);
25145 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025146 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25147 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025148 xmlResetLastError();
25149 if (mem_base != xmlMemBlocks()) {
25150 printf("Leak of %d blocks found in xmlValidateDocument",
25151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025152 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025153 printf(" %d", n_ctxt);
25154 printf(" %d", n_doc);
25155 printf("\n");
25156 }
25157 }
25158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025159 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025160#endif
25161
Daniel Veillard42595322004-11-08 10:52:06 +000025162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025163}
25164
25165
25166static int
25167test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025169
William M. Brack21e4ef22005-01-02 09:53:13 +000025170#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025171 int mem_base;
25172 int ret_val;
25173 xmlValidCtxtPtr ctxt; /* the validation context */
25174 int n_ctxt;
25175 xmlDocPtr doc; /* a document instance */
25176 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025177
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025178 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25179 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025181 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25182 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025183
25184 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25185 desret_int(ret_val);
25186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025187 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25188 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025189 xmlResetLastError();
25190 if (mem_base != xmlMemBlocks()) {
25191 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025193 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025194 printf(" %d", n_ctxt);
25195 printf(" %d", n_doc);
25196 printf("\n");
25197 }
25198 }
25199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025200 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025201#endif
25202
Daniel Veillard42595322004-11-08 10:52:06 +000025203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025204}
25205
25206
25207static int
25208test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025210
William M. Brack21e4ef22005-01-02 09:53:13 +000025211#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025212 int mem_base;
25213 int ret_val;
25214 xmlValidCtxtPtr ctxt; /* the validation context */
25215 int n_ctxt;
25216 xmlDocPtr doc; /* a document instance */
25217 int n_doc;
25218 xmlDtdPtr dtd; /* a dtd instance */
25219 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025220
Daniel Veillard27f20102004-11-05 11:50:11 +000025221 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25222 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25223 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25224 mem_base = xmlMemBlocks();
25225 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25226 doc = gen_xmlDocPtr(n_doc, 1);
25227 dtd = gen_xmlDtdPtr(n_dtd, 2);
25228
25229 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25230 desret_int(ret_val);
25231 call_tests++;
25232 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25233 des_xmlDocPtr(n_doc, doc, 1);
25234 des_xmlDtdPtr(n_dtd, dtd, 2);
25235 xmlResetLastError();
25236 if (mem_base != xmlMemBlocks()) {
25237 printf("Leak of %d blocks found in xmlValidateDtd",
25238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025239 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025240 printf(" %d", n_ctxt);
25241 printf(" %d", n_doc);
25242 printf(" %d", n_dtd);
25243 printf("\n");
25244 }
25245 }
25246 }
25247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025248 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025249#endif
25250
Daniel Veillard42595322004-11-08 10:52:06 +000025251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025252}
25253
25254
25255static int
25256test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025258
William M. Brack21e4ef22005-01-02 09:53:13 +000025259#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025260 int mem_base;
25261 int ret_val;
25262 xmlValidCtxtPtr ctxt; /* the validation context */
25263 int n_ctxt;
25264 xmlDocPtr doc; /* a document instance */
25265 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025266
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025267 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25268 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25269 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025270 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25271 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025272
25273 ret_val = xmlValidateDtdFinal(ctxt, doc);
25274 desret_int(ret_val);
25275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025276 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25277 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025278 xmlResetLastError();
25279 if (mem_base != xmlMemBlocks()) {
25280 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025282 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025283 printf(" %d", n_ctxt);
25284 printf(" %d", n_doc);
25285 printf("\n");
25286 }
25287 }
25288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025289 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025290#endif
25291
Daniel Veillard42595322004-11-08 10:52:06 +000025292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025293}
25294
25295
25296static int
25297test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025299
William M. Brack21e4ef22005-01-02 09:53:13 +000025300#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025301 int mem_base;
25302 int ret_val;
25303 xmlValidCtxtPtr ctxt; /* the validation context */
25304 int n_ctxt;
25305 xmlDocPtr doc; /* a document instance */
25306 int n_doc;
25307 xmlNodePtr elem; /* an element instance */
25308 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025309
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025310 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25312 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25313 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025314 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25315 doc = gen_xmlDocPtr(n_doc, 1);
25316 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025317
25318 ret_val = xmlValidateElement(ctxt, doc, elem);
25319 desret_int(ret_val);
25320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025321 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25322 des_xmlDocPtr(n_doc, doc, 1);
25323 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025324 xmlResetLastError();
25325 if (mem_base != xmlMemBlocks()) {
25326 printf("Leak of %d blocks found in xmlValidateElement",
25327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025328 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025329 printf(" %d", n_ctxt);
25330 printf(" %d", n_doc);
25331 printf(" %d", n_elem);
25332 printf("\n");
25333 }
25334 }
25335 }
25336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025337 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025338#endif
25339
Daniel Veillard42595322004-11-08 10:52:06 +000025340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025341}
25342
25343
25344static int
25345test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025347
William M. Brack21e4ef22005-01-02 09:53:13 +000025348#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025349 int mem_base;
25350 int ret_val;
25351 xmlValidCtxtPtr ctxt; /* the validation context */
25352 int n_ctxt;
25353 xmlDocPtr doc; /* a document instance */
25354 int n_doc;
25355 xmlElementPtr elem; /* an element definition */
25356 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025357
Daniel Veillardce682bc2004-11-05 17:22:25 +000025358 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25359 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25360 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25361 mem_base = xmlMemBlocks();
25362 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25363 doc = gen_xmlDocPtr(n_doc, 1);
25364 elem = gen_xmlElementPtr(n_elem, 2);
25365
25366 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25367 desret_int(ret_val);
25368 call_tests++;
25369 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25370 des_xmlDocPtr(n_doc, doc, 1);
25371 des_xmlElementPtr(n_elem, elem, 2);
25372 xmlResetLastError();
25373 if (mem_base != xmlMemBlocks()) {
25374 printf("Leak of %d blocks found in xmlValidateElementDecl",
25375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025376 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025377 printf(" %d", n_ctxt);
25378 printf(" %d", n_doc);
25379 printf(" %d", n_elem);
25380 printf("\n");
25381 }
25382 }
25383 }
25384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025385 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025386#endif
25387
Daniel Veillard42595322004-11-08 10:52:06 +000025388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025389}
25390
25391
25392static int
25393test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025395
William M. Brack21e4ef22005-01-02 09:53:13 +000025396#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025397 int mem_base;
25398 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025399 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025400 int n_value;
25401
25402 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25403 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025404 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025405
William M. Brackf13f77f2004-11-12 16:03:48 +000025406 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025407 desret_int(ret_val);
25408 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025409 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025410 xmlResetLastError();
25411 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025412 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025414 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025415 printf(" %d", n_value);
25416 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025417 }
25418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025419 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlValidateNamesValue(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 Names 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 = xmlValidateNamesValue((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 xmlValidateNamesValue",
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_xmlValidateNmtokenValue(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 Nmtoken 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 = xmlValidateNmtokenValue((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 xmlValidateNmtokenValue",
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_xmlValidateNmtokensValue(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 Nmtokens 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 = xmlValidateNmtokensValue((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 xmlValidateNmtokensValue",
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_xmlValidateNotationDecl(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 Veillardce682bc2004-11-05 17:22:25 +000025533 int mem_base;
25534 int ret_val;
25535 xmlValidCtxtPtr ctxt; /* the validation context */
25536 int n_ctxt;
25537 xmlDocPtr doc; /* a document instance */
25538 int n_doc;
25539 xmlNotationPtr nota; /* a notation definition */
25540 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025541
Daniel Veillardce682bc2004-11-05 17:22:25 +000025542 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25543 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25544 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25545 mem_base = xmlMemBlocks();
25546 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25547 doc = gen_xmlDocPtr(n_doc, 1);
25548 nota = gen_xmlNotationPtr(n_nota, 2);
25549
25550 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25551 desret_int(ret_val);
25552 call_tests++;
25553 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25554 des_xmlDocPtr(n_doc, doc, 1);
25555 des_xmlNotationPtr(n_nota, nota, 2);
25556 xmlResetLastError();
25557 if (mem_base != xmlMemBlocks()) {
25558 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025560 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025561 printf(" %d", n_ctxt);
25562 printf(" %d", n_doc);
25563 printf(" %d", n_nota);
25564 printf("\n");
25565 }
25566 }
25567 }
25568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025569 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025570#endif
25571
Daniel Veillard42595322004-11-08 10:52:06 +000025572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025573}
25574
25575
25576static int
25577test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025579
William M. Brack21e4ef22005-01-02 09:53:13 +000025580#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025581 int mem_base;
25582 int ret_val;
25583 xmlValidCtxtPtr ctxt; /* the validation context */
25584 int n_ctxt;
25585 xmlDocPtr doc; /* the document */
25586 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025587 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025588 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025589
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025590 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25591 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25592 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25593 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025594 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25595 doc = gen_xmlDocPtr(n_doc, 1);
25596 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025597
William M. Brackf13f77f2004-11-12 16:03:48 +000025598 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025599 desret_int(ret_val);
25600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025601 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25602 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025603 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025604 xmlResetLastError();
25605 if (mem_base != xmlMemBlocks()) {
25606 printf("Leak of %d blocks found in xmlValidateNotationUse",
25607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025608 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025609 printf(" %d", n_ctxt);
25610 printf(" %d", n_doc);
25611 printf(" %d", n_notationName);
25612 printf("\n");
25613 }
25614 }
25615 }
25616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025617 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025618#endif
25619
Daniel Veillard42595322004-11-08 10:52:06 +000025620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025621}
25622
25623
25624static int
25625test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025627
William M. Brack21e4ef22005-01-02 09:53:13 +000025628#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025629 int mem_base;
25630 int ret_val;
25631 xmlValidCtxtPtr ctxt; /* the validation context */
25632 int n_ctxt;
25633 xmlDocPtr doc; /* a document instance */
25634 int n_doc;
25635 xmlNodePtr elem; /* an element instance */
25636 int n_elem;
25637 xmlAttrPtr attr; /* an attribute instance */
25638 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025639 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025640 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025641
Daniel Veillardce244ad2004-11-05 10:03:46 +000025642 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25643 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25644 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25645 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25646 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25647 mem_base = xmlMemBlocks();
25648 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25649 doc = gen_xmlDocPtr(n_doc, 1);
25650 elem = gen_xmlNodePtr(n_elem, 2);
25651 attr = gen_xmlAttrPtr(n_attr, 3);
25652 value = gen_const_xmlChar_ptr(n_value, 4);
25653
William M. Brackf13f77f2004-11-12 16:03:48 +000025654 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025655 desret_int(ret_val);
25656 call_tests++;
25657 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25658 des_xmlDocPtr(n_doc, doc, 1);
25659 des_xmlNodePtr(n_elem, elem, 2);
25660 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025661 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025662 xmlResetLastError();
25663 if (mem_base != xmlMemBlocks()) {
25664 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025666 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025667 printf(" %d", n_ctxt);
25668 printf(" %d", n_doc);
25669 printf(" %d", n_elem);
25670 printf(" %d", n_attr);
25671 printf(" %d", n_value);
25672 printf("\n");
25673 }
25674 }
25675 }
25676 }
25677 }
25678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025679 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025680#endif
25681
Daniel Veillard42595322004-11-08 10:52:06 +000025682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025683}
25684
25685
25686static int
25687test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025689
William M. Brack21e4ef22005-01-02 09:53:13 +000025690#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025691 int mem_base;
25692 int ret_val;
25693 xmlValidCtxtPtr ctxt; /* the validation context */
25694 int n_ctxt;
25695 xmlDocPtr doc; /* a document instance */
25696 int n_doc;
25697 xmlNodePtr elem; /* an element instance */
25698 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025699
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25701 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25702 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25703 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025704 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25705 doc = gen_xmlDocPtr(n_doc, 1);
25706 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025707
25708 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25709 desret_int(ret_val);
25710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025711 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25712 des_xmlDocPtr(n_doc, doc, 1);
25713 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025714 xmlResetLastError();
25715 if (mem_base != xmlMemBlocks()) {
25716 printf("Leak of %d blocks found in xmlValidateOneElement",
25717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025718 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025719 printf(" %d", n_ctxt);
25720 printf(" %d", n_doc);
25721 printf(" %d", n_elem);
25722 printf("\n");
25723 }
25724 }
25725 }
25726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025727 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025728#endif
25729
Daniel Veillard42595322004-11-08 10:52:06 +000025730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025731}
25732
25733
25734static int
25735test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025737
William M. Brack21e4ef22005-01-02 09:53:13 +000025738#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025739 int mem_base;
25740 int ret_val;
25741 xmlValidCtxtPtr ctxt; /* the validation context */
25742 int n_ctxt;
25743 xmlDocPtr doc; /* a document instance */
25744 int n_doc;
25745 xmlNodePtr elem; /* an element instance */
25746 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025747 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025748 int n_prefix;
25749 xmlNsPtr ns; /* an namespace declaration instance */
25750 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025751 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025752 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025753
Daniel Veillard27f20102004-11-05 11:50:11 +000025754 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25755 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25756 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25757 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25758 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25759 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25760 mem_base = xmlMemBlocks();
25761 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25762 doc = gen_xmlDocPtr(n_doc, 1);
25763 elem = gen_xmlNodePtr(n_elem, 2);
25764 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25765 ns = gen_xmlNsPtr(n_ns, 4);
25766 value = gen_const_xmlChar_ptr(n_value, 5);
25767
William M. Brackf13f77f2004-11-12 16:03:48 +000025768 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025769 desret_int(ret_val);
25770 call_tests++;
25771 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25772 des_xmlDocPtr(n_doc, doc, 1);
25773 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025774 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025775 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025776 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025777 xmlResetLastError();
25778 if (mem_base != xmlMemBlocks()) {
25779 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025781 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025782 printf(" %d", n_ctxt);
25783 printf(" %d", n_doc);
25784 printf(" %d", n_elem);
25785 printf(" %d", n_prefix);
25786 printf(" %d", n_ns);
25787 printf(" %d", n_value);
25788 printf("\n");
25789 }
25790 }
25791 }
25792 }
25793 }
25794 }
25795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025796 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025797#endif
25798
Daniel Veillard42595322004-11-08 10:52:06 +000025799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025800}
25801
25802
25803static int
25804test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025806
William M. Brack21e4ef22005-01-02 09:53:13 +000025807#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025808 int mem_base;
25809 int ret_val;
25810 xmlValidCtxtPtr ctxt; /* the validation context */
25811 int n_ctxt;
25812 xmlDocPtr doc; /* a document instance */
25813 int n_doc;
25814 xmlNodePtr elem; /* an element instance */
25815 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025816 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025817 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025818
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025819 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25820 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25821 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25822 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25823 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025824 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25825 doc = gen_xmlDocPtr(n_doc, 1);
25826 elem = gen_xmlNodePtr(n_elem, 2);
25827 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025828
William M. Brackf13f77f2004-11-12 16:03:48 +000025829 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025830 desret_int(ret_val);
25831 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025832 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25833 des_xmlDocPtr(n_doc, doc, 1);
25834 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025835 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025836 xmlResetLastError();
25837 if (mem_base != xmlMemBlocks()) {
25838 printf("Leak of %d blocks found in xmlValidatePopElement",
25839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025840 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025841 printf(" %d", n_ctxt);
25842 printf(" %d", n_doc);
25843 printf(" %d", n_elem);
25844 printf(" %d", n_qname);
25845 printf("\n");
25846 }
25847 }
25848 }
25849 }
25850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025851 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025852#endif
25853
Daniel Veillard42595322004-11-08 10:52:06 +000025854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025855}
25856
25857
25858static int
25859test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025861
William M. Brack21e4ef22005-01-02 09:53:13 +000025862#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025863 int mem_base;
25864 int ret_val;
25865 xmlValidCtxtPtr ctxt; /* the validation context */
25866 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025867 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025868 int n_data;
25869 int len; /* the lenght of the data */
25870 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025871
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025872 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25873 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25874 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025876 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25877 data = gen_const_xmlChar_ptr(n_data, 1);
25878 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025879
William M. Brackf13f77f2004-11-12 16:03:48 +000025880 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025881 desret_int(ret_val);
25882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025883 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025884 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025885 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025886 xmlResetLastError();
25887 if (mem_base != xmlMemBlocks()) {
25888 printf("Leak of %d blocks found in xmlValidatePushCData",
25889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025890 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025891 printf(" %d", n_ctxt);
25892 printf(" %d", n_data);
25893 printf(" %d", n_len);
25894 printf("\n");
25895 }
25896 }
25897 }
25898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025899 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025900#endif
25901
Daniel Veillard42595322004-11-08 10:52:06 +000025902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025903}
25904
25905
25906static int
25907test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025909
William M. Brack21e4ef22005-01-02 09:53:13 +000025910#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025911 int mem_base;
25912 int ret_val;
25913 xmlValidCtxtPtr ctxt; /* the validation context */
25914 int n_ctxt;
25915 xmlDocPtr doc; /* a document instance */
25916 int n_doc;
25917 xmlNodePtr elem; /* an element instance */
25918 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025919 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025920 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025921
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025922 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25923 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25924 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25925 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025927 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25928 doc = gen_xmlDocPtr(n_doc, 1);
25929 elem = gen_xmlNodePtr(n_elem, 2);
25930 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025931
William M. Brackf13f77f2004-11-12 16:03:48 +000025932 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025933 desret_int(ret_val);
25934 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025935 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25936 des_xmlDocPtr(n_doc, doc, 1);
25937 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025938 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025939 xmlResetLastError();
25940 if (mem_base != xmlMemBlocks()) {
25941 printf("Leak of %d blocks found in xmlValidatePushElement",
25942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025943 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025944 printf(" %d", n_ctxt);
25945 printf(" %d", n_doc);
25946 printf(" %d", n_elem);
25947 printf(" %d", n_qname);
25948 printf("\n");
25949 }
25950 }
25951 }
25952 }
25953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025954 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025955#endif
25956
Daniel Veillard42595322004-11-08 10:52:06 +000025957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025958}
25959
25960
25961static int
25962test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025964
William M. Brack21e4ef22005-01-02 09:53:13 +000025965#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025966 int mem_base;
25967 int ret_val;
25968 xmlValidCtxtPtr ctxt; /* the validation context */
25969 int n_ctxt;
25970 xmlDocPtr doc; /* a document instance */
25971 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025972
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025973 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25974 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025976 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25977 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025978
25979 ret_val = xmlValidateRoot(ctxt, doc);
25980 desret_int(ret_val);
25981 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025982 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25983 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025984 xmlResetLastError();
25985 if (mem_base != xmlMemBlocks()) {
25986 printf("Leak of %d blocks found in xmlValidateRoot",
25987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025988 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025989 printf(" %d", n_ctxt);
25990 printf(" %d", n_doc);
25991 printf("\n");
25992 }
25993 }
25994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025995 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025996#endif
25997
Daniel Veillard42595322004-11-08 10:52:06 +000025998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025999}
26000
26001static int
26002test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026004
Daniel Veillard2ae13382005-01-25 23:45:06 +000026005 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026006 test_ret += test_xmlAddAttributeDecl();
26007 test_ret += test_xmlAddElementDecl();
26008 test_ret += test_xmlAddID();
26009 test_ret += test_xmlAddNotationDecl();
26010 test_ret += test_xmlAddRef();
26011 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026012 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026013 test_ret += test_xmlCopyElementContent();
26014 test_ret += test_xmlCopyElementTable();
26015 test_ret += test_xmlCopyEnumeration();
26016 test_ret += test_xmlCopyNotationTable();
26017 test_ret += test_xmlCreateEnumeration();
26018 test_ret += test_xmlDumpAttributeDecl();
26019 test_ret += test_xmlDumpAttributeTable();
26020 test_ret += test_xmlDumpElementDecl();
26021 test_ret += test_xmlDumpElementTable();
26022 test_ret += test_xmlDumpNotationDecl();
26023 test_ret += test_xmlDumpNotationTable();
26024 test_ret += test_xmlGetDtdAttrDesc();
26025 test_ret += test_xmlGetDtdElementDesc();
26026 test_ret += test_xmlGetDtdNotationDesc();
26027 test_ret += test_xmlGetDtdQAttrDesc();
26028 test_ret += test_xmlGetDtdQElementDesc();
26029 test_ret += test_xmlGetID();
26030 test_ret += test_xmlGetRefs();
26031 test_ret += test_xmlIsID();
26032 test_ret += test_xmlIsMixedElement();
26033 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026034 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026035 test_ret += test_xmlNewElementContent();
26036 test_ret += test_xmlNewValidCtxt();
26037 test_ret += test_xmlRemoveID();
26038 test_ret += test_xmlRemoveRef();
26039 test_ret += test_xmlSnprintfElementContent();
26040 test_ret += test_xmlSprintfElementContent();
26041 test_ret += test_xmlValidBuildContentModel();
26042 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26043 test_ret += test_xmlValidGetPotentialChildren();
26044 test_ret += test_xmlValidGetValidElements();
26045 test_ret += test_xmlValidNormalizeAttributeValue();
26046 test_ret += test_xmlValidateAttributeDecl();
26047 test_ret += test_xmlValidateAttributeValue();
26048 test_ret += test_xmlValidateDocument();
26049 test_ret += test_xmlValidateDocumentFinal();
26050 test_ret += test_xmlValidateDtd();
26051 test_ret += test_xmlValidateDtdFinal();
26052 test_ret += test_xmlValidateElement();
26053 test_ret += test_xmlValidateElementDecl();
26054 test_ret += test_xmlValidateNameValue();
26055 test_ret += test_xmlValidateNamesValue();
26056 test_ret += test_xmlValidateNmtokenValue();
26057 test_ret += test_xmlValidateNmtokensValue();
26058 test_ret += test_xmlValidateNotationDecl();
26059 test_ret += test_xmlValidateNotationUse();
26060 test_ret += test_xmlValidateOneAttribute();
26061 test_ret += test_xmlValidateOneElement();
26062 test_ret += test_xmlValidateOneNamespace();
26063 test_ret += test_xmlValidatePopElement();
26064 test_ret += test_xmlValidatePushCData();
26065 test_ret += test_xmlValidatePushElement();
26066 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026067
Daniel Veillard42595322004-11-08 10:52:06 +000026068 if (test_ret != 0)
26069 printf("Module valid: %d errors\n", test_ret);
26070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026071}
26072
26073static int
26074test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026076
26077
26078 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026080}
26081
26082
26083static int
26084test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026086
William M. Brack21e4ef22005-01-02 09:53:13 +000026087#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026088 int mem_base;
26089 int ret_val;
26090 xmlDocPtr doc; /* an XML document */
26091 int n_doc;
26092
26093 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026095 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026096
26097 ret_val = xmlXIncludeProcess(doc);
26098 desret_int(ret_val);
26099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026100 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026101 xmlResetLastError();
26102 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026103 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026105 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026106 printf(" %d", n_doc);
26107 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026108 }
26109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026110 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111#endif
26112
Daniel Veillard42595322004-11-08 10:52:06 +000026113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026114}
26115
26116
26117static int
26118test_xmlXIncludeProcessFlags(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 int flags; /* a set of xmlParserOption used for parsing XML includes */
26127 int n_flags;
26128
26129 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26130 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026132 doc = gen_xmlDocPtr(n_doc, 0);
26133 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026134
26135 ret_val = xmlXIncludeProcessFlags(doc, flags);
26136 desret_int(ret_val);
26137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026138 des_xmlDocPtr(n_doc, doc, 0);
26139 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026140 xmlResetLastError();
26141 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026142 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026144 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026145 printf(" %d", n_doc);
26146 printf(" %d", n_flags);
26147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026148 }
26149 }
26150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026151 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026152#endif
26153
Daniel Veillard42595322004-11-08 10:52:06 +000026154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026155}
26156
Daniel Veillarda521d282004-11-09 14:59:59 +000026157#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026158
Daniel Veillardce682bc2004-11-05 17:22:25 +000026159#define gen_nb_xmlXIncludeCtxtPtr 1
26160static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26161 return(NULL);
26162}
26163static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26164}
Daniel Veillarda521d282004-11-09 14:59:59 +000026165#endif
26166
Daniel Veillardce682bc2004-11-05 17:22:25 +000026167
Daniel Veillardd93f6252004-11-02 15:53:51 +000026168static int
26169test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026171
William M. Brack21e4ef22005-01-02 09:53:13 +000026172#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026173 int mem_base;
26174 int ret_val;
26175 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26176 int n_ctxt;
26177 xmlNodePtr node; /* a node in an XML document */
26178 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026179
Daniel Veillardce682bc2004-11-05 17:22:25 +000026180 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26181 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26182 mem_base = xmlMemBlocks();
26183 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26184 node = gen_xmlNodePtr(n_node, 1);
26185
26186 ret_val = xmlXIncludeProcessNode(ctxt, node);
26187 desret_int(ret_val);
26188 call_tests++;
26189 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26190 des_xmlNodePtr(n_node, node, 1);
26191 xmlResetLastError();
26192 if (mem_base != xmlMemBlocks()) {
26193 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026195 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026196 printf(" %d", n_ctxt);
26197 printf(" %d", n_node);
26198 printf("\n");
26199 }
26200 }
26201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026202 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026203#endif
26204
Daniel Veillard42595322004-11-08 10:52:06 +000026205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026206}
26207
26208
26209static int
26210test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026212
William M. Brack21e4ef22005-01-02 09:53:13 +000026213#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026214 int mem_base;
26215 int ret_val;
26216 xmlNodePtr tree; /* a node in an XML document */
26217 int n_tree;
26218
26219 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026221 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026222
26223 ret_val = xmlXIncludeProcessTree(tree);
26224 desret_int(ret_val);
26225 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026226 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026227 xmlResetLastError();
26228 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026229 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026231 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026232 printf(" %d", n_tree);
26233 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026234 }
26235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026236 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlXIncludeProcessTreeFlags(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 int flags; /* a set of xmlParserOption used for parsing XML includes */
26253 int n_flags;
26254
26255 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26256 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026258 tree = gen_xmlNodePtr(n_tree, 0);
26259 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026260
26261 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26262 desret_int(ret_val);
26263 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026264 des_xmlNodePtr(n_tree, tree, 0);
26265 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026266 xmlResetLastError();
26267 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026268 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026271 printf(" %d", n_tree);
26272 printf(" %d", n_flags);
26273 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026274 }
26275 }
26276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026277 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026278#endif
26279
Daniel Veillard42595322004-11-08 10:52:06 +000026280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026281}
26282
26283
26284static int
26285test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026287
William M. Brack21e4ef22005-01-02 09:53:13 +000026288#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026289 int mem_base;
26290 int ret_val;
26291 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26292 int n_ctxt;
26293 int flags; /* a set of xmlParserOption used for parsing XML includes */
26294 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026295
Daniel Veillardce682bc2004-11-05 17:22:25 +000026296 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26297 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26298 mem_base = xmlMemBlocks();
26299 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26300 flags = gen_int(n_flags, 1);
26301
26302 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26303 desret_int(ret_val);
26304 call_tests++;
26305 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26306 des_int(n_flags, flags, 1);
26307 xmlResetLastError();
26308 if (mem_base != xmlMemBlocks()) {
26309 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026311 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026312 printf(" %d", n_ctxt);
26313 printf(" %d", n_flags);
26314 printf("\n");
26315 }
26316 }
26317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026318 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026319#endif
26320
Daniel Veillard42595322004-11-08 10:52:06 +000026321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026322}
26323
26324static int
26325test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026327
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026328 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026329 test_ret += test_xmlXIncludeNewContext();
26330 test_ret += test_xmlXIncludeProcess();
26331 test_ret += test_xmlXIncludeProcessFlags();
26332 test_ret += test_xmlXIncludeProcessNode();
26333 test_ret += test_xmlXIncludeProcessTree();
26334 test_ret += test_xmlXIncludeProcessTreeFlags();
26335 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026336
Daniel Veillard42595322004-11-08 10:52:06 +000026337 if (test_ret != 0)
26338 printf("Module xinclude: %d errors\n", test_ret);
26339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026340}
26341
26342static int
26343test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026345
William M. Brack21e4ef22005-01-02 09:53:13 +000026346#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026347 int mem_base;
26348 xmlOutputBufferPtr ret_val;
26349 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26350 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026351
Daniel Veillard3d95c732004-11-06 22:25:14 +000026352 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26353 mem_base = xmlMemBlocks();
26354 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26355
26356 ret_val = xmlAllocOutputBuffer(encoder);
26357 desret_xmlOutputBufferPtr(ret_val);
26358 call_tests++;
26359 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26360 xmlResetLastError();
26361 if (mem_base != xmlMemBlocks()) {
26362 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026364 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026365 printf(" %d", n_encoder);
26366 printf("\n");
26367 }
26368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026369 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026370#endif
26371
Daniel Veillard42595322004-11-08 10:52:06 +000026372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026373}
26374
26375
26376static int
26377test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026380 int mem_base;
26381 xmlParserInputBufferPtr ret_val;
26382 xmlCharEncoding enc; /* the charset encoding if known */
26383 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026384
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026385 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26386 mem_base = xmlMemBlocks();
26387 enc = gen_xmlCharEncoding(n_enc, 0);
26388
26389 ret_val = xmlAllocParserInputBuffer(enc);
26390 desret_xmlParserInputBufferPtr(ret_val);
26391 call_tests++;
26392 des_xmlCharEncoding(n_enc, enc, 0);
26393 xmlResetLastError();
26394 if (mem_base != xmlMemBlocks()) {
26395 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026397 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026398 printf(" %d", n_enc);
26399 printf("\n");
26400 }
26401 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026403
Daniel Veillard42595322004-11-08 10:52:06 +000026404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026405}
26406
26407
26408static int
26409test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026411
26412 int mem_base;
26413 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026414 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026415 int n_path;
26416
26417 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26418 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026419 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026420
William M. Brackf13f77f2004-11-12 16:03:48 +000026421 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026422 desret_int(ret_val);
26423 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026424 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026425 xmlResetLastError();
26426 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026427 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026429 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026430 printf(" %d", n_path);
26431 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026432 }
26433 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026434 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026435
Daniel Veillard42595322004-11-08 10:52:06 +000026436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026437}
26438
26439
26440static int
26441test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026443
Daniel Veillard42595322004-11-08 10:52:06 +000026444 int mem_base;
26445 xmlParserInputPtr ret_val;
26446 xmlParserCtxtPtr ctxt; /* an XML parser context */
26447 int n_ctxt;
26448 xmlParserInputPtr ret; /* an XML parser input */
26449 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026450
Daniel Veillard42595322004-11-08 10:52:06 +000026451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26452 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26453 mem_base = xmlMemBlocks();
26454 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26455 ret = gen_xmlParserInputPtr(n_ret, 1);
26456
26457 ret_val = xmlCheckHTTPInput(ctxt, ret);
26458 desret_xmlParserInputPtr(ret_val);
26459 call_tests++;
26460 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26461 des_xmlParserInputPtr(n_ret, ret, 1);
26462 xmlResetLastError();
26463 if (mem_base != xmlMemBlocks()) {
26464 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26465 xmlMemBlocks() - mem_base);
26466 test_ret++;
26467 printf(" %d", n_ctxt);
26468 printf(" %d", n_ret);
26469 printf("\n");
26470 }
26471 }
26472 }
Daniel Veillard42595322004-11-08 10:52:06 +000026473 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026474
Daniel Veillard42595322004-11-08 10:52:06 +000026475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026476}
26477
26478
26479static int
26480test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026482
26483 int mem_base;
26484
26485 mem_base = xmlMemBlocks();
26486
26487 xmlCleanupInputCallbacks();
26488 call_tests++;
26489 xmlResetLastError();
26490 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026491 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026493 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026494 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026495 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026496 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026497
Daniel Veillard42595322004-11-08 10:52:06 +000026498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026499}
26500
26501
26502static int
26503test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026505
William M. Brack21e4ef22005-01-02 09:53:13 +000026506#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026507 int mem_base;
26508
26509 mem_base = xmlMemBlocks();
26510
26511 xmlCleanupOutputCallbacks();
26512 call_tests++;
26513 xmlResetLastError();
26514 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026515 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026517 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026518 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026520 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026521#endif
26522
Daniel Veillard42595322004-11-08 10:52:06 +000026523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026524}
26525
26526
26527static int
26528test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026530
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026531 int mem_base;
26532 int ret_val;
26533 void * context; /* the I/O context */
26534 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026535
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026536 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026538 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026539
26540 ret_val = xmlFileClose(context);
26541 desret_int(ret_val);
26542 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026543 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026544 xmlResetLastError();
26545 if (mem_base != xmlMemBlocks()) {
26546 printf("Leak of %d blocks found in xmlFileClose",
26547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026548 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026549 printf(" %d", n_context);
26550 printf("\n");
26551 }
26552 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026554
Daniel Veillard42595322004-11-08 10:52:06 +000026555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026556}
26557
26558
26559static int
26560test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026562
26563 int mem_base;
26564 int ret_val;
26565 const char * filename; /* the URI for matching */
26566 int n_filename;
26567
26568 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026570 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026571
26572 ret_val = xmlFileMatch(filename);
26573 desret_int(ret_val);
26574 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026575 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026576 xmlResetLastError();
26577 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026578 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026580 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026581 printf(" %d", n_filename);
26582 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026583 }
26584 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026585 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026586
Daniel Veillard42595322004-11-08 10:52:06 +000026587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026588}
26589
26590
26591static int
26592test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026594
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026595 int mem_base;
26596 void * ret_val;
26597 const char * filename; /* the URI for matching */
26598 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026599
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026600 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026602 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026603
26604 ret_val = xmlFileOpen(filename);
26605 desret_void_ptr(ret_val);
26606 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026607 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026608 xmlResetLastError();
26609 if (mem_base != xmlMemBlocks()) {
26610 printf("Leak of %d blocks found in xmlFileOpen",
26611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026612 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026613 printf(" %d", n_filename);
26614 printf("\n");
26615 }
26616 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026618
Daniel Veillard42595322004-11-08 10:52:06 +000026619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026620}
26621
26622
26623static int
26624test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026626
Daniel Veillardce682bc2004-11-05 17:22:25 +000026627 int mem_base;
26628 int ret_val;
26629 void * context; /* the I/O context */
26630 int n_context;
26631 char * buffer; /* where to drop data */
26632 int n_buffer;
26633 int len; /* number of bytes to write */
26634 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026635
Daniel Veillardce682bc2004-11-05 17:22:25 +000026636 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26637 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26638 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26639 mem_base = xmlMemBlocks();
26640 context = gen_void_ptr(n_context, 0);
26641 buffer = gen_char_ptr(n_buffer, 1);
26642 len = gen_int(n_len, 2);
26643
26644 ret_val = xmlFileRead(context, buffer, len);
26645 desret_int(ret_val);
26646 call_tests++;
26647 des_void_ptr(n_context, context, 0);
26648 des_char_ptr(n_buffer, buffer, 1);
26649 des_int(n_len, len, 2);
26650 xmlResetLastError();
26651 if (mem_base != xmlMemBlocks()) {
26652 printf("Leak of %d blocks found in xmlFileRead",
26653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026654 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026655 printf(" %d", n_context);
26656 printf(" %d", n_buffer);
26657 printf(" %d", n_len);
26658 printf("\n");
26659 }
26660 }
26661 }
26662 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026663 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026664
Daniel Veillard42595322004-11-08 10:52:06 +000026665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026666}
26667
26668
26669static int
26670test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026672
William M. Brack21e4ef22005-01-02 09:53:13 +000026673#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026674 int mem_base;
26675 int ret_val;
26676 void * context; /* the I/O context */
26677 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026678
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026679 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026681 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026682
26683 ret_val = xmlIOFTPClose(context);
26684 desret_int(ret_val);
26685 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026686 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026687 xmlResetLastError();
26688 if (mem_base != xmlMemBlocks()) {
26689 printf("Leak of %d blocks found in xmlIOFTPClose",
26690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026691 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026692 printf(" %d", n_context);
26693 printf("\n");
26694 }
26695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026696 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026697#endif
26698
Daniel Veillard42595322004-11-08 10:52:06 +000026699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026700}
26701
26702
26703static int
26704test_xmlIOFTPMatch(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 Veillardd93f6252004-11-02 15:53:51 +000026708 int mem_base;
26709 int ret_val;
26710 const char * filename; /* the URI for matching */
26711 int n_filename;
26712
26713 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026715 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026716
26717 ret_val = xmlIOFTPMatch(filename);
26718 desret_int(ret_val);
26719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026720 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026721 xmlResetLastError();
26722 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026723 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026725 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026726 printf(" %d", n_filename);
26727 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026728 }
26729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026730 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlIOFTPOpen(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 Veillardb1b3a3e2004-11-03 23:25:47 +000026742 int mem_base;
26743 void * ret_val;
26744 const char * filename; /* the URI for matching */
26745 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026746
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026747 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 Veillardb1b3a3e2004-11-03 23:25:47 +000026750
26751 ret_val = xmlIOFTPOpen(filename);
26752 desret_void_ptr(ret_val);
26753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026754 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026755 xmlResetLastError();
26756 if (mem_base != xmlMemBlocks()) {
26757 printf("Leak of %d blocks found in xmlIOFTPOpen",
26758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026759 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026760 printf(" %d", n_filename);
26761 printf("\n");
26762 }
26763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026764 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +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_xmlIOFTPRead(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 Veillardce682bc2004-11-05 17:22:25 +000026776 int mem_base;
26777 int ret_val;
26778 void * context; /* the I/O context */
26779 int n_context;
26780 char * buffer; /* where to drop data */
26781 int n_buffer;
26782 int len; /* number of bytes to write */
26783 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026784
Daniel Veillardce682bc2004-11-05 17:22:25 +000026785 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26786 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26787 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26788 mem_base = xmlMemBlocks();
26789 context = gen_void_ptr(n_context, 0);
26790 buffer = gen_char_ptr(n_buffer, 1);
26791 len = gen_int(n_len, 2);
26792
26793 ret_val = xmlIOFTPRead(context, buffer, len);
26794 desret_int(ret_val);
26795 call_tests++;
26796 des_void_ptr(n_context, context, 0);
26797 des_char_ptr(n_buffer, buffer, 1);
26798 des_int(n_len, len, 2);
26799 xmlResetLastError();
26800 if (mem_base != xmlMemBlocks()) {
26801 printf("Leak of %d blocks found in xmlIOFTPRead",
26802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026803 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026804 printf(" %d", n_context);
26805 printf(" %d", n_buffer);
26806 printf(" %d", n_len);
26807 printf("\n");
26808 }
26809 }
26810 }
26811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026812 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026813#endif
26814
Daniel Veillard42595322004-11-08 10:52:06 +000026815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026816}
26817
26818
26819static int
26820test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026822
William M. Brack21e4ef22005-01-02 09:53:13 +000026823#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026824 int mem_base;
26825 int ret_val;
26826 void * context; /* the I/O context */
26827 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026828
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026829 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026831 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026832
26833 ret_val = xmlIOHTTPClose(context);
26834 desret_int(ret_val);
26835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026836 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026837 xmlResetLastError();
26838 if (mem_base != xmlMemBlocks()) {
26839 printf("Leak of %d blocks found in xmlIOHTTPClose",
26840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026841 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026842 printf(" %d", n_context);
26843 printf("\n");
26844 }
26845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026846 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +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_xmlIOHTTPMatch(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 Veillardd93f6252004-11-02 15:53:51 +000026858 int mem_base;
26859 int ret_val;
26860 const char * filename; /* the URI for matching */
26861 int n_filename;
26862
26863 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026865 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026866
26867 ret_val = xmlIOHTTPMatch(filename);
26868 desret_int(ret_val);
26869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026870 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026871 xmlResetLastError();
26872 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026873 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026875 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026876 printf(" %d", n_filename);
26877 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026878 }
26879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026880 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlIOHTTPOpen(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 Veillardb1b3a3e2004-11-03 23:25:47 +000026892 int mem_base;
26893 void * ret_val;
26894 const char * filename; /* the URI for matching */
26895 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026896
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026897 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 Veillardb1b3a3e2004-11-03 23:25:47 +000026900
26901 ret_val = xmlIOHTTPOpen(filename);
26902 desret_void_ptr(ret_val);
26903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026904 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026905 xmlResetLastError();
26906 if (mem_base != xmlMemBlocks()) {
26907 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026909 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026910 printf(" %d", n_filename);
26911 printf("\n");
26912 }
26913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026914 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +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_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026924
26925
26926 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026928}
26929
26930
26931static int
26932test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026934
William M. Brack21e4ef22005-01-02 09:53:13 +000026935#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026936 int mem_base;
26937 int ret_val;
26938 void * context; /* the I/O context */
26939 int n_context;
26940 char * buffer; /* where to drop data */
26941 int n_buffer;
26942 int len; /* number of bytes to write */
26943 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026944
Daniel Veillardce682bc2004-11-05 17:22:25 +000026945 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26946 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26947 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26948 mem_base = xmlMemBlocks();
26949 context = gen_void_ptr(n_context, 0);
26950 buffer = gen_char_ptr(n_buffer, 1);
26951 len = gen_int(n_len, 2);
26952
26953 ret_val = xmlIOHTTPRead(context, buffer, len);
26954 desret_int(ret_val);
26955 call_tests++;
26956 des_void_ptr(n_context, context, 0);
26957 des_char_ptr(n_buffer, buffer, 1);
26958 des_int(n_len, len, 2);
26959 xmlResetLastError();
26960 if (mem_base != xmlMemBlocks()) {
26961 printf("Leak of %d blocks found in xmlIOHTTPRead",
26962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026963 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026964 printf(" %d", n_context);
26965 printf(" %d", n_buffer);
26966 printf(" %d", n_len);
26967 printf("\n");
26968 }
26969 }
26970 }
26971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026972 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026973#endif
26974
Daniel Veillard42595322004-11-08 10:52:06 +000026975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026976}
26977
26978
26979static int
26980test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026982
Daniel Veillard42595322004-11-08 10:52:06 +000026983 int mem_base;
26984 xmlParserInputPtr ret_val;
26985 const char * URL; /* the URL for the entity to load */
26986 int n_URL;
26987 char * ID; /* the System ID for the entity to load */
26988 int n_ID;
26989 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26990 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026991
Daniel Veillard42595322004-11-08 10:52:06 +000026992 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26993 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26994 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26995 mem_base = xmlMemBlocks();
26996 URL = gen_filepath(n_URL, 0);
26997 ID = gen_const_char_ptr(n_ID, 1);
26998 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26999
William M. Brackf13f77f2004-11-12 16:03:48 +000027000 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000027001 desret_xmlParserInputPtr(ret_val);
27002 call_tests++;
27003 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027004 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000027005 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
27006 xmlResetLastError();
27007 if (mem_base != xmlMemBlocks()) {
27008 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
27009 xmlMemBlocks() - mem_base);
27010 test_ret++;
27011 printf(" %d", n_URL);
27012 printf(" %d", n_ID);
27013 printf(" %d", n_ctxt);
27014 printf("\n");
27015 }
27016 }
27017 }
27018 }
Daniel Veillard42595322004-11-08 10:52:06 +000027019 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027020
Daniel Veillard42595322004-11-08 10:52:06 +000027021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027022}
27023
27024
27025static int
27026test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027028
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027029 int mem_base;
27030 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027031 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027032 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027033
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027034 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
27035 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027036 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027037
William M. Brackf13f77f2004-11-12 16:03:48 +000027038 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027039 desret_xmlChar_ptr(ret_val);
27040 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027041 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027042 xmlResetLastError();
27043 if (mem_base != xmlMemBlocks()) {
27044 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027046 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027047 printf(" %d", n_path);
27048 printf("\n");
27049 }
27050 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027051 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027052
Daniel Veillard42595322004-11-08 10:52:06 +000027053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027054}
27055
27056
27057static int
27058test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027060
William M. Brack21e4ef22005-01-02 09:53:13 +000027061#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027062 int mem_base;
27063 xmlOutputBufferPtr ret_val;
27064 int fd; /* a file descriptor number */
27065 int n_fd;
27066 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27067 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027068
Daniel Veillard3d95c732004-11-06 22:25:14 +000027069 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27070 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27071 mem_base = xmlMemBlocks();
27072 fd = gen_int(n_fd, 0);
27073 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27074
27075 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27076 desret_xmlOutputBufferPtr(ret_val);
27077 call_tests++;
27078 des_int(n_fd, fd, 0);
27079 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27080 xmlResetLastError();
27081 if (mem_base != xmlMemBlocks()) {
27082 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027084 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027085 printf(" %d", n_fd);
27086 printf(" %d", n_encoder);
27087 printf("\n");
27088 }
27089 }
27090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027091 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027092#endif
27093
Daniel Veillard42595322004-11-08 10:52:06 +000027094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027095}
27096
27097
27098static int
27099test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027101
William M. Brack21e4ef22005-01-02 09:53:13 +000027102#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027103 int mem_base;
27104 xmlOutputBufferPtr ret_val;
27105 FILE * file; /* a FILE* */
27106 int n_file;
27107 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27108 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027109
Daniel Veillard3d95c732004-11-06 22:25:14 +000027110 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27111 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27112 mem_base = xmlMemBlocks();
27113 file = gen_FILE_ptr(n_file, 0);
27114 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27115
27116 ret_val = xmlOutputBufferCreateFile(file, encoder);
27117 desret_xmlOutputBufferPtr(ret_val);
27118 call_tests++;
27119 des_FILE_ptr(n_file, file, 0);
27120 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27121 xmlResetLastError();
27122 if (mem_base != xmlMemBlocks()) {
27123 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027125 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027126 printf(" %d", n_file);
27127 printf(" %d", n_encoder);
27128 printf("\n");
27129 }
27130 }
27131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027132 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027133#endif
27134
Daniel Veillard42595322004-11-08 10:52:06 +000027135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027136}
27137
27138
27139static int
27140test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027142
William M. Brack21e4ef22005-01-02 09:53:13 +000027143#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027144 int mem_base;
27145 xmlOutputBufferPtr ret_val;
27146 const char * URI; /* a C string containing the URI or filename */
27147 int n_URI;
27148 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27149 int n_encoder;
27150 int compression; /* the compression ration (0 none, 9 max). */
27151 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027152
Daniel Veillard42595322004-11-08 10:52:06 +000027153 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027154 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27155 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27156 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027157 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027158 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27159 compression = gen_int(n_compression, 2);
27160
27161 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27162 desret_xmlOutputBufferPtr(ret_val);
27163 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027164 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027165 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27166 des_int(n_compression, compression, 2);
27167 xmlResetLastError();
27168 if (mem_base != xmlMemBlocks()) {
27169 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027171 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027172 printf(" %d", n_URI);
27173 printf(" %d", n_encoder);
27174 printf(" %d", n_compression);
27175 printf("\n");
27176 }
27177 }
27178 }
27179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027180 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027181#endif
27182
Daniel Veillard42595322004-11-08 10:52:06 +000027183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027184}
27185
27186
27187static int
27188test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027190
William M. Brack21e4ef22005-01-02 09:53:13 +000027191#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027192 int mem_base;
27193 int ret_val;
27194 xmlOutputBufferPtr out; /* a buffered output */
27195 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027196
Daniel Veillard3d97e662004-11-04 10:49:00 +000027197 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27198 mem_base = xmlMemBlocks();
27199 out = gen_xmlOutputBufferPtr(n_out, 0);
27200
27201 ret_val = xmlOutputBufferFlush(out);
27202 desret_int(ret_val);
27203 call_tests++;
27204 des_xmlOutputBufferPtr(n_out, out, 0);
27205 xmlResetLastError();
27206 if (mem_base != xmlMemBlocks()) {
27207 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027209 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027210 printf(" %d", n_out);
27211 printf("\n");
27212 }
27213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027214 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027215#endif
27216
Daniel Veillard42595322004-11-08 10:52:06 +000027217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027218}
27219
27220
27221static int
27222test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027224
William M. Brack21e4ef22005-01-02 09:53:13 +000027225#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027226 int mem_base;
27227 int ret_val;
27228 xmlOutputBufferPtr out; /* a buffered parser output */
27229 int n_out;
27230 int len; /* the size in bytes of the array. */
27231 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027232 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027233 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027234
Daniel Veillard3d97e662004-11-04 10:49:00 +000027235 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27236 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27237 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27238 mem_base = xmlMemBlocks();
27239 out = gen_xmlOutputBufferPtr(n_out, 0);
27240 len = gen_int(n_len, 1);
27241 buf = gen_const_char_ptr(n_buf, 2);
27242
William M. Brackf13f77f2004-11-12 16:03:48 +000027243 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027244 desret_int(ret_val);
27245 call_tests++;
27246 des_xmlOutputBufferPtr(n_out, out, 0);
27247 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027248 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027249 xmlResetLastError();
27250 if (mem_base != xmlMemBlocks()) {
27251 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027253 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027254 printf(" %d", n_out);
27255 printf(" %d", n_len);
27256 printf(" %d", n_buf);
27257 printf("\n");
27258 }
27259 }
27260 }
27261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027262 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027263#endif
27264
Daniel Veillard42595322004-11-08 10:52:06 +000027265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027266}
27267
27268
27269static int
27270test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027272
27273
27274 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027276}
27277
27278
27279static int
27280test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027282
William M. Brack21e4ef22005-01-02 09:53:13 +000027283#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027284 int mem_base;
27285 int ret_val;
27286 xmlOutputBufferPtr out; /* a buffered parser output */
27287 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027288 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027289 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027290
Daniel Veillard3d97e662004-11-04 10:49:00 +000027291 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27292 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27293 mem_base = xmlMemBlocks();
27294 out = gen_xmlOutputBufferPtr(n_out, 0);
27295 str = gen_const_char_ptr(n_str, 1);
27296
William M. Brackf13f77f2004-11-12 16:03:48 +000027297 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027298 desret_int(ret_val);
27299 call_tests++;
27300 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027301 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027302 xmlResetLastError();
27303 if (mem_base != xmlMemBlocks()) {
27304 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027306 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027307 printf(" %d", n_out);
27308 printf(" %d", n_str);
27309 printf("\n");
27310 }
27311 }
27312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027313 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027314#endif
27315
Daniel Veillard42595322004-11-08 10:52:06 +000027316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027317}
27318
27319
27320static int
27321test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027323
27324
27325 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027327}
27328
27329
27330static int
27331test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027333
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027334 int mem_base;
27335 xmlParserInputBufferPtr ret_val;
27336 int fd; /* a file descriptor number */
27337 int n_fd;
27338 xmlCharEncoding enc; /* the charset encoding if known */
27339 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027340
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027341 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27342 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27343 mem_base = xmlMemBlocks();
27344 fd = gen_int(n_fd, 0);
27345 enc = gen_xmlCharEncoding(n_enc, 1);
27346 if (fd >= 0) fd = -1;
27347
27348 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27349 desret_xmlParserInputBufferPtr(ret_val);
27350 call_tests++;
27351 des_int(n_fd, fd, 0);
27352 des_xmlCharEncoding(n_enc, enc, 1);
27353 xmlResetLastError();
27354 if (mem_base != xmlMemBlocks()) {
27355 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027357 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027358 printf(" %d", n_fd);
27359 printf(" %d", n_enc);
27360 printf("\n");
27361 }
27362 }
27363 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027364 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027365
Daniel Veillard42595322004-11-08 10:52:06 +000027366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027367}
27368
27369
27370static int
27371test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027373
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027374 int mem_base;
27375 xmlParserInputBufferPtr ret_val;
27376 FILE * file; /* a FILE* */
27377 int n_file;
27378 xmlCharEncoding enc; /* the charset encoding if known */
27379 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027380
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027381 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27382 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27383 mem_base = xmlMemBlocks();
27384 file = gen_FILE_ptr(n_file, 0);
27385 enc = gen_xmlCharEncoding(n_enc, 1);
27386
27387 ret_val = xmlParserInputBufferCreateFile(file, enc);
27388 desret_xmlParserInputBufferPtr(ret_val);
27389 call_tests++;
27390 des_FILE_ptr(n_file, file, 0);
27391 des_xmlCharEncoding(n_enc, enc, 1);
27392 xmlResetLastError();
27393 if (mem_base != xmlMemBlocks()) {
27394 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027396 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027397 printf(" %d", n_file);
27398 printf(" %d", n_enc);
27399 printf("\n");
27400 }
27401 }
27402 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027403 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027404
Daniel Veillard42595322004-11-08 10:52:06 +000027405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027406}
27407
27408
27409static int
27410test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027412
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027413 int mem_base;
27414 xmlParserInputBufferPtr ret_val;
27415 const char * URI; /* a C string containing the URI or filename */
27416 int n_URI;
27417 xmlCharEncoding enc; /* the charset encoding if known */
27418 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027419
Daniel Veillard42595322004-11-08 10:52:06 +000027420 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027421 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27422 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027423 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027424 enc = gen_xmlCharEncoding(n_enc, 1);
27425
27426 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27427 desret_xmlParserInputBufferPtr(ret_val);
27428 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027429 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027430 des_xmlCharEncoding(n_enc, enc, 1);
27431 xmlResetLastError();
27432 if (mem_base != xmlMemBlocks()) {
27433 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027435 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027436 printf(" %d", n_URI);
27437 printf(" %d", n_enc);
27438 printf("\n");
27439 }
27440 }
27441 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027442 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027443
Daniel Veillard42595322004-11-08 10:52:06 +000027444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027445}
27446
27447
27448static int
27449test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027451
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027452 int mem_base;
27453 xmlParserInputBufferPtr ret_val;
27454 char * mem; /* the memory input */
27455 int n_mem;
27456 int size; /* the length of the memory block */
27457 int n_size;
27458 xmlCharEncoding enc; /* the charset encoding if known */
27459 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027460
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027461 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27462 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27463 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27464 mem_base = xmlMemBlocks();
27465 mem = gen_const_char_ptr(n_mem, 0);
27466 size = gen_int(n_size, 1);
27467 enc = gen_xmlCharEncoding(n_enc, 2);
27468
William M. Brackf13f77f2004-11-12 16:03:48 +000027469 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027470 desret_xmlParserInputBufferPtr(ret_val);
27471 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027472 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027473 des_int(n_size, size, 1);
27474 des_xmlCharEncoding(n_enc, enc, 2);
27475 xmlResetLastError();
27476 if (mem_base != xmlMemBlocks()) {
27477 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027479 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027480 printf(" %d", n_mem);
27481 printf(" %d", n_size);
27482 printf(" %d", n_enc);
27483 printf("\n");
27484 }
27485 }
27486 }
27487 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027489
Daniel Veillard42595322004-11-08 10:52:06 +000027490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027491}
27492
27493
27494static int
27495test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027497
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027498 int mem_base;
27499 xmlParserInputBufferPtr ret_val;
27500 char * mem; /* the memory input */
27501 int n_mem;
27502 int size; /* the length of the memory block */
27503 int n_size;
27504 xmlCharEncoding enc; /* the charset encoding if known */
27505 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027506
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027507 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27508 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27509 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27510 mem_base = xmlMemBlocks();
27511 mem = gen_const_char_ptr(n_mem, 0);
27512 size = gen_int(n_size, 1);
27513 enc = gen_xmlCharEncoding(n_enc, 2);
27514
William M. Brackf13f77f2004-11-12 16:03:48 +000027515 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027516 desret_xmlParserInputBufferPtr(ret_val);
27517 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027518 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027519 des_int(n_size, size, 1);
27520 des_xmlCharEncoding(n_enc, enc, 2);
27521 xmlResetLastError();
27522 if (mem_base != xmlMemBlocks()) {
27523 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027525 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027526 printf(" %d", n_mem);
27527 printf(" %d", n_size);
27528 printf(" %d", n_enc);
27529 printf("\n");
27530 }
27531 }
27532 }
27533 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027534 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027535
Daniel Veillard42595322004-11-08 10:52:06 +000027536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027537}
27538
27539
27540static int
27541test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027543
Daniel Veillard34099b42004-11-04 17:34:35 +000027544 int mem_base;
27545 int ret_val;
27546 xmlParserInputBufferPtr in; /* a buffered parser input */
27547 int n_in;
27548 int len; /* indicative value of the amount of chars to read */
27549 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027550
Daniel Veillard34099b42004-11-04 17:34:35 +000027551 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27552 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27553 mem_base = xmlMemBlocks();
27554 in = gen_xmlParserInputBufferPtr(n_in, 0);
27555 len = gen_int(n_len, 1);
27556
27557 ret_val = xmlParserInputBufferGrow(in, len);
27558 desret_int(ret_val);
27559 call_tests++;
27560 des_xmlParserInputBufferPtr(n_in, in, 0);
27561 des_int(n_len, len, 1);
27562 xmlResetLastError();
27563 if (mem_base != xmlMemBlocks()) {
27564 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027566 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027567 printf(" %d", n_in);
27568 printf(" %d", n_len);
27569 printf("\n");
27570 }
27571 }
27572 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027574
Daniel Veillard42595322004-11-08 10:52:06 +000027575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027576}
27577
27578
27579static int
27580test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027582
Daniel Veillard34099b42004-11-04 17:34:35 +000027583 int mem_base;
27584 int ret_val;
27585 xmlParserInputBufferPtr in; /* a buffered parser input */
27586 int n_in;
27587 int len; /* the size in bytes of the array. */
27588 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027589 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027590 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027591
Daniel Veillard34099b42004-11-04 17:34:35 +000027592 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27593 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27594 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27595 mem_base = xmlMemBlocks();
27596 in = gen_xmlParserInputBufferPtr(n_in, 0);
27597 len = gen_int(n_len, 1);
27598 buf = gen_const_char_ptr(n_buf, 2);
27599
William M. Brackf13f77f2004-11-12 16:03:48 +000027600 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027601 desret_int(ret_val);
27602 call_tests++;
27603 des_xmlParserInputBufferPtr(n_in, in, 0);
27604 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027605 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027606 xmlResetLastError();
27607 if (mem_base != xmlMemBlocks()) {
27608 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027610 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027611 printf(" %d", n_in);
27612 printf(" %d", n_len);
27613 printf(" %d", n_buf);
27614 printf("\n");
27615 }
27616 }
27617 }
27618 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027620
Daniel Veillard42595322004-11-08 10:52:06 +000027621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027622}
27623
27624
27625static int
27626test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027628
Daniel Veillard34099b42004-11-04 17:34:35 +000027629 int mem_base;
27630 int ret_val;
27631 xmlParserInputBufferPtr in; /* a buffered parser input */
27632 int n_in;
27633 int len; /* indicative value of the amount of chars to read */
27634 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027635
Daniel Veillard34099b42004-11-04 17:34:35 +000027636 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27637 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27638 mem_base = xmlMemBlocks();
27639 in = gen_xmlParserInputBufferPtr(n_in, 0);
27640 len = gen_int(n_len, 1);
27641
27642 ret_val = xmlParserInputBufferRead(in, len);
27643 desret_int(ret_val);
27644 call_tests++;
27645 des_xmlParserInputBufferPtr(n_in, in, 0);
27646 des_int(n_len, len, 1);
27647 xmlResetLastError();
27648 if (mem_base != xmlMemBlocks()) {
27649 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027651 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027652 printf(" %d", n_in);
27653 printf(" %d", n_len);
27654 printf("\n");
27655 }
27656 }
27657 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027658 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027659
Daniel Veillard42595322004-11-08 10:52:06 +000027660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027661}
27662
27663
27664static int
27665test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027667
27668 int mem_base;
27669 int ret_val;
27670
27671 mem_base = xmlMemBlocks();
27672
27673 ret_val = xmlPopInputCallbacks();
27674 desret_int(ret_val);
27675 call_tests++;
27676 xmlResetLastError();
27677 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027678 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027680 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027681 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027682 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027683 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027684
Daniel Veillard42595322004-11-08 10:52:06 +000027685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027686}
27687
27688
27689static int
27690test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027692
27693 int mem_base;
27694
27695 mem_base = xmlMemBlocks();
27696
27697 xmlRegisterDefaultInputCallbacks();
27698 call_tests++;
27699 xmlResetLastError();
27700 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027701 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027703 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027704 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027705 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027707
Daniel Veillard42595322004-11-08 10:52:06 +000027708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027709}
27710
27711
27712static int
27713test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027715
William M. Brack21e4ef22005-01-02 09:53:13 +000027716#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027717 int mem_base;
27718
27719 mem_base = xmlMemBlocks();
27720
27721 xmlRegisterDefaultOutputCallbacks();
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 xmlRegisterDefaultOutputCallbacks",
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 Veillardd0cf7f62004-11-09 16:17:02 +000027730 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027731#endif
27732
Daniel Veillard42595322004-11-08 10:52:06 +000027733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027734}
27735
27736
27737static int
27738test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027740
William M. Brack21e4ef22005-01-02 09:53:13 +000027741#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027742 int mem_base;
27743
27744 mem_base = xmlMemBlocks();
27745
27746 xmlRegisterHTTPPostCallbacks();
27747 call_tests++;
27748 xmlResetLastError();
27749 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027750 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027752 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027753 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027755 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027756#endif
27757
Daniel Veillard42595322004-11-08 10:52:06 +000027758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027759}
27760
27761static int
27762test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027764
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027765 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027766 test_ret += test_xmlAllocOutputBuffer();
27767 test_ret += test_xmlAllocParserInputBuffer();
27768 test_ret += test_xmlCheckFilename();
27769 test_ret += test_xmlCheckHTTPInput();
27770 test_ret += test_xmlCleanupInputCallbacks();
27771 test_ret += test_xmlCleanupOutputCallbacks();
27772 test_ret += test_xmlFileClose();
27773 test_ret += test_xmlFileMatch();
27774 test_ret += test_xmlFileOpen();
27775 test_ret += test_xmlFileRead();
27776 test_ret += test_xmlIOFTPClose();
27777 test_ret += test_xmlIOFTPMatch();
27778 test_ret += test_xmlIOFTPOpen();
27779 test_ret += test_xmlIOFTPRead();
27780 test_ret += test_xmlIOHTTPClose();
27781 test_ret += test_xmlIOHTTPMatch();
27782 test_ret += test_xmlIOHTTPOpen();
27783 test_ret += test_xmlIOHTTPOpenW();
27784 test_ret += test_xmlIOHTTPRead();
27785 test_ret += test_xmlNoNetExternalEntityLoader();
27786 test_ret += test_xmlNormalizeWindowsPath();
27787 test_ret += test_xmlOutputBufferCreateFd();
27788 test_ret += test_xmlOutputBufferCreateFile();
27789 test_ret += test_xmlOutputBufferCreateFilename();
27790 test_ret += test_xmlOutputBufferFlush();
27791 test_ret += test_xmlOutputBufferWrite();
27792 test_ret += test_xmlOutputBufferWriteEscape();
27793 test_ret += test_xmlOutputBufferWriteString();
27794 test_ret += test_xmlParserGetDirectory();
27795 test_ret += test_xmlParserInputBufferCreateFd();
27796 test_ret += test_xmlParserInputBufferCreateFile();
27797 test_ret += test_xmlParserInputBufferCreateFilename();
27798 test_ret += test_xmlParserInputBufferCreateMem();
27799 test_ret += test_xmlParserInputBufferCreateStatic();
27800 test_ret += test_xmlParserInputBufferGrow();
27801 test_ret += test_xmlParserInputBufferPush();
27802 test_ret += test_xmlParserInputBufferRead();
27803 test_ret += test_xmlPopInputCallbacks();
27804 test_ret += test_xmlRegisterDefaultInputCallbacks();
27805 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27806 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027807
Daniel Veillard42595322004-11-08 10:52:06 +000027808 if (test_ret != 0)
27809 printf("Module xmlIO: %d errors\n", test_ret);
27810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027811}
Daniel Veillarda521d282004-11-09 14:59:59 +000027812#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027813
Daniel Veillarda82b1822004-11-08 16:24:57 +000027814#define gen_nb_xmlAutomataPtr 1
27815static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27816 return(NULL);
27817}
27818static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27819}
Daniel Veillarda521d282004-11-09 14:59:59 +000027820#endif
27821
Daniel Veillarda82b1822004-11-08 16:24:57 +000027822
27823static int
27824test_xmlAutomataCompile(void) {
27825 int test_ret = 0;
27826
27827
27828 /* missing type support */
27829 return(test_ret);
27830}
27831
27832
27833static int
27834test_xmlAutomataGetInitState(void) {
27835 int test_ret = 0;
27836
27837
27838 /* missing type support */
27839 return(test_ret);
27840}
27841
27842
27843static int
27844test_xmlAutomataIsDeterminist(void) {
27845 int test_ret = 0;
27846
William M. Brack21e4ef22005-01-02 09:53:13 +000027847#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027848 int mem_base;
27849 int ret_val;
27850 xmlAutomataPtr am; /* an automata */
27851 int n_am;
27852
27853 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27854 mem_base = xmlMemBlocks();
27855 am = gen_xmlAutomataPtr(n_am, 0);
27856
27857 ret_val = xmlAutomataIsDeterminist(am);
27858 desret_int(ret_val);
27859 call_tests++;
27860 des_xmlAutomataPtr(n_am, am, 0);
27861 xmlResetLastError();
27862 if (mem_base != xmlMemBlocks()) {
27863 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27864 xmlMemBlocks() - mem_base);
27865 test_ret++;
27866 printf(" %d", n_am);
27867 printf("\n");
27868 }
27869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027870 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027871#endif
27872
Daniel Veillarda82b1822004-11-08 16:24:57 +000027873 return(test_ret);
27874}
27875
Daniel Veillarda521d282004-11-09 14:59:59 +000027876#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027877
27878#define gen_nb_xmlAutomataStatePtr 1
27879static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27880 return(NULL);
27881}
27882static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27883}
Daniel Veillarda521d282004-11-09 14:59:59 +000027884#endif
27885
Daniel Veillarda82b1822004-11-08 16:24:57 +000027886
27887static int
27888test_xmlAutomataNewAllTrans(void) {
27889 int test_ret = 0;
27890
27891
27892 /* missing type support */
27893 return(test_ret);
27894}
27895
27896
27897static int
27898test_xmlAutomataNewCountTrans(void) {
27899 int test_ret = 0;
27900
27901
27902 /* missing type support */
27903 return(test_ret);
27904}
27905
27906
27907static int
27908test_xmlAutomataNewCountTrans2(void) {
27909 int test_ret = 0;
27910
27911
27912 /* missing type support */
27913 return(test_ret);
27914}
27915
27916
27917static int
27918test_xmlAutomataNewCountedTrans(void) {
27919 int test_ret = 0;
27920
27921
27922 /* missing type support */
27923 return(test_ret);
27924}
27925
27926
27927static int
27928test_xmlAutomataNewCounter(void) {
27929 int test_ret = 0;
27930
William M. Brack21e4ef22005-01-02 09:53:13 +000027931#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027932 int mem_base;
27933 int ret_val;
27934 xmlAutomataPtr am; /* an automata */
27935 int n_am;
27936 int min; /* the minimal value on the counter */
27937 int n_min;
27938 int max; /* the maximal value on the counter */
27939 int n_max;
27940
27941 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27942 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27943 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27944 mem_base = xmlMemBlocks();
27945 am = gen_xmlAutomataPtr(n_am, 0);
27946 min = gen_int(n_min, 1);
27947 max = gen_int(n_max, 2);
27948
27949 ret_val = xmlAutomataNewCounter(am, min, max);
27950 desret_int(ret_val);
27951 call_tests++;
27952 des_xmlAutomataPtr(n_am, am, 0);
27953 des_int(n_min, min, 1);
27954 des_int(n_max, max, 2);
27955 xmlResetLastError();
27956 if (mem_base != xmlMemBlocks()) {
27957 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27958 xmlMemBlocks() - mem_base);
27959 test_ret++;
27960 printf(" %d", n_am);
27961 printf(" %d", n_min);
27962 printf(" %d", n_max);
27963 printf("\n");
27964 }
27965 }
27966 }
27967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027968 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027969#endif
27970
Daniel Veillarda82b1822004-11-08 16:24:57 +000027971 return(test_ret);
27972}
27973
27974
27975static int
27976test_xmlAutomataNewCounterTrans(void) {
27977 int test_ret = 0;
27978
27979
27980 /* missing type support */
27981 return(test_ret);
27982}
27983
27984
27985static int
27986test_xmlAutomataNewEpsilon(void) {
27987 int test_ret = 0;
27988
27989
27990 /* missing type support */
27991 return(test_ret);
27992}
27993
27994
27995static int
27996test_xmlAutomataNewOnceTrans(void) {
27997 int test_ret = 0;
27998
27999
28000 /* missing type support */
28001 return(test_ret);
28002}
28003
28004
28005static int
28006test_xmlAutomataNewOnceTrans2(void) {
28007 int test_ret = 0;
28008
28009
28010 /* missing type support */
28011 return(test_ret);
28012}
28013
28014
28015static int
28016test_xmlAutomataNewState(void) {
28017 int test_ret = 0;
28018
28019
28020 /* missing type support */
28021 return(test_ret);
28022}
28023
28024
28025static int
28026test_xmlAutomataNewTransition(void) {
28027 int test_ret = 0;
28028
28029
28030 /* missing type support */
28031 return(test_ret);
28032}
28033
28034
28035static int
28036test_xmlAutomataNewTransition2(void) {
28037 int test_ret = 0;
28038
28039
28040 /* missing type support */
28041 return(test_ret);
28042}
28043
28044
28045static int
28046test_xmlAutomataSetFinalState(void) {
28047 int test_ret = 0;
28048
William M. Brack21e4ef22005-01-02 09:53:13 +000028049#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028050 int mem_base;
28051 int ret_val;
28052 xmlAutomataPtr am; /* an automata */
28053 int n_am;
28054 xmlAutomataStatePtr state; /* a state in this automata */
28055 int n_state;
28056
28057 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28058 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28059 mem_base = xmlMemBlocks();
28060 am = gen_xmlAutomataPtr(n_am, 0);
28061 state = gen_xmlAutomataStatePtr(n_state, 1);
28062
28063 ret_val = xmlAutomataSetFinalState(am, state);
28064 desret_int(ret_val);
28065 call_tests++;
28066 des_xmlAutomataPtr(n_am, am, 0);
28067 des_xmlAutomataStatePtr(n_state, state, 1);
28068 xmlResetLastError();
28069 if (mem_base != xmlMemBlocks()) {
28070 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28071 xmlMemBlocks() - mem_base);
28072 test_ret++;
28073 printf(" %d", n_am);
28074 printf(" %d", n_state);
28075 printf("\n");
28076 }
28077 }
28078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028079 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028080#endif
28081
Daniel Veillarda82b1822004-11-08 16:24:57 +000028082 return(test_ret);
28083}
28084
28085
28086static int
28087test_xmlNewAutomata(void) {
28088 int test_ret = 0;
28089
28090
28091 /* missing type support */
28092 return(test_ret);
28093}
28094
28095static int
28096test_xmlautomata(void) {
28097 int test_ret = 0;
28098
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028099 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028100 test_ret += test_xmlAutomataCompile();
28101 test_ret += test_xmlAutomataGetInitState();
28102 test_ret += test_xmlAutomataIsDeterminist();
28103 test_ret += test_xmlAutomataNewAllTrans();
28104 test_ret += test_xmlAutomataNewCountTrans();
28105 test_ret += test_xmlAutomataNewCountTrans2();
28106 test_ret += test_xmlAutomataNewCountedTrans();
28107 test_ret += test_xmlAutomataNewCounter();
28108 test_ret += test_xmlAutomataNewCounterTrans();
28109 test_ret += test_xmlAutomataNewEpsilon();
28110 test_ret += test_xmlAutomataNewOnceTrans();
28111 test_ret += test_xmlAutomataNewOnceTrans2();
28112 test_ret += test_xmlAutomataNewState();
28113 test_ret += test_xmlAutomataNewTransition();
28114 test_ret += test_xmlAutomataNewTransition2();
28115 test_ret += test_xmlAutomataSetFinalState();
28116 test_ret += test_xmlNewAutomata();
28117
28118 if (test_ret != 0)
28119 printf("Module xmlautomata: %d errors\n", test_ret);
28120 return(test_ret);
28121}
28122
Daniel Veillardce682bc2004-11-05 17:22:25 +000028123#define gen_nb_xmlGenericErrorFunc_ptr 1
28124static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28125 return(NULL);
28126}
28127static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28128}
28129
Daniel Veillardd93f6252004-11-02 15:53:51 +000028130static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028131test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028133
Daniel Veillardce682bc2004-11-05 17:22:25 +000028134 int mem_base;
28135 xmlGenericErrorFunc * handler; /* the handler */
28136 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028137
Daniel Veillardce682bc2004-11-05 17:22:25 +000028138 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28139 mem_base = xmlMemBlocks();
28140 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28141
28142 initGenericErrorDefaultFunc(handler);
28143 call_tests++;
28144 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28145 xmlResetLastError();
28146 if (mem_base != xmlMemBlocks()) {
28147 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028149 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028150 printf(" %d", n_handler);
28151 printf("\n");
28152 }
28153 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028154 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028155
Daniel Veillard42595322004-11-08 10:52:06 +000028156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028157}
28158
28159
Daniel Veillardce682bc2004-11-05 17:22:25 +000028160#define gen_nb_xmlErrorPtr 1
28161static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28162 return(NULL);
28163}
28164static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28165}
28166
Daniel Veillardd93f6252004-11-02 15:53:51 +000028167static int
28168test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028170
Daniel Veillardce682bc2004-11-05 17:22:25 +000028171 int mem_base;
28172 int ret_val;
28173 xmlErrorPtr from; /* a source error */
28174 int n_from;
28175 xmlErrorPtr to; /* a target error */
28176 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028177
Daniel Veillardce682bc2004-11-05 17:22:25 +000028178 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28179 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28180 mem_base = xmlMemBlocks();
28181 from = gen_xmlErrorPtr(n_from, 0);
28182 to = gen_xmlErrorPtr(n_to, 1);
28183
28184 ret_val = xmlCopyError(from, to);
28185 desret_int(ret_val);
28186 call_tests++;
28187 des_xmlErrorPtr(n_from, from, 0);
28188 des_xmlErrorPtr(n_to, to, 1);
28189 xmlResetLastError();
28190 if (mem_base != xmlMemBlocks()) {
28191 printf("Leak of %d blocks found in xmlCopyError",
28192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028193 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028194 printf(" %d", n_from);
28195 printf(" %d", n_to);
28196 printf("\n");
28197 }
28198 }
28199 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028200 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028201
Daniel Veillard42595322004-11-08 10:52:06 +000028202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028203}
28204
28205
28206static int
28207test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028209
28210
28211 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028213}
28214
28215
28216static int
28217test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028219
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028220 int mem_base;
28221 void * ctx; /* an XML parser context */
28222 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028223
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028224 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028226 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028227
28228 xmlCtxtResetLastError(ctx);
28229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028230 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028231 xmlResetLastError();
28232 if (mem_base != xmlMemBlocks()) {
28233 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028235 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028236 printf(" %d", n_ctx);
28237 printf("\n");
28238 }
28239 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028240 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028241
Daniel Veillard42595322004-11-08 10:52:06 +000028242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028243}
28244
28245
28246static int
28247test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028249
28250
28251 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028253}
28254
28255
28256static int
28257test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028259
28260
28261 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028263}
28264
28265
28266static int
28267test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028269
Daniel Veillardce682bc2004-11-05 17:22:25 +000028270 int mem_base;
28271 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28272 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028273
Daniel Veillardce682bc2004-11-05 17:22:25 +000028274 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28275 mem_base = xmlMemBlocks();
28276 input = gen_xmlParserInputPtr(n_input, 0);
28277
28278 xmlParserPrintFileContext(input);
28279 call_tests++;
28280 des_xmlParserInputPtr(n_input, input, 0);
28281 xmlResetLastError();
28282 if (mem_base != xmlMemBlocks()) {
28283 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028285 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028286 printf(" %d", n_input);
28287 printf("\n");
28288 }
28289 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028290 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028291
Daniel Veillard42595322004-11-08 10:52:06 +000028292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028293}
28294
28295
28296static int
28297test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028299
Daniel Veillardce682bc2004-11-05 17:22:25 +000028300 int mem_base;
28301 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28302 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028303
Daniel Veillardce682bc2004-11-05 17:22:25 +000028304 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28305 mem_base = xmlMemBlocks();
28306 input = gen_xmlParserInputPtr(n_input, 0);
28307
28308 xmlParserPrintFileInfo(input);
28309 call_tests++;
28310 des_xmlParserInputPtr(n_input, input, 0);
28311 xmlResetLastError();
28312 if (mem_base != xmlMemBlocks()) {
28313 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028315 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028316 printf(" %d", n_input);
28317 printf("\n");
28318 }
28319 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028320 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028321
Daniel Veillard42595322004-11-08 10:52:06 +000028322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028323}
28324
28325
28326static int
28327test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028329
28330
28331 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028333}
28334
28335
28336static int
28337test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028339
28340
28341 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028343}
28344
28345
28346static int
28347test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028349
28350
28351 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028353}
28354
28355
28356static int
28357test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028359
Daniel Veillardce682bc2004-11-05 17:22:25 +000028360 int mem_base;
28361 xmlErrorPtr err; /* pointer to the error. */
28362 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028363
Daniel Veillardce682bc2004-11-05 17:22:25 +000028364 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28365 mem_base = xmlMemBlocks();
28366 err = gen_xmlErrorPtr(n_err, 0);
28367
28368 xmlResetError(err);
28369 call_tests++;
28370 des_xmlErrorPtr(n_err, err, 0);
28371 xmlResetLastError();
28372 if (mem_base != xmlMemBlocks()) {
28373 printf("Leak of %d blocks found in xmlResetError",
28374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028375 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028376 printf(" %d", n_err);
28377 printf("\n");
28378 }
28379 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028381
Daniel Veillard42595322004-11-08 10:52:06 +000028382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028383}
28384
28385
28386static int
28387test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028389
28390
28391
28392 xmlResetLastError();
28393 call_tests++;
28394 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028396
Daniel Veillard42595322004-11-08 10:52:06 +000028397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028398}
28399
28400
28401static int
28402test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028404
28405
28406 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028408}
28409
28410
28411static int
28412test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028414
28415
28416 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028418}
28419
28420static int
28421test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028423
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028424 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028425 test_ret += test_initGenericErrorDefaultFunc();
28426 test_ret += test_xmlCopyError();
28427 test_ret += test_xmlCtxtGetLastError();
28428 test_ret += test_xmlCtxtResetLastError();
28429 test_ret += test_xmlGetLastError();
28430 test_ret += test_xmlParserError();
28431 test_ret += test_xmlParserPrintFileContext();
28432 test_ret += test_xmlParserPrintFileInfo();
28433 test_ret += test_xmlParserValidityError();
28434 test_ret += test_xmlParserValidityWarning();
28435 test_ret += test_xmlParserWarning();
28436 test_ret += test_xmlResetError();
28437 test_ret += test_xmlResetLastError();
28438 test_ret += test_xmlSetGenericErrorFunc();
28439 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028440
Daniel Veillard42595322004-11-08 10:52:06 +000028441 if (test_ret != 0)
28442 printf("Module xmlerror: %d errors\n", test_ret);
28443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028444}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028445#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028446
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028447#define gen_nb_xmlModulePtr 1
28448static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28449 return(NULL);
28450}
28451static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28452}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028453#endif
28454
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028455
28456static int
28457test_xmlModuleClose(void) {
28458 int test_ret = 0;
28459
28460#if defined(LIBXML_MODULES_ENABLED)
28461 int mem_base;
28462 int ret_val;
28463 xmlModulePtr module; /* the module handle */
28464 int n_module;
28465
28466 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28467 mem_base = xmlMemBlocks();
28468 module = gen_xmlModulePtr(n_module, 0);
28469
28470 ret_val = xmlModuleClose(module);
28471 desret_int(ret_val);
28472 call_tests++;
28473 des_xmlModulePtr(n_module, module, 0);
28474 xmlResetLastError();
28475 if (mem_base != xmlMemBlocks()) {
28476 printf("Leak of %d blocks found in xmlModuleClose",
28477 xmlMemBlocks() - mem_base);
28478 test_ret++;
28479 printf(" %d", n_module);
28480 printf("\n");
28481 }
28482 }
28483 function_tests++;
28484#endif
28485
28486 return(test_ret);
28487}
28488
28489
28490static int
28491test_xmlModuleOpen(void) {
28492 int test_ret = 0;
28493
28494
28495 /* missing type support */
28496 return(test_ret);
28497}
28498
28499
28500static int
28501test_xmlModuleSymbol(void) {
28502 int test_ret = 0;
28503
28504#if defined(LIBXML_MODULES_ENABLED)
28505 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028506 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028507 xmlModulePtr module; /* the module */
28508 int n_module;
28509 char * name; /* the name of the symbol */
28510 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028511 void ** symbol; /* the resulting symbol address */
28512 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028513
28514 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28515 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028516 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028517 mem_base = xmlMemBlocks();
28518 module = gen_xmlModulePtr(n_module, 0);
28519 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028520 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028521
Daniel Veillardbe076e92005-01-04 20:18:14 +000028522 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28523 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028524 call_tests++;
28525 des_xmlModulePtr(n_module, module, 0);
28526 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028527 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028528 xmlResetLastError();
28529 if (mem_base != xmlMemBlocks()) {
28530 printf("Leak of %d blocks found in xmlModuleSymbol",
28531 xmlMemBlocks() - mem_base);
28532 test_ret++;
28533 printf(" %d", n_module);
28534 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028535 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028536 printf("\n");
28537 }
28538 }
28539 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028540 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028541 function_tests++;
28542#endif
28543
28544 return(test_ret);
28545}
28546
28547static int
28548test_xmlmodule(void) {
28549 int test_ret = 0;
28550
28551 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28552 test_ret += test_xmlModuleClose();
28553 test_ret += test_xmlModuleOpen();
28554 test_ret += test_xmlModuleSymbol();
28555
28556 if (test_ret != 0)
28557 printf("Module xmlmodule: %d errors\n", test_ret);
28558 return(test_ret);
28559}
28560
Daniel Veillardd93f6252004-11-02 15:53:51 +000028561static int
28562test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028564
William M. Brack21e4ef22005-01-02 09:53:13 +000028565#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028566 int mem_base;
28567 xmlTextReaderPtr ret_val;
28568 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28569 int n_input;
28570 const char * URI; /* the URI information for the source if available */
28571 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028572
Daniel Veillard34099b42004-11-04 17:34:35 +000028573 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28574 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28575 mem_base = xmlMemBlocks();
28576 input = gen_xmlParserInputBufferPtr(n_input, 0);
28577 URI = gen_filepath(n_URI, 1);
28578
28579 ret_val = xmlNewTextReader(input, URI);
28580 desret_xmlTextReaderPtr(ret_val);
28581 call_tests++;
28582 des_xmlParserInputBufferPtr(n_input, input, 0);
28583 des_filepath(n_URI, URI, 1);
28584 xmlResetLastError();
28585 if (mem_base != xmlMemBlocks()) {
28586 printf("Leak of %d blocks found in xmlNewTextReader",
28587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028588 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028589 printf(" %d", n_input);
28590 printf(" %d", n_URI);
28591 printf("\n");
28592 }
28593 }
28594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028595 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028596#endif
28597
Daniel Veillard42595322004-11-08 10:52:06 +000028598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028599}
28600
28601
28602static int
28603test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028605
William M. Brack21e4ef22005-01-02 09:53:13 +000028606#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028607 int mem_base;
28608 xmlTextReaderPtr ret_val;
28609 const char * URI; /* the URI of the resource to process */
28610 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028611
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028612 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28613 mem_base = xmlMemBlocks();
28614 URI = gen_filepath(n_URI, 0);
28615
28616 ret_val = xmlNewTextReaderFilename(URI);
28617 desret_xmlTextReaderPtr(ret_val);
28618 call_tests++;
28619 des_filepath(n_URI, URI, 0);
28620 xmlResetLastError();
28621 if (mem_base != xmlMemBlocks()) {
28622 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028624 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028625 printf(" %d", n_URI);
28626 printf("\n");
28627 }
28628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028629 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028630#endif
28631
Daniel Veillard42595322004-11-08 10:52:06 +000028632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028633}
28634
28635
28636static int
28637test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028639
William M. Brack21e4ef22005-01-02 09:53:13 +000028640#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028641 int mem_base;
28642 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028643 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028644 int n_cur;
28645 const char * URL; /* the base URL to use for the document */
28646 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028647 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028648 int n_encoding;
28649 int options; /* a combination of xmlParserOption */
28650 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028651
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028652 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28653 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28654 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028655 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028656 mem_base = xmlMemBlocks();
28657 cur = gen_const_xmlChar_ptr(n_cur, 0);
28658 URL = gen_filepath(n_URL, 1);
28659 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028660 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028661
William M. Brackf13f77f2004-11-12 16:03:48 +000028662 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028663 desret_xmlTextReaderPtr(ret_val);
28664 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028665 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028666 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028667 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028668 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028669 xmlResetLastError();
28670 if (mem_base != xmlMemBlocks()) {
28671 printf("Leak of %d blocks found in xmlReaderForDoc",
28672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028673 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028674 printf(" %d", n_cur);
28675 printf(" %d", n_URL);
28676 printf(" %d", n_encoding);
28677 printf(" %d", n_options);
28678 printf("\n");
28679 }
28680 }
28681 }
28682 }
28683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028684 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028685#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028686
Daniel Veillard42595322004-11-08 10:52:06 +000028687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028688}
28689
28690
28691static int
28692test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028694
William M. Brack21e4ef22005-01-02 09:53:13 +000028695#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028696 int mem_base;
28697 xmlTextReaderPtr ret_val;
28698 const char * filename; /* a file or URL */
28699 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028700 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028701 int n_encoding;
28702 int options; /* a combination of xmlParserOption */
28703 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028704
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028705 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28706 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028707 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028708 mem_base = xmlMemBlocks();
28709 filename = gen_filepath(n_filename, 0);
28710 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028711 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028712
William M. Brackf13f77f2004-11-12 16:03:48 +000028713 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028714 desret_xmlTextReaderPtr(ret_val);
28715 call_tests++;
28716 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028717 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028718 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028719 xmlResetLastError();
28720 if (mem_base != xmlMemBlocks()) {
28721 printf("Leak of %d blocks found in xmlReaderForFile",
28722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028723 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028724 printf(" %d", n_filename);
28725 printf(" %d", n_encoding);
28726 printf(" %d", n_options);
28727 printf("\n");
28728 }
28729 }
28730 }
28731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028732 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028733#endif
28734
Daniel Veillard42595322004-11-08 10:52:06 +000028735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028736}
28737
28738
28739static int
28740test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028742
William M. Brack21e4ef22005-01-02 09:53:13 +000028743#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028744 int mem_base;
28745 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028746 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028747 int n_buffer;
28748 int size; /* the size of the array */
28749 int n_size;
28750 const char * URL; /* the base URL to use for the document */
28751 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028752 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028753 int n_encoding;
28754 int options; /* a combination of xmlParserOption */
28755 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028756
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028757 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28758 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28759 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28760 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028761 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028762 mem_base = xmlMemBlocks();
28763 buffer = gen_const_char_ptr(n_buffer, 0);
28764 size = gen_int(n_size, 1);
28765 URL = gen_filepath(n_URL, 2);
28766 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028767 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028768
William M. Brackf13f77f2004-11-12 16:03:48 +000028769 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028770 desret_xmlTextReaderPtr(ret_val);
28771 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028772 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028773 des_int(n_size, size, 1);
28774 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028775 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028776 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028777 xmlResetLastError();
28778 if (mem_base != xmlMemBlocks()) {
28779 printf("Leak of %d blocks found in xmlReaderForMemory",
28780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028781 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028782 printf(" %d", n_buffer);
28783 printf(" %d", n_size);
28784 printf(" %d", n_URL);
28785 printf(" %d", n_encoding);
28786 printf(" %d", n_options);
28787 printf("\n");
28788 }
28789 }
28790 }
28791 }
28792 }
28793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028794 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028795#endif
28796
Daniel Veillard42595322004-11-08 10:52:06 +000028797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028798}
28799
28800
28801static int
28802test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028804
William M. Brack21e4ef22005-01-02 09:53:13 +000028805#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028806 int mem_base;
28807 int ret_val;
28808 xmlTextReaderPtr reader; /* an XML reader */
28809 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028810 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028811 int n_cur;
28812 const char * URL; /* the base URL to use for the document */
28813 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028814 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028815 int n_encoding;
28816 int options; /* a combination of xmlParserOption */
28817 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028818
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028819 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28820 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28821 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28822 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028823 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028824 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028825 reader = gen_xmlTextReaderPtr(n_reader, 0);
28826 cur = gen_const_xmlChar_ptr(n_cur, 1);
28827 URL = gen_filepath(n_URL, 2);
28828 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028829 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028830
William M. Brackf13f77f2004-11-12 16:03:48 +000028831 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028832 desret_int(ret_val);
28833 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028834 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028835 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028836 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028837 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028838 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028839 xmlResetLastError();
28840 if (mem_base != xmlMemBlocks()) {
28841 printf("Leak of %d blocks found in xmlReaderNewDoc",
28842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028843 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028844 printf(" %d", n_reader);
28845 printf(" %d", n_cur);
28846 printf(" %d", n_URL);
28847 printf(" %d", n_encoding);
28848 printf(" %d", n_options);
28849 printf("\n");
28850 }
28851 }
28852 }
28853 }
28854 }
28855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028856 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028857#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028858
Daniel Veillard42595322004-11-08 10:52:06 +000028859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028860}
28861
28862
28863static int
28864test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028866
William M. Brack21e4ef22005-01-02 09:53:13 +000028867#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028868 int mem_base;
28869 int ret_val;
28870 xmlTextReaderPtr reader; /* an XML reader */
28871 int n_reader;
28872 const char * filename; /* a file or URL */
28873 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028874 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028875 int n_encoding;
28876 int options; /* a combination of xmlParserOption */
28877 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028878
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028879 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28880 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28881 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028882 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028883 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028884 reader = gen_xmlTextReaderPtr(n_reader, 0);
28885 filename = gen_filepath(n_filename, 1);
28886 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028887 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028888
William M. Brackf13f77f2004-11-12 16:03:48 +000028889 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028890 desret_int(ret_val);
28891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028892 des_xmlTextReaderPtr(n_reader, reader, 0);
28893 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028894 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028895 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028896 xmlResetLastError();
28897 if (mem_base != xmlMemBlocks()) {
28898 printf("Leak of %d blocks found in xmlReaderNewFile",
28899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028900 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028901 printf(" %d", n_reader);
28902 printf(" %d", n_filename);
28903 printf(" %d", n_encoding);
28904 printf(" %d", n_options);
28905 printf("\n");
28906 }
28907 }
28908 }
28909 }
28910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028911 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028912#endif
28913
Daniel Veillard42595322004-11-08 10:52:06 +000028914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028915}
28916
28917
28918static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028919test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028921
William M. Brack21e4ef22005-01-02 09:53:13 +000028922#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028923 int mem_base;
28924 int ret_val;
28925 xmlTextReaderPtr reader; /* an XML reader */
28926 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028927 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028928 int n_buffer;
28929 int size; /* the size of the array */
28930 int n_size;
28931 const char * URL; /* the base URL to use for the document */
28932 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028933 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028934 int n_encoding;
28935 int options; /* a combination of xmlParserOption */
28936 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028937
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028938 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28939 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28940 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28941 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28942 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028943 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028945 reader = gen_xmlTextReaderPtr(n_reader, 0);
28946 buffer = gen_const_char_ptr(n_buffer, 1);
28947 size = gen_int(n_size, 2);
28948 URL = gen_filepath(n_URL, 3);
28949 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028950 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028951
William M. Brackf13f77f2004-11-12 16:03:48 +000028952 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028953 desret_int(ret_val);
28954 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028955 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028956 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028957 des_int(n_size, size, 2);
28958 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028959 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028960 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028961 xmlResetLastError();
28962 if (mem_base != xmlMemBlocks()) {
28963 printf("Leak of %d blocks found in xmlReaderNewMemory",
28964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028965 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028966 printf(" %d", n_reader);
28967 printf(" %d", n_buffer);
28968 printf(" %d", n_size);
28969 printf(" %d", n_URL);
28970 printf(" %d", n_encoding);
28971 printf(" %d", n_options);
28972 printf("\n");
28973 }
28974 }
28975 }
28976 }
28977 }
28978 }
28979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028980 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028981#endif
28982
Daniel Veillard42595322004-11-08 10:52:06 +000028983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028984}
28985
28986
28987static int
28988test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028990
William M. Brack21e4ef22005-01-02 09:53:13 +000028991#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028992 int mem_base;
28993 int ret_val;
28994 xmlTextReaderPtr reader; /* an XML reader */
28995 int n_reader;
28996 xmlDocPtr doc; /* a preparsed document */
28997 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028998
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028999 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29000 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29001 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029002 reader = gen_xmlTextReaderPtr(n_reader, 0);
29003 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029004
29005 ret_val = xmlReaderNewWalker(reader, doc);
29006 desret_int(ret_val);
29007 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029008 des_xmlTextReaderPtr(n_reader, reader, 0);
29009 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029010 xmlResetLastError();
29011 if (mem_base != xmlMemBlocks()) {
29012 printf("Leak of %d blocks found in xmlReaderNewWalker",
29013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029014 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029015 printf(" %d", n_reader);
29016 printf(" %d", n_doc);
29017 printf("\n");
29018 }
29019 }
29020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029021 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029022#endif
29023
Daniel Veillard42595322004-11-08 10:52:06 +000029024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029025}
29026
29027
29028static int
29029test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029031
William M. Brack21e4ef22005-01-02 09:53:13 +000029032#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029033 int mem_base;
29034 xmlTextReaderPtr ret_val;
29035 xmlDocPtr doc; /* a preparsed document */
29036 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029037
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029038 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29039 mem_base = xmlMemBlocks();
29040 doc = gen_xmlDocPtr(n_doc, 0);
29041
29042 ret_val = xmlReaderWalker(doc);
29043 desret_xmlTextReaderPtr(ret_val);
29044 call_tests++;
29045 des_xmlDocPtr(n_doc, doc, 0);
29046 xmlResetLastError();
29047 if (mem_base != xmlMemBlocks()) {
29048 printf("Leak of %d blocks found in xmlReaderWalker",
29049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029050 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029051 printf(" %d", n_doc);
29052 printf("\n");
29053 }
29054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029055 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029056#endif
29057
Daniel Veillard42595322004-11-08 10:52:06 +000029058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029059}
29060
29061
29062static int
29063test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029065
William M. Brack21e4ef22005-01-02 09:53:13 +000029066#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029067 int mem_base;
29068 int ret_val;
29069 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29070 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029071
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029072 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029074 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029075
29076 ret_val = xmlTextReaderAttributeCount(reader);
29077 desret_int(ret_val);
29078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029079 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029080 xmlResetLastError();
29081 if (mem_base != xmlMemBlocks()) {
29082 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
29083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029084 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029085 printf(" %d", n_reader);
29086 printf("\n");
29087 }
29088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029089 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029090#endif
29091
Daniel Veillard42595322004-11-08 10:52:06 +000029092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029093}
29094
29095
29096static int
29097test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029099
William M. Brack21e4ef22005-01-02 09:53:13 +000029100#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029101 int mem_base;
29102 xmlChar * ret_val;
29103 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29104 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029105
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029106 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029108 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029109
29110 ret_val = xmlTextReaderBaseUri(reader);
29111 desret_xmlChar_ptr(ret_val);
29112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029113 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029114 xmlResetLastError();
29115 if (mem_base != xmlMemBlocks()) {
29116 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029118 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029119 printf(" %d", n_reader);
29120 printf("\n");
29121 }
29122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029123 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029124#endif
29125
Daniel Veillard42595322004-11-08 10:52:06 +000029126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029127}
29128
29129
29130static int
29131test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029133
William M. Brack21e4ef22005-01-02 09:53:13 +000029134#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029135 int mem_base;
29136 int ret_val;
29137 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29138 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029139
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029140 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029142 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029143
29144 ret_val = xmlTextReaderClose(reader);
29145 desret_int(ret_val);
29146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029147 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029148 xmlResetLastError();
29149 if (mem_base != xmlMemBlocks()) {
29150 printf("Leak of %d blocks found in xmlTextReaderClose",
29151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029152 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029153 printf(" %d", n_reader);
29154 printf("\n");
29155 }
29156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029157 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029158#endif
29159
Daniel Veillard42595322004-11-08 10:52:06 +000029160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029161}
29162
29163
29164static int
29165test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029167
William M. Brack21e4ef22005-01-02 09:53:13 +000029168#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029169 int mem_base;
29170 const xmlChar * ret_val;
29171 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29172 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029173
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029174 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029176 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029177
29178 ret_val = xmlTextReaderConstBaseUri(reader);
29179 desret_const_xmlChar_ptr(ret_val);
29180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029181 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029182 xmlResetLastError();
29183 if (mem_base != xmlMemBlocks()) {
29184 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029186 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029187 printf(" %d", n_reader);
29188 printf("\n");
29189 }
29190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029191 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029192#endif
29193
Daniel Veillard42595322004-11-08 10:52:06 +000029194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029195}
29196
29197
29198static int
29199test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029201
William M. Brack21e4ef22005-01-02 09:53:13 +000029202#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029203 int mem_base;
29204 const xmlChar * ret_val;
29205 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29206 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029207
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029208 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029210 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029211
29212 ret_val = xmlTextReaderConstEncoding(reader);
29213 desret_const_xmlChar_ptr(ret_val);
29214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029215 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029216 xmlResetLastError();
29217 if (mem_base != xmlMemBlocks()) {
29218 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029220 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029221 printf(" %d", n_reader);
29222 printf("\n");
29223 }
29224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029225 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029226#endif
29227
Daniel Veillard42595322004-11-08 10:52:06 +000029228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029229}
29230
29231
29232static int
29233test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029235
William M. Brack21e4ef22005-01-02 09:53:13 +000029236#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029237 int mem_base;
29238 const xmlChar * ret_val;
29239 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29240 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029241
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029242 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029244 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029245
29246 ret_val = xmlTextReaderConstLocalName(reader);
29247 desret_const_xmlChar_ptr(ret_val);
29248 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029249 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029250 xmlResetLastError();
29251 if (mem_base != xmlMemBlocks()) {
29252 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029254 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029255 printf(" %d", n_reader);
29256 printf("\n");
29257 }
29258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029259 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260#endif
29261
Daniel Veillard42595322004-11-08 10:52:06 +000029262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029263}
29264
29265
29266static int
29267test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029269
William M. Brack21e4ef22005-01-02 09:53:13 +000029270#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029271 int mem_base;
29272 const xmlChar * ret_val;
29273 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29274 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029275
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029276 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029278 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029279
29280 ret_val = xmlTextReaderConstName(reader);
29281 desret_const_xmlChar_ptr(ret_val);
29282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029283 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029284 xmlResetLastError();
29285 if (mem_base != xmlMemBlocks()) {
29286 printf("Leak of %d blocks found in xmlTextReaderConstName",
29287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029288 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029289 printf(" %d", n_reader);
29290 printf("\n");
29291 }
29292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029293 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029294#endif
29295
Daniel Veillard42595322004-11-08 10:52:06 +000029296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029297}
29298
29299
29300static int
29301test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029303
William M. Brack21e4ef22005-01-02 09:53:13 +000029304#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029305 int mem_base;
29306 const xmlChar * ret_val;
29307 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29308 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029309
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029310 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029312 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029313
29314 ret_val = xmlTextReaderConstNamespaceUri(reader);
29315 desret_const_xmlChar_ptr(ret_val);
29316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029317 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029318 xmlResetLastError();
29319 if (mem_base != xmlMemBlocks()) {
29320 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029322 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029323 printf(" %d", n_reader);
29324 printf("\n");
29325 }
29326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029327 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029328#endif
29329
Daniel Veillard42595322004-11-08 10:52:06 +000029330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029331}
29332
29333
29334static int
29335test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029337
William M. Brack21e4ef22005-01-02 09:53:13 +000029338#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029339 int mem_base;
29340 const xmlChar * ret_val;
29341 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29342 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029343
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029344 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029346 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029347
29348 ret_val = xmlTextReaderConstPrefix(reader);
29349 desret_const_xmlChar_ptr(ret_val);
29350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029351 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029352 xmlResetLastError();
29353 if (mem_base != xmlMemBlocks()) {
29354 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029356 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029357 printf(" %d", n_reader);
29358 printf("\n");
29359 }
29360 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029361 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029362#endif
29363
Daniel Veillard42595322004-11-08 10:52:06 +000029364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029365}
29366
29367
29368static int
29369test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029371
William M. Brack21e4ef22005-01-02 09:53:13 +000029372#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029373 int mem_base;
29374 const xmlChar * ret_val;
29375 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29376 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029377 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029378 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029379
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029380 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29381 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29382 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029383 reader = gen_xmlTextReaderPtr(n_reader, 0);
29384 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029385
William M. Brackf13f77f2004-11-12 16:03:48 +000029386 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029387 desret_const_xmlChar_ptr(ret_val);
29388 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029389 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029390 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029391 xmlResetLastError();
29392 if (mem_base != xmlMemBlocks()) {
29393 printf("Leak of %d blocks found in xmlTextReaderConstString",
29394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029395 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029396 printf(" %d", n_reader);
29397 printf(" %d", n_str);
29398 printf("\n");
29399 }
29400 }
29401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029402 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029403#endif
29404
Daniel Veillard42595322004-11-08 10:52:06 +000029405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029406}
29407
29408
29409static int
29410test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029412
William M. Brack21e4ef22005-01-02 09:53:13 +000029413#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029414 int mem_base;
29415 const xmlChar * ret_val;
29416 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29417 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029418
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029419 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029421 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029422
29423 ret_val = xmlTextReaderConstValue(reader);
29424 desret_const_xmlChar_ptr(ret_val);
29425 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029426 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029427 xmlResetLastError();
29428 if (mem_base != xmlMemBlocks()) {
29429 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029431 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029432 printf(" %d", n_reader);
29433 printf("\n");
29434 }
29435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029436 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029437#endif
29438
Daniel Veillard42595322004-11-08 10:52:06 +000029439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029440}
29441
29442
29443static int
29444test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029446
William M. Brack21e4ef22005-01-02 09:53:13 +000029447#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029448 int mem_base;
29449 const xmlChar * ret_val;
29450 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29451 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029452
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029453 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29454 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029455 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029456
29457 ret_val = xmlTextReaderConstXmlLang(reader);
29458 desret_const_xmlChar_ptr(ret_val);
29459 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029460 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029461 xmlResetLastError();
29462 if (mem_base != xmlMemBlocks()) {
29463 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029465 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029466 printf(" %d", n_reader);
29467 printf("\n");
29468 }
29469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029470 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029471#endif
29472
Daniel Veillard42595322004-11-08 10:52:06 +000029473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029474}
29475
29476
29477static int
29478test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029480
William M. Brack21e4ef22005-01-02 09:53:13 +000029481#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029482 int mem_base;
29483 const xmlChar * ret_val;
29484 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29485 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029486
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029487 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029489 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029490
29491 ret_val = xmlTextReaderConstXmlVersion(reader);
29492 desret_const_xmlChar_ptr(ret_val);
29493 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029494 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029495 xmlResetLastError();
29496 if (mem_base != xmlMemBlocks()) {
29497 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029499 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029500 printf(" %d", n_reader);
29501 printf("\n");
29502 }
29503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029504 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029505#endif
29506
Daniel Veillard42595322004-11-08 10:52:06 +000029507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029508}
29509
29510
29511static int
29512test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029514
William M. Brack21e4ef22005-01-02 09:53:13 +000029515#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029516 int mem_base;
29517 xmlDocPtr ret_val;
29518 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29519 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029520
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029521 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029523 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029524
29525 ret_val = xmlTextReaderCurrentDoc(reader);
29526 desret_xmlDocPtr(ret_val);
29527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029528 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029529 xmlResetLastError();
29530 if (mem_base != xmlMemBlocks()) {
29531 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029533 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029534 printf(" %d", n_reader);
29535 printf("\n");
29536 }
29537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029538 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029539#endif
29540
Daniel Veillard42595322004-11-08 10:52:06 +000029541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029542}
29543
29544
29545static int
29546test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029548
William M. Brack21e4ef22005-01-02 09:53:13 +000029549#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029550 int mem_base;
29551 xmlNodePtr ret_val;
29552 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29553 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029554
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029555 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029557 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029558
29559 ret_val = xmlTextReaderCurrentNode(reader);
29560 desret_xmlNodePtr(ret_val);
29561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029562 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029563 xmlResetLastError();
29564 if (mem_base != xmlMemBlocks()) {
29565 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029567 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029568 printf(" %d", n_reader);
29569 printf("\n");
29570 }
29571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029572 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029573#endif
29574
Daniel Veillard42595322004-11-08 10:52:06 +000029575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029576}
29577
29578
29579static int
29580test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029582
William M. Brack21e4ef22005-01-02 09:53:13 +000029583#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029584 int mem_base;
29585 int ret_val;
29586 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29587 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029588
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029589 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029591 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029592
29593 ret_val = xmlTextReaderDepth(reader);
29594 desret_int(ret_val);
29595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029596 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029597 xmlResetLastError();
29598 if (mem_base != xmlMemBlocks()) {
29599 printf("Leak of %d blocks found in xmlTextReaderDepth",
29600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029601 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029602 printf(" %d", n_reader);
29603 printf("\n");
29604 }
29605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029606 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029607#endif
29608
Daniel Veillard42595322004-11-08 10:52:06 +000029609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029610}
29611
29612
29613static int
29614test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029616
William M. Brack21e4ef22005-01-02 09:53:13 +000029617#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029618 int mem_base;
29619 xmlNodePtr ret_val;
29620 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29621 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029622
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029623 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29624 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029625 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029626
29627 ret_val = xmlTextReaderExpand(reader);
29628 desret_xmlNodePtr(ret_val);
29629 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029630 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029631 xmlResetLastError();
29632 if (mem_base != xmlMemBlocks()) {
29633 printf("Leak of %d blocks found in xmlTextReaderExpand",
29634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029635 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029636 printf(" %d", n_reader);
29637 printf("\n");
29638 }
29639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029640 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029641#endif
29642
Daniel Veillard42595322004-11-08 10:52:06 +000029643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029644}
29645
29646
29647static int
29648test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029650
William M. Brack21e4ef22005-01-02 09:53:13 +000029651#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029652 int mem_base;
29653 xmlChar * ret_val;
29654 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29655 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029656 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029657 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029658
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029659 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29660 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29661 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029662 reader = gen_xmlTextReaderPtr(n_reader, 0);
29663 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029664
William M. Brackf13f77f2004-11-12 16:03:48 +000029665 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029666 desret_xmlChar_ptr(ret_val);
29667 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029668 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029669 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029670 xmlResetLastError();
29671 if (mem_base != xmlMemBlocks()) {
29672 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029674 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029675 printf(" %d", n_reader);
29676 printf(" %d", n_name);
29677 printf("\n");
29678 }
29679 }
29680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029681 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029682#endif
29683
Daniel Veillard42595322004-11-08 10:52:06 +000029684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029685}
29686
29687
29688static int
29689test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029691
William M. Brack21e4ef22005-01-02 09:53:13 +000029692#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029693 int mem_base;
29694 xmlChar * ret_val;
29695 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29696 int n_reader;
29697 int no; /* the zero-based index of the attribute relative to the containing element */
29698 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029699
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029700 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29701 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029703 reader = gen_xmlTextReaderPtr(n_reader, 0);
29704 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029705
29706 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29707 desret_xmlChar_ptr(ret_val);
29708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029709 des_xmlTextReaderPtr(n_reader, reader, 0);
29710 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029711 xmlResetLastError();
29712 if (mem_base != xmlMemBlocks()) {
29713 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029715 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029716 printf(" %d", n_reader);
29717 printf(" %d", n_no);
29718 printf("\n");
29719 }
29720 }
29721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029722 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029723#endif
29724
Daniel Veillard42595322004-11-08 10:52:06 +000029725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029726}
29727
29728
29729static int
29730test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029732
William M. Brack21e4ef22005-01-02 09:53:13 +000029733#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029734 int mem_base;
29735 xmlChar * ret_val;
29736 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29737 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029738 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029739 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029740 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029741 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029742
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029743 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29744 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29745 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029747 reader = gen_xmlTextReaderPtr(n_reader, 0);
29748 localName = gen_const_xmlChar_ptr(n_localName, 1);
29749 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029750
William M. Brackf13f77f2004-11-12 16:03:48 +000029751 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029752 desret_xmlChar_ptr(ret_val);
29753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029754 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029755 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29756 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029757 xmlResetLastError();
29758 if (mem_base != xmlMemBlocks()) {
29759 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029761 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029762 printf(" %d", n_reader);
29763 printf(" %d", n_localName);
29764 printf(" %d", n_namespaceURI);
29765 printf("\n");
29766 }
29767 }
29768 }
29769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029770 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029771#endif
29772
Daniel Veillard42595322004-11-08 10:52:06 +000029773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029774}
29775
Daniel Veillarda521d282004-11-09 14:59:59 +000029776#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029777
Daniel Veillardce682bc2004-11-05 17:22:25 +000029778#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29779static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29780 return(NULL);
29781}
29782static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29783}
Daniel Veillarda521d282004-11-09 14:59:59 +000029784#endif
29785
Daniel Veillardce682bc2004-11-05 17:22:25 +000029786
Daniel Veillardd93f6252004-11-02 15:53:51 +000029787static int
29788test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029790
William M. Brack21e4ef22005-01-02 09:53:13 +000029791#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029792 int mem_base;
29793 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29794 int n_reader;
29795 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29796 int n_f;
29797 void ** arg; /* a user argument */
29798 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029799
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029800 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29801 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29802 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29803 mem_base = xmlMemBlocks();
29804 reader = gen_xmlTextReaderPtr(n_reader, 0);
29805 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29806 arg = gen_void_ptr_ptr(n_arg, 2);
29807
29808 xmlTextReaderGetErrorHandler(reader, f, arg);
29809 call_tests++;
29810 des_xmlTextReaderPtr(n_reader, reader, 0);
29811 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29812 des_void_ptr_ptr(n_arg, arg, 2);
29813 xmlResetLastError();
29814 if (mem_base != xmlMemBlocks()) {
29815 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029817 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029818 printf(" %d", n_reader);
29819 printf(" %d", n_f);
29820 printf(" %d", n_arg);
29821 printf("\n");
29822 }
29823 }
29824 }
29825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029826 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029827#endif
29828
Daniel Veillard42595322004-11-08 10:52:06 +000029829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029830}
29831
29832
29833static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029834test_xmlTextReaderGetParserColumnNumber(void) {
29835 int test_ret = 0;
29836
29837#if defined(LIBXML_READER_ENABLED)
29838 int mem_base;
29839 int ret_val;
29840 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29841 int n_reader;
29842
29843 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29844 mem_base = xmlMemBlocks();
29845 reader = gen_xmlTextReaderPtr(n_reader, 0);
29846
29847 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29848 desret_int(ret_val);
29849 call_tests++;
29850 des_xmlTextReaderPtr(n_reader, reader, 0);
29851 xmlResetLastError();
29852 if (mem_base != xmlMemBlocks()) {
29853 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29854 xmlMemBlocks() - mem_base);
29855 test_ret++;
29856 printf(" %d", n_reader);
29857 printf("\n");
29858 }
29859 }
29860 function_tests++;
29861#endif
29862
29863 return(test_ret);
29864}
29865
29866
29867static int
29868test_xmlTextReaderGetParserLineNumber(void) {
29869 int test_ret = 0;
29870
29871#if defined(LIBXML_READER_ENABLED)
29872 int mem_base;
29873 int ret_val;
29874 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29875 int n_reader;
29876
29877 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29878 mem_base = xmlMemBlocks();
29879 reader = gen_xmlTextReaderPtr(n_reader, 0);
29880
29881 ret_val = xmlTextReaderGetParserLineNumber(reader);
29882 desret_int(ret_val);
29883 call_tests++;
29884 des_xmlTextReaderPtr(n_reader, reader, 0);
29885 xmlResetLastError();
29886 if (mem_base != xmlMemBlocks()) {
29887 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29888 xmlMemBlocks() - mem_base);
29889 test_ret++;
29890 printf(" %d", n_reader);
29891 printf("\n");
29892 }
29893 }
29894 function_tests++;
29895#endif
29896
29897 return(test_ret);
29898}
29899
29900
29901static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029902test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029904
William M. Brack21e4ef22005-01-02 09:53:13 +000029905#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029906 int mem_base;
29907 int ret_val;
29908 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29909 int n_reader;
29910 int prop; /* the xmlParserProperties to get */
29911 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029912
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029913 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29914 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029916 reader = gen_xmlTextReaderPtr(n_reader, 0);
29917 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029918
29919 ret_val = xmlTextReaderGetParserProp(reader, prop);
29920 desret_int(ret_val);
29921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029922 des_xmlTextReaderPtr(n_reader, reader, 0);
29923 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029924 xmlResetLastError();
29925 if (mem_base != xmlMemBlocks()) {
29926 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029928 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029929 printf(" %d", n_reader);
29930 printf(" %d", n_prop);
29931 printf("\n");
29932 }
29933 }
29934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029935 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029936#endif
29937
Daniel Veillard42595322004-11-08 10:52:06 +000029938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029939}
29940
29941
29942static int
29943test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029945
William M. Brack21e4ef22005-01-02 09:53:13 +000029946#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029947 int mem_base;
29948 xmlParserInputBufferPtr ret_val;
29949 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29950 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029951
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029952 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29953 mem_base = xmlMemBlocks();
29954 reader = gen_xmlTextReaderPtr(n_reader, 0);
29955
29956 ret_val = xmlTextReaderGetRemainder(reader);
29957 desret_xmlParserInputBufferPtr(ret_val);
29958 call_tests++;
29959 des_xmlTextReaderPtr(n_reader, reader, 0);
29960 xmlResetLastError();
29961 if (mem_base != xmlMemBlocks()) {
29962 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029964 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029965 printf(" %d", n_reader);
29966 printf("\n");
29967 }
29968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029969 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029970#endif
29971
Daniel Veillard42595322004-11-08 10:52:06 +000029972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029973}
29974
29975
29976static int
29977test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029979
William M. Brack21e4ef22005-01-02 09:53:13 +000029980#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029981 int mem_base;
29982 int ret_val;
29983 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29984 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029985
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029986 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29987 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029988 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029989
29990 ret_val = xmlTextReaderHasAttributes(reader);
29991 desret_int(ret_val);
29992 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029993 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029994 xmlResetLastError();
29995 if (mem_base != xmlMemBlocks()) {
29996 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029998 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029999 printf(" %d", n_reader);
30000 printf("\n");
30001 }
30002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030003 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030004#endif
30005
Daniel Veillard42595322004-11-08 10:52:06 +000030006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030007}
30008
30009
30010static int
30011test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030013
William M. Brack21e4ef22005-01-02 09:53:13 +000030014#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030015 int mem_base;
30016 int ret_val;
30017 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30018 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030019
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030020 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030022 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030023
30024 ret_val = xmlTextReaderHasValue(reader);
30025 desret_int(ret_val);
30026 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030027 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030028 xmlResetLastError();
30029 if (mem_base != xmlMemBlocks()) {
30030 printf("Leak of %d blocks found in xmlTextReaderHasValue",
30031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030032 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030033 printf(" %d", n_reader);
30034 printf("\n");
30035 }
30036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030037 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038#endif
30039
Daniel Veillard42595322004-11-08 10:52:06 +000030040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030041}
30042
30043
30044static int
30045test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030047
William M. Brack21e4ef22005-01-02 09:53:13 +000030048#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030049 int mem_base;
30050 int ret_val;
30051 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30052 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030053
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030054 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030056 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030057
30058 ret_val = xmlTextReaderIsDefault(reader);
30059 desret_int(ret_val);
30060 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030061 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030062 xmlResetLastError();
30063 if (mem_base != xmlMemBlocks()) {
30064 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
30065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030066 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030067 printf(" %d", n_reader);
30068 printf("\n");
30069 }
30070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030071 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072#endif
30073
Daniel Veillard42595322004-11-08 10:52:06 +000030074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030075}
30076
30077
30078static int
30079test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030081
William M. Brack21e4ef22005-01-02 09:53:13 +000030082#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030083 int mem_base;
30084 int ret_val;
30085 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30086 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030087
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030088 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030090 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030091
30092 ret_val = xmlTextReaderIsEmptyElement(reader);
30093 desret_int(ret_val);
30094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030095 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030096 xmlResetLastError();
30097 if (mem_base != xmlMemBlocks()) {
30098 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
30099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030100 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030101 printf(" %d", n_reader);
30102 printf("\n");
30103 }
30104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030105 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106#endif
30107
Daniel Veillard42595322004-11-08 10:52:06 +000030108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030109}
30110
30111
30112static int
30113test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030115
William M. Brack21e4ef22005-01-02 09:53:13 +000030116#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030117 int mem_base;
30118 int ret_val;
30119 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30120 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030121
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030122 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30123 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030124 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030125
30126 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30127 desret_int(ret_val);
30128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030129 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030130 xmlResetLastError();
30131 if (mem_base != xmlMemBlocks()) {
30132 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030134 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030135 printf(" %d", n_reader);
30136 printf("\n");
30137 }
30138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030139 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030140#endif
30141
Daniel Veillard42595322004-11-08 10:52:06 +000030142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030143}
30144
30145
30146static int
30147test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030149
William M. Brack21e4ef22005-01-02 09:53:13 +000030150#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030151 int mem_base;
30152 int ret_val;
30153 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30154 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030155
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030156 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30157 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030158 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030159
30160 ret_val = xmlTextReaderIsValid(reader);
30161 desret_int(ret_val);
30162 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030163 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030164 xmlResetLastError();
30165 if (mem_base != xmlMemBlocks()) {
30166 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030168 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030169 printf(" %d", n_reader);
30170 printf("\n");
30171 }
30172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030173 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174#endif
30175
Daniel Veillard42595322004-11-08 10:52:06 +000030176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030177}
30178
30179
30180static int
30181test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030183
William M. Brack21e4ef22005-01-02 09:53:13 +000030184#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030185 int mem_base;
30186 xmlChar * ret_val;
30187 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30188 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030189
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030190 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30191 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030192 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030193
30194 ret_val = xmlTextReaderLocalName(reader);
30195 desret_xmlChar_ptr(ret_val);
30196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030197 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030198 xmlResetLastError();
30199 if (mem_base != xmlMemBlocks()) {
30200 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030202 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030203 printf(" %d", n_reader);
30204 printf("\n");
30205 }
30206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030207 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208#endif
30209
Daniel Veillard42595322004-11-08 10:52:06 +000030210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030211}
30212
Daniel Veillarda521d282004-11-09 14:59:59 +000030213#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030214
Daniel Veillardce682bc2004-11-05 17:22:25 +000030215#define gen_nb_xmlTextReaderLocatorPtr 1
30216static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30217 return(NULL);
30218}
30219static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30220}
Daniel Veillarda521d282004-11-09 14:59:59 +000030221#endif
30222
Daniel Veillardce682bc2004-11-05 17:22:25 +000030223
Daniel Veillardd93f6252004-11-02 15:53:51 +000030224static int
30225test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030227
William M. Brack21e4ef22005-01-02 09:53:13 +000030228#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030229 int mem_base;
30230 xmlChar * ret_val;
30231 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30232 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030233
Daniel Veillardce682bc2004-11-05 17:22:25 +000030234 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30235 mem_base = xmlMemBlocks();
30236 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30237
30238 ret_val = xmlTextReaderLocatorBaseURI(locator);
30239 desret_xmlChar_ptr(ret_val);
30240 call_tests++;
30241 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30242 xmlResetLastError();
30243 if (mem_base != xmlMemBlocks()) {
30244 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030246 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030247 printf(" %d", n_locator);
30248 printf("\n");
30249 }
30250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030251 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030252#endif
30253
Daniel Veillard42595322004-11-08 10:52:06 +000030254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030255}
30256
30257
30258static int
30259test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030261
William M. Brack21e4ef22005-01-02 09:53:13 +000030262#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030263 int mem_base;
30264 int ret_val;
30265 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30266 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030267
Daniel Veillardce682bc2004-11-05 17:22:25 +000030268 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30269 mem_base = xmlMemBlocks();
30270 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30271
30272 ret_val = xmlTextReaderLocatorLineNumber(locator);
30273 desret_int(ret_val);
30274 call_tests++;
30275 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30276 xmlResetLastError();
30277 if (mem_base != xmlMemBlocks()) {
30278 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030280 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030281 printf(" %d", n_locator);
30282 printf("\n");
30283 }
30284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030285 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030286#endif
30287
Daniel Veillard42595322004-11-08 10:52:06 +000030288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030289}
30290
30291
30292static int
30293test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030295
William M. Brack21e4ef22005-01-02 09:53:13 +000030296#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030297 int mem_base;
30298 xmlChar * ret_val;
30299 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30300 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030301 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 +000030302 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030303
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030304 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30305 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030307 reader = gen_xmlTextReaderPtr(n_reader, 0);
30308 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030309
William M. Brackf13f77f2004-11-12 16:03:48 +000030310 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030311 desret_xmlChar_ptr(ret_val);
30312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030313 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030314 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030315 xmlResetLastError();
30316 if (mem_base != xmlMemBlocks()) {
30317 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030319 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030320 printf(" %d", n_reader);
30321 printf(" %d", n_prefix);
30322 printf("\n");
30323 }
30324 }
30325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030326 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030327#endif
30328
Daniel Veillard42595322004-11-08 10:52:06 +000030329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030330}
30331
30332
30333static int
30334test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030336
William M. Brack21e4ef22005-01-02 09:53:13 +000030337#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030338 int mem_base;
30339 int ret_val;
30340 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30341 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030342 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030343 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030344
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030345 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30346 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030348 reader = gen_xmlTextReaderPtr(n_reader, 0);
30349 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030350
William M. Brackf13f77f2004-11-12 16:03:48 +000030351 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030352 desret_int(ret_val);
30353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030354 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030355 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030356 xmlResetLastError();
30357 if (mem_base != xmlMemBlocks()) {
30358 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030360 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030361 printf(" %d", n_reader);
30362 printf(" %d", n_name);
30363 printf("\n");
30364 }
30365 }
30366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030367 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030368#endif
30369
Daniel Veillard42595322004-11-08 10:52:06 +000030370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030371}
30372
30373
30374static int
30375test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030377
William M. Brack21e4ef22005-01-02 09:53:13 +000030378#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379 int mem_base;
30380 int ret_val;
30381 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30382 int n_reader;
30383 int no; /* the zero-based index of the attribute relative to the containing element. */
30384 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030385
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030386 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30387 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030389 reader = gen_xmlTextReaderPtr(n_reader, 0);
30390 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030391
30392 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30393 desret_int(ret_val);
30394 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030395 des_xmlTextReaderPtr(n_reader, reader, 0);
30396 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030397 xmlResetLastError();
30398 if (mem_base != xmlMemBlocks()) {
30399 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030401 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030402 printf(" %d", n_reader);
30403 printf(" %d", n_no);
30404 printf("\n");
30405 }
30406 }
30407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030408 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030409#endif
30410
Daniel Veillard42595322004-11-08 10:52:06 +000030411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030412}
30413
30414
30415static int
30416test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030418
William M. Brack21e4ef22005-01-02 09:53:13 +000030419#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030420 int mem_base;
30421 int ret_val;
30422 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30423 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030424 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030425 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030426 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030427 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030428
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030429 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30430 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30431 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030433 reader = gen_xmlTextReaderPtr(n_reader, 0);
30434 localName = gen_const_xmlChar_ptr(n_localName, 1);
30435 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030436
William M. Brackf13f77f2004-11-12 16:03:48 +000030437 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030438 desret_int(ret_val);
30439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030440 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030441 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30442 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030443 xmlResetLastError();
30444 if (mem_base != xmlMemBlocks()) {
30445 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030447 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030448 printf(" %d", n_reader);
30449 printf(" %d", n_localName);
30450 printf(" %d", n_namespaceURI);
30451 printf("\n");
30452 }
30453 }
30454 }
30455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030456 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030457#endif
30458
Daniel Veillard42595322004-11-08 10:52:06 +000030459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030460}
30461
30462
30463static int
30464test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030466
William M. Brack21e4ef22005-01-02 09:53:13 +000030467#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030468 int mem_base;
30469 int ret_val;
30470 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30471 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030472
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030473 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030475 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030476
30477 ret_val = xmlTextReaderMoveToElement(reader);
30478 desret_int(ret_val);
30479 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030480 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481 xmlResetLastError();
30482 if (mem_base != xmlMemBlocks()) {
30483 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030485 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030486 printf(" %d", n_reader);
30487 printf("\n");
30488 }
30489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030490 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030491#endif
30492
Daniel Veillard42595322004-11-08 10:52:06 +000030493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030494}
30495
30496
30497static int
30498test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030500
William M. Brack21e4ef22005-01-02 09:53:13 +000030501#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030502 int mem_base;
30503 int ret_val;
30504 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30505 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030506
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030507 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030509 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030510
30511 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30512 desret_int(ret_val);
30513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030514 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515 xmlResetLastError();
30516 if (mem_base != xmlMemBlocks()) {
30517 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030519 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030520 printf(" %d", n_reader);
30521 printf("\n");
30522 }
30523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030524 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030525#endif
30526
Daniel Veillard42595322004-11-08 10:52:06 +000030527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030528}
30529
30530
30531static int
30532test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030534
William M. Brack21e4ef22005-01-02 09:53:13 +000030535#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030536 int mem_base;
30537 int ret_val;
30538 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30539 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030540
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030541 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030543 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030544
30545 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30546 desret_int(ret_val);
30547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030548 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549 xmlResetLastError();
30550 if (mem_base != xmlMemBlocks()) {
30551 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030553 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030554 printf(" %d", n_reader);
30555 printf("\n");
30556 }
30557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030558 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030559#endif
30560
Daniel Veillard42595322004-11-08 10:52:06 +000030561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030562}
30563
30564
30565static int
30566test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030568
William M. Brack21e4ef22005-01-02 09:53:13 +000030569#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030570 int mem_base;
30571 xmlChar * ret_val;
30572 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30573 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030574
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030575 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30576 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030577 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030578
30579 ret_val = xmlTextReaderName(reader);
30580 desret_xmlChar_ptr(ret_val);
30581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030582 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030583 xmlResetLastError();
30584 if (mem_base != xmlMemBlocks()) {
30585 printf("Leak of %d blocks found in xmlTextReaderName",
30586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030587 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030588 printf(" %d", n_reader);
30589 printf("\n");
30590 }
30591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030592 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030593#endif
30594
Daniel Veillard42595322004-11-08 10:52:06 +000030595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030596}
30597
30598
30599static int
30600test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030602
William M. Brack21e4ef22005-01-02 09:53:13 +000030603#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030604 int mem_base;
30605 xmlChar * ret_val;
30606 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30607 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030608
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030609 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30610 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030611 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030612
30613 ret_val = xmlTextReaderNamespaceUri(reader);
30614 desret_xmlChar_ptr(ret_val);
30615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030616 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030617 xmlResetLastError();
30618 if (mem_base != xmlMemBlocks()) {
30619 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030621 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030622 printf(" %d", n_reader);
30623 printf("\n");
30624 }
30625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030626 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030627#endif
30628
Daniel Veillard42595322004-11-08 10:52:06 +000030629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030630}
30631
30632
30633static int
30634test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030636
William M. Brack21e4ef22005-01-02 09:53:13 +000030637#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030638 int mem_base;
30639 int ret_val;
30640 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30641 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030642
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030643 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030645 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030646
30647 ret_val = xmlTextReaderNext(reader);
30648 desret_int(ret_val);
30649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030650 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030651 xmlResetLastError();
30652 if (mem_base != xmlMemBlocks()) {
30653 printf("Leak of %d blocks found in xmlTextReaderNext",
30654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030655 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030656 printf(" %d", n_reader);
30657 printf("\n");
30658 }
30659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030660 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030661#endif
30662
Daniel Veillard42595322004-11-08 10:52:06 +000030663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030664}
30665
30666
30667static int
30668test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030670
William M. Brack21e4ef22005-01-02 09:53:13 +000030671#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030672 int mem_base;
30673 int ret_val;
30674 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30675 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030676
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030677 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030679 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030680
30681 ret_val = xmlTextReaderNextSibling(reader);
30682 desret_int(ret_val);
30683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030684 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030685 xmlResetLastError();
30686 if (mem_base != xmlMemBlocks()) {
30687 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030689 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030690 printf(" %d", n_reader);
30691 printf("\n");
30692 }
30693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030694 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030695#endif
30696
Daniel Veillard42595322004-11-08 10:52:06 +000030697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030698}
30699
30700
30701static int
30702test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030704
William M. Brack21e4ef22005-01-02 09:53:13 +000030705#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030706 int mem_base;
30707 int ret_val;
30708 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30709 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030710
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030711 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030713 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030714
30715 ret_val = xmlTextReaderNodeType(reader);
30716 desret_int(ret_val);
30717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030718 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030719 xmlResetLastError();
30720 if (mem_base != xmlMemBlocks()) {
30721 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030723 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030724 printf(" %d", n_reader);
30725 printf("\n");
30726 }
30727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030728 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030729#endif
30730
Daniel Veillard42595322004-11-08 10:52:06 +000030731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030732}
30733
30734
30735static int
30736test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030738
William M. Brack21e4ef22005-01-02 09:53:13 +000030739#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030740 int mem_base;
30741 int ret_val;
30742 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30743 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030744
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030745 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030747 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030748
30749 ret_val = xmlTextReaderNormalization(reader);
30750 desret_int(ret_val);
30751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030752 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030753 xmlResetLastError();
30754 if (mem_base != xmlMemBlocks()) {
30755 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030757 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030758 printf(" %d", n_reader);
30759 printf("\n");
30760 }
30761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030762 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030763#endif
30764
Daniel Veillard42595322004-11-08 10:52:06 +000030765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030766}
30767
30768
30769static int
30770test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030772
William M. Brack21e4ef22005-01-02 09:53:13 +000030773#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030774 int mem_base;
30775 xmlChar * ret_val;
30776 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30777 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030778
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030779 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030781 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030782
30783 ret_val = xmlTextReaderPrefix(reader);
30784 desret_xmlChar_ptr(ret_val);
30785 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030786 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030787 xmlResetLastError();
30788 if (mem_base != xmlMemBlocks()) {
30789 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030791 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030792 printf(" %d", n_reader);
30793 printf("\n");
30794 }
30795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030796 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030797#endif
30798
Daniel Veillard42595322004-11-08 10:52:06 +000030799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030800}
30801
30802
30803static int
30804test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030806
William M. Brack21e4ef22005-01-02 09:53:13 +000030807#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030808 int mem_base;
30809 xmlNodePtr ret_val;
30810 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30811 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030812
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030813 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030815 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030816
30817 ret_val = xmlTextReaderPreserve(reader);
30818 desret_xmlNodePtr(ret_val);
30819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030820 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030821 xmlResetLastError();
30822 if (mem_base != xmlMemBlocks()) {
30823 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030825 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030826 printf(" %d", n_reader);
30827 printf("\n");
30828 }
30829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030830 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030831#endif
30832
Daniel Veillard42595322004-11-08 10:52:06 +000030833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030834}
30835
30836
30837static int
30838test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030840
William M. Brack21e4ef22005-01-02 09:53:13 +000030841#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030842#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030843 int mem_base;
30844 int ret_val;
30845 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30846 int n_reader;
30847 xmlChar * pattern; /* an XPath subset pattern */
30848 int n_pattern;
30849 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30850 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030851
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030852 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30853 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30854 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30855 mem_base = xmlMemBlocks();
30856 reader = gen_xmlTextReaderPtr(n_reader, 0);
30857 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30858 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30859
William M. Brackf13f77f2004-11-12 16:03:48 +000030860 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030861 desret_int(ret_val);
30862 call_tests++;
30863 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030864 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30865 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030866 xmlResetLastError();
30867 if (mem_base != xmlMemBlocks()) {
30868 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030870 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030871 printf(" %d", n_reader);
30872 printf(" %d", n_pattern);
30873 printf(" %d", n_namespaces);
30874 printf("\n");
30875 }
30876 }
30877 }
30878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030879 function_tests++;
30880#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030881#endif
30882
Daniel Veillard42595322004-11-08 10:52:06 +000030883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030884}
30885
30886
30887static int
30888test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030890
William M. Brack21e4ef22005-01-02 09:53:13 +000030891#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030892 int mem_base;
30893 int ret_val;
30894 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30895 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030896
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030897 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030899 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030900
30901 ret_val = xmlTextReaderQuoteChar(reader);
30902 desret_int(ret_val);
30903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030904 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030905 xmlResetLastError();
30906 if (mem_base != xmlMemBlocks()) {
30907 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030909 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030910 printf(" %d", n_reader);
30911 printf("\n");
30912 }
30913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030914 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030915#endif
30916
Daniel Veillard42595322004-11-08 10:52:06 +000030917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030918}
30919
30920
30921static int
30922test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030924
William M. Brack21e4ef22005-01-02 09:53:13 +000030925#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030926 int mem_base;
30927 int ret_val;
30928 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30929 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030930
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030931 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030933 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030934
30935 ret_val = xmlTextReaderRead(reader);
30936 desret_int(ret_val);
30937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030938 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030939 xmlResetLastError();
30940 if (mem_base != xmlMemBlocks()) {
30941 printf("Leak of %d blocks found in xmlTextReaderRead",
30942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030943 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030944 printf(" %d", n_reader);
30945 printf("\n");
30946 }
30947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030948 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030949#endif
30950
Daniel Veillard42595322004-11-08 10:52:06 +000030951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030952}
30953
30954
30955static int
30956test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030958
William M. Brack21e4ef22005-01-02 09:53:13 +000030959#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030960 int mem_base;
30961 int ret_val;
30962 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30963 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030964
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030965 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30966 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030967 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030968
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030969 ret_val = xmlTextReaderReadAttributeValue(reader);
30970 desret_int(ret_val);
30971 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030972 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030973 xmlResetLastError();
30974 if (mem_base != xmlMemBlocks()) {
30975 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030977 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030978 printf(" %d", n_reader);
30979 printf("\n");
30980 }
30981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030982 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030983#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030984
Daniel Veillard42595322004-11-08 10:52:06 +000030985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030986}
30987
30988
30989static int
30990test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030992
William M. Brack21e4ef22005-01-02 09:53:13 +000030993#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030994 int mem_base;
30995 int ret_val;
30996 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30997 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030998
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030999 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31000 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031001 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031002
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031003 ret_val = xmlTextReaderReadState(reader);
31004 desret_int(ret_val);
31005 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031006 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031007 xmlResetLastError();
31008 if (mem_base != xmlMemBlocks()) {
31009 printf("Leak of %d blocks found in xmlTextReaderReadState",
31010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031011 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031012 printf(" %d", n_reader);
31013 printf("\n");
31014 }
31015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031016 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031017#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031018
Daniel Veillard42595322004-11-08 10:52:06 +000031019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031020}
31021
31022
31023static int
31024test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031026
William M. Brack21e4ef22005-01-02 09:53:13 +000031027#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031028 int mem_base;
31029 int ret_val;
31030 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31031 int n_reader;
31032 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
31033 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031034
Daniel Veillardce682bc2004-11-05 17:22:25 +000031035 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31036 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
31037 mem_base = xmlMemBlocks();
31038 reader = gen_xmlTextReaderPtr(n_reader, 0);
31039 schema = gen_xmlRelaxNGPtr(n_schema, 1);
31040
31041 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
31042 desret_int(ret_val);
31043 call_tests++;
31044 des_xmlTextReaderPtr(n_reader, reader, 0);
31045 des_xmlRelaxNGPtr(n_schema, schema, 1);
31046 xmlResetLastError();
31047 if (mem_base != xmlMemBlocks()) {
31048 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
31049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031050 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031051 printf(" %d", n_reader);
31052 printf(" %d", n_schema);
31053 printf("\n");
31054 }
31055 }
31056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031057 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031058#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031059
Daniel Veillard42595322004-11-08 10:52:06 +000031060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031061}
31062
31063
31064static int
31065test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031067
William M. Brack21e4ef22005-01-02 09:53:13 +000031068#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031069 int mem_base;
31070 int ret_val;
31071 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31072 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031073 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031074 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031075
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031076 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31077 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
31078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031079 reader = gen_xmlTextReaderPtr(n_reader, 0);
31080 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031081
William M. Brackf13f77f2004-11-12 16:03:48 +000031082 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031083 desret_int(ret_val);
31084 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031085 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031086 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031087 xmlResetLastError();
31088 if (mem_base != xmlMemBlocks()) {
31089 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
31090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031091 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031092 printf(" %d", n_reader);
31093 printf(" %d", n_rng);
31094 printf("\n");
31095 }
31096 }
31097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031098 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031099#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031100
Daniel Veillard42595322004-11-08 10:52:06 +000031101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031102}
31103
31104
31105static int
31106test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031108
31109
31110 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031112}
31113
31114
31115static int
31116test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031118
William M. Brack21e4ef22005-01-02 09:53:13 +000031119#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031120 int mem_base;
31121 int ret_val;
31122 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31123 int n_reader;
31124 int prop; /* the xmlParserProperties to set */
31125 int n_prop;
31126 int value; /* usually 0 or 1 to (de)activate it */
31127 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031128
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031129 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31130 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31131 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31132 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031133 reader = gen_xmlTextReaderPtr(n_reader, 0);
31134 prop = gen_int(n_prop, 1);
31135 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031136
31137 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31138 desret_int(ret_val);
31139 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031140 des_xmlTextReaderPtr(n_reader, reader, 0);
31141 des_int(n_prop, prop, 1);
31142 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031143 xmlResetLastError();
31144 if (mem_base != xmlMemBlocks()) {
31145 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031147 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031148 printf(" %d", n_reader);
31149 printf(" %d", n_prop);
31150 printf(" %d", n_value);
31151 printf("\n");
31152 }
31153 }
31154 }
31155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031156 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031157#endif
31158
Daniel Veillard42595322004-11-08 10:52:06 +000031159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031160}
31161
31162
31163static int
31164test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031166
31167
31168 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031170}
31171
31172
31173static int
31174test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031176
William M. Brack21e4ef22005-01-02 09:53:13 +000031177#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031178 int mem_base;
31179 int ret_val;
31180 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31181 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031182
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031183 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31184 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031185 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031186
31187 ret_val = xmlTextReaderStandalone(reader);
31188 desret_int(ret_val);
31189 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031190 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031191 xmlResetLastError();
31192 if (mem_base != xmlMemBlocks()) {
31193 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031195 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031196 printf(" %d", n_reader);
31197 printf("\n");
31198 }
31199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031200 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031201#endif
31202
Daniel Veillard42595322004-11-08 10:52:06 +000031203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031204}
31205
31206
31207static int
31208test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031210
William M. Brack21e4ef22005-01-02 09:53:13 +000031211#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031212 int mem_base;
31213 xmlChar * ret_val;
31214 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31215 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031216
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031217 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31218 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031219 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031220
31221 ret_val = xmlTextReaderValue(reader);
31222 desret_xmlChar_ptr(ret_val);
31223 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031224 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031225 xmlResetLastError();
31226 if (mem_base != xmlMemBlocks()) {
31227 printf("Leak of %d blocks found in xmlTextReaderValue",
31228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031229 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031230 printf(" %d", n_reader);
31231 printf("\n");
31232 }
31233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031234 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031235#endif
31236
Daniel Veillard42595322004-11-08 10:52:06 +000031237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031238}
31239
31240
31241static int
31242test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031244
William M. Brack21e4ef22005-01-02 09:53:13 +000031245#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031246 int mem_base;
31247 xmlChar * ret_val;
31248 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31249 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031250
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031251 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31252 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031253 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031254
31255 ret_val = xmlTextReaderXmlLang(reader);
31256 desret_xmlChar_ptr(ret_val);
31257 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031258 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031259 xmlResetLastError();
31260 if (mem_base != xmlMemBlocks()) {
31261 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031263 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031264 printf(" %d", n_reader);
31265 printf("\n");
31266 }
31267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031268 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031269#endif
31270
Daniel Veillard42595322004-11-08 10:52:06 +000031271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031272}
31273
31274static int
31275test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031277
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031278 if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031279 test_ret += test_xmlNewTextReader();
31280 test_ret += test_xmlNewTextReaderFilename();
31281 test_ret += test_xmlReaderForDoc();
31282 test_ret += test_xmlReaderForFile();
31283 test_ret += test_xmlReaderForMemory();
31284 test_ret += test_xmlReaderNewDoc();
31285 test_ret += test_xmlReaderNewFile();
31286 test_ret += test_xmlReaderNewMemory();
31287 test_ret += test_xmlReaderNewWalker();
31288 test_ret += test_xmlReaderWalker();
31289 test_ret += test_xmlTextReaderAttributeCount();
31290 test_ret += test_xmlTextReaderBaseUri();
31291 test_ret += test_xmlTextReaderClose();
31292 test_ret += test_xmlTextReaderConstBaseUri();
31293 test_ret += test_xmlTextReaderConstEncoding();
31294 test_ret += test_xmlTextReaderConstLocalName();
31295 test_ret += test_xmlTextReaderConstName();
31296 test_ret += test_xmlTextReaderConstNamespaceUri();
31297 test_ret += test_xmlTextReaderConstPrefix();
31298 test_ret += test_xmlTextReaderConstString();
31299 test_ret += test_xmlTextReaderConstValue();
31300 test_ret += test_xmlTextReaderConstXmlLang();
31301 test_ret += test_xmlTextReaderConstXmlVersion();
31302 test_ret += test_xmlTextReaderCurrentDoc();
31303 test_ret += test_xmlTextReaderCurrentNode();
31304 test_ret += test_xmlTextReaderDepth();
31305 test_ret += test_xmlTextReaderExpand();
31306 test_ret += test_xmlTextReaderGetAttribute();
31307 test_ret += test_xmlTextReaderGetAttributeNo();
31308 test_ret += test_xmlTextReaderGetAttributeNs();
31309 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031310 test_ret += test_xmlTextReaderGetParserColumnNumber();
31311 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031312 test_ret += test_xmlTextReaderGetParserProp();
31313 test_ret += test_xmlTextReaderGetRemainder();
31314 test_ret += test_xmlTextReaderHasAttributes();
31315 test_ret += test_xmlTextReaderHasValue();
31316 test_ret += test_xmlTextReaderIsDefault();
31317 test_ret += test_xmlTextReaderIsEmptyElement();
31318 test_ret += test_xmlTextReaderIsNamespaceDecl();
31319 test_ret += test_xmlTextReaderIsValid();
31320 test_ret += test_xmlTextReaderLocalName();
31321 test_ret += test_xmlTextReaderLocatorBaseURI();
31322 test_ret += test_xmlTextReaderLocatorLineNumber();
31323 test_ret += test_xmlTextReaderLookupNamespace();
31324 test_ret += test_xmlTextReaderMoveToAttribute();
31325 test_ret += test_xmlTextReaderMoveToAttributeNo();
31326 test_ret += test_xmlTextReaderMoveToAttributeNs();
31327 test_ret += test_xmlTextReaderMoveToElement();
31328 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31329 test_ret += test_xmlTextReaderMoveToNextAttribute();
31330 test_ret += test_xmlTextReaderName();
31331 test_ret += test_xmlTextReaderNamespaceUri();
31332 test_ret += test_xmlTextReaderNext();
31333 test_ret += test_xmlTextReaderNextSibling();
31334 test_ret += test_xmlTextReaderNodeType();
31335 test_ret += test_xmlTextReaderNormalization();
31336 test_ret += test_xmlTextReaderPrefix();
31337 test_ret += test_xmlTextReaderPreserve();
31338 test_ret += test_xmlTextReaderPreservePattern();
31339 test_ret += test_xmlTextReaderQuoteChar();
31340 test_ret += test_xmlTextReaderRead();
31341 test_ret += test_xmlTextReaderReadAttributeValue();
31342 test_ret += test_xmlTextReaderReadState();
31343 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31344 test_ret += test_xmlTextReaderRelaxNGValidate();
31345 test_ret += test_xmlTextReaderSetErrorHandler();
31346 test_ret += test_xmlTextReaderSetParserProp();
31347 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31348 test_ret += test_xmlTextReaderStandalone();
31349 test_ret += test_xmlTextReaderValue();
31350 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031351
Daniel Veillard42595322004-11-08 10:52:06 +000031352 if (test_ret != 0)
31353 printf("Module xmlreader: %d errors\n", test_ret);
31354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031355}
Daniel Veillarda521d282004-11-09 14:59:59 +000031356#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031357
Daniel Veillarda82b1822004-11-08 16:24:57 +000031358#define gen_nb_xmlRegExecCtxtPtr 1
31359static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31360 return(NULL);
31361}
31362static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31363}
Daniel Veillarda521d282004-11-09 14:59:59 +000031364#endif
31365
Daniel Veillarda82b1822004-11-08 16:24:57 +000031366
31367static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031368test_xmlRegExecErrInfo(void) {
31369 int test_ret = 0;
31370
31371#if defined(LIBXML_REGEXP_ENABLED)
31372 int mem_base;
31373 int ret_val;
31374 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31375 int n_exec;
31376 xmlChar ** string; /* return value for the error string */
31377 int n_string;
31378 int * nbval; /* pointer to the number of accepted values IN/OUT */
31379 int n_nbval;
31380 int * nbneg; /* return number of negative transitions */
31381 int n_nbneg;
31382 xmlChar ** values; /* pointer to the array of acceptable values */
31383 int n_values;
31384 int * terminal; /* return value if this was a terminal state */
31385 int n_terminal;
31386
31387 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31388 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31389 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31390 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31391 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31392 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31393 mem_base = xmlMemBlocks();
31394 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31395 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31396 nbval = gen_int_ptr(n_nbval, 2);
31397 nbneg = gen_int_ptr(n_nbneg, 3);
31398 values = gen_xmlChar_ptr_ptr(n_values, 4);
31399 terminal = gen_int_ptr(n_terminal, 5);
31400
31401 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31402 desret_int(ret_val);
31403 call_tests++;
31404 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31405 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31406 des_int_ptr(n_nbval, nbval, 2);
31407 des_int_ptr(n_nbneg, nbneg, 3);
31408 des_xmlChar_ptr_ptr(n_values, values, 4);
31409 des_int_ptr(n_terminal, terminal, 5);
31410 xmlResetLastError();
31411 if (mem_base != xmlMemBlocks()) {
31412 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31413 xmlMemBlocks() - mem_base);
31414 test_ret++;
31415 printf(" %d", n_exec);
31416 printf(" %d", n_string);
31417 printf(" %d", n_nbval);
31418 printf(" %d", n_nbneg);
31419 printf(" %d", n_values);
31420 printf(" %d", n_terminal);
31421 printf("\n");
31422 }
31423 }
31424 }
31425 }
31426 }
31427 }
31428 }
31429 function_tests++;
31430#endif
31431
31432 return(test_ret);
31433}
31434
31435
31436static int
31437test_xmlRegExecNextValues(void) {
31438 int test_ret = 0;
31439
31440#if defined(LIBXML_REGEXP_ENABLED)
31441 int mem_base;
31442 int ret_val;
31443 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31444 int n_exec;
31445 int * nbval; /* pointer to the number of accepted values IN/OUT */
31446 int n_nbval;
31447 int * nbneg; /* return number of negative transitions */
31448 int n_nbneg;
31449 xmlChar ** values; /* pointer to the array of acceptable values */
31450 int n_values;
31451 int * terminal; /* return value if this was a terminal state */
31452 int n_terminal;
31453
31454 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31455 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31456 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31457 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31458 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31459 mem_base = xmlMemBlocks();
31460 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31461 nbval = gen_int_ptr(n_nbval, 1);
31462 nbneg = gen_int_ptr(n_nbneg, 2);
31463 values = gen_xmlChar_ptr_ptr(n_values, 3);
31464 terminal = gen_int_ptr(n_terminal, 4);
31465
31466 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31467 desret_int(ret_val);
31468 call_tests++;
31469 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31470 des_int_ptr(n_nbval, nbval, 1);
31471 des_int_ptr(n_nbneg, nbneg, 2);
31472 des_xmlChar_ptr_ptr(n_values, values, 3);
31473 des_int_ptr(n_terminal, terminal, 4);
31474 xmlResetLastError();
31475 if (mem_base != xmlMemBlocks()) {
31476 printf("Leak of %d blocks found in xmlRegExecNextValues",
31477 xmlMemBlocks() - mem_base);
31478 test_ret++;
31479 printf(" %d", n_exec);
31480 printf(" %d", n_nbval);
31481 printf(" %d", n_nbneg);
31482 printf(" %d", n_values);
31483 printf(" %d", n_terminal);
31484 printf("\n");
31485 }
31486 }
31487 }
31488 }
31489 }
31490 }
31491 function_tests++;
31492#endif
31493
31494 return(test_ret);
31495}
31496
31497
31498static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031499test_xmlRegExecPushString(void) {
31500 int test_ret = 0;
31501
William M. Brack21e4ef22005-01-02 09:53:13 +000031502#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031503 int mem_base;
31504 int ret_val;
31505 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31506 int n_exec;
31507 xmlChar * value; /* a string token input */
31508 int n_value;
31509 void * data; /* data associated to the token to reuse in callbacks */
31510 int n_data;
31511
31512 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31513 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31514 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31515 mem_base = xmlMemBlocks();
31516 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31517 value = gen_const_xmlChar_ptr(n_value, 1);
31518 data = gen_userdata(n_data, 2);
31519
William M. Brackf13f77f2004-11-12 16:03:48 +000031520 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031521 desret_int(ret_val);
31522 call_tests++;
31523 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031524 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031525 des_userdata(n_data, data, 2);
31526 xmlResetLastError();
31527 if (mem_base != xmlMemBlocks()) {
31528 printf("Leak of %d blocks found in xmlRegExecPushString",
31529 xmlMemBlocks() - mem_base);
31530 test_ret++;
31531 printf(" %d", n_exec);
31532 printf(" %d", n_value);
31533 printf(" %d", n_data);
31534 printf("\n");
31535 }
31536 }
31537 }
31538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031539 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031540#endif
31541
Daniel Veillarda82b1822004-11-08 16:24:57 +000031542 return(test_ret);
31543}
31544
31545
31546static int
31547test_xmlRegExecPushString2(void) {
31548 int test_ret = 0;
31549
William M. Brack21e4ef22005-01-02 09:53:13 +000031550#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031551 int mem_base;
31552 int ret_val;
31553 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31554 int n_exec;
31555 xmlChar * value; /* the first string token input */
31556 int n_value;
31557 xmlChar * value2; /* the second string token input */
31558 int n_value2;
31559 void * data; /* data associated to the token to reuse in callbacks */
31560 int n_data;
31561
31562 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31563 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31564 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31565 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31566 mem_base = xmlMemBlocks();
31567 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31568 value = gen_const_xmlChar_ptr(n_value, 1);
31569 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31570 data = gen_userdata(n_data, 3);
31571
William M. Brackf13f77f2004-11-12 16:03:48 +000031572 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031573 desret_int(ret_val);
31574 call_tests++;
31575 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031576 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31577 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031578 des_userdata(n_data, data, 3);
31579 xmlResetLastError();
31580 if (mem_base != xmlMemBlocks()) {
31581 printf("Leak of %d blocks found in xmlRegExecPushString2",
31582 xmlMemBlocks() - mem_base);
31583 test_ret++;
31584 printf(" %d", n_exec);
31585 printf(" %d", n_value);
31586 printf(" %d", n_value2);
31587 printf(" %d", n_data);
31588 printf("\n");
31589 }
31590 }
31591 }
31592 }
31593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031594 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031595#endif
31596
Daniel Veillarda82b1822004-11-08 16:24:57 +000031597 return(test_ret);
31598}
31599
Daniel Veillarda521d282004-11-09 14:59:59 +000031600#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031601
31602#define gen_nb_xmlRegexpPtr 1
31603static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31604 return(NULL);
31605}
31606static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31607}
Daniel Veillarda521d282004-11-09 14:59:59 +000031608#endif
31609
Daniel Veillarda82b1822004-11-08 16:24:57 +000031610
31611static int
31612test_xmlRegNewExecCtxt(void) {
31613 int test_ret = 0;
31614
31615
31616 /* missing type support */
31617 return(test_ret);
31618}
31619
31620
31621static int
31622test_xmlRegexpCompile(void) {
31623 int test_ret = 0;
31624
31625
31626 /* missing type support */
31627 return(test_ret);
31628}
31629
31630
31631static int
31632test_xmlRegexpExec(void) {
31633 int test_ret = 0;
31634
William M. Brack21e4ef22005-01-02 09:53:13 +000031635#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031636 int mem_base;
31637 int ret_val;
31638 xmlRegexpPtr comp; /* the compiled regular expression */
31639 int n_comp;
31640 xmlChar * content; /* the value to check against the regular expression */
31641 int n_content;
31642
31643 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31644 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31645 mem_base = xmlMemBlocks();
31646 comp = gen_xmlRegexpPtr(n_comp, 0);
31647 content = gen_const_xmlChar_ptr(n_content, 1);
31648
William M. Brackf13f77f2004-11-12 16:03:48 +000031649 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031650 desret_int(ret_val);
31651 call_tests++;
31652 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031653 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031654 xmlResetLastError();
31655 if (mem_base != xmlMemBlocks()) {
31656 printf("Leak of %d blocks found in xmlRegexpExec",
31657 xmlMemBlocks() - mem_base);
31658 test_ret++;
31659 printf(" %d", n_comp);
31660 printf(" %d", n_content);
31661 printf("\n");
31662 }
31663 }
31664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031665 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031666#endif
31667
Daniel Veillarda82b1822004-11-08 16:24:57 +000031668 return(test_ret);
31669}
31670
31671
31672static int
31673test_xmlRegexpIsDeterminist(void) {
31674 int test_ret = 0;
31675
William M. Brack21e4ef22005-01-02 09:53:13 +000031676#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031677 int mem_base;
31678 int ret_val;
31679 xmlRegexpPtr comp; /* the compiled regular expression */
31680 int n_comp;
31681
31682 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31683 mem_base = xmlMemBlocks();
31684 comp = gen_xmlRegexpPtr(n_comp, 0);
31685
31686 ret_val = xmlRegexpIsDeterminist(comp);
31687 desret_int(ret_val);
31688 call_tests++;
31689 des_xmlRegexpPtr(n_comp, comp, 0);
31690 xmlResetLastError();
31691 if (mem_base != xmlMemBlocks()) {
31692 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31693 xmlMemBlocks() - mem_base);
31694 test_ret++;
31695 printf(" %d", n_comp);
31696 printf("\n");
31697 }
31698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031699 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031700#endif
31701
Daniel Veillarda82b1822004-11-08 16:24:57 +000031702 return(test_ret);
31703}
31704
31705
31706static int
31707test_xmlRegexpPrint(void) {
31708 int test_ret = 0;
31709
William M. Brack21e4ef22005-01-02 09:53:13 +000031710#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031711 int mem_base;
31712 FILE * output; /* the file for the output debug */
31713 int n_output;
31714 xmlRegexpPtr regexp; /* the compiled regexp */
31715 int n_regexp;
31716
31717 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31718 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31719 mem_base = xmlMemBlocks();
31720 output = gen_FILE_ptr(n_output, 0);
31721 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31722
31723 xmlRegexpPrint(output, regexp);
31724 call_tests++;
31725 des_FILE_ptr(n_output, output, 0);
31726 des_xmlRegexpPtr(n_regexp, regexp, 1);
31727 xmlResetLastError();
31728 if (mem_base != xmlMemBlocks()) {
31729 printf("Leak of %d blocks found in xmlRegexpPrint",
31730 xmlMemBlocks() - mem_base);
31731 test_ret++;
31732 printf(" %d", n_output);
31733 printf(" %d", n_regexp);
31734 printf("\n");
31735 }
31736 }
31737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031738 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031739#endif
31740
Daniel Veillarda82b1822004-11-08 16:24:57 +000031741 return(test_ret);
31742}
31743
31744static int
31745test_xmlregexp(void) {
31746 int test_ret = 0;
31747
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031748 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31749 test_ret += test_xmlRegExecErrInfo();
31750 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031751 test_ret += test_xmlRegExecPushString();
31752 test_ret += test_xmlRegExecPushString2();
31753 test_ret += test_xmlRegNewExecCtxt();
31754 test_ret += test_xmlRegexpCompile();
31755 test_ret += test_xmlRegexpExec();
31756 test_ret += test_xmlRegexpIsDeterminist();
31757 test_ret += test_xmlRegexpPrint();
31758
31759 if (test_ret != 0)
31760 printf("Module xmlregexp: %d errors\n", test_ret);
31761 return(test_ret);
31762}
Daniel Veillarda521d282004-11-09 14:59:59 +000031763#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031764
Daniel Veillardce682bc2004-11-05 17:22:25 +000031765#define gen_nb_xmlSaveCtxtPtr 1
31766static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31767 return(NULL);
31768}
31769static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31770}
Daniel Veillarda521d282004-11-09 14:59:59 +000031771#endif
31772
Daniel Veillardce682bc2004-11-05 17:22:25 +000031773
Daniel Veillardd93f6252004-11-02 15:53:51 +000031774static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031775test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031777
William M. Brack21e4ef22005-01-02 09:53:13 +000031778#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031779 int mem_base;
31780 int ret_val;
31781 xmlSaveCtxtPtr ctxt; /* a document saving context */
31782 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031783
Daniel Veillardce682bc2004-11-05 17:22:25 +000031784 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31785 mem_base = xmlMemBlocks();
31786 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31787
31788 ret_val = xmlSaveClose(ctxt);
31789 desret_int(ret_val);
31790 call_tests++;
31791 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31792 xmlResetLastError();
31793 if (mem_base != xmlMemBlocks()) {
31794 printf("Leak of %d blocks found in xmlSaveClose",
31795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031796 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031797 printf(" %d", n_ctxt);
31798 printf("\n");
31799 }
31800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031801 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031802#endif
31803
Daniel Veillard42595322004-11-08 10:52:06 +000031804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031805}
31806
31807
31808static int
31809test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031811
William M. Brack21e4ef22005-01-02 09:53:13 +000031812#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031813 int mem_base;
31814 long ret_val;
31815 xmlSaveCtxtPtr ctxt; /* a document saving context */
31816 int n_ctxt;
31817 xmlDocPtr doc; /* a document */
31818 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031819
Daniel Veillardce682bc2004-11-05 17:22:25 +000031820 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31821 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31822 mem_base = xmlMemBlocks();
31823 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31824 doc = gen_xmlDocPtr(n_doc, 1);
31825
31826 ret_val = xmlSaveDoc(ctxt, doc);
31827 desret_long(ret_val);
31828 call_tests++;
31829 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31830 des_xmlDocPtr(n_doc, doc, 1);
31831 xmlResetLastError();
31832 if (mem_base != xmlMemBlocks()) {
31833 printf("Leak of %d blocks found in xmlSaveDoc",
31834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031835 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031836 printf(" %d", n_ctxt);
31837 printf(" %d", n_doc);
31838 printf("\n");
31839 }
31840 }
31841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031842 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031843#endif
31844
Daniel Veillard42595322004-11-08 10:52:06 +000031845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031846}
31847
31848
31849static int
31850test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031852
William M. Brack21e4ef22005-01-02 09:53:13 +000031853#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031854 int mem_base;
31855 int ret_val;
31856 xmlSaveCtxtPtr ctxt; /* a document saving context */
31857 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031858
Daniel Veillardce682bc2004-11-05 17:22:25 +000031859 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31860 mem_base = xmlMemBlocks();
31861 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31862
31863 ret_val = xmlSaveFlush(ctxt);
31864 desret_int(ret_val);
31865 call_tests++;
31866 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31867 xmlResetLastError();
31868 if (mem_base != xmlMemBlocks()) {
31869 printf("Leak of %d blocks found in xmlSaveFlush",
31870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031871 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031872 printf(" %d", n_ctxt);
31873 printf("\n");
31874 }
31875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031876 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031877#endif
31878
Daniel Veillard42595322004-11-08 10:52:06 +000031879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031880}
31881
31882
31883static int
31884test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031886
31887
31888 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031890}
31891
31892
31893static int
31894test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031896
31897
31898 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031900}
31901
31902
31903static int
31904test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031906
31907
31908 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031910}
31911
31912
31913static int
31914test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031916
31917
31918 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031920}
31921
31922
31923static int
31924test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031926
William M. Brack21e4ef22005-01-02 09:53:13 +000031927#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031928 int mem_base;
31929 long ret_val;
31930 xmlSaveCtxtPtr ctxt; /* a document saving context */
31931 int n_ctxt;
31932 xmlNodePtr node; /* a document */
31933 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031934
Daniel Veillardce682bc2004-11-05 17:22:25 +000031935 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31936 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31937 mem_base = xmlMemBlocks();
31938 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31939 node = gen_xmlNodePtr(n_node, 1);
31940
31941 ret_val = xmlSaveTree(ctxt, node);
31942 desret_long(ret_val);
31943 call_tests++;
31944 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31945 des_xmlNodePtr(n_node, node, 1);
31946 xmlResetLastError();
31947 if (mem_base != xmlMemBlocks()) {
31948 printf("Leak of %d blocks found in xmlSaveTree",
31949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031950 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031951 printf(" %d", n_ctxt);
31952 printf(" %d", n_node);
31953 printf("\n");
31954 }
31955 }
31956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031957 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031958#endif
31959
Daniel Veillard42595322004-11-08 10:52:06 +000031960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031961}
31962
31963static int
31964test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031966
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031967 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031968 test_ret += test_xmlSaveClose();
31969 test_ret += test_xmlSaveDoc();
31970 test_ret += test_xmlSaveFlush();
31971 test_ret += test_xmlSaveSetAttrEscape();
31972 test_ret += test_xmlSaveSetEscape();
31973 test_ret += test_xmlSaveToFd();
31974 test_ret += test_xmlSaveToFilename();
31975 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031976
Daniel Veillard42595322004-11-08 10:52:06 +000031977 if (test_ret != 0)
31978 printf("Module xmlsave: %d errors\n", test_ret);
31979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031980}
Daniel Veillarda521d282004-11-09 14:59:59 +000031981#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031982
Daniel Veillardce682bc2004-11-05 17:22:25 +000031983#define gen_nb_xmlSchemaPtr 1
31984static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31985 return(NULL);
31986}
31987static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31988}
Daniel Veillarda521d282004-11-09 14:59:59 +000031989#endif
31990
Daniel Veillardce682bc2004-11-05 17:22:25 +000031991
Daniel Veillardd93f6252004-11-02 15:53:51 +000031992static int
31993test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031995
William M. Brack21e4ef22005-01-02 09:53:13 +000031996#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031997 int mem_base;
31998 FILE * output; /* the file output */
31999 int n_output;
32000 xmlSchemaPtr schema; /* a schema structure */
32001 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032002
Daniel Veillardce682bc2004-11-05 17:22:25 +000032003 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
32004 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
32005 mem_base = xmlMemBlocks();
32006 output = gen_FILE_ptr(n_output, 0);
32007 schema = gen_xmlSchemaPtr(n_schema, 1);
32008
32009 xmlSchemaDump(output, schema);
32010 call_tests++;
32011 des_FILE_ptr(n_output, output, 0);
32012 des_xmlSchemaPtr(n_schema, schema, 1);
32013 xmlResetLastError();
32014 if (mem_base != xmlMemBlocks()) {
32015 printf("Leak of %d blocks found in xmlSchemaDump",
32016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032017 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032018 printf(" %d", n_output);
32019 printf(" %d", n_schema);
32020 printf("\n");
32021 }
32022 }
32023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032024 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032025#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000032026
Daniel Veillard42595322004-11-08 10:52:06 +000032027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032028}
32029
Daniel Veillarda521d282004-11-09 14:59:59 +000032030#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032031
Daniel Veillardce682bc2004-11-05 17:22:25 +000032032#define gen_nb_xmlSchemaParserCtxtPtr 1
32033static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32034 return(NULL);
32035}
32036static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32037}
Daniel Veillarda521d282004-11-09 14:59:59 +000032038#endif
32039
32040#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032041
32042#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
32043static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32044 return(NULL);
32045}
32046static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32047}
Daniel Veillarda521d282004-11-09 14:59:59 +000032048#endif
32049
32050#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032051
32052#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
32053static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32054 return(NULL);
32055}
32056static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32057}
Daniel Veillarda521d282004-11-09 14:59:59 +000032058#endif
32059
Daniel Veillardce682bc2004-11-05 17:22:25 +000032060
Daniel Veillardd93f6252004-11-02 15:53:51 +000032061static int
32062test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032064
William M. Brack21e4ef22005-01-02 09:53:13 +000032065#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032066 int mem_base;
32067 int ret_val;
32068 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
32069 int n_ctxt;
32070 xmlSchemaValidityErrorFunc * err; /* the error callback result */
32071 int n_err;
32072 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
32073 int n_warn;
32074 void ** ctx; /* contextual data for the callbacks result */
32075 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032076
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032077 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32078 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32079 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32080 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32081 mem_base = xmlMemBlocks();
32082 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
32083 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32084 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32085 ctx = gen_void_ptr_ptr(n_ctx, 3);
32086
32087 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
32088 desret_int(ret_val);
32089 call_tests++;
32090 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
32091 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32092 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32093 des_void_ptr_ptr(n_ctx, ctx, 3);
32094 xmlResetLastError();
32095 if (mem_base != xmlMemBlocks()) {
32096 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
32097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032098 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032099 printf(" %d", n_ctxt);
32100 printf(" %d", n_err);
32101 printf(" %d", n_warn);
32102 printf(" %d", n_ctx);
32103 printf("\n");
32104 }
32105 }
32106 }
32107 }
32108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032109 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032110#endif
32111
Daniel Veillard42595322004-11-08 10:52:06 +000032112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032113}
32114
Daniel Veillarda521d282004-11-09 14:59:59 +000032115#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032116
Daniel Veillardce682bc2004-11-05 17:22:25 +000032117#define gen_nb_xmlSchemaValidCtxtPtr 1
32118static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32119 return(NULL);
32120}
32121static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32122}
Daniel Veillarda521d282004-11-09 14:59:59 +000032123#endif
32124
Daniel Veillardce682bc2004-11-05 17:22:25 +000032125
Daniel Veillardd93f6252004-11-02 15:53:51 +000032126static int
32127test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032129
William M. Brack21e4ef22005-01-02 09:53:13 +000032130#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032131 int mem_base;
32132 int ret_val;
32133 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32134 int n_ctxt;
32135 xmlSchemaValidityErrorFunc * err; /* the error function result */
32136 int n_err;
32137 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32138 int n_warn;
32139 void ** ctx; /* the functions context result */
32140 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032141
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032142 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32143 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32144 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32145 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32146 mem_base = xmlMemBlocks();
32147 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32148 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32149 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32150 ctx = gen_void_ptr_ptr(n_ctx, 3);
32151
32152 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32153 desret_int(ret_val);
32154 call_tests++;
32155 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32156 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32157 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32158 des_void_ptr_ptr(n_ctx, ctx, 3);
32159 xmlResetLastError();
32160 if (mem_base != xmlMemBlocks()) {
32161 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032163 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032164 printf(" %d", n_ctxt);
32165 printf(" %d", n_err);
32166 printf(" %d", n_warn);
32167 printf(" %d", n_ctx);
32168 printf("\n");
32169 }
32170 }
32171 }
32172 }
32173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032174 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032175#endif
32176
Daniel Veillard42595322004-11-08 10:52:06 +000032177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032178}
32179
32180
32181static int
32182test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032184
William M. Brack21e4ef22005-01-02 09:53:13 +000032185#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032186 int mem_base;
32187 xmlSchemaParserCtxtPtr ret_val;
32188 xmlDocPtr doc; /* a preparsed document tree */
32189 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032190
Daniel Veillard42595322004-11-08 10:52:06 +000032191 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32192 mem_base = xmlMemBlocks();
32193 doc = gen_xmlDocPtr(n_doc, 0);
32194
32195 ret_val = xmlSchemaNewDocParserCtxt(doc);
32196 desret_xmlSchemaParserCtxtPtr(ret_val);
32197 call_tests++;
32198 des_xmlDocPtr(n_doc, doc, 0);
32199 xmlResetLastError();
32200 if (mem_base != xmlMemBlocks()) {
32201 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32202 xmlMemBlocks() - mem_base);
32203 test_ret++;
32204 printf(" %d", n_doc);
32205 printf("\n");
32206 }
32207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032208 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032209#endif
32210
Daniel Veillard42595322004-11-08 10:52:06 +000032211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032212}
32213
32214
32215static int
32216test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032218
William M. Brack21e4ef22005-01-02 09:53:13 +000032219#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032220 int mem_base;
32221 xmlSchemaParserCtxtPtr ret_val;
32222 char * buffer; /* a pointer to a char array containing the schemas */
32223 int n_buffer;
32224 int size; /* the size of the array */
32225 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032226
Daniel Veillard42595322004-11-08 10:52:06 +000032227 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32228 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32229 mem_base = xmlMemBlocks();
32230 buffer = gen_const_char_ptr(n_buffer, 0);
32231 size = gen_int(n_size, 1);
32232
William M. Brackf13f77f2004-11-12 16:03:48 +000032233 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032234 desret_xmlSchemaParserCtxtPtr(ret_val);
32235 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032236 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032237 des_int(n_size, size, 1);
32238 xmlResetLastError();
32239 if (mem_base != xmlMemBlocks()) {
32240 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32241 xmlMemBlocks() - mem_base);
32242 test_ret++;
32243 printf(" %d", n_buffer);
32244 printf(" %d", n_size);
32245 printf("\n");
32246 }
32247 }
32248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032249 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032250#endif
32251
Daniel Veillard42595322004-11-08 10:52:06 +000032252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032253}
32254
32255
32256static int
32257test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032259
William M. Brack21e4ef22005-01-02 09:53:13 +000032260#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032261 int mem_base;
32262 xmlSchemaParserCtxtPtr ret_val;
32263 char * URL; /* the location of the schema */
32264 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032265
Daniel Veillard42595322004-11-08 10:52:06 +000032266 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32267 mem_base = xmlMemBlocks();
32268 URL = gen_const_char_ptr(n_URL, 0);
32269
William M. Brackf13f77f2004-11-12 16:03:48 +000032270 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032271 desret_xmlSchemaParserCtxtPtr(ret_val);
32272 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032273 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032274 xmlResetLastError();
32275 if (mem_base != xmlMemBlocks()) {
32276 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32277 xmlMemBlocks() - mem_base);
32278 test_ret++;
32279 printf(" %d", n_URL);
32280 printf("\n");
32281 }
32282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032283 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032284#endif
32285
Daniel Veillard42595322004-11-08 10:52:06 +000032286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032287}
32288
32289
32290static int
32291test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032293
32294
32295 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032297}
32298
32299
32300static int
32301test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032303
32304
32305 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032307}
32308
32309
32310static int
32311test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032313
32314
32315 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032317}
32318
32319
32320static int
32321test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032323
32324
32325 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032327}
32328
32329
32330static int
32331test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032333
William M. Brack21e4ef22005-01-02 09:53:13 +000032334#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032335 int mem_base;
32336 int ret_val;
32337 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32338 int n_ctxt;
32339 int options; /* a combination of xmlSchemaValidOption */
32340 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032341
Daniel Veillardce682bc2004-11-05 17:22:25 +000032342 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32343 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32344 mem_base = xmlMemBlocks();
32345 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32346 options = gen_int(n_options, 1);
32347
32348 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32349 desret_int(ret_val);
32350 call_tests++;
32351 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32352 des_int(n_options, options, 1);
32353 xmlResetLastError();
32354 if (mem_base != xmlMemBlocks()) {
32355 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032357 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032358 printf(" %d", n_ctxt);
32359 printf(" %d", n_options);
32360 printf("\n");
32361 }
32362 }
32363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032364 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032365#endif
32366
Daniel Veillard42595322004-11-08 10:52:06 +000032367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032368}
32369
32370
32371static int
32372test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032374
William M. Brack21e4ef22005-01-02 09:53:13 +000032375#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032376 int mem_base;
32377 int ret_val;
32378 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32379 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032380
Daniel Veillardce682bc2004-11-05 17:22:25 +000032381 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32382 mem_base = xmlMemBlocks();
32383 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32384
32385 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32386 desret_int(ret_val);
32387 call_tests++;
32388 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32389 xmlResetLastError();
32390 if (mem_base != xmlMemBlocks()) {
32391 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032393 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032394 printf(" %d", n_ctxt);
32395 printf("\n");
32396 }
32397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032398 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032399#endif
32400
Daniel Veillard42595322004-11-08 10:52:06 +000032401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032402}
32403
32404
32405static int
32406test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032408
William M. Brack21e4ef22005-01-02 09:53:13 +000032409#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032410 int mem_base;
32411 int ret_val;
32412 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32413 int n_ctxt;
32414 xmlDocPtr doc; /* a parsed document tree */
32415 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032416
Daniel Veillardce682bc2004-11-05 17:22:25 +000032417 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32418 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32419 mem_base = xmlMemBlocks();
32420 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32421 doc = gen_xmlDocPtr(n_doc, 1);
32422
32423 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32424 desret_int(ret_val);
32425 call_tests++;
32426 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32427 des_xmlDocPtr(n_doc, doc, 1);
32428 xmlResetLastError();
32429 if (mem_base != xmlMemBlocks()) {
32430 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032432 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032433 printf(" %d", n_ctxt);
32434 printf(" %d", n_doc);
32435 printf("\n");
32436 }
32437 }
32438 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032439 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032440#endif
32441
Daniel Veillard42595322004-11-08 10:52:06 +000032442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032443}
32444
32445
32446static int
32447test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032449
William M. Brack21e4ef22005-01-02 09:53:13 +000032450#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032451 int mem_base;
32452 int ret_val;
32453 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32454 int n_ctxt;
32455 xmlNodePtr elem; /* an element node */
32456 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032457
Daniel Veillardce682bc2004-11-05 17:22:25 +000032458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32459 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32460 mem_base = xmlMemBlocks();
32461 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32462 elem = gen_xmlNodePtr(n_elem, 1);
32463
32464 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32465 desret_int(ret_val);
32466 call_tests++;
32467 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32468 des_xmlNodePtr(n_elem, elem, 1);
32469 xmlResetLastError();
32470 if (mem_base != xmlMemBlocks()) {
32471 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032473 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032474 printf(" %d", n_ctxt);
32475 printf(" %d", n_elem);
32476 printf("\n");
32477 }
32478 }
32479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032480 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032481#endif
32482
Daniel Veillard42595322004-11-08 10:52:06 +000032483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032484}
32485
32486
32487static int
32488test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032490
William M. Brack21e4ef22005-01-02 09:53:13 +000032491#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032492 int mem_base;
32493 int ret_val;
32494 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32495 int n_ctxt;
32496 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32497 int n_input;
32498 xmlCharEncoding enc; /* an optional encoding information */
32499 int n_enc;
32500 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32501 int n_sax;
32502 void * user_data; /* the context to provide to the SAX handler. */
32503 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032504
Daniel Veillardce682bc2004-11-05 17:22:25 +000032505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32506 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32507 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32508 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32509 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32510 mem_base = xmlMemBlocks();
32511 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32512 input = gen_xmlParserInputBufferPtr(n_input, 1);
32513 enc = gen_xmlCharEncoding(n_enc, 2);
32514 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32515 user_data = gen_userdata(n_user_data, 4);
32516
32517 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32518 desret_int(ret_val);
32519 call_tests++;
32520 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32521 des_xmlParserInputBufferPtr(n_input, input, 1);
32522 des_xmlCharEncoding(n_enc, enc, 2);
32523 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32524 des_userdata(n_user_data, user_data, 4);
32525 xmlResetLastError();
32526 if (mem_base != xmlMemBlocks()) {
32527 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032529 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032530 printf(" %d", n_ctxt);
32531 printf(" %d", n_input);
32532 printf(" %d", n_enc);
32533 printf(" %d", n_sax);
32534 printf(" %d", n_user_data);
32535 printf("\n");
32536 }
32537 }
32538 }
32539 }
32540 }
32541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032542 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032543#endif
32544
Daniel Veillard42595322004-11-08 10:52:06 +000032545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032546}
32547
32548static int
32549test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032551
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032552 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032553 test_ret += test_xmlSchemaDump();
32554 test_ret += test_xmlSchemaGetParserErrors();
32555 test_ret += test_xmlSchemaGetValidErrors();
32556 test_ret += test_xmlSchemaNewDocParserCtxt();
32557 test_ret += test_xmlSchemaNewMemParserCtxt();
32558 test_ret += test_xmlSchemaNewParserCtxt();
32559 test_ret += test_xmlSchemaNewValidCtxt();
32560 test_ret += test_xmlSchemaParse();
32561 test_ret += test_xmlSchemaSetParserErrors();
32562 test_ret += test_xmlSchemaSetValidErrors();
32563 test_ret += test_xmlSchemaSetValidOptions();
32564 test_ret += test_xmlSchemaValidCtxtGetOptions();
32565 test_ret += test_xmlSchemaValidateDoc();
32566 test_ret += test_xmlSchemaValidateOneElement();
32567 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032568
Daniel Veillard42595322004-11-08 10:52:06 +000032569 if (test_ret != 0)
32570 printf("Module xmlschemas: %d errors\n", test_ret);
32571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032572}
Daniel Veillarda521d282004-11-09 14:59:59 +000032573#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032574
Daniel Veillardce682bc2004-11-05 17:22:25 +000032575#define gen_nb_xmlSchemaFacetPtr 1
32576static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32577 return(NULL);
32578}
32579static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32580}
Daniel Veillarda521d282004-11-09 14:59:59 +000032581#endif
32582
32583#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032584
32585#define gen_nb_xmlSchemaTypePtr 1
32586static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32587 return(NULL);
32588}
32589static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32590}
Daniel Veillarda521d282004-11-09 14:59:59 +000032591#endif
32592
Daniel Veillardce682bc2004-11-05 17:22:25 +000032593
Daniel Veillardd93f6252004-11-02 15:53:51 +000032594static int
32595test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032597
William M. Brack21e4ef22005-01-02 09:53:13 +000032598#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032599 int mem_base;
32600 int ret_val;
32601 xmlSchemaFacetPtr facet; /* the facet */
32602 int n_facet;
32603 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32604 int n_typeDecl;
32605 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32606 int n_ctxt;
32607 xmlChar * name; /* name of the type */
32608 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032609
Daniel Veillardce682bc2004-11-05 17:22:25 +000032610 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32611 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32612 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32613 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32614 mem_base = xmlMemBlocks();
32615 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32616 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32617 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32618 name = gen_const_xmlChar_ptr(n_name, 3);
32619
William M. Brackf13f77f2004-11-12 16:03:48 +000032620 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032621 desret_int(ret_val);
32622 call_tests++;
32623 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32624 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32625 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032626 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032627 xmlResetLastError();
32628 if (mem_base != xmlMemBlocks()) {
32629 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032631 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032632 printf(" %d", n_facet);
32633 printf(" %d", n_typeDecl);
32634 printf(" %d", n_ctxt);
32635 printf(" %d", n_name);
32636 printf("\n");
32637 }
32638 }
32639 }
32640 }
32641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032642 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032643#endif
32644
Daniel Veillard42595322004-11-08 10:52:06 +000032645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032646}
32647
32648
32649static int
32650test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032652
William M. Brack21e4ef22005-01-02 09:53:13 +000032653#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032654 int mem_base;
32655
32656 mem_base = xmlMemBlocks();
32657
32658 xmlSchemaCleanupTypes();
32659 call_tests++;
32660 xmlResetLastError();
32661 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032662 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032664 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032665 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032666 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032667 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032668#endif
32669
Daniel Veillard42595322004-11-08 10:52:06 +000032670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032671}
32672
32673
32674static int
32675test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032677
William M. Brack21e4ef22005-01-02 09:53:13 +000032678#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032679 int mem_base;
32680 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032681 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032682 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032683
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032684 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032686 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032687
William M. Brackf13f77f2004-11-12 16:03:48 +000032688 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032689 desret_xmlChar_ptr(ret_val);
32690 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032691 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032692 xmlResetLastError();
32693 if (mem_base != xmlMemBlocks()) {
32694 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032696 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032697 printf(" %d", n_value);
32698 printf("\n");
32699 }
32700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032701 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032702#endif
32703
Daniel Veillard42595322004-11-08 10:52:06 +000032704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032705}
32706
Daniel Veillarda521d282004-11-09 14:59:59 +000032707#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032708
Daniel Veillardce682bc2004-11-05 17:22:25 +000032709#define gen_nb_xmlSchemaValPtr 1
32710static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32711 return(NULL);
32712}
32713static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32714}
Daniel Veillarda521d282004-11-09 14:59:59 +000032715#endif
32716
Daniel Veillardce682bc2004-11-05 17:22:25 +000032717
Daniel Veillardd93f6252004-11-02 15:53:51 +000032718static int
32719test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032721
William M. Brack21e4ef22005-01-02 09:53:13 +000032722#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032723 int mem_base;
32724 int ret_val;
32725 xmlSchemaValPtr x; /* a first value */
32726 int n_x;
32727 xmlSchemaValPtr y; /* a second value */
32728 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032729
Daniel Veillardce682bc2004-11-05 17:22:25 +000032730 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32731 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32732 mem_base = xmlMemBlocks();
32733 x = gen_xmlSchemaValPtr(n_x, 0);
32734 y = gen_xmlSchemaValPtr(n_y, 1);
32735
32736 ret_val = xmlSchemaCompareValues(x, y);
32737 desret_int(ret_val);
32738 call_tests++;
32739 des_xmlSchemaValPtr(n_x, x, 0);
32740 des_xmlSchemaValPtr(n_y, y, 1);
32741 xmlResetLastError();
32742 if (mem_base != xmlMemBlocks()) {
32743 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032745 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032746 printf(" %d", n_x);
32747 printf(" %d", n_y);
32748 printf("\n");
32749 }
32750 }
32751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032752 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032753#endif
32754
Daniel Veillard42595322004-11-08 10:52:06 +000032755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032756}
32757
32758
32759static int
32760test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032762
William M. Brack21e4ef22005-01-02 09:53:13 +000032763#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032764 int mem_base;
32765 xmlSchemaTypePtr ret_val;
32766 xmlSchemaTypePtr type; /* the built-in simple type. */
32767 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032768
Daniel Veillard42595322004-11-08 10:52:06 +000032769 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32770 mem_base = xmlMemBlocks();
32771 type = gen_xmlSchemaTypePtr(n_type, 0);
32772
32773 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32774 desret_xmlSchemaTypePtr(ret_val);
32775 call_tests++;
32776 des_xmlSchemaTypePtr(n_type, type, 0);
32777 xmlResetLastError();
32778 if (mem_base != xmlMemBlocks()) {
32779 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32780 xmlMemBlocks() - mem_base);
32781 test_ret++;
32782 printf(" %d", n_type);
32783 printf("\n");
32784 }
32785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032786 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032787#endif
32788
Daniel Veillard42595322004-11-08 10:52:06 +000032789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032790}
32791
32792
32793static int
32794test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032796
William M. Brack21e4ef22005-01-02 09:53:13 +000032797#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032798 xmlSchemaTypePtr ret_val;
32799 xmlSchemaValType type; /* the type of the built in type */
32800 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032801
Daniel Veillard42595322004-11-08 10:52:06 +000032802 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32803 type = gen_xmlSchemaValType(n_type, 0);
32804
32805 ret_val = xmlSchemaGetBuiltInType(type);
32806 desret_xmlSchemaTypePtr(ret_val);
32807 call_tests++;
32808 des_xmlSchemaValType(n_type, type, 0);
32809 xmlResetLastError();
32810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032811 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032812#endif
32813
Daniel Veillard42595322004-11-08 10:52:06 +000032814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032815}
32816
32817
32818static int
32819test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032821
William M. Brack21e4ef22005-01-02 09:53:13 +000032822#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032823 int mem_base;
32824 unsigned long ret_val;
32825 xmlSchemaFacetPtr facet; /* an schemas type facet */
32826 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032827
William M. Brack094dd862004-11-14 14:28:34 +000032828 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32829 mem_base = xmlMemBlocks();
32830 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32831
32832 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32833 desret_unsigned_long(ret_val);
32834 call_tests++;
32835 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32836 xmlResetLastError();
32837 if (mem_base != xmlMemBlocks()) {
32838 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32839 xmlMemBlocks() - mem_base);
32840 test_ret++;
32841 printf(" %d", n_facet);
32842 printf("\n");
32843 }
32844 }
32845 function_tests++;
32846#endif
32847
Daniel Veillard42595322004-11-08 10:52:06 +000032848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032849}
32850
32851
32852static int
32853test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032855
William M. Brack21e4ef22005-01-02 09:53:13 +000032856#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032857 int mem_base;
32858 xmlSchemaTypePtr ret_val;
32859 xmlChar * name; /* the type name */
32860 int n_name;
32861 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32862 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032863
Daniel Veillard42595322004-11-08 10:52:06 +000032864 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32865 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32866 mem_base = xmlMemBlocks();
32867 name = gen_const_xmlChar_ptr(n_name, 0);
32868 ns = gen_const_xmlChar_ptr(n_ns, 1);
32869
William M. Brackf13f77f2004-11-12 16:03:48 +000032870 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032871 desret_xmlSchemaTypePtr(ret_val);
32872 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032873 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32874 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032875 xmlResetLastError();
32876 if (mem_base != xmlMemBlocks()) {
32877 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32878 xmlMemBlocks() - mem_base);
32879 test_ret++;
32880 printf(" %d", n_name);
32881 printf(" %d", n_ns);
32882 printf("\n");
32883 }
32884 }
32885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032886 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032887#endif
32888
Daniel Veillard42595322004-11-08 10:52:06 +000032889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032890}
32891
32892
32893static int
32894test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032896
William M. Brack21e4ef22005-01-02 09:53:13 +000032897#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032898
32899
32900 xmlSchemaInitTypes();
32901 call_tests++;
32902 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032903 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032904#endif
32905
Daniel Veillard42595322004-11-08 10:52:06 +000032906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032907}
32908
32909
32910static int
32911test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032913
William M. Brack21e4ef22005-01-02 09:53:13 +000032914#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032915 int mem_base;
32916 int ret_val;
32917 xmlSchemaTypePtr type; /* the built-in type */
32918 int n_type;
32919 int facetType; /* the facet type */
32920 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032921
Daniel Veillardce682bc2004-11-05 17:22:25 +000032922 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32923 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32924 mem_base = xmlMemBlocks();
32925 type = gen_xmlSchemaTypePtr(n_type, 0);
32926 facetType = gen_int(n_facetType, 1);
32927
32928 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32929 desret_int(ret_val);
32930 call_tests++;
32931 des_xmlSchemaTypePtr(n_type, type, 0);
32932 des_int(n_facetType, facetType, 1);
32933 xmlResetLastError();
32934 if (mem_base != xmlMemBlocks()) {
32935 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032937 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032938 printf(" %d", n_type);
32939 printf(" %d", n_facetType);
32940 printf("\n");
32941 }
32942 }
32943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032944 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032945#endif
32946
Daniel Veillard42595322004-11-08 10:52:06 +000032947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032948}
32949
32950
32951static int
32952test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032954
32955
32956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032958}
32959
Daniel Veillarda521d282004-11-09 14:59:59 +000032960#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032961
Daniel Veillardce682bc2004-11-05 17:22:25 +000032962#define gen_nb_xmlSchemaValPtr_ptr 1
32963static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32964 return(NULL);
32965}
32966static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32967}
Daniel Veillarda521d282004-11-09 14:59:59 +000032968#endif
32969
Daniel Veillardce682bc2004-11-05 17:22:25 +000032970
Daniel Veillardd93f6252004-11-02 15:53:51 +000032971static int
32972test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032974
William M. Brack21e4ef22005-01-02 09:53:13 +000032975#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032976 int mem_base;
32977 int ret_val;
32978 xmlSchemaTypePtr type; /* the predefined type */
32979 int n_type;
32980 xmlChar * value; /* the value to check */
32981 int n_value;
32982 xmlSchemaValPtr * val; /* the return computed value */
32983 int n_val;
32984 xmlNodePtr node; /* the node containing the value */
32985 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032986
Daniel Veillardce682bc2004-11-05 17:22:25 +000032987 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32988 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32989 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32990 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32991 mem_base = xmlMemBlocks();
32992 type = gen_xmlSchemaTypePtr(n_type, 0);
32993 value = gen_const_xmlChar_ptr(n_value, 1);
32994 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32995 node = gen_xmlNodePtr(n_node, 3);
32996
William M. Brackf13f77f2004-11-12 16:03:48 +000032997 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032998 desret_int(ret_val);
32999 call_tests++;
33000 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033001 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033002 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33003 des_xmlNodePtr(n_node, node, 3);
33004 xmlResetLastError();
33005 if (mem_base != xmlMemBlocks()) {
33006 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
33007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033008 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033009 printf(" %d", n_type);
33010 printf(" %d", n_value);
33011 printf(" %d", n_val);
33012 printf(" %d", n_node);
33013 printf("\n");
33014 }
33015 }
33016 }
33017 }
33018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033019 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033020#endif
33021
Daniel Veillard42595322004-11-08 10:52:06 +000033022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033023}
33024
33025
33026static int
33027test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033029
William M. Brack21e4ef22005-01-02 09:53:13 +000033030#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033031 int mem_base;
33032 int ret_val;
33033 xmlSchemaTypePtr type; /* the predefined type */
33034 int n_type;
33035 xmlChar * value; /* the value to check */
33036 int n_value;
33037 xmlSchemaValPtr * val; /* the return computed value */
33038 int n_val;
33039 xmlNodePtr node; /* the node containing the value */
33040 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033041
Daniel Veillardce682bc2004-11-05 17:22:25 +000033042 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33043 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33044 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33045 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33046 mem_base = xmlMemBlocks();
33047 type = gen_xmlSchemaTypePtr(n_type, 0);
33048 value = gen_const_xmlChar_ptr(n_value, 1);
33049 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33050 node = gen_xmlNodePtr(n_node, 3);
33051
William M. Brackf13f77f2004-11-12 16:03:48 +000033052 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033053 desret_int(ret_val);
33054 call_tests++;
33055 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033056 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033057 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33058 des_xmlNodePtr(n_node, node, 3);
33059 xmlResetLastError();
33060 if (mem_base != xmlMemBlocks()) {
33061 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
33062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033063 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033064 printf(" %d", n_type);
33065 printf(" %d", n_value);
33066 printf(" %d", n_val);
33067 printf(" %d", n_node);
33068 printf("\n");
33069 }
33070 }
33071 }
33072 }
33073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033074 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033075#endif
33076
Daniel Veillard42595322004-11-08 10:52:06 +000033077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033078}
33079
33080
33081static int
33082test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033084
William M. Brack21e4ef22005-01-02 09:53:13 +000033085#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033086 int mem_base;
33087 int ret_val;
33088 xmlSchemaTypePtr base; /* the base type */
33089 int n_base;
33090 xmlSchemaFacetPtr facet; /* the facet to check */
33091 int n_facet;
33092 xmlChar * value; /* the lexical repr of the value to validate */
33093 int n_value;
33094 xmlSchemaValPtr val; /* the precomputed value */
33095 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033096
Daniel Veillardce682bc2004-11-05 17:22:25 +000033097 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
33098 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33099 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33100 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33101 mem_base = xmlMemBlocks();
33102 base = gen_xmlSchemaTypePtr(n_base, 0);
33103 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33104 value = gen_const_xmlChar_ptr(n_value, 2);
33105 val = gen_xmlSchemaValPtr(n_val, 3);
33106
William M. Brackf13f77f2004-11-12 16:03:48 +000033107 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033108 desret_int(ret_val);
33109 call_tests++;
33110 des_xmlSchemaTypePtr(n_base, base, 0);
33111 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033112 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033113 des_xmlSchemaValPtr(n_val, val, 3);
33114 xmlResetLastError();
33115 if (mem_base != xmlMemBlocks()) {
33116 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033118 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033119 printf(" %d", n_base);
33120 printf(" %d", n_facet);
33121 printf(" %d", n_value);
33122 printf(" %d", n_val);
33123 printf("\n");
33124 }
33125 }
33126 }
33127 }
33128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033129 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033130#endif
33131
Daniel Veillard42595322004-11-08 10:52:06 +000033132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033133}
33134
33135
33136static int
33137test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033139
William M. Brack21e4ef22005-01-02 09:53:13 +000033140#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033141 int mem_base;
33142 int ret_val;
33143 xmlSchemaTypePtr type; /* the built-in type */
33144 int n_type;
33145 xmlSchemaFacetPtr facet; /* the facet to check */
33146 int n_facet;
33147 xmlChar * value; /* the lexical repr. of the value to be validated */
33148 int n_value;
33149 xmlSchemaValPtr val; /* the precomputed value */
33150 int n_val;
33151 unsigned long * length; /* the actual length of the value */
33152 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033153
Daniel Veillardce682bc2004-11-05 17:22:25 +000033154 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33155 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33156 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33157 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33158 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33159 mem_base = xmlMemBlocks();
33160 type = gen_xmlSchemaTypePtr(n_type, 0);
33161 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33162 value = gen_const_xmlChar_ptr(n_value, 2);
33163 val = gen_xmlSchemaValPtr(n_val, 3);
33164 length = gen_unsigned_long_ptr(n_length, 4);
33165
William M. Brackf13f77f2004-11-12 16:03:48 +000033166 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033167 desret_int(ret_val);
33168 call_tests++;
33169 des_xmlSchemaTypePtr(n_type, type, 0);
33170 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033171 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033172 des_xmlSchemaValPtr(n_val, val, 3);
33173 des_unsigned_long_ptr(n_length, length, 4);
33174 xmlResetLastError();
33175 if (mem_base != xmlMemBlocks()) {
33176 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033178 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033179 printf(" %d", n_type);
33180 printf(" %d", n_facet);
33181 printf(" %d", n_value);
33182 printf(" %d", n_val);
33183 printf(" %d", n_length);
33184 printf("\n");
33185 }
33186 }
33187 }
33188 }
33189 }
33190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033191 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033192#endif
33193
Daniel Veillard42595322004-11-08 10:52:06 +000033194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033195}
33196
33197
33198static int
33199test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033201
William M. Brack21e4ef22005-01-02 09:53:13 +000033202#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033203 int mem_base;
33204 int ret_val;
33205 xmlSchemaFacetPtr facet; /* the facet to check */
33206 int n_facet;
33207 xmlChar * value; /* the lexical repr of the value to validate */
33208 int n_value;
33209 unsigned long actualLen; /* the number of list items */
33210 int n_actualLen;
33211 unsigned long * expectedLen; /* the resulting expected number of list items */
33212 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033213
Daniel Veillardce682bc2004-11-05 17:22:25 +000033214 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33215 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33216 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33217 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33218 mem_base = xmlMemBlocks();
33219 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33220 value = gen_const_xmlChar_ptr(n_value, 1);
33221 actualLen = gen_unsigned_long(n_actualLen, 2);
33222 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33223
William M. Brackf13f77f2004-11-12 16:03:48 +000033224 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033225 desret_int(ret_val);
33226 call_tests++;
33227 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033228 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033229 des_unsigned_long(n_actualLen, actualLen, 2);
33230 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33231 xmlResetLastError();
33232 if (mem_base != xmlMemBlocks()) {
33233 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033235 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033236 printf(" %d", n_facet);
33237 printf(" %d", n_value);
33238 printf(" %d", n_actualLen);
33239 printf(" %d", n_expectedLen);
33240 printf("\n");
33241 }
33242 }
33243 }
33244 }
33245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033246 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033247#endif
33248
Daniel Veillard42595322004-11-08 10:52:06 +000033249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033250}
33251
33252
33253static int
33254test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033256
William M. Brack21e4ef22005-01-02 09:53:13 +000033257#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033258 int mem_base;
33259 int ret_val;
33260 xmlSchemaTypePtr type; /* the predefined type */
33261 int n_type;
33262 xmlChar * value; /* the value to check */
33263 int n_value;
33264 xmlSchemaValPtr * val; /* the return computed value */
33265 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033266
Daniel Veillardce682bc2004-11-05 17:22:25 +000033267 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33268 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33269 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33270 mem_base = xmlMemBlocks();
33271 type = gen_xmlSchemaTypePtr(n_type, 0);
33272 value = gen_const_xmlChar_ptr(n_value, 1);
33273 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33274
William M. Brackf13f77f2004-11-12 16:03:48 +000033275 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033276 desret_int(ret_val);
33277 call_tests++;
33278 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033279 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033280 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33281 xmlResetLastError();
33282 if (mem_base != xmlMemBlocks()) {
33283 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033285 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033286 printf(" %d", n_type);
33287 printf(" %d", n_value);
33288 printf(" %d", n_val);
33289 printf("\n");
33290 }
33291 }
33292 }
33293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033294 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033295#endif
33296
Daniel Veillard42595322004-11-08 10:52:06 +000033297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033298}
33299
Daniel Veillard91b955c2004-12-10 10:26:42 +000033300
33301static int
33302test_xmlSchemaWhiteSpaceReplace(void) {
33303 int test_ret = 0;
33304
William M. Brack21e4ef22005-01-02 09:53:13 +000033305#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033306 int mem_base;
33307 xmlChar * ret_val;
33308 xmlChar * value; /* a value */
33309 int n_value;
33310
33311 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33312 mem_base = xmlMemBlocks();
33313 value = gen_const_xmlChar_ptr(n_value, 0);
33314
33315 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33316 desret_xmlChar_ptr(ret_val);
33317 call_tests++;
33318 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33319 xmlResetLastError();
33320 if (mem_base != xmlMemBlocks()) {
33321 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33322 xmlMemBlocks() - mem_base);
33323 test_ret++;
33324 printf(" %d", n_value);
33325 printf("\n");
33326 }
33327 }
33328 function_tests++;
33329#endif
33330
33331 return(test_ret);
33332}
33333
Daniel Veillardd93f6252004-11-02 15:53:51 +000033334static int
33335test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033337
Daniel Veillard91b955c2004-12-10 10:26:42 +000033338 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033339 test_ret += test_xmlSchemaCheckFacet();
33340 test_ret += test_xmlSchemaCleanupTypes();
33341 test_ret += test_xmlSchemaCollapseString();
33342 test_ret += test_xmlSchemaCompareValues();
33343 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33344 test_ret += test_xmlSchemaGetBuiltInType();
33345 test_ret += test_xmlSchemaGetFacetValueAsULong();
33346 test_ret += test_xmlSchemaGetPredefinedType();
33347 test_ret += test_xmlSchemaInitTypes();
33348 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33349 test_ret += test_xmlSchemaNewFacet();
33350 test_ret += test_xmlSchemaValPredefTypeNode();
33351 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33352 test_ret += test_xmlSchemaValidateFacet();
33353 test_ret += test_xmlSchemaValidateLengthFacet();
33354 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33355 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033356 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033357
Daniel Veillard42595322004-11-08 10:52:06 +000033358 if (test_ret != 0)
33359 printf("Module xmlschemastypes: %d errors\n", test_ret);
33360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033361}
33362
33363static int
33364test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033366
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033367 int mem_base;
33368 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033369 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033370 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033371
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033372 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033374 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033375
William M. Brackf13f77f2004-11-12 16:03:48 +000033376 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033377 desret_xmlChar_ptr(ret_val);
33378 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033379 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033380 xmlResetLastError();
33381 if (mem_base != xmlMemBlocks()) {
33382 printf("Leak of %d blocks found in xmlCharStrdup",
33383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033384 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033385 printf(" %d", n_cur);
33386 printf("\n");
33387 }
33388 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033389 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033390
Daniel Veillard42595322004-11-08 10:52:06 +000033391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033392}
33393
33394
33395static int
33396test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033398
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033399 int mem_base;
33400 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033401 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033402 int n_cur;
33403 int len; /* the len of @cur */
33404 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033405
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033406 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33407 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033409 cur = gen_const_char_ptr(n_cur, 0);
33410 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033411
William M. Brackf13f77f2004-11-12 16:03:48 +000033412 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033413 desret_xmlChar_ptr(ret_val);
33414 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033415 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033416 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033417 xmlResetLastError();
33418 if (mem_base != xmlMemBlocks()) {
33419 printf("Leak of %d blocks found in xmlCharStrndup",
33420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033421 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033422 printf(" %d", n_cur);
33423 printf(" %d", n_len);
33424 printf("\n");
33425 }
33426 }
33427 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033428 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033429
Daniel Veillard42595322004-11-08 10:52:06 +000033430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033431}
33432
33433
33434static int
33435test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033437
Daniel Veillardce682bc2004-11-05 17:22:25 +000033438 int mem_base;
33439 int ret_val;
33440 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33441 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033442
Daniel Veillardce682bc2004-11-05 17:22:25 +000033443 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33444 mem_base = xmlMemBlocks();
33445 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33446
William M. Brackf13f77f2004-11-12 16:03:48 +000033447 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033448 desret_int(ret_val);
33449 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033450 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033451 xmlResetLastError();
33452 if (mem_base != xmlMemBlocks()) {
33453 printf("Leak of %d blocks found in xmlCheckUTF8",
33454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033455 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033456 printf(" %d", n_utf);
33457 printf("\n");
33458 }
33459 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033460 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033461
Daniel Veillard42595322004-11-08 10:52:06 +000033462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033463}
33464
33465
33466static int
33467test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033469
Daniel Veillardce682bc2004-11-05 17:22:25 +000033470 int mem_base;
33471 int ret_val;
33472 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33473 int n_utf;
33474 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. */
33475 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033476
Daniel Veillardce682bc2004-11-05 17:22:25 +000033477 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33478 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33479 mem_base = xmlMemBlocks();
33480 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33481 len = gen_int_ptr(n_len, 1);
33482
William M. Brackf13f77f2004-11-12 16:03:48 +000033483 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033484 desret_int(ret_val);
33485 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033486 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033487 des_int_ptr(n_len, len, 1);
33488 xmlResetLastError();
33489 if (mem_base != xmlMemBlocks()) {
33490 printf("Leak of %d blocks found in xmlGetUTF8Char",
33491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033492 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033493 printf(" %d", n_utf);
33494 printf(" %d", n_len);
33495 printf("\n");
33496 }
33497 }
33498 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033500
Daniel Veillard42595322004-11-08 10:52:06 +000033501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033502}
33503
33504
33505static int
33506test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033508
33509 int mem_base;
33510 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033511 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033512 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033513 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033514 int n_str2;
33515
33516 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33517 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33518 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033519 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33520 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033521
William M. Brackf13f77f2004-11-12 16:03:48 +000033522 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033523 desret_int(ret_val);
33524 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033525 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33526 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033527 xmlResetLastError();
33528 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033529 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033531 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033532 printf(" %d", n_str1);
33533 printf(" %d", n_str2);
33534 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033535 }
33536 }
33537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033539
Daniel Veillard42595322004-11-08 10:52:06 +000033540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033541}
33542
33543
33544static int
33545test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033547
33548
33549 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033551}
33552
33553
33554static int
33555test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033557
33558 int mem_base;
33559 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033560 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033561 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033562 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033563 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033564 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033565 int n_str;
33566
33567 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33568 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33569 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33570 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033571 pref = gen_const_xmlChar_ptr(n_pref, 0);
33572 name = gen_const_xmlChar_ptr(n_name, 1);
33573 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033574
William M. Brackf13f77f2004-11-12 16:03:48 +000033575 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033576 desret_int(ret_val);
33577 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033578 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33579 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33580 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033581 xmlResetLastError();
33582 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033583 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033585 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033586 printf(" %d", n_pref);
33587 printf(" %d", n_name);
33588 printf(" %d", n_str);
33589 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033590 }
33591 }
33592 }
33593 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033595
Daniel Veillard42595322004-11-08 10:52:06 +000033596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597}
33598
33599
33600static int
33601test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033603
33604
33605 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033607}
33608
33609
33610static int
33611test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033613
33614 int mem_base;
33615 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033616 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033617 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033618 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033619 int n_str2;
33620
33621 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33622 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033624 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33625 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033626
William M. Brackf13f77f2004-11-12 16:03:48 +000033627 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033628 desret_int(ret_val);
33629 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033630 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33631 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033632 xmlResetLastError();
33633 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033634 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033635 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033636 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033637 printf(" %d", n_str1);
33638 printf(" %d", n_str2);
33639 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033640 }
33641 }
33642 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033644
Daniel Veillard42595322004-11-08 10:52:06 +000033645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033646}
33647
33648
33649static int
33650test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033652
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033653 int mem_base;
33654 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033655 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033656 int n_str;
33657 xmlChar * val; /* the xmlChar to search (needle) */
33658 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033659
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033660 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33661 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33662 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033663 str = gen_const_xmlChar_ptr(n_str, 0);
33664 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033665
William M. Brackf13f77f2004-11-12 16:03:48 +000033666 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033667 desret_const_xmlChar_ptr(ret_val);
33668 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033669 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033670 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033671 xmlResetLastError();
33672 if (mem_base != xmlMemBlocks()) {
33673 printf("Leak of %d blocks found in xmlStrcasestr",
33674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033675 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033676 printf(" %d", n_str);
33677 printf(" %d", n_val);
33678 printf("\n");
33679 }
33680 }
33681 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033683
Daniel Veillard42595322004-11-08 10:52:06 +000033684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033685}
33686
33687
33688static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033689test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033691
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033692 int mem_base;
33693 const xmlChar * ret_val;
33694 xmlChar * str; /* the xmlChar * array */
33695 int n_str;
33696 xmlChar val; /* the xmlChar to search */
33697 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033698
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033699 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33700 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33701 mem_base = xmlMemBlocks();
33702 str = gen_const_xmlChar_ptr(n_str, 0);
33703 val = gen_xmlChar(n_val, 1);
33704
William M. Brackf13f77f2004-11-12 16:03:48 +000033705 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033706 desret_const_xmlChar_ptr(ret_val);
33707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033708 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033709 des_xmlChar(n_val, val, 1);
33710 xmlResetLastError();
33711 if (mem_base != xmlMemBlocks()) {
33712 printf("Leak of %d blocks found in xmlStrchr",
33713 xmlMemBlocks() - mem_base);
33714 test_ret++;
33715 printf(" %d", n_str);
33716 printf(" %d", n_val);
33717 printf("\n");
33718 }
33719 }
33720 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033722
Daniel Veillard42595322004-11-08 10:52:06 +000033723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033724}
33725
33726
33727static int
33728test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033730
33731 int mem_base;
33732 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033733 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033734 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033735 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033736 int n_str2;
33737
33738 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33739 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033741 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33742 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033743
William M. Brackf13f77f2004-11-12 16:03:48 +000033744 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033745 desret_int(ret_val);
33746 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033747 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33748 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033749 xmlResetLastError();
33750 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033751 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033753 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033754 printf(" %d", n_str1);
33755 printf(" %d", n_str2);
33756 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033757 }
33758 }
33759 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033760 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033761
Daniel Veillard42595322004-11-08 10:52:06 +000033762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033763}
33764
33765
33766static int
33767test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033769
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033770 int mem_base;
33771 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033772 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033773 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033774
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033775 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33776 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033777 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033778
William M. Brackf13f77f2004-11-12 16:03:48 +000033779 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033780 desret_xmlChar_ptr(ret_val);
33781 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033782 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033783 xmlResetLastError();
33784 if (mem_base != xmlMemBlocks()) {
33785 printf("Leak of %d blocks found in xmlStrdup",
33786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033787 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033788 printf(" %d", n_cur);
33789 printf("\n");
33790 }
33791 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033792 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033793
Daniel Veillard42595322004-11-08 10:52:06 +000033794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033795}
33796
33797
33798static int
33799test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033801
33802 int mem_base;
33803 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033804 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033805 int n_str;
33806
33807 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33808 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033809 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033810
William M. Brackf13f77f2004-11-12 16:03:48 +000033811 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033812 desret_int(ret_val);
33813 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033814 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033815 xmlResetLastError();
33816 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033817 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033819 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033820 printf(" %d", n_str);
33821 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033822 }
33823 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033824 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033825
Daniel Veillard42595322004-11-08 10:52:06 +000033826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033827}
33828
33829
33830static int
33831test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033833
33834 int mem_base;
33835 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033836 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033837 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033838 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033839 int n_str2;
33840 int len; /* the max comparison length */
33841 int n_len;
33842
33843 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33844 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33845 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033847 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33848 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33849 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033850
William M. Brackf13f77f2004-11-12 16:03:48 +000033851 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033852 desret_int(ret_val);
33853 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033854 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33855 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033856 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033857 xmlResetLastError();
33858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033859 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033862 printf(" %d", n_str1);
33863 printf(" %d", n_str2);
33864 printf(" %d", n_len);
33865 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033866 }
33867 }
33868 }
33869 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033870 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033871
Daniel Veillard42595322004-11-08 10:52:06 +000033872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033873}
33874
33875
33876static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033877test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033879
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033880 int mem_base;
33881 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033882 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033883 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033884 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033885 int n_str2;
33886 int len; /* the len of @str2 */
33887 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033888
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033889 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33890 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33891 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33892 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033893 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33894 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33895 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033896
William M. Brackf13f77f2004-11-12 16:03:48 +000033897 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033898 desret_xmlChar_ptr(ret_val);
33899 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033900 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33901 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033902 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033903 xmlResetLastError();
33904 if (mem_base != xmlMemBlocks()) {
33905 printf("Leak of %d blocks found in xmlStrncatNew",
33906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033907 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033908 printf(" %d", n_str1);
33909 printf(" %d", n_str2);
33910 printf(" %d", n_len);
33911 printf("\n");
33912 }
33913 }
33914 }
33915 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033916 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033917
Daniel Veillard42595322004-11-08 10:52:06 +000033918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033919}
33920
33921
33922static int
33923test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033925
33926 int mem_base;
33927 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033928 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033929 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033930 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033931 int n_str2;
33932 int len; /* the max comparison length */
33933 int n_len;
33934
33935 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33936 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33937 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33938 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033939 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33940 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33941 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033942
William M. Brackf13f77f2004-11-12 16:03:48 +000033943 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033944 desret_int(ret_val);
33945 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033946 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33947 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033948 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033949 xmlResetLastError();
33950 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033951 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033953 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033954 printf(" %d", n_str1);
33955 printf(" %d", n_str2);
33956 printf(" %d", n_len);
33957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033958 }
33959 }
33960 }
33961 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033962 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033963
Daniel Veillard42595322004-11-08 10:52:06 +000033964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033965}
33966
33967
33968static int
33969test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033971
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033972 int mem_base;
33973 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033974 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033975 int n_cur;
33976 int len; /* the len of @cur */
33977 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033978
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033979 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33980 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033982 cur = gen_const_xmlChar_ptr(n_cur, 0);
33983 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033984
William M. Brackf13f77f2004-11-12 16:03:48 +000033985 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033986 desret_xmlChar_ptr(ret_val);
33987 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033988 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033989 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033990 xmlResetLastError();
33991 if (mem_base != xmlMemBlocks()) {
33992 printf("Leak of %d blocks found in xmlStrndup",
33993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033994 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033995 printf(" %d", n_cur);
33996 printf(" %d", n_len);
33997 printf("\n");
33998 }
33999 }
34000 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034001 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034002
Daniel Veillard42595322004-11-08 10:52:06 +000034003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034004}
34005
34006
34007static int
34008test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034010
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034011 int mem_base;
34012 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034013 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034014 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034015 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034016 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034017
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034018 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34019 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
34020 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034021 str = gen_const_xmlChar_ptr(n_str, 0);
34022 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034023
William M. Brackf13f77f2004-11-12 16:03:48 +000034024 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034025 desret_const_xmlChar_ptr(ret_val);
34026 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034027 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
34028 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034029 xmlResetLastError();
34030 if (mem_base != xmlMemBlocks()) {
34031 printf("Leak of %d blocks found in xmlStrstr",
34032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034033 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034034 printf(" %d", n_str);
34035 printf(" %d", n_val);
34036 printf("\n");
34037 }
34038 }
34039 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034040 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034041
Daniel Veillard42595322004-11-08 10:52:06 +000034042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034043}
34044
34045
34046static int
34047test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034049
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034050 int mem_base;
34051 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034052 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034053 int n_str;
34054 int start; /* the index of the first char (zero based) */
34055 int n_start;
34056 int len; /* the length of the substring */
34057 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034058
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034059 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34060 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34061 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034063 str = gen_const_xmlChar_ptr(n_str, 0);
34064 start = gen_int(n_start, 1);
34065 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034066
William M. Brackf13f77f2004-11-12 16:03:48 +000034067 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034068 desret_xmlChar_ptr(ret_val);
34069 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034070 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034071 des_int(n_start, start, 1);
34072 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034073 xmlResetLastError();
34074 if (mem_base != xmlMemBlocks()) {
34075 printf("Leak of %d blocks found in xmlStrsub",
34076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034077 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034078 printf(" %d", n_str);
34079 printf(" %d", n_start);
34080 printf(" %d", n_len);
34081 printf("\n");
34082 }
34083 }
34084 }
34085 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034086 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034087
Daniel Veillard42595322004-11-08 10:52:06 +000034088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034089}
34090
34091
34092static int
34093test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034095
34096 int mem_base;
34097 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034098 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034099 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034100 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034101 int n_utf2;
34102
34103 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34104 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34105 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034106 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34107 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034108
William M. Brackf13f77f2004-11-12 16:03:48 +000034109 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034110 desret_int(ret_val);
34111 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034112 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34113 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034114 xmlResetLastError();
34115 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034116 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034118 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034119 printf(" %d", n_utf1);
34120 printf(" %d", n_utf2);
34121 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034122 }
34123 }
34124 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034125 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034126
Daniel Veillard42595322004-11-08 10:52:06 +000034127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034128}
34129
34130
34131static int
34132test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034134
34135 int mem_base;
34136 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034137 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034138 int n_utf;
34139
34140 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034142 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034143
William M. Brackf13f77f2004-11-12 16:03:48 +000034144 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034145 desret_int(ret_val);
34146 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034147 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034148 xmlResetLastError();
34149 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034150 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034152 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034153 printf(" %d", n_utf);
34154 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034155 }
34156 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034158
Daniel Veillard42595322004-11-08 10:52:06 +000034159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034160}
34161
34162
34163static int
34164test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034166
34167 int mem_base;
34168 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034169 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034170 int n_utf;
34171
34172 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034174 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034175
William M. Brackf13f77f2004-11-12 16:03:48 +000034176 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034177 desret_int(ret_val);
34178 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034179 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034180 xmlResetLastError();
34181 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034182 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034184 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034185 printf(" %d", n_utf);
34186 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034187 }
34188 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034189 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034190
Daniel Veillard42595322004-11-08 10:52:06 +000034191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034192}
34193
34194
34195static int
34196test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034198
34199 int mem_base;
34200 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034201 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034202 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034203 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034204 int n_utfchar;
34205
34206 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34207 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034209 utf = gen_const_xmlChar_ptr(n_utf, 0);
34210 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034211
William M. Brackf13f77f2004-11-12 16:03:48 +000034212 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034213 desret_int(ret_val);
34214 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034215 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34216 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034217 xmlResetLastError();
34218 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034219 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034221 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034222 printf(" %d", n_utf);
34223 printf(" %d", n_utfchar);
34224 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034225 }
34226 }
34227 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034228 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034229
Daniel Veillard42595322004-11-08 10:52:06 +000034230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034231}
34232
34233
34234static int
34235test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034237
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034238 int mem_base;
34239 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034240 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034241 int n_utf;
34242 int len; /* the len of @utf (in chars) */
34243 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034244
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034245 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34246 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034248 utf = gen_const_xmlChar_ptr(n_utf, 0);
34249 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034250
William M. Brackf13f77f2004-11-12 16:03:48 +000034251 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034252 desret_xmlChar_ptr(ret_val);
34253 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034254 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034255 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034256 xmlResetLastError();
34257 if (mem_base != xmlMemBlocks()) {
34258 printf("Leak of %d blocks found in xmlUTF8Strndup",
34259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034260 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034261 printf(" %d", n_utf);
34262 printf(" %d", n_len);
34263 printf("\n");
34264 }
34265 }
34266 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034267 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034268
Daniel Veillard42595322004-11-08 10:52:06 +000034269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034270}
34271
34272
34273static int
34274test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034276
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034277 int mem_base;
34278 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034279 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034280 int n_utf;
34281 int pos; /* the position of the desired UTF8 char (in chars) */
34282 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034283
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034284 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34285 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034287 utf = gen_const_xmlChar_ptr(n_utf, 0);
34288 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034289
William M. Brackf13f77f2004-11-12 16:03:48 +000034290 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034291 desret_const_xmlChar_ptr(ret_val);
34292 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034293 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034294 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034295 xmlResetLastError();
34296 if (mem_base != xmlMemBlocks()) {
34297 printf("Leak of %d blocks found in xmlUTF8Strpos",
34298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034299 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034300 printf(" %d", n_utf);
34301 printf(" %d", n_pos);
34302 printf("\n");
34303 }
34304 }
34305 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034307
Daniel Veillard42595322004-11-08 10:52:06 +000034308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034309}
34310
34311
34312static int
34313test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034315
34316 int mem_base;
34317 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034318 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034319 int n_utf;
34320 int len; /* the number of characters in the array */
34321 int n_len;
34322
34323 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34324 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34325 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034326 utf = gen_const_xmlChar_ptr(n_utf, 0);
34327 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034328
William M. Brackf13f77f2004-11-12 16:03:48 +000034329 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034330 desret_int(ret_val);
34331 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034332 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034333 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034334 xmlResetLastError();
34335 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034336 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034339 printf(" %d", n_utf);
34340 printf(" %d", n_len);
34341 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034342 }
34343 }
34344 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034346
Daniel Veillard42595322004-11-08 10:52:06 +000034347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034348}
34349
34350
34351static int
34352test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034354
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034355 int mem_base;
34356 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034357 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034358 int n_utf;
34359 int start; /* relative pos of first char */
34360 int n_start;
34361 int len; /* total number to copy */
34362 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034363
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034364 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34365 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34366 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034368 utf = gen_const_xmlChar_ptr(n_utf, 0);
34369 start = gen_int(n_start, 1);
34370 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034371
William M. Brackf13f77f2004-11-12 16:03:48 +000034372 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034373 desret_xmlChar_ptr(ret_val);
34374 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034375 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034376 des_int(n_start, start, 1);
34377 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034378 xmlResetLastError();
34379 if (mem_base != xmlMemBlocks()) {
34380 printf("Leak of %d blocks found in xmlUTF8Strsub",
34381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034382 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034383 printf(" %d", n_utf);
34384 printf(" %d", n_start);
34385 printf(" %d", n_len);
34386 printf("\n");
34387 }
34388 }
34389 }
34390 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034391 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034392
Daniel Veillard42595322004-11-08 10:52:06 +000034393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034394}
34395
34396static int
34397test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034399
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034400 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034401 test_ret += test_xmlCharStrdup();
34402 test_ret += test_xmlCharStrndup();
34403 test_ret += test_xmlCheckUTF8();
34404 test_ret += test_xmlGetUTF8Char();
34405 test_ret += test_xmlStrEqual();
34406 test_ret += test_xmlStrPrintf();
34407 test_ret += test_xmlStrQEqual();
34408 test_ret += test_xmlStrVPrintf();
34409 test_ret += test_xmlStrcasecmp();
34410 test_ret += test_xmlStrcasestr();
34411 test_ret += test_xmlStrchr();
34412 test_ret += test_xmlStrcmp();
34413 test_ret += test_xmlStrdup();
34414 test_ret += test_xmlStrlen();
34415 test_ret += test_xmlStrncasecmp();
34416 test_ret += test_xmlStrncatNew();
34417 test_ret += test_xmlStrncmp();
34418 test_ret += test_xmlStrndup();
34419 test_ret += test_xmlStrstr();
34420 test_ret += test_xmlStrsub();
34421 test_ret += test_xmlUTF8Charcmp();
34422 test_ret += test_xmlUTF8Size();
34423 test_ret += test_xmlUTF8Strlen();
34424 test_ret += test_xmlUTF8Strloc();
34425 test_ret += test_xmlUTF8Strndup();
34426 test_ret += test_xmlUTF8Strpos();
34427 test_ret += test_xmlUTF8Strsize();
34428 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034429
Daniel Veillard42595322004-11-08 10:52:06 +000034430 if (test_ret != 0)
34431 printf("Module xmlstring: %d errors\n", test_ret);
34432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034433}
34434
34435static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034436test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034438
William M. Brack21e4ef22005-01-02 09:53:13 +000034439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034440 int mem_base;
34441 int ret_val;
34442 int code; /* UCS code point */
34443 int n_code;
34444
34445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34446 mem_base = xmlMemBlocks();
34447 code = gen_int(n_code, 0);
34448
34449 ret_val = xmlUCSIsAegeanNumbers(code);
34450 desret_int(ret_val);
34451 call_tests++;
34452 des_int(n_code, code, 0);
34453 xmlResetLastError();
34454 if (mem_base != xmlMemBlocks()) {
34455 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034458 printf(" %d", n_code);
34459 printf("\n");
34460 }
34461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034463#endif
34464
Daniel Veillard42595322004-11-08 10:52:06 +000034465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034466}
34467
34468
34469static int
34470test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034472
William M. Brack21e4ef22005-01-02 09:53:13 +000034473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034474 int mem_base;
34475 int ret_val;
34476 int code; /* UCS code point */
34477 int n_code;
34478
34479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34480 mem_base = xmlMemBlocks();
34481 code = gen_int(n_code, 0);
34482
34483 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34484 desret_int(ret_val);
34485 call_tests++;
34486 des_int(n_code, code, 0);
34487 xmlResetLastError();
34488 if (mem_base != xmlMemBlocks()) {
34489 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034492 printf(" %d", n_code);
34493 printf("\n");
34494 }
34495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034497#endif
34498
Daniel Veillard42595322004-11-08 10:52:06 +000034499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034500}
34501
34502
34503static int
34504test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034506
William M. Brack21e4ef22005-01-02 09:53:13 +000034507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034508 int mem_base;
34509 int ret_val;
34510 int code; /* UCS code point */
34511 int n_code;
34512
34513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34514 mem_base = xmlMemBlocks();
34515 code = gen_int(n_code, 0);
34516
34517 ret_val = xmlUCSIsArabic(code);
34518 desret_int(ret_val);
34519 call_tests++;
34520 des_int(n_code, code, 0);
34521 xmlResetLastError();
34522 if (mem_base != xmlMemBlocks()) {
34523 printf("Leak of %d blocks found in xmlUCSIsArabic",
34524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034526 printf(" %d", n_code);
34527 printf("\n");
34528 }
34529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034531#endif
34532
Daniel Veillard42595322004-11-08 10:52:06 +000034533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034534}
34535
34536
34537static int
34538test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034540
William M. Brack21e4ef22005-01-02 09:53:13 +000034541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034542 int mem_base;
34543 int ret_val;
34544 int code; /* UCS code point */
34545 int n_code;
34546
34547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34548 mem_base = xmlMemBlocks();
34549 code = gen_int(n_code, 0);
34550
34551 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34552 desret_int(ret_val);
34553 call_tests++;
34554 des_int(n_code, code, 0);
34555 xmlResetLastError();
34556 if (mem_base != xmlMemBlocks()) {
34557 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034560 printf(" %d", n_code);
34561 printf("\n");
34562 }
34563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034565#endif
34566
Daniel Veillard42595322004-11-08 10:52:06 +000034567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034568}
34569
34570
34571static int
34572test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034574
William M. Brack21e4ef22005-01-02 09:53:13 +000034575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034576 int mem_base;
34577 int ret_val;
34578 int code; /* UCS code point */
34579 int n_code;
34580
34581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34582 mem_base = xmlMemBlocks();
34583 code = gen_int(n_code, 0);
34584
34585 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34586 desret_int(ret_val);
34587 call_tests++;
34588 des_int(n_code, code, 0);
34589 xmlResetLastError();
34590 if (mem_base != xmlMemBlocks()) {
34591 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034594 printf(" %d", n_code);
34595 printf("\n");
34596 }
34597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034599#endif
34600
Daniel Veillard42595322004-11-08 10:52:06 +000034601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034602}
34603
34604
34605static int
34606test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034608
William M. Brack21e4ef22005-01-02 09:53:13 +000034609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034610 int mem_base;
34611 int ret_val;
34612 int code; /* UCS code point */
34613 int n_code;
34614
34615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34616 mem_base = xmlMemBlocks();
34617 code = gen_int(n_code, 0);
34618
34619 ret_val = xmlUCSIsArmenian(code);
34620 desret_int(ret_val);
34621 call_tests++;
34622 des_int(n_code, code, 0);
34623 xmlResetLastError();
34624 if (mem_base != xmlMemBlocks()) {
34625 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034628 printf(" %d", n_code);
34629 printf("\n");
34630 }
34631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034633#endif
34634
Daniel Veillard42595322004-11-08 10:52:06 +000034635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034636}
34637
34638
34639static int
34640test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034642
William M. Brack21e4ef22005-01-02 09:53:13 +000034643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034644 int mem_base;
34645 int ret_val;
34646 int code; /* UCS code point */
34647 int n_code;
34648
34649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34650 mem_base = xmlMemBlocks();
34651 code = gen_int(n_code, 0);
34652
34653 ret_val = xmlUCSIsArrows(code);
34654 desret_int(ret_val);
34655 call_tests++;
34656 des_int(n_code, code, 0);
34657 xmlResetLastError();
34658 if (mem_base != xmlMemBlocks()) {
34659 printf("Leak of %d blocks found in xmlUCSIsArrows",
34660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034662 printf(" %d", n_code);
34663 printf("\n");
34664 }
34665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034667#endif
34668
Daniel Veillard42595322004-11-08 10:52:06 +000034669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034670}
34671
34672
34673static int
34674test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034676
William M. Brack21e4ef22005-01-02 09:53:13 +000034677#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034678 int mem_base;
34679 int ret_val;
34680 int code; /* UCS code point */
34681 int n_code;
34682
34683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34684 mem_base = xmlMemBlocks();
34685 code = gen_int(n_code, 0);
34686
34687 ret_val = xmlUCSIsBasicLatin(code);
34688 desret_int(ret_val);
34689 call_tests++;
34690 des_int(n_code, code, 0);
34691 xmlResetLastError();
34692 if (mem_base != xmlMemBlocks()) {
34693 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034696 printf(" %d", n_code);
34697 printf("\n");
34698 }
34699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034701#endif
34702
Daniel Veillard42595322004-11-08 10:52:06 +000034703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034704}
34705
34706
34707static int
34708test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034710
William M. Brack21e4ef22005-01-02 09:53:13 +000034711#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034712 int mem_base;
34713 int ret_val;
34714 int code; /* UCS code point */
34715 int n_code;
34716
34717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34718 mem_base = xmlMemBlocks();
34719 code = gen_int(n_code, 0);
34720
34721 ret_val = xmlUCSIsBengali(code);
34722 desret_int(ret_val);
34723 call_tests++;
34724 des_int(n_code, code, 0);
34725 xmlResetLastError();
34726 if (mem_base != xmlMemBlocks()) {
34727 printf("Leak of %d blocks found in xmlUCSIsBengali",
34728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034730 printf(" %d", n_code);
34731 printf("\n");
34732 }
34733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034735#endif
34736
Daniel Veillard42595322004-11-08 10:52:06 +000034737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034738}
34739
34740
34741static int
34742test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034744
William M. Brack21e4ef22005-01-02 09:53:13 +000034745#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034746 int mem_base;
34747 int ret_val;
34748 int code; /* UCS code point */
34749 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034750 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034751 int n_block;
34752
34753 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34754 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34755 mem_base = xmlMemBlocks();
34756 code = gen_int(n_code, 0);
34757 block = gen_const_char_ptr(n_block, 1);
34758
William M. Brackf13f77f2004-11-12 16:03:48 +000034759 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034760 desret_int(ret_val);
34761 call_tests++;
34762 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034763 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034764 xmlResetLastError();
34765 if (mem_base != xmlMemBlocks()) {
34766 printf("Leak of %d blocks found in xmlUCSIsBlock",
34767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034768 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034769 printf(" %d", n_code);
34770 printf(" %d", n_block);
34771 printf("\n");
34772 }
34773 }
34774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034775 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034776#endif
34777
Daniel Veillard42595322004-11-08 10:52:06 +000034778 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034779}
34780
34781
34782static int
34783test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034784 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034785
William M. Brack21e4ef22005-01-02 09:53:13 +000034786#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034787 int mem_base;
34788 int ret_val;
34789 int code; /* UCS code point */
34790 int n_code;
34791
34792 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34793 mem_base = xmlMemBlocks();
34794 code = gen_int(n_code, 0);
34795
34796 ret_val = xmlUCSIsBlockElements(code);
34797 desret_int(ret_val);
34798 call_tests++;
34799 des_int(n_code, code, 0);
34800 xmlResetLastError();
34801 if (mem_base != xmlMemBlocks()) {
34802 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034804 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034805 printf(" %d", n_code);
34806 printf("\n");
34807 }
34808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034809 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034810#endif
34811
Daniel Veillard42595322004-11-08 10:52:06 +000034812 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034813}
34814
34815
34816static int
34817test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034818 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034819
William M. Brack21e4ef22005-01-02 09:53:13 +000034820#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034821 int mem_base;
34822 int ret_val;
34823 int code; /* UCS code point */
34824 int n_code;
34825
34826 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34827 mem_base = xmlMemBlocks();
34828 code = gen_int(n_code, 0);
34829
34830 ret_val = xmlUCSIsBopomofo(code);
34831 desret_int(ret_val);
34832 call_tests++;
34833 des_int(n_code, code, 0);
34834 xmlResetLastError();
34835 if (mem_base != xmlMemBlocks()) {
34836 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034838 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034839 printf(" %d", n_code);
34840 printf("\n");
34841 }
34842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034843 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034844#endif
34845
Daniel Veillard42595322004-11-08 10:52:06 +000034846 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034847}
34848
34849
34850static int
34851test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034852 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034853
William M. Brack21e4ef22005-01-02 09:53:13 +000034854#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034855 int mem_base;
34856 int ret_val;
34857 int code; /* UCS code point */
34858 int n_code;
34859
34860 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34861 mem_base = xmlMemBlocks();
34862 code = gen_int(n_code, 0);
34863
34864 ret_val = xmlUCSIsBopomofoExtended(code);
34865 desret_int(ret_val);
34866 call_tests++;
34867 des_int(n_code, code, 0);
34868 xmlResetLastError();
34869 if (mem_base != xmlMemBlocks()) {
34870 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034872 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034873 printf(" %d", n_code);
34874 printf("\n");
34875 }
34876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034877 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034878#endif
34879
Daniel Veillard42595322004-11-08 10:52:06 +000034880 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034881}
34882
34883
34884static int
34885test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034886 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034887
William M. Brack21e4ef22005-01-02 09:53:13 +000034888#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034889 int mem_base;
34890 int ret_val;
34891 int code; /* UCS code point */
34892 int n_code;
34893
34894 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34895 mem_base = xmlMemBlocks();
34896 code = gen_int(n_code, 0);
34897
34898 ret_val = xmlUCSIsBoxDrawing(code);
34899 desret_int(ret_val);
34900 call_tests++;
34901 des_int(n_code, code, 0);
34902 xmlResetLastError();
34903 if (mem_base != xmlMemBlocks()) {
34904 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034906 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034907 printf(" %d", n_code);
34908 printf("\n");
34909 }
34910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034911 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034912#endif
34913
Daniel Veillard42595322004-11-08 10:52:06 +000034914 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034915}
34916
34917
34918static int
34919test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034920 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034921
William M. Brack21e4ef22005-01-02 09:53:13 +000034922#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034923 int mem_base;
34924 int ret_val;
34925 int code; /* UCS code point */
34926 int n_code;
34927
34928 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34929 mem_base = xmlMemBlocks();
34930 code = gen_int(n_code, 0);
34931
34932 ret_val = xmlUCSIsBraillePatterns(code);
34933 desret_int(ret_val);
34934 call_tests++;
34935 des_int(n_code, code, 0);
34936 xmlResetLastError();
34937 if (mem_base != xmlMemBlocks()) {
34938 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034940 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034941 printf(" %d", n_code);
34942 printf("\n");
34943 }
34944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034945 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034946#endif
34947
Daniel Veillard42595322004-11-08 10:52:06 +000034948 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034949}
34950
34951
34952static int
34953test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034954 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034955
William M. Brack21e4ef22005-01-02 09:53:13 +000034956#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034957 int mem_base;
34958 int ret_val;
34959 int code; /* UCS code point */
34960 int n_code;
34961
34962 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34963 mem_base = xmlMemBlocks();
34964 code = gen_int(n_code, 0);
34965
34966 ret_val = xmlUCSIsBuhid(code);
34967 desret_int(ret_val);
34968 call_tests++;
34969 des_int(n_code, code, 0);
34970 xmlResetLastError();
34971 if (mem_base != xmlMemBlocks()) {
34972 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034974 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034975 printf(" %d", n_code);
34976 printf("\n");
34977 }
34978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034979 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034980#endif
34981
Daniel Veillard42595322004-11-08 10:52:06 +000034982 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034983}
34984
34985
34986static int
34987test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034988 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034989
William M. Brack21e4ef22005-01-02 09:53:13 +000034990#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034991 int mem_base;
34992 int ret_val;
34993 int code; /* UCS code point */
34994 int n_code;
34995
34996 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34997 mem_base = xmlMemBlocks();
34998 code = gen_int(n_code, 0);
34999
35000 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
35001 desret_int(ret_val);
35002 call_tests++;
35003 des_int(n_code, code, 0);
35004 xmlResetLastError();
35005 if (mem_base != xmlMemBlocks()) {
35006 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
35007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035008 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035009 printf(" %d", n_code);
35010 printf("\n");
35011 }
35012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035013 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035014#endif
35015
Daniel Veillard42595322004-11-08 10:52:06 +000035016 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035017}
35018
35019
35020static int
35021test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035022 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035023
William M. Brack21e4ef22005-01-02 09:53:13 +000035024#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035025 int mem_base;
35026 int ret_val;
35027 int code; /* UCS code point */
35028 int n_code;
35029
35030 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35031 mem_base = xmlMemBlocks();
35032 code = gen_int(n_code, 0);
35033
35034 ret_val = xmlUCSIsCJKCompatibility(code);
35035 desret_int(ret_val);
35036 call_tests++;
35037 des_int(n_code, code, 0);
35038 xmlResetLastError();
35039 if (mem_base != xmlMemBlocks()) {
35040 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
35041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035042 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035043 printf(" %d", n_code);
35044 printf("\n");
35045 }
35046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035047 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035048#endif
35049
Daniel Veillard42595322004-11-08 10:52:06 +000035050 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035051}
35052
35053
35054static int
35055test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035056 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035057
William M. Brack21e4ef22005-01-02 09:53:13 +000035058#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035059 int mem_base;
35060 int ret_val;
35061 int code; /* UCS code point */
35062 int n_code;
35063
35064 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35065 mem_base = xmlMemBlocks();
35066 code = gen_int(n_code, 0);
35067
35068 ret_val = xmlUCSIsCJKCompatibilityForms(code);
35069 desret_int(ret_val);
35070 call_tests++;
35071 des_int(n_code, code, 0);
35072 xmlResetLastError();
35073 if (mem_base != xmlMemBlocks()) {
35074 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
35075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035076 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035077 printf(" %d", n_code);
35078 printf("\n");
35079 }
35080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035081 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035082#endif
35083
Daniel Veillard42595322004-11-08 10:52:06 +000035084 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035085}
35086
35087
35088static int
35089test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035090 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035091
William M. Brack21e4ef22005-01-02 09:53:13 +000035092#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035093 int mem_base;
35094 int ret_val;
35095 int code; /* UCS code point */
35096 int n_code;
35097
35098 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35099 mem_base = xmlMemBlocks();
35100 code = gen_int(n_code, 0);
35101
35102 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
35103 desret_int(ret_val);
35104 call_tests++;
35105 des_int(n_code, code, 0);
35106 xmlResetLastError();
35107 if (mem_base != xmlMemBlocks()) {
35108 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
35109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035110 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035111 printf(" %d", n_code);
35112 printf("\n");
35113 }
35114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035115 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035116#endif
35117
Daniel Veillard42595322004-11-08 10:52:06 +000035118 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035119}
35120
35121
35122static int
35123test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035124 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035125
William M. Brack21e4ef22005-01-02 09:53:13 +000035126#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035127 int mem_base;
35128 int ret_val;
35129 int code; /* UCS code point */
35130 int n_code;
35131
35132 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35133 mem_base = xmlMemBlocks();
35134 code = gen_int(n_code, 0);
35135
35136 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
35137 desret_int(ret_val);
35138 call_tests++;
35139 des_int(n_code, code, 0);
35140 xmlResetLastError();
35141 if (mem_base != xmlMemBlocks()) {
35142 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
35143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035144 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035145 printf(" %d", n_code);
35146 printf("\n");
35147 }
35148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035149 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035150#endif
35151
Daniel Veillard42595322004-11-08 10:52:06 +000035152 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035153}
35154
35155
35156static int
35157test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035158 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035159
William M. Brack21e4ef22005-01-02 09:53:13 +000035160#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035161 int mem_base;
35162 int ret_val;
35163 int code; /* UCS code point */
35164 int n_code;
35165
35166 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35167 mem_base = xmlMemBlocks();
35168 code = gen_int(n_code, 0);
35169
35170 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35171 desret_int(ret_val);
35172 call_tests++;
35173 des_int(n_code, code, 0);
35174 xmlResetLastError();
35175 if (mem_base != xmlMemBlocks()) {
35176 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035178 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035179 printf(" %d", n_code);
35180 printf("\n");
35181 }
35182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035183 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035184#endif
35185
Daniel Veillard42595322004-11-08 10:52:06 +000035186 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035187}
35188
35189
35190static int
35191test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035192 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035193
William M. Brack21e4ef22005-01-02 09:53:13 +000035194#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035195 int mem_base;
35196 int ret_val;
35197 int code; /* UCS code point */
35198 int n_code;
35199
35200 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35201 mem_base = xmlMemBlocks();
35202 code = gen_int(n_code, 0);
35203
35204 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35205 desret_int(ret_val);
35206 call_tests++;
35207 des_int(n_code, code, 0);
35208 xmlResetLastError();
35209 if (mem_base != xmlMemBlocks()) {
35210 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035212 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035213 printf(" %d", n_code);
35214 printf("\n");
35215 }
35216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035217 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218#endif
35219
Daniel Veillard42595322004-11-08 10:52:06 +000035220 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035221}
35222
35223
35224static int
35225test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035226 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035227
William M. Brack21e4ef22005-01-02 09:53:13 +000035228#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035229 int mem_base;
35230 int ret_val;
35231 int code; /* UCS code point */
35232 int n_code;
35233
35234 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35235 mem_base = xmlMemBlocks();
35236 code = gen_int(n_code, 0);
35237
35238 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35239 desret_int(ret_val);
35240 call_tests++;
35241 des_int(n_code, code, 0);
35242 xmlResetLastError();
35243 if (mem_base != xmlMemBlocks()) {
35244 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035246 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035247 printf(" %d", n_code);
35248 printf("\n");
35249 }
35250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035251 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252#endif
35253
Daniel Veillard42595322004-11-08 10:52:06 +000035254 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035255}
35256
35257
35258static int
35259test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035260 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035261
William M. Brack21e4ef22005-01-02 09:53:13 +000035262#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035263 int mem_base;
35264 int ret_val;
35265 int code; /* UCS code point */
35266 int n_code;
35267
35268 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35269 mem_base = xmlMemBlocks();
35270 code = gen_int(n_code, 0);
35271
35272 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35273 desret_int(ret_val);
35274 call_tests++;
35275 des_int(n_code, code, 0);
35276 xmlResetLastError();
35277 if (mem_base != xmlMemBlocks()) {
35278 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035280 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035281 printf(" %d", n_code);
35282 printf("\n");
35283 }
35284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035285 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035286#endif
35287
Daniel Veillard42595322004-11-08 10:52:06 +000035288 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035289}
35290
35291
35292static int
35293test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035294 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035295
William M. Brack21e4ef22005-01-02 09:53:13 +000035296#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035297 int mem_base;
35298 int ret_val;
35299 int code; /* UCS code point */
35300 int n_code;
35301
35302 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35303 mem_base = xmlMemBlocks();
35304 code = gen_int(n_code, 0);
35305
35306 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35307 desret_int(ret_val);
35308 call_tests++;
35309 des_int(n_code, code, 0);
35310 xmlResetLastError();
35311 if (mem_base != xmlMemBlocks()) {
35312 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035314 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035315 printf(" %d", n_code);
35316 printf("\n");
35317 }
35318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035319 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035320#endif
35321
Daniel Veillard42595322004-11-08 10:52:06 +000035322 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035323}
35324
35325
35326static int
35327test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035328 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035329
William M. Brack21e4ef22005-01-02 09:53:13 +000035330#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035331 int mem_base;
35332 int ret_val;
35333 int code; /* UCS code point */
35334 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035335 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035336 int n_cat;
35337
35338 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35339 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35340 mem_base = xmlMemBlocks();
35341 code = gen_int(n_code, 0);
35342 cat = gen_const_char_ptr(n_cat, 1);
35343
William M. Brackf13f77f2004-11-12 16:03:48 +000035344 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035345 desret_int(ret_val);
35346 call_tests++;
35347 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035348 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035349 xmlResetLastError();
35350 if (mem_base != xmlMemBlocks()) {
35351 printf("Leak of %d blocks found in xmlUCSIsCat",
35352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035353 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035354 printf(" %d", n_code);
35355 printf(" %d", n_cat);
35356 printf("\n");
35357 }
35358 }
35359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035360 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035361#endif
35362
Daniel Veillard42595322004-11-08 10:52:06 +000035363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035364}
35365
35366
35367static int
35368test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035370
William M. Brack21e4ef22005-01-02 09:53:13 +000035371#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035372 int mem_base;
35373 int ret_val;
35374 int code; /* UCS code point */
35375 int n_code;
35376
35377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35378 mem_base = xmlMemBlocks();
35379 code = gen_int(n_code, 0);
35380
35381 ret_val = xmlUCSIsCatC(code);
35382 desret_int(ret_val);
35383 call_tests++;
35384 des_int(n_code, code, 0);
35385 xmlResetLastError();
35386 if (mem_base != xmlMemBlocks()) {
35387 printf("Leak of %d blocks found in xmlUCSIsCatC",
35388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035390 printf(" %d", n_code);
35391 printf("\n");
35392 }
35393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035395#endif
35396
Daniel Veillard42595322004-11-08 10:52:06 +000035397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035398}
35399
35400
35401static int
35402test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035404
William M. Brack21e4ef22005-01-02 09:53:13 +000035405#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035406 int mem_base;
35407 int ret_val;
35408 int code; /* UCS code point */
35409 int n_code;
35410
35411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35412 mem_base = xmlMemBlocks();
35413 code = gen_int(n_code, 0);
35414
35415 ret_val = xmlUCSIsCatCc(code);
35416 desret_int(ret_val);
35417 call_tests++;
35418 des_int(n_code, code, 0);
35419 xmlResetLastError();
35420 if (mem_base != xmlMemBlocks()) {
35421 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035424 printf(" %d", n_code);
35425 printf("\n");
35426 }
35427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035429#endif
35430
Daniel Veillard42595322004-11-08 10:52:06 +000035431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035432}
35433
35434
35435static int
35436test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035438
William M. Brack21e4ef22005-01-02 09:53:13 +000035439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035440 int mem_base;
35441 int ret_val;
35442 int code; /* UCS code point */
35443 int n_code;
35444
35445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35446 mem_base = xmlMemBlocks();
35447 code = gen_int(n_code, 0);
35448
35449 ret_val = xmlUCSIsCatCf(code);
35450 desret_int(ret_val);
35451 call_tests++;
35452 des_int(n_code, code, 0);
35453 xmlResetLastError();
35454 if (mem_base != xmlMemBlocks()) {
35455 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035458 printf(" %d", n_code);
35459 printf("\n");
35460 }
35461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035463#endif
35464
Daniel Veillard42595322004-11-08 10:52:06 +000035465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035466}
35467
35468
35469static int
35470test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035472
William M. Brack21e4ef22005-01-02 09:53:13 +000035473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035474 int mem_base;
35475 int ret_val;
35476 int code; /* UCS code point */
35477 int n_code;
35478
35479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35480 mem_base = xmlMemBlocks();
35481 code = gen_int(n_code, 0);
35482
35483 ret_val = xmlUCSIsCatCo(code);
35484 desret_int(ret_val);
35485 call_tests++;
35486 des_int(n_code, code, 0);
35487 xmlResetLastError();
35488 if (mem_base != xmlMemBlocks()) {
35489 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035492 printf(" %d", n_code);
35493 printf("\n");
35494 }
35495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035497#endif
35498
Daniel Veillard42595322004-11-08 10:52:06 +000035499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035500}
35501
35502
35503static int
35504test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035506
William M. Brack21e4ef22005-01-02 09:53:13 +000035507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035508 int mem_base;
35509 int ret_val;
35510 int code; /* UCS code point */
35511 int n_code;
35512
35513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35514 mem_base = xmlMemBlocks();
35515 code = gen_int(n_code, 0);
35516
35517 ret_val = xmlUCSIsCatCs(code);
35518 desret_int(ret_val);
35519 call_tests++;
35520 des_int(n_code, code, 0);
35521 xmlResetLastError();
35522 if (mem_base != xmlMemBlocks()) {
35523 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035526 printf(" %d", n_code);
35527 printf("\n");
35528 }
35529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035531#endif
35532
Daniel Veillard42595322004-11-08 10:52:06 +000035533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035534}
35535
35536
35537static int
35538test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035540
William M. Brack21e4ef22005-01-02 09:53:13 +000035541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035542 int mem_base;
35543 int ret_val;
35544 int code; /* UCS code point */
35545 int n_code;
35546
35547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35548 mem_base = xmlMemBlocks();
35549 code = gen_int(n_code, 0);
35550
35551 ret_val = xmlUCSIsCatL(code);
35552 desret_int(ret_val);
35553 call_tests++;
35554 des_int(n_code, code, 0);
35555 xmlResetLastError();
35556 if (mem_base != xmlMemBlocks()) {
35557 printf("Leak of %d blocks found in xmlUCSIsCatL",
35558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035560 printf(" %d", n_code);
35561 printf("\n");
35562 }
35563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035565#endif
35566
Daniel Veillard42595322004-11-08 10:52:06 +000035567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035568}
35569
35570
35571static int
35572test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035574
William M. Brack21e4ef22005-01-02 09:53:13 +000035575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035576 int mem_base;
35577 int ret_val;
35578 int code; /* UCS code point */
35579 int n_code;
35580
35581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35582 mem_base = xmlMemBlocks();
35583 code = gen_int(n_code, 0);
35584
35585 ret_val = xmlUCSIsCatLl(code);
35586 desret_int(ret_val);
35587 call_tests++;
35588 des_int(n_code, code, 0);
35589 xmlResetLastError();
35590 if (mem_base != xmlMemBlocks()) {
35591 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035594 printf(" %d", n_code);
35595 printf("\n");
35596 }
35597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035599#endif
35600
Daniel Veillard42595322004-11-08 10:52:06 +000035601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035602}
35603
35604
35605static int
35606test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035608
William M. Brack21e4ef22005-01-02 09:53:13 +000035609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035610 int mem_base;
35611 int ret_val;
35612 int code; /* UCS code point */
35613 int n_code;
35614
35615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35616 mem_base = xmlMemBlocks();
35617 code = gen_int(n_code, 0);
35618
35619 ret_val = xmlUCSIsCatLm(code);
35620 desret_int(ret_val);
35621 call_tests++;
35622 des_int(n_code, code, 0);
35623 xmlResetLastError();
35624 if (mem_base != xmlMemBlocks()) {
35625 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035628 printf(" %d", n_code);
35629 printf("\n");
35630 }
35631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035633#endif
35634
Daniel Veillard42595322004-11-08 10:52:06 +000035635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035636}
35637
35638
35639static int
35640test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035642
William M. Brack21e4ef22005-01-02 09:53:13 +000035643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035644 int mem_base;
35645 int ret_val;
35646 int code; /* UCS code point */
35647 int n_code;
35648
35649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35650 mem_base = xmlMemBlocks();
35651 code = gen_int(n_code, 0);
35652
35653 ret_val = xmlUCSIsCatLo(code);
35654 desret_int(ret_val);
35655 call_tests++;
35656 des_int(n_code, code, 0);
35657 xmlResetLastError();
35658 if (mem_base != xmlMemBlocks()) {
35659 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035662 printf(" %d", n_code);
35663 printf("\n");
35664 }
35665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035667#endif
35668
Daniel Veillard42595322004-11-08 10:52:06 +000035669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035670}
35671
35672
35673static int
35674test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035676
William M. Brack21e4ef22005-01-02 09:53:13 +000035677#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035678 int mem_base;
35679 int ret_val;
35680 int code; /* UCS code point */
35681 int n_code;
35682
35683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35684 mem_base = xmlMemBlocks();
35685 code = gen_int(n_code, 0);
35686
35687 ret_val = xmlUCSIsCatLt(code);
35688 desret_int(ret_val);
35689 call_tests++;
35690 des_int(n_code, code, 0);
35691 xmlResetLastError();
35692 if (mem_base != xmlMemBlocks()) {
35693 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035696 printf(" %d", n_code);
35697 printf("\n");
35698 }
35699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035701#endif
35702
Daniel Veillard42595322004-11-08 10:52:06 +000035703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035704}
35705
35706
35707static int
35708test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035710
William M. Brack21e4ef22005-01-02 09:53:13 +000035711#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035712 int mem_base;
35713 int ret_val;
35714 int code; /* UCS code point */
35715 int n_code;
35716
35717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35718 mem_base = xmlMemBlocks();
35719 code = gen_int(n_code, 0);
35720
35721 ret_val = xmlUCSIsCatLu(code);
35722 desret_int(ret_val);
35723 call_tests++;
35724 des_int(n_code, code, 0);
35725 xmlResetLastError();
35726 if (mem_base != xmlMemBlocks()) {
35727 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035730 printf(" %d", n_code);
35731 printf("\n");
35732 }
35733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035735#endif
35736
Daniel Veillard42595322004-11-08 10:52:06 +000035737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035738}
35739
35740
35741static int
35742test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035744
William M. Brack21e4ef22005-01-02 09:53:13 +000035745#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035746 int mem_base;
35747 int ret_val;
35748 int code; /* UCS code point */
35749 int n_code;
35750
35751 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35752 mem_base = xmlMemBlocks();
35753 code = gen_int(n_code, 0);
35754
35755 ret_val = xmlUCSIsCatM(code);
35756 desret_int(ret_val);
35757 call_tests++;
35758 des_int(n_code, code, 0);
35759 xmlResetLastError();
35760 if (mem_base != xmlMemBlocks()) {
35761 printf("Leak of %d blocks found in xmlUCSIsCatM",
35762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035763 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035764 printf(" %d", n_code);
35765 printf("\n");
35766 }
35767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035768 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035769#endif
35770
Daniel Veillard42595322004-11-08 10:52:06 +000035771 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035772}
35773
35774
35775static int
35776test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035777 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035778
William M. Brack21e4ef22005-01-02 09:53:13 +000035779#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035780 int mem_base;
35781 int ret_val;
35782 int code; /* UCS code point */
35783 int n_code;
35784
35785 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35786 mem_base = xmlMemBlocks();
35787 code = gen_int(n_code, 0);
35788
35789 ret_val = xmlUCSIsCatMc(code);
35790 desret_int(ret_val);
35791 call_tests++;
35792 des_int(n_code, code, 0);
35793 xmlResetLastError();
35794 if (mem_base != xmlMemBlocks()) {
35795 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035797 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035798 printf(" %d", n_code);
35799 printf("\n");
35800 }
35801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035802 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035803#endif
35804
Daniel Veillard42595322004-11-08 10:52:06 +000035805 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035806}
35807
35808
35809static int
35810test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035811 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035812
William M. Brack21e4ef22005-01-02 09:53:13 +000035813#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035814 int mem_base;
35815 int ret_val;
35816 int code; /* UCS code point */
35817 int n_code;
35818
35819 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35820 mem_base = xmlMemBlocks();
35821 code = gen_int(n_code, 0);
35822
35823 ret_val = xmlUCSIsCatMe(code);
35824 desret_int(ret_val);
35825 call_tests++;
35826 des_int(n_code, code, 0);
35827 xmlResetLastError();
35828 if (mem_base != xmlMemBlocks()) {
35829 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035831 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035832 printf(" %d", n_code);
35833 printf("\n");
35834 }
35835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035836 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035837#endif
35838
Daniel Veillard42595322004-11-08 10:52:06 +000035839 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035840}
35841
35842
35843static int
35844test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035845 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035846
William M. Brack21e4ef22005-01-02 09:53:13 +000035847#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035848 int mem_base;
35849 int ret_val;
35850 int code; /* UCS code point */
35851 int n_code;
35852
35853 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35854 mem_base = xmlMemBlocks();
35855 code = gen_int(n_code, 0);
35856
35857 ret_val = xmlUCSIsCatMn(code);
35858 desret_int(ret_val);
35859 call_tests++;
35860 des_int(n_code, code, 0);
35861 xmlResetLastError();
35862 if (mem_base != xmlMemBlocks()) {
35863 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035865 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035866 printf(" %d", n_code);
35867 printf("\n");
35868 }
35869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035870 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035871#endif
35872
Daniel Veillard42595322004-11-08 10:52:06 +000035873 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035874}
35875
35876
35877static int
35878test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035879 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035880
William M. Brack21e4ef22005-01-02 09:53:13 +000035881#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035882 int mem_base;
35883 int ret_val;
35884 int code; /* UCS code point */
35885 int n_code;
35886
35887 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35888 mem_base = xmlMemBlocks();
35889 code = gen_int(n_code, 0);
35890
35891 ret_val = xmlUCSIsCatN(code);
35892 desret_int(ret_val);
35893 call_tests++;
35894 des_int(n_code, code, 0);
35895 xmlResetLastError();
35896 if (mem_base != xmlMemBlocks()) {
35897 printf("Leak of %d blocks found in xmlUCSIsCatN",
35898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035900 printf(" %d", n_code);
35901 printf("\n");
35902 }
35903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035904 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035905#endif
35906
Daniel Veillard42595322004-11-08 10:52:06 +000035907 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035908}
35909
35910
35911static int
35912test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035913 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035914
William M. Brack21e4ef22005-01-02 09:53:13 +000035915#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035916 int mem_base;
35917 int ret_val;
35918 int code; /* UCS code point */
35919 int n_code;
35920
35921 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35922 mem_base = xmlMemBlocks();
35923 code = gen_int(n_code, 0);
35924
35925 ret_val = xmlUCSIsCatNd(code);
35926 desret_int(ret_val);
35927 call_tests++;
35928 des_int(n_code, code, 0);
35929 xmlResetLastError();
35930 if (mem_base != xmlMemBlocks()) {
35931 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035933 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035934 printf(" %d", n_code);
35935 printf("\n");
35936 }
35937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035938 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035939#endif
35940
Daniel Veillard42595322004-11-08 10:52:06 +000035941 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035942}
35943
35944
35945static int
35946test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035947 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035948
William M. Brack21e4ef22005-01-02 09:53:13 +000035949#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035950 int mem_base;
35951 int ret_val;
35952 int code; /* UCS code point */
35953 int n_code;
35954
35955 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35956 mem_base = xmlMemBlocks();
35957 code = gen_int(n_code, 0);
35958
35959 ret_val = xmlUCSIsCatNl(code);
35960 desret_int(ret_val);
35961 call_tests++;
35962 des_int(n_code, code, 0);
35963 xmlResetLastError();
35964 if (mem_base != xmlMemBlocks()) {
35965 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035967 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035968 printf(" %d", n_code);
35969 printf("\n");
35970 }
35971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035972 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035973#endif
35974
Daniel Veillard42595322004-11-08 10:52:06 +000035975 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035976}
35977
35978
35979static int
35980test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035981 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035982
William M. Brack21e4ef22005-01-02 09:53:13 +000035983#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035984 int mem_base;
35985 int ret_val;
35986 int code; /* UCS code point */
35987 int n_code;
35988
35989 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35990 mem_base = xmlMemBlocks();
35991 code = gen_int(n_code, 0);
35992
35993 ret_val = xmlUCSIsCatNo(code);
35994 desret_int(ret_val);
35995 call_tests++;
35996 des_int(n_code, code, 0);
35997 xmlResetLastError();
35998 if (mem_base != xmlMemBlocks()) {
35999 printf("Leak of %d blocks found in xmlUCSIsCatNo",
36000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036001 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036002 printf(" %d", n_code);
36003 printf("\n");
36004 }
36005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036006 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036007#endif
36008
Daniel Veillard42595322004-11-08 10:52:06 +000036009 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036010}
36011
36012
36013static int
36014test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036015 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036016
William M. Brack21e4ef22005-01-02 09:53:13 +000036017#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036018 int mem_base;
36019 int ret_val;
36020 int code; /* UCS code point */
36021 int n_code;
36022
36023 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36024 mem_base = xmlMemBlocks();
36025 code = gen_int(n_code, 0);
36026
36027 ret_val = xmlUCSIsCatP(code);
36028 desret_int(ret_val);
36029 call_tests++;
36030 des_int(n_code, code, 0);
36031 xmlResetLastError();
36032 if (mem_base != xmlMemBlocks()) {
36033 printf("Leak of %d blocks found in xmlUCSIsCatP",
36034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036035 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036036 printf(" %d", n_code);
36037 printf("\n");
36038 }
36039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036040 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036041#endif
36042
Daniel Veillard42595322004-11-08 10:52:06 +000036043 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036044}
36045
36046
36047static int
36048test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036049 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036050
William M. Brack21e4ef22005-01-02 09:53:13 +000036051#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036052 int mem_base;
36053 int ret_val;
36054 int code; /* UCS code point */
36055 int n_code;
36056
36057 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36058 mem_base = xmlMemBlocks();
36059 code = gen_int(n_code, 0);
36060
36061 ret_val = xmlUCSIsCatPc(code);
36062 desret_int(ret_val);
36063 call_tests++;
36064 des_int(n_code, code, 0);
36065 xmlResetLastError();
36066 if (mem_base != xmlMemBlocks()) {
36067 printf("Leak of %d blocks found in xmlUCSIsCatPc",
36068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036069 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036070 printf(" %d", n_code);
36071 printf("\n");
36072 }
36073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036074 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036075#endif
36076
Daniel Veillard42595322004-11-08 10:52:06 +000036077 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036078}
36079
36080
36081static int
36082test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036083 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036084
William M. Brack21e4ef22005-01-02 09:53:13 +000036085#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036086 int mem_base;
36087 int ret_val;
36088 int code; /* UCS code point */
36089 int n_code;
36090
36091 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36092 mem_base = xmlMemBlocks();
36093 code = gen_int(n_code, 0);
36094
36095 ret_val = xmlUCSIsCatPd(code);
36096 desret_int(ret_val);
36097 call_tests++;
36098 des_int(n_code, code, 0);
36099 xmlResetLastError();
36100 if (mem_base != xmlMemBlocks()) {
36101 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036103 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036104 printf(" %d", n_code);
36105 printf("\n");
36106 }
36107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036108 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036109#endif
36110
Daniel Veillard42595322004-11-08 10:52:06 +000036111 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036112}
36113
36114
36115static int
36116test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036117 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036118
William M. Brack21e4ef22005-01-02 09:53:13 +000036119#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036120 int mem_base;
36121 int ret_val;
36122 int code; /* UCS code point */
36123 int n_code;
36124
36125 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36126 mem_base = xmlMemBlocks();
36127 code = gen_int(n_code, 0);
36128
36129 ret_val = xmlUCSIsCatPe(code);
36130 desret_int(ret_val);
36131 call_tests++;
36132 des_int(n_code, code, 0);
36133 xmlResetLastError();
36134 if (mem_base != xmlMemBlocks()) {
36135 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036137 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036138 printf(" %d", n_code);
36139 printf("\n");
36140 }
36141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036142 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036143#endif
36144
Daniel Veillard42595322004-11-08 10:52:06 +000036145 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036146}
36147
36148
36149static int
36150test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036151 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036152
William M. Brack21e4ef22005-01-02 09:53:13 +000036153#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036154 int mem_base;
36155 int ret_val;
36156 int code; /* UCS code point */
36157 int n_code;
36158
36159 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36160 mem_base = xmlMemBlocks();
36161 code = gen_int(n_code, 0);
36162
36163 ret_val = xmlUCSIsCatPf(code);
36164 desret_int(ret_val);
36165 call_tests++;
36166 des_int(n_code, code, 0);
36167 xmlResetLastError();
36168 if (mem_base != xmlMemBlocks()) {
36169 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036171 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036172 printf(" %d", n_code);
36173 printf("\n");
36174 }
36175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036176 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036177#endif
36178
Daniel Veillard42595322004-11-08 10:52:06 +000036179 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036180}
36181
36182
36183static int
36184test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036185 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036186
William M. Brack21e4ef22005-01-02 09:53:13 +000036187#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036188 int mem_base;
36189 int ret_val;
36190 int code; /* UCS code point */
36191 int n_code;
36192
36193 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36194 mem_base = xmlMemBlocks();
36195 code = gen_int(n_code, 0);
36196
36197 ret_val = xmlUCSIsCatPi(code);
36198 desret_int(ret_val);
36199 call_tests++;
36200 des_int(n_code, code, 0);
36201 xmlResetLastError();
36202 if (mem_base != xmlMemBlocks()) {
36203 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036205 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036206 printf(" %d", n_code);
36207 printf("\n");
36208 }
36209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036210 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036211#endif
36212
Daniel Veillard42595322004-11-08 10:52:06 +000036213 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036214}
36215
36216
36217static int
36218test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036219 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036220
William M. Brack21e4ef22005-01-02 09:53:13 +000036221#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036222 int mem_base;
36223 int ret_val;
36224 int code; /* UCS code point */
36225 int n_code;
36226
36227 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36228 mem_base = xmlMemBlocks();
36229 code = gen_int(n_code, 0);
36230
36231 ret_val = xmlUCSIsCatPo(code);
36232 desret_int(ret_val);
36233 call_tests++;
36234 des_int(n_code, code, 0);
36235 xmlResetLastError();
36236 if (mem_base != xmlMemBlocks()) {
36237 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036239 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036240 printf(" %d", n_code);
36241 printf("\n");
36242 }
36243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036244 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036245#endif
36246
Daniel Veillard42595322004-11-08 10:52:06 +000036247 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036248}
36249
36250
36251static int
36252test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036253 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036254
William M. Brack21e4ef22005-01-02 09:53:13 +000036255#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036256 int mem_base;
36257 int ret_val;
36258 int code; /* UCS code point */
36259 int n_code;
36260
36261 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36262 mem_base = xmlMemBlocks();
36263 code = gen_int(n_code, 0);
36264
36265 ret_val = xmlUCSIsCatPs(code);
36266 desret_int(ret_val);
36267 call_tests++;
36268 des_int(n_code, code, 0);
36269 xmlResetLastError();
36270 if (mem_base != xmlMemBlocks()) {
36271 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036273 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036274 printf(" %d", n_code);
36275 printf("\n");
36276 }
36277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036278 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036279#endif
36280
Daniel Veillard42595322004-11-08 10:52:06 +000036281 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036282}
36283
36284
36285static int
36286test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036287 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036288
William M. Brack21e4ef22005-01-02 09:53:13 +000036289#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036290 int mem_base;
36291 int ret_val;
36292 int code; /* UCS code point */
36293 int n_code;
36294
36295 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36296 mem_base = xmlMemBlocks();
36297 code = gen_int(n_code, 0);
36298
36299 ret_val = xmlUCSIsCatS(code);
36300 desret_int(ret_val);
36301 call_tests++;
36302 des_int(n_code, code, 0);
36303 xmlResetLastError();
36304 if (mem_base != xmlMemBlocks()) {
36305 printf("Leak of %d blocks found in xmlUCSIsCatS",
36306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036307 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036308 printf(" %d", n_code);
36309 printf("\n");
36310 }
36311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036312 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036313#endif
36314
Daniel Veillard42595322004-11-08 10:52:06 +000036315 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036316}
36317
36318
36319static int
36320test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036321 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036322
William M. Brack21e4ef22005-01-02 09:53:13 +000036323#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036324 int mem_base;
36325 int ret_val;
36326 int code; /* UCS code point */
36327 int n_code;
36328
36329 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36330 mem_base = xmlMemBlocks();
36331 code = gen_int(n_code, 0);
36332
36333 ret_val = xmlUCSIsCatSc(code);
36334 desret_int(ret_val);
36335 call_tests++;
36336 des_int(n_code, code, 0);
36337 xmlResetLastError();
36338 if (mem_base != xmlMemBlocks()) {
36339 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036341 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036342 printf(" %d", n_code);
36343 printf("\n");
36344 }
36345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036346 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036347#endif
36348
Daniel Veillard42595322004-11-08 10:52:06 +000036349 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036350}
36351
36352
36353static int
36354test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036355 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036356
William M. Brack21e4ef22005-01-02 09:53:13 +000036357#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036358 int mem_base;
36359 int ret_val;
36360 int code; /* UCS code point */
36361 int n_code;
36362
36363 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36364 mem_base = xmlMemBlocks();
36365 code = gen_int(n_code, 0);
36366
36367 ret_val = xmlUCSIsCatSk(code);
36368 desret_int(ret_val);
36369 call_tests++;
36370 des_int(n_code, code, 0);
36371 xmlResetLastError();
36372 if (mem_base != xmlMemBlocks()) {
36373 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036375 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036376 printf(" %d", n_code);
36377 printf("\n");
36378 }
36379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036380 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036381#endif
36382
Daniel Veillard42595322004-11-08 10:52:06 +000036383 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036384}
36385
36386
36387static int
36388test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036389 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036390
William M. Brack21e4ef22005-01-02 09:53:13 +000036391#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036392 int mem_base;
36393 int ret_val;
36394 int code; /* UCS code point */
36395 int n_code;
36396
36397 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36398 mem_base = xmlMemBlocks();
36399 code = gen_int(n_code, 0);
36400
36401 ret_val = xmlUCSIsCatSm(code);
36402 desret_int(ret_val);
36403 call_tests++;
36404 des_int(n_code, code, 0);
36405 xmlResetLastError();
36406 if (mem_base != xmlMemBlocks()) {
36407 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036409 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036410 printf(" %d", n_code);
36411 printf("\n");
36412 }
36413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036414 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036415#endif
36416
Daniel Veillard42595322004-11-08 10:52:06 +000036417 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036418}
36419
36420
36421static int
36422test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036423 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036424
William M. Brack21e4ef22005-01-02 09:53:13 +000036425#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036426 int mem_base;
36427 int ret_val;
36428 int code; /* UCS code point */
36429 int n_code;
36430
36431 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36432 mem_base = xmlMemBlocks();
36433 code = gen_int(n_code, 0);
36434
36435 ret_val = xmlUCSIsCatSo(code);
36436 desret_int(ret_val);
36437 call_tests++;
36438 des_int(n_code, code, 0);
36439 xmlResetLastError();
36440 if (mem_base != xmlMemBlocks()) {
36441 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036443 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036444 printf(" %d", n_code);
36445 printf("\n");
36446 }
36447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036448 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036449#endif
36450
Daniel Veillard42595322004-11-08 10:52:06 +000036451 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036452}
36453
36454
36455static int
36456test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036457 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036458
William M. Brack21e4ef22005-01-02 09:53:13 +000036459#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036460 int mem_base;
36461 int ret_val;
36462 int code; /* UCS code point */
36463 int n_code;
36464
36465 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36466 mem_base = xmlMemBlocks();
36467 code = gen_int(n_code, 0);
36468
36469 ret_val = xmlUCSIsCatZ(code);
36470 desret_int(ret_val);
36471 call_tests++;
36472 des_int(n_code, code, 0);
36473 xmlResetLastError();
36474 if (mem_base != xmlMemBlocks()) {
36475 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036477 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036478 printf(" %d", n_code);
36479 printf("\n");
36480 }
36481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036482 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036483#endif
36484
Daniel Veillard42595322004-11-08 10:52:06 +000036485 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036486}
36487
36488
36489static int
36490test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036491 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036492
William M. Brack21e4ef22005-01-02 09:53:13 +000036493#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036494 int mem_base;
36495 int ret_val;
36496 int code; /* UCS code point */
36497 int n_code;
36498
36499 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36500 mem_base = xmlMemBlocks();
36501 code = gen_int(n_code, 0);
36502
36503 ret_val = xmlUCSIsCatZl(code);
36504 desret_int(ret_val);
36505 call_tests++;
36506 des_int(n_code, code, 0);
36507 xmlResetLastError();
36508 if (mem_base != xmlMemBlocks()) {
36509 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036511 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036512 printf(" %d", n_code);
36513 printf("\n");
36514 }
36515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036516 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036517#endif
36518
Daniel Veillard42595322004-11-08 10:52:06 +000036519 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036520}
36521
36522
36523static int
36524test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036525 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036526
William M. Brack21e4ef22005-01-02 09:53:13 +000036527#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036528 int mem_base;
36529 int ret_val;
36530 int code; /* UCS code point */
36531 int n_code;
36532
36533 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36534 mem_base = xmlMemBlocks();
36535 code = gen_int(n_code, 0);
36536
36537 ret_val = xmlUCSIsCatZp(code);
36538 desret_int(ret_val);
36539 call_tests++;
36540 des_int(n_code, code, 0);
36541 xmlResetLastError();
36542 if (mem_base != xmlMemBlocks()) {
36543 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036545 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036546 printf(" %d", n_code);
36547 printf("\n");
36548 }
36549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036550 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036551#endif
36552
Daniel Veillard42595322004-11-08 10:52:06 +000036553 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036554}
36555
36556
36557static int
36558test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036559 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036560
William M. Brack21e4ef22005-01-02 09:53:13 +000036561#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036562 int mem_base;
36563 int ret_val;
36564 int code; /* UCS code point */
36565 int n_code;
36566
36567 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36568 mem_base = xmlMemBlocks();
36569 code = gen_int(n_code, 0);
36570
36571 ret_val = xmlUCSIsCatZs(code);
36572 desret_int(ret_val);
36573 call_tests++;
36574 des_int(n_code, code, 0);
36575 xmlResetLastError();
36576 if (mem_base != xmlMemBlocks()) {
36577 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036579 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036580 printf(" %d", n_code);
36581 printf("\n");
36582 }
36583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036584 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036585#endif
36586
Daniel Veillard42595322004-11-08 10:52:06 +000036587 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036588}
36589
36590
36591static int
36592test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036593 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036594
William M. Brack21e4ef22005-01-02 09:53:13 +000036595#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036596 int mem_base;
36597 int ret_val;
36598 int code; /* UCS code point */
36599 int n_code;
36600
36601 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36602 mem_base = xmlMemBlocks();
36603 code = gen_int(n_code, 0);
36604
36605 ret_val = xmlUCSIsCherokee(code);
36606 desret_int(ret_val);
36607 call_tests++;
36608 des_int(n_code, code, 0);
36609 xmlResetLastError();
36610 if (mem_base != xmlMemBlocks()) {
36611 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036613 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036614 printf(" %d", n_code);
36615 printf("\n");
36616 }
36617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036618 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036619#endif
36620
Daniel Veillard42595322004-11-08 10:52:06 +000036621 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036622}
36623
36624
36625static int
36626test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036627 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036628
William M. Brack21e4ef22005-01-02 09:53:13 +000036629#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036630 int mem_base;
36631 int ret_val;
36632 int code; /* UCS code point */
36633 int n_code;
36634
36635 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36636 mem_base = xmlMemBlocks();
36637 code = gen_int(n_code, 0);
36638
36639 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36640 desret_int(ret_val);
36641 call_tests++;
36642 des_int(n_code, code, 0);
36643 xmlResetLastError();
36644 if (mem_base != xmlMemBlocks()) {
36645 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036647 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036648 printf(" %d", n_code);
36649 printf("\n");
36650 }
36651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036652 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036653#endif
36654
Daniel Veillard42595322004-11-08 10:52:06 +000036655 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036656}
36657
36658
36659static int
36660test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036661 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036662
William M. Brack21e4ef22005-01-02 09:53:13 +000036663#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036664 int mem_base;
36665 int ret_val;
36666 int code; /* UCS code point */
36667 int n_code;
36668
36669 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36670 mem_base = xmlMemBlocks();
36671 code = gen_int(n_code, 0);
36672
36673 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36674 desret_int(ret_val);
36675 call_tests++;
36676 des_int(n_code, code, 0);
36677 xmlResetLastError();
36678 if (mem_base != xmlMemBlocks()) {
36679 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036681 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036682 printf(" %d", n_code);
36683 printf("\n");
36684 }
36685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036686 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036687#endif
36688
Daniel Veillard42595322004-11-08 10:52:06 +000036689 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036690}
36691
36692
36693static int
36694test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036695 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036696
William M. Brack21e4ef22005-01-02 09:53:13 +000036697#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036698 int mem_base;
36699 int ret_val;
36700 int code; /* UCS code point */
36701 int n_code;
36702
36703 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36704 mem_base = xmlMemBlocks();
36705 code = gen_int(n_code, 0);
36706
36707 ret_val = xmlUCSIsCombiningHalfMarks(code);
36708 desret_int(ret_val);
36709 call_tests++;
36710 des_int(n_code, code, 0);
36711 xmlResetLastError();
36712 if (mem_base != xmlMemBlocks()) {
36713 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036715 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036716 printf(" %d", n_code);
36717 printf("\n");
36718 }
36719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036720 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036721#endif
36722
Daniel Veillard42595322004-11-08 10:52:06 +000036723 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036724}
36725
36726
36727static int
36728test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036729 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036730
William M. Brack21e4ef22005-01-02 09:53:13 +000036731#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036732 int mem_base;
36733 int ret_val;
36734 int code; /* UCS code point */
36735 int n_code;
36736
36737 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36738 mem_base = xmlMemBlocks();
36739 code = gen_int(n_code, 0);
36740
36741 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36742 desret_int(ret_val);
36743 call_tests++;
36744 des_int(n_code, code, 0);
36745 xmlResetLastError();
36746 if (mem_base != xmlMemBlocks()) {
36747 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036749 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036750 printf(" %d", n_code);
36751 printf("\n");
36752 }
36753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036754 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036755#endif
36756
Daniel Veillard42595322004-11-08 10:52:06 +000036757 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036758}
36759
36760
36761static int
36762test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036763 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036764
William M. Brack21e4ef22005-01-02 09:53:13 +000036765#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036766 int mem_base;
36767 int ret_val;
36768 int code; /* UCS code point */
36769 int n_code;
36770
36771 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36772 mem_base = xmlMemBlocks();
36773 code = gen_int(n_code, 0);
36774
36775 ret_val = xmlUCSIsControlPictures(code);
36776 desret_int(ret_val);
36777 call_tests++;
36778 des_int(n_code, code, 0);
36779 xmlResetLastError();
36780 if (mem_base != xmlMemBlocks()) {
36781 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036783 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036784 printf(" %d", n_code);
36785 printf("\n");
36786 }
36787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036788 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036789#endif
36790
Daniel Veillard42595322004-11-08 10:52:06 +000036791 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036792}
36793
36794
36795static int
36796test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036797 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036798
William M. Brack21e4ef22005-01-02 09:53:13 +000036799#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036800 int mem_base;
36801 int ret_val;
36802 int code; /* UCS code point */
36803 int n_code;
36804
36805 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36806 mem_base = xmlMemBlocks();
36807 code = gen_int(n_code, 0);
36808
36809 ret_val = xmlUCSIsCurrencySymbols(code);
36810 desret_int(ret_val);
36811 call_tests++;
36812 des_int(n_code, code, 0);
36813 xmlResetLastError();
36814 if (mem_base != xmlMemBlocks()) {
36815 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036817 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036818 printf(" %d", n_code);
36819 printf("\n");
36820 }
36821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036822 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036823#endif
36824
Daniel Veillard42595322004-11-08 10:52:06 +000036825 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036826}
36827
36828
36829static int
36830test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036831 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036832
William M. Brack21e4ef22005-01-02 09:53:13 +000036833#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036834 int mem_base;
36835 int ret_val;
36836 int code; /* UCS code point */
36837 int n_code;
36838
36839 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36840 mem_base = xmlMemBlocks();
36841 code = gen_int(n_code, 0);
36842
36843 ret_val = xmlUCSIsCypriotSyllabary(code);
36844 desret_int(ret_val);
36845 call_tests++;
36846 des_int(n_code, code, 0);
36847 xmlResetLastError();
36848 if (mem_base != xmlMemBlocks()) {
36849 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036851 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036852 printf(" %d", n_code);
36853 printf("\n");
36854 }
36855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036856 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036857#endif
36858
Daniel Veillard42595322004-11-08 10:52:06 +000036859 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036860}
36861
36862
36863static int
36864test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036865 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036866
William M. Brack21e4ef22005-01-02 09:53:13 +000036867#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036868 int mem_base;
36869 int ret_val;
36870 int code; /* UCS code point */
36871 int n_code;
36872
36873 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36874 mem_base = xmlMemBlocks();
36875 code = gen_int(n_code, 0);
36876
36877 ret_val = xmlUCSIsCyrillic(code);
36878 desret_int(ret_val);
36879 call_tests++;
36880 des_int(n_code, code, 0);
36881 xmlResetLastError();
36882 if (mem_base != xmlMemBlocks()) {
36883 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036885 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036886 printf(" %d", n_code);
36887 printf("\n");
36888 }
36889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036890 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036891#endif
36892
Daniel Veillard42595322004-11-08 10:52:06 +000036893 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036894}
36895
36896
36897static int
36898test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036899 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036900
William M. Brack21e4ef22005-01-02 09:53:13 +000036901#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036902 int mem_base;
36903 int ret_val;
36904 int code; /* UCS code point */
36905 int n_code;
36906
36907 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36908 mem_base = xmlMemBlocks();
36909 code = gen_int(n_code, 0);
36910
36911 ret_val = xmlUCSIsCyrillicSupplement(code);
36912 desret_int(ret_val);
36913 call_tests++;
36914 des_int(n_code, code, 0);
36915 xmlResetLastError();
36916 if (mem_base != xmlMemBlocks()) {
36917 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036919 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036920 printf(" %d", n_code);
36921 printf("\n");
36922 }
36923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036924 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036925#endif
36926
Daniel Veillard42595322004-11-08 10:52:06 +000036927 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036928}
36929
36930
36931static int
36932test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036933 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036934
William M. Brack21e4ef22005-01-02 09:53:13 +000036935#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036936 int mem_base;
36937 int ret_val;
36938 int code; /* UCS code point */
36939 int n_code;
36940
36941 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36942 mem_base = xmlMemBlocks();
36943 code = gen_int(n_code, 0);
36944
36945 ret_val = xmlUCSIsDeseret(code);
36946 desret_int(ret_val);
36947 call_tests++;
36948 des_int(n_code, code, 0);
36949 xmlResetLastError();
36950 if (mem_base != xmlMemBlocks()) {
36951 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036953 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036954 printf(" %d", n_code);
36955 printf("\n");
36956 }
36957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036958 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036959#endif
36960
Daniel Veillard42595322004-11-08 10:52:06 +000036961 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036962}
36963
36964
36965static int
36966test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036967 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036968
William M. Brack21e4ef22005-01-02 09:53:13 +000036969#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036970 int mem_base;
36971 int ret_val;
36972 int code; /* UCS code point */
36973 int n_code;
36974
36975 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36976 mem_base = xmlMemBlocks();
36977 code = gen_int(n_code, 0);
36978
36979 ret_val = xmlUCSIsDevanagari(code);
36980 desret_int(ret_val);
36981 call_tests++;
36982 des_int(n_code, code, 0);
36983 xmlResetLastError();
36984 if (mem_base != xmlMemBlocks()) {
36985 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036987 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036988 printf(" %d", n_code);
36989 printf("\n");
36990 }
36991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036992 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036993#endif
36994
Daniel Veillard42595322004-11-08 10:52:06 +000036995 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036996}
36997
36998
36999static int
37000test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037001 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037002
William M. Brack21e4ef22005-01-02 09:53:13 +000037003#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037004 int mem_base;
37005 int ret_val;
37006 int code; /* UCS code point */
37007 int n_code;
37008
37009 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37010 mem_base = xmlMemBlocks();
37011 code = gen_int(n_code, 0);
37012
37013 ret_val = xmlUCSIsDingbats(code);
37014 desret_int(ret_val);
37015 call_tests++;
37016 des_int(n_code, code, 0);
37017 xmlResetLastError();
37018 if (mem_base != xmlMemBlocks()) {
37019 printf("Leak of %d blocks found in xmlUCSIsDingbats",
37020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037021 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037022 printf(" %d", n_code);
37023 printf("\n");
37024 }
37025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037026 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037027#endif
37028
Daniel Veillard42595322004-11-08 10:52:06 +000037029 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037030}
37031
37032
37033static int
37034test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037035 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037036
William M. Brack21e4ef22005-01-02 09:53:13 +000037037#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037038 int mem_base;
37039 int ret_val;
37040 int code; /* UCS code point */
37041 int n_code;
37042
37043 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37044 mem_base = xmlMemBlocks();
37045 code = gen_int(n_code, 0);
37046
37047 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
37048 desret_int(ret_val);
37049 call_tests++;
37050 des_int(n_code, code, 0);
37051 xmlResetLastError();
37052 if (mem_base != xmlMemBlocks()) {
37053 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
37054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037055 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037056 printf(" %d", n_code);
37057 printf("\n");
37058 }
37059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037060 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037061#endif
37062
Daniel Veillard42595322004-11-08 10:52:06 +000037063 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037064}
37065
37066
37067static int
37068test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037069 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037070
William M. Brack21e4ef22005-01-02 09:53:13 +000037071#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037072 int mem_base;
37073 int ret_val;
37074 int code; /* UCS code point */
37075 int n_code;
37076
37077 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37078 mem_base = xmlMemBlocks();
37079 code = gen_int(n_code, 0);
37080
37081 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
37082 desret_int(ret_val);
37083 call_tests++;
37084 des_int(n_code, code, 0);
37085 xmlResetLastError();
37086 if (mem_base != xmlMemBlocks()) {
37087 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
37088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037089 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037090 printf(" %d", n_code);
37091 printf("\n");
37092 }
37093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037094 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037095#endif
37096
Daniel Veillard42595322004-11-08 10:52:06 +000037097 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037098}
37099
37100
37101static int
37102test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037103 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037104
William M. Brack21e4ef22005-01-02 09:53:13 +000037105#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037106 int mem_base;
37107 int ret_val;
37108 int code; /* UCS code point */
37109 int n_code;
37110
37111 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37112 mem_base = xmlMemBlocks();
37113 code = gen_int(n_code, 0);
37114
37115 ret_val = xmlUCSIsEthiopic(code);
37116 desret_int(ret_val);
37117 call_tests++;
37118 des_int(n_code, code, 0);
37119 xmlResetLastError();
37120 if (mem_base != xmlMemBlocks()) {
37121 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037123 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037124 printf(" %d", n_code);
37125 printf("\n");
37126 }
37127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037128 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037129#endif
37130
Daniel Veillard42595322004-11-08 10:52:06 +000037131 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037132}
37133
37134
37135static int
37136test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037137 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037138
William M. Brack21e4ef22005-01-02 09:53:13 +000037139#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037140 int mem_base;
37141 int ret_val;
37142 int code; /* UCS code point */
37143 int n_code;
37144
37145 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37146 mem_base = xmlMemBlocks();
37147 code = gen_int(n_code, 0);
37148
37149 ret_val = xmlUCSIsGeneralPunctuation(code);
37150 desret_int(ret_val);
37151 call_tests++;
37152 des_int(n_code, code, 0);
37153 xmlResetLastError();
37154 if (mem_base != xmlMemBlocks()) {
37155 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037157 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037158 printf(" %d", n_code);
37159 printf("\n");
37160 }
37161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037162 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037163#endif
37164
Daniel Veillard42595322004-11-08 10:52:06 +000037165 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037166}
37167
37168
37169static int
37170test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037171 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037172
William M. Brack21e4ef22005-01-02 09:53:13 +000037173#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037174 int mem_base;
37175 int ret_val;
37176 int code; /* UCS code point */
37177 int n_code;
37178
37179 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37180 mem_base = xmlMemBlocks();
37181 code = gen_int(n_code, 0);
37182
37183 ret_val = xmlUCSIsGeometricShapes(code);
37184 desret_int(ret_val);
37185 call_tests++;
37186 des_int(n_code, code, 0);
37187 xmlResetLastError();
37188 if (mem_base != xmlMemBlocks()) {
37189 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037191 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037192 printf(" %d", n_code);
37193 printf("\n");
37194 }
37195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037196 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037197#endif
37198
Daniel Veillard42595322004-11-08 10:52:06 +000037199 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037200}
37201
37202
37203static int
37204test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037205 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037206
William M. Brack21e4ef22005-01-02 09:53:13 +000037207#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037208 int mem_base;
37209 int ret_val;
37210 int code; /* UCS code point */
37211 int n_code;
37212
37213 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37214 mem_base = xmlMemBlocks();
37215 code = gen_int(n_code, 0);
37216
37217 ret_val = xmlUCSIsGeorgian(code);
37218 desret_int(ret_val);
37219 call_tests++;
37220 des_int(n_code, code, 0);
37221 xmlResetLastError();
37222 if (mem_base != xmlMemBlocks()) {
37223 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037225 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037226 printf(" %d", n_code);
37227 printf("\n");
37228 }
37229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037230 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037231#endif
37232
Daniel Veillard42595322004-11-08 10:52:06 +000037233 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037234}
37235
37236
37237static int
37238test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037239 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037240
William M. Brack21e4ef22005-01-02 09:53:13 +000037241#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037242 int mem_base;
37243 int ret_val;
37244 int code; /* UCS code point */
37245 int n_code;
37246
37247 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37248 mem_base = xmlMemBlocks();
37249 code = gen_int(n_code, 0);
37250
37251 ret_val = xmlUCSIsGothic(code);
37252 desret_int(ret_val);
37253 call_tests++;
37254 des_int(n_code, code, 0);
37255 xmlResetLastError();
37256 if (mem_base != xmlMemBlocks()) {
37257 printf("Leak of %d blocks found in xmlUCSIsGothic",
37258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037259 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037260 printf(" %d", n_code);
37261 printf("\n");
37262 }
37263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037264 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037265#endif
37266
Daniel Veillard42595322004-11-08 10:52:06 +000037267 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037268}
37269
37270
37271static int
37272test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037273 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037274
William M. Brack21e4ef22005-01-02 09:53:13 +000037275#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037276 int mem_base;
37277 int ret_val;
37278 int code; /* UCS code point */
37279 int n_code;
37280
37281 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37282 mem_base = xmlMemBlocks();
37283 code = gen_int(n_code, 0);
37284
37285 ret_val = xmlUCSIsGreek(code);
37286 desret_int(ret_val);
37287 call_tests++;
37288 des_int(n_code, code, 0);
37289 xmlResetLastError();
37290 if (mem_base != xmlMemBlocks()) {
37291 printf("Leak of %d blocks found in xmlUCSIsGreek",
37292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037293 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037294 printf(" %d", n_code);
37295 printf("\n");
37296 }
37297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037298 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037299#endif
37300
Daniel Veillard42595322004-11-08 10:52:06 +000037301 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037302}
37303
37304
37305static int
37306test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037307 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037308
William M. Brack21e4ef22005-01-02 09:53:13 +000037309#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037310 int mem_base;
37311 int ret_val;
37312 int code; /* UCS code point */
37313 int n_code;
37314
37315 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37316 mem_base = xmlMemBlocks();
37317 code = gen_int(n_code, 0);
37318
37319 ret_val = xmlUCSIsGreekExtended(code);
37320 desret_int(ret_val);
37321 call_tests++;
37322 des_int(n_code, code, 0);
37323 xmlResetLastError();
37324 if (mem_base != xmlMemBlocks()) {
37325 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037327 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037328 printf(" %d", n_code);
37329 printf("\n");
37330 }
37331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037332 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037333#endif
37334
Daniel Veillard42595322004-11-08 10:52:06 +000037335 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037336}
37337
37338
37339static int
37340test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037341 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037342
William M. Brack21e4ef22005-01-02 09:53:13 +000037343#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037344 int mem_base;
37345 int ret_val;
37346 int code; /* UCS code point */
37347 int n_code;
37348
37349 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37350 mem_base = xmlMemBlocks();
37351 code = gen_int(n_code, 0);
37352
37353 ret_val = xmlUCSIsGreekandCoptic(code);
37354 desret_int(ret_val);
37355 call_tests++;
37356 des_int(n_code, code, 0);
37357 xmlResetLastError();
37358 if (mem_base != xmlMemBlocks()) {
37359 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037361 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037362 printf(" %d", n_code);
37363 printf("\n");
37364 }
37365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037366 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037367#endif
37368
Daniel Veillard42595322004-11-08 10:52:06 +000037369 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037370}
37371
37372
37373static int
37374test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037375 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037376
William M. Brack21e4ef22005-01-02 09:53:13 +000037377#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037378 int mem_base;
37379 int ret_val;
37380 int code; /* UCS code point */
37381 int n_code;
37382
37383 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37384 mem_base = xmlMemBlocks();
37385 code = gen_int(n_code, 0);
37386
37387 ret_val = xmlUCSIsGujarati(code);
37388 desret_int(ret_val);
37389 call_tests++;
37390 des_int(n_code, code, 0);
37391 xmlResetLastError();
37392 if (mem_base != xmlMemBlocks()) {
37393 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037395 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037396 printf(" %d", n_code);
37397 printf("\n");
37398 }
37399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037400 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037401#endif
37402
Daniel Veillard42595322004-11-08 10:52:06 +000037403 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037404}
37405
37406
37407static int
37408test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037409 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037410
William M. Brack21e4ef22005-01-02 09:53:13 +000037411#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037412 int mem_base;
37413 int ret_val;
37414 int code; /* UCS code point */
37415 int n_code;
37416
37417 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37418 mem_base = xmlMemBlocks();
37419 code = gen_int(n_code, 0);
37420
37421 ret_val = xmlUCSIsGurmukhi(code);
37422 desret_int(ret_val);
37423 call_tests++;
37424 des_int(n_code, code, 0);
37425 xmlResetLastError();
37426 if (mem_base != xmlMemBlocks()) {
37427 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037429 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037430 printf(" %d", n_code);
37431 printf("\n");
37432 }
37433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037434 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037435#endif
37436
Daniel Veillard42595322004-11-08 10:52:06 +000037437 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037438}
37439
37440
37441static int
37442test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037443 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037444
William M. Brack21e4ef22005-01-02 09:53:13 +000037445#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037446 int mem_base;
37447 int ret_val;
37448 int code; /* UCS code point */
37449 int n_code;
37450
37451 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37452 mem_base = xmlMemBlocks();
37453 code = gen_int(n_code, 0);
37454
37455 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37456 desret_int(ret_val);
37457 call_tests++;
37458 des_int(n_code, code, 0);
37459 xmlResetLastError();
37460 if (mem_base != xmlMemBlocks()) {
37461 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037463 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037464 printf(" %d", n_code);
37465 printf("\n");
37466 }
37467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037468 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037469#endif
37470
Daniel Veillard42595322004-11-08 10:52:06 +000037471 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037472}
37473
37474
37475static int
37476test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037477 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037478
William M. Brack21e4ef22005-01-02 09:53:13 +000037479#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037480 int mem_base;
37481 int ret_val;
37482 int code; /* UCS code point */
37483 int n_code;
37484
37485 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37486 mem_base = xmlMemBlocks();
37487 code = gen_int(n_code, 0);
37488
37489 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37490 desret_int(ret_val);
37491 call_tests++;
37492 des_int(n_code, code, 0);
37493 xmlResetLastError();
37494 if (mem_base != xmlMemBlocks()) {
37495 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037497 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037498 printf(" %d", n_code);
37499 printf("\n");
37500 }
37501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037502 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037503#endif
37504
Daniel Veillard42595322004-11-08 10:52:06 +000037505 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037506}
37507
37508
37509static int
37510test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037511 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037512
William M. Brack21e4ef22005-01-02 09:53:13 +000037513#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037514 int mem_base;
37515 int ret_val;
37516 int code; /* UCS code point */
37517 int n_code;
37518
37519 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37520 mem_base = xmlMemBlocks();
37521 code = gen_int(n_code, 0);
37522
37523 ret_val = xmlUCSIsHangulJamo(code);
37524 desret_int(ret_val);
37525 call_tests++;
37526 des_int(n_code, code, 0);
37527 xmlResetLastError();
37528 if (mem_base != xmlMemBlocks()) {
37529 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037531 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037532 printf(" %d", n_code);
37533 printf("\n");
37534 }
37535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037536 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037537#endif
37538
Daniel Veillard42595322004-11-08 10:52:06 +000037539 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037540}
37541
37542
37543static int
37544test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037545 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037546
William M. Brack21e4ef22005-01-02 09:53:13 +000037547#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037548 int mem_base;
37549 int ret_val;
37550 int code; /* UCS code point */
37551 int n_code;
37552
37553 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37554 mem_base = xmlMemBlocks();
37555 code = gen_int(n_code, 0);
37556
37557 ret_val = xmlUCSIsHangulSyllables(code);
37558 desret_int(ret_val);
37559 call_tests++;
37560 des_int(n_code, code, 0);
37561 xmlResetLastError();
37562 if (mem_base != xmlMemBlocks()) {
37563 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037565 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037566 printf(" %d", n_code);
37567 printf("\n");
37568 }
37569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037570 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037571#endif
37572
Daniel Veillard42595322004-11-08 10:52:06 +000037573 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037574}
37575
37576
37577static int
37578test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037579 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037580
William M. Brack21e4ef22005-01-02 09:53:13 +000037581#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037582 int mem_base;
37583 int ret_val;
37584 int code; /* UCS code point */
37585 int n_code;
37586
37587 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37588 mem_base = xmlMemBlocks();
37589 code = gen_int(n_code, 0);
37590
37591 ret_val = xmlUCSIsHanunoo(code);
37592 desret_int(ret_val);
37593 call_tests++;
37594 des_int(n_code, code, 0);
37595 xmlResetLastError();
37596 if (mem_base != xmlMemBlocks()) {
37597 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037599 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037600 printf(" %d", n_code);
37601 printf("\n");
37602 }
37603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037604 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037605#endif
37606
Daniel Veillard42595322004-11-08 10:52:06 +000037607 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037608}
37609
37610
37611static int
37612test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037613 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037614
William M. Brack21e4ef22005-01-02 09:53:13 +000037615#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037616 int mem_base;
37617 int ret_val;
37618 int code; /* UCS code point */
37619 int n_code;
37620
37621 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37622 mem_base = xmlMemBlocks();
37623 code = gen_int(n_code, 0);
37624
37625 ret_val = xmlUCSIsHebrew(code);
37626 desret_int(ret_val);
37627 call_tests++;
37628 des_int(n_code, code, 0);
37629 xmlResetLastError();
37630 if (mem_base != xmlMemBlocks()) {
37631 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037633 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037634 printf(" %d", n_code);
37635 printf("\n");
37636 }
37637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037638 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037639#endif
37640
Daniel Veillard42595322004-11-08 10:52:06 +000037641 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037642}
37643
37644
37645static int
37646test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037647 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037648
William M. Brack21e4ef22005-01-02 09:53:13 +000037649#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037650 int mem_base;
37651 int ret_val;
37652 int code; /* UCS code point */
37653 int n_code;
37654
37655 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37656 mem_base = xmlMemBlocks();
37657 code = gen_int(n_code, 0);
37658
37659 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37660 desret_int(ret_val);
37661 call_tests++;
37662 des_int(n_code, code, 0);
37663 xmlResetLastError();
37664 if (mem_base != xmlMemBlocks()) {
37665 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037667 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037668 printf(" %d", n_code);
37669 printf("\n");
37670 }
37671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037672 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037673#endif
37674
Daniel Veillard42595322004-11-08 10:52:06 +000037675 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037676}
37677
37678
37679static int
37680test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037681 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037682
William M. Brack21e4ef22005-01-02 09:53:13 +000037683#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037684 int mem_base;
37685 int ret_val;
37686 int code; /* UCS code point */
37687 int n_code;
37688
37689 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37690 mem_base = xmlMemBlocks();
37691 code = gen_int(n_code, 0);
37692
37693 ret_val = xmlUCSIsHighSurrogates(code);
37694 desret_int(ret_val);
37695 call_tests++;
37696 des_int(n_code, code, 0);
37697 xmlResetLastError();
37698 if (mem_base != xmlMemBlocks()) {
37699 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037701 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037702 printf(" %d", n_code);
37703 printf("\n");
37704 }
37705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037706 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037707#endif
37708
Daniel Veillard42595322004-11-08 10:52:06 +000037709 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037710}
37711
37712
37713static int
37714test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037715 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037716
William M. Brack21e4ef22005-01-02 09:53:13 +000037717#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037718 int mem_base;
37719 int ret_val;
37720 int code; /* UCS code point */
37721 int n_code;
37722
37723 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37724 mem_base = xmlMemBlocks();
37725 code = gen_int(n_code, 0);
37726
37727 ret_val = xmlUCSIsHiragana(code);
37728 desret_int(ret_val);
37729 call_tests++;
37730 des_int(n_code, code, 0);
37731 xmlResetLastError();
37732 if (mem_base != xmlMemBlocks()) {
37733 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037735 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037736 printf(" %d", n_code);
37737 printf("\n");
37738 }
37739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037740 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037741#endif
37742
Daniel Veillard42595322004-11-08 10:52:06 +000037743 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037744}
37745
37746
37747static int
37748test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037749 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037750
William M. Brack21e4ef22005-01-02 09:53:13 +000037751#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037752 int mem_base;
37753 int ret_val;
37754 int code; /* UCS code point */
37755 int n_code;
37756
37757 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37758 mem_base = xmlMemBlocks();
37759 code = gen_int(n_code, 0);
37760
37761 ret_val = xmlUCSIsIPAExtensions(code);
37762 desret_int(ret_val);
37763 call_tests++;
37764 des_int(n_code, code, 0);
37765 xmlResetLastError();
37766 if (mem_base != xmlMemBlocks()) {
37767 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037769 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037770 printf(" %d", n_code);
37771 printf("\n");
37772 }
37773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037774 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037775#endif
37776
Daniel Veillard42595322004-11-08 10:52:06 +000037777 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037778}
37779
37780
37781static int
37782test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037783 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037784
William M. Brack21e4ef22005-01-02 09:53:13 +000037785#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037786 int mem_base;
37787 int ret_val;
37788 int code; /* UCS code point */
37789 int n_code;
37790
37791 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37792 mem_base = xmlMemBlocks();
37793 code = gen_int(n_code, 0);
37794
37795 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37796 desret_int(ret_val);
37797 call_tests++;
37798 des_int(n_code, code, 0);
37799 xmlResetLastError();
37800 if (mem_base != xmlMemBlocks()) {
37801 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037803 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037804 printf(" %d", n_code);
37805 printf("\n");
37806 }
37807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037808 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037809#endif
37810
Daniel Veillard42595322004-11-08 10:52:06 +000037811 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037812}
37813
37814
37815static int
37816test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037817 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037818
William M. Brack21e4ef22005-01-02 09:53:13 +000037819#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037820 int mem_base;
37821 int ret_val;
37822 int code; /* UCS code point */
37823 int n_code;
37824
37825 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37826 mem_base = xmlMemBlocks();
37827 code = gen_int(n_code, 0);
37828
37829 ret_val = xmlUCSIsKanbun(code);
37830 desret_int(ret_val);
37831 call_tests++;
37832 des_int(n_code, code, 0);
37833 xmlResetLastError();
37834 if (mem_base != xmlMemBlocks()) {
37835 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037837 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037838 printf(" %d", n_code);
37839 printf("\n");
37840 }
37841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037842 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037843#endif
37844
Daniel Veillard42595322004-11-08 10:52:06 +000037845 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037846}
37847
37848
37849static int
37850test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037851 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037852
William M. Brack21e4ef22005-01-02 09:53:13 +000037853#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037854 int mem_base;
37855 int ret_val;
37856 int code; /* UCS code point */
37857 int n_code;
37858
37859 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37860 mem_base = xmlMemBlocks();
37861 code = gen_int(n_code, 0);
37862
37863 ret_val = xmlUCSIsKangxiRadicals(code);
37864 desret_int(ret_val);
37865 call_tests++;
37866 des_int(n_code, code, 0);
37867 xmlResetLastError();
37868 if (mem_base != xmlMemBlocks()) {
37869 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037871 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037872 printf(" %d", n_code);
37873 printf("\n");
37874 }
37875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037876 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037877#endif
37878
Daniel Veillard42595322004-11-08 10:52:06 +000037879 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037880}
37881
37882
37883static int
37884test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037885 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037886
William M. Brack21e4ef22005-01-02 09:53:13 +000037887#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037888 int mem_base;
37889 int ret_val;
37890 int code; /* UCS code point */
37891 int n_code;
37892
37893 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37894 mem_base = xmlMemBlocks();
37895 code = gen_int(n_code, 0);
37896
37897 ret_val = xmlUCSIsKannada(code);
37898 desret_int(ret_val);
37899 call_tests++;
37900 des_int(n_code, code, 0);
37901 xmlResetLastError();
37902 if (mem_base != xmlMemBlocks()) {
37903 printf("Leak of %d blocks found in xmlUCSIsKannada",
37904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037905 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037906 printf(" %d", n_code);
37907 printf("\n");
37908 }
37909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037910 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037911#endif
37912
Daniel Veillard42595322004-11-08 10:52:06 +000037913 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037914}
37915
37916
37917static int
37918test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037919 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037920
William M. Brack21e4ef22005-01-02 09:53:13 +000037921#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037922 int mem_base;
37923 int ret_val;
37924 int code; /* UCS code point */
37925 int n_code;
37926
37927 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37928 mem_base = xmlMemBlocks();
37929 code = gen_int(n_code, 0);
37930
37931 ret_val = xmlUCSIsKatakana(code);
37932 desret_int(ret_val);
37933 call_tests++;
37934 des_int(n_code, code, 0);
37935 xmlResetLastError();
37936 if (mem_base != xmlMemBlocks()) {
37937 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037939 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037940 printf(" %d", n_code);
37941 printf("\n");
37942 }
37943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037944 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037945#endif
37946
Daniel Veillard42595322004-11-08 10:52:06 +000037947 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037948}
37949
37950
37951static int
37952test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037953 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037954
William M. Brack21e4ef22005-01-02 09:53:13 +000037955#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037956 int mem_base;
37957 int ret_val;
37958 int code; /* UCS code point */
37959 int n_code;
37960
37961 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37962 mem_base = xmlMemBlocks();
37963 code = gen_int(n_code, 0);
37964
37965 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37966 desret_int(ret_val);
37967 call_tests++;
37968 des_int(n_code, code, 0);
37969 xmlResetLastError();
37970 if (mem_base != xmlMemBlocks()) {
37971 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037973 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037974 printf(" %d", n_code);
37975 printf("\n");
37976 }
37977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037978 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037979#endif
37980
Daniel Veillard42595322004-11-08 10:52:06 +000037981 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037982}
37983
37984
37985static int
37986test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037987 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037988
William M. Brack21e4ef22005-01-02 09:53:13 +000037989#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037990 int mem_base;
37991 int ret_val;
37992 int code; /* UCS code point */
37993 int n_code;
37994
37995 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37996 mem_base = xmlMemBlocks();
37997 code = gen_int(n_code, 0);
37998
37999 ret_val = xmlUCSIsKhmer(code);
38000 desret_int(ret_val);
38001 call_tests++;
38002 des_int(n_code, code, 0);
38003 xmlResetLastError();
38004 if (mem_base != xmlMemBlocks()) {
38005 printf("Leak of %d blocks found in xmlUCSIsKhmer",
38006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038007 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038008 printf(" %d", n_code);
38009 printf("\n");
38010 }
38011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038012 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038013#endif
38014
Daniel Veillard42595322004-11-08 10:52:06 +000038015 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038016}
38017
38018
38019static int
38020test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038021 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038022
William M. Brack21e4ef22005-01-02 09:53:13 +000038023#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038024 int mem_base;
38025 int ret_val;
38026 int code; /* UCS code point */
38027 int n_code;
38028
38029 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38030 mem_base = xmlMemBlocks();
38031 code = gen_int(n_code, 0);
38032
38033 ret_val = xmlUCSIsKhmerSymbols(code);
38034 desret_int(ret_val);
38035 call_tests++;
38036 des_int(n_code, code, 0);
38037 xmlResetLastError();
38038 if (mem_base != xmlMemBlocks()) {
38039 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
38040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038041 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038042 printf(" %d", n_code);
38043 printf("\n");
38044 }
38045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038046 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038047#endif
38048
Daniel Veillard42595322004-11-08 10:52:06 +000038049 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038050}
38051
38052
38053static int
38054test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038055 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038056
William M. Brack21e4ef22005-01-02 09:53:13 +000038057#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038058 int mem_base;
38059 int ret_val;
38060 int code; /* UCS code point */
38061 int n_code;
38062
38063 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38064 mem_base = xmlMemBlocks();
38065 code = gen_int(n_code, 0);
38066
38067 ret_val = xmlUCSIsLao(code);
38068 desret_int(ret_val);
38069 call_tests++;
38070 des_int(n_code, code, 0);
38071 xmlResetLastError();
38072 if (mem_base != xmlMemBlocks()) {
38073 printf("Leak of %d blocks found in xmlUCSIsLao",
38074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038075 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038076 printf(" %d", n_code);
38077 printf("\n");
38078 }
38079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038080 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038081#endif
38082
Daniel Veillard42595322004-11-08 10:52:06 +000038083 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038084}
38085
38086
38087static int
38088test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038089 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038090
William M. Brack21e4ef22005-01-02 09:53:13 +000038091#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038092 int mem_base;
38093 int ret_val;
38094 int code; /* UCS code point */
38095 int n_code;
38096
38097 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38098 mem_base = xmlMemBlocks();
38099 code = gen_int(n_code, 0);
38100
38101 ret_val = xmlUCSIsLatin1Supplement(code);
38102 desret_int(ret_val);
38103 call_tests++;
38104 des_int(n_code, code, 0);
38105 xmlResetLastError();
38106 if (mem_base != xmlMemBlocks()) {
38107 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038109 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038110 printf(" %d", n_code);
38111 printf("\n");
38112 }
38113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038114 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038115#endif
38116
Daniel Veillard42595322004-11-08 10:52:06 +000038117 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038118}
38119
38120
38121static int
38122test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038123 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038124
William M. Brack21e4ef22005-01-02 09:53:13 +000038125#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038126 int mem_base;
38127 int ret_val;
38128 int code; /* UCS code point */
38129 int n_code;
38130
38131 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38132 mem_base = xmlMemBlocks();
38133 code = gen_int(n_code, 0);
38134
38135 ret_val = xmlUCSIsLatinExtendedA(code);
38136 desret_int(ret_val);
38137 call_tests++;
38138 des_int(n_code, code, 0);
38139 xmlResetLastError();
38140 if (mem_base != xmlMemBlocks()) {
38141 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038143 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038144 printf(" %d", n_code);
38145 printf("\n");
38146 }
38147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038148 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038149#endif
38150
Daniel Veillard42595322004-11-08 10:52:06 +000038151 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038152}
38153
38154
38155static int
38156test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038157 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038158
William M. Brack21e4ef22005-01-02 09:53:13 +000038159#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038160 int mem_base;
38161 int ret_val;
38162 int code; /* UCS code point */
38163 int n_code;
38164
38165 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38166 mem_base = xmlMemBlocks();
38167 code = gen_int(n_code, 0);
38168
38169 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38170 desret_int(ret_val);
38171 call_tests++;
38172 des_int(n_code, code, 0);
38173 xmlResetLastError();
38174 if (mem_base != xmlMemBlocks()) {
38175 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038177 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038178 printf(" %d", n_code);
38179 printf("\n");
38180 }
38181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038182 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038183#endif
38184
Daniel Veillard42595322004-11-08 10:52:06 +000038185 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038186}
38187
38188
38189static int
38190test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038191 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038192
William M. Brack21e4ef22005-01-02 09:53:13 +000038193#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038194 int mem_base;
38195 int ret_val;
38196 int code; /* UCS code point */
38197 int n_code;
38198
38199 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38200 mem_base = xmlMemBlocks();
38201 code = gen_int(n_code, 0);
38202
38203 ret_val = xmlUCSIsLatinExtendedB(code);
38204 desret_int(ret_val);
38205 call_tests++;
38206 des_int(n_code, code, 0);
38207 xmlResetLastError();
38208 if (mem_base != xmlMemBlocks()) {
38209 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038211 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038212 printf(" %d", n_code);
38213 printf("\n");
38214 }
38215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038216 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038217#endif
38218
Daniel Veillard42595322004-11-08 10:52:06 +000038219 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038220}
38221
38222
38223static int
38224test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038225 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038226
William M. Brack21e4ef22005-01-02 09:53:13 +000038227#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038228 int mem_base;
38229 int ret_val;
38230 int code; /* UCS code point */
38231 int n_code;
38232
38233 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38234 mem_base = xmlMemBlocks();
38235 code = gen_int(n_code, 0);
38236
38237 ret_val = xmlUCSIsLetterlikeSymbols(code);
38238 desret_int(ret_val);
38239 call_tests++;
38240 des_int(n_code, code, 0);
38241 xmlResetLastError();
38242 if (mem_base != xmlMemBlocks()) {
38243 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038245 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038246 printf(" %d", n_code);
38247 printf("\n");
38248 }
38249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038250 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038251#endif
38252
Daniel Veillard42595322004-11-08 10:52:06 +000038253 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038254}
38255
38256
38257static int
38258test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038259 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038260
William M. Brack21e4ef22005-01-02 09:53:13 +000038261#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038262 int mem_base;
38263 int ret_val;
38264 int code; /* UCS code point */
38265 int n_code;
38266
38267 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38268 mem_base = xmlMemBlocks();
38269 code = gen_int(n_code, 0);
38270
38271 ret_val = xmlUCSIsLimbu(code);
38272 desret_int(ret_val);
38273 call_tests++;
38274 des_int(n_code, code, 0);
38275 xmlResetLastError();
38276 if (mem_base != xmlMemBlocks()) {
38277 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038279 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038280 printf(" %d", n_code);
38281 printf("\n");
38282 }
38283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038284 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038285#endif
38286
Daniel Veillard42595322004-11-08 10:52:06 +000038287 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038288}
38289
38290
38291static int
38292test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038293 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038294
William M. Brack21e4ef22005-01-02 09:53:13 +000038295#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038296 int mem_base;
38297 int ret_val;
38298 int code; /* UCS code point */
38299 int n_code;
38300
38301 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38302 mem_base = xmlMemBlocks();
38303 code = gen_int(n_code, 0);
38304
38305 ret_val = xmlUCSIsLinearBIdeograms(code);
38306 desret_int(ret_val);
38307 call_tests++;
38308 des_int(n_code, code, 0);
38309 xmlResetLastError();
38310 if (mem_base != xmlMemBlocks()) {
38311 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038313 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038314 printf(" %d", n_code);
38315 printf("\n");
38316 }
38317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038318 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038319#endif
38320
Daniel Veillard42595322004-11-08 10:52:06 +000038321 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038322}
38323
38324
38325static int
38326test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038327 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038328
William M. Brack21e4ef22005-01-02 09:53:13 +000038329#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038330 int mem_base;
38331 int ret_val;
38332 int code; /* UCS code point */
38333 int n_code;
38334
38335 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38336 mem_base = xmlMemBlocks();
38337 code = gen_int(n_code, 0);
38338
38339 ret_val = xmlUCSIsLinearBSyllabary(code);
38340 desret_int(ret_val);
38341 call_tests++;
38342 des_int(n_code, code, 0);
38343 xmlResetLastError();
38344 if (mem_base != xmlMemBlocks()) {
38345 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038347 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038348 printf(" %d", n_code);
38349 printf("\n");
38350 }
38351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038352 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038353#endif
38354
Daniel Veillard42595322004-11-08 10:52:06 +000038355 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038356}
38357
38358
38359static int
38360test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038361 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038362
William M. Brack21e4ef22005-01-02 09:53:13 +000038363#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038364 int mem_base;
38365 int ret_val;
38366 int code; /* UCS code point */
38367 int n_code;
38368
38369 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38370 mem_base = xmlMemBlocks();
38371 code = gen_int(n_code, 0);
38372
38373 ret_val = xmlUCSIsLowSurrogates(code);
38374 desret_int(ret_val);
38375 call_tests++;
38376 des_int(n_code, code, 0);
38377 xmlResetLastError();
38378 if (mem_base != xmlMemBlocks()) {
38379 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038381 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038382 printf(" %d", n_code);
38383 printf("\n");
38384 }
38385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038386 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038387#endif
38388
Daniel Veillard42595322004-11-08 10:52:06 +000038389 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038390}
38391
38392
38393static int
38394test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038395 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038396
William M. Brack21e4ef22005-01-02 09:53:13 +000038397#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038398 int mem_base;
38399 int ret_val;
38400 int code; /* UCS code point */
38401 int n_code;
38402
38403 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38404 mem_base = xmlMemBlocks();
38405 code = gen_int(n_code, 0);
38406
38407 ret_val = xmlUCSIsMalayalam(code);
38408 desret_int(ret_val);
38409 call_tests++;
38410 des_int(n_code, code, 0);
38411 xmlResetLastError();
38412 if (mem_base != xmlMemBlocks()) {
38413 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038415 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038416 printf(" %d", n_code);
38417 printf("\n");
38418 }
38419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038420 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038421#endif
38422
Daniel Veillard42595322004-11-08 10:52:06 +000038423 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038424}
38425
38426
38427static int
38428test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038429 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038430
William M. Brack21e4ef22005-01-02 09:53:13 +000038431#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038432 int mem_base;
38433 int ret_val;
38434 int code; /* UCS code point */
38435 int n_code;
38436
38437 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38438 mem_base = xmlMemBlocks();
38439 code = gen_int(n_code, 0);
38440
38441 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38442 desret_int(ret_val);
38443 call_tests++;
38444 des_int(n_code, code, 0);
38445 xmlResetLastError();
38446 if (mem_base != xmlMemBlocks()) {
38447 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038449 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038450 printf(" %d", n_code);
38451 printf("\n");
38452 }
38453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038454 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038455#endif
38456
Daniel Veillard42595322004-11-08 10:52:06 +000038457 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038458}
38459
38460
38461static int
38462test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038463 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038464
William M. Brack21e4ef22005-01-02 09:53:13 +000038465#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038466 int mem_base;
38467 int ret_val;
38468 int code; /* UCS code point */
38469 int n_code;
38470
38471 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38472 mem_base = xmlMemBlocks();
38473 code = gen_int(n_code, 0);
38474
38475 ret_val = xmlUCSIsMathematicalOperators(code);
38476 desret_int(ret_val);
38477 call_tests++;
38478 des_int(n_code, code, 0);
38479 xmlResetLastError();
38480 if (mem_base != xmlMemBlocks()) {
38481 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038483 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038484 printf(" %d", n_code);
38485 printf("\n");
38486 }
38487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038488 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038489#endif
38490
Daniel Veillard42595322004-11-08 10:52:06 +000038491 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038492}
38493
38494
38495static int
38496test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038497 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038498
William M. Brack21e4ef22005-01-02 09:53:13 +000038499#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038500 int mem_base;
38501 int ret_val;
38502 int code; /* UCS code point */
38503 int n_code;
38504
38505 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38506 mem_base = xmlMemBlocks();
38507 code = gen_int(n_code, 0);
38508
38509 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38510 desret_int(ret_val);
38511 call_tests++;
38512 des_int(n_code, code, 0);
38513 xmlResetLastError();
38514 if (mem_base != xmlMemBlocks()) {
38515 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038517 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038518 printf(" %d", n_code);
38519 printf("\n");
38520 }
38521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038522 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038523#endif
38524
Daniel Veillard42595322004-11-08 10:52:06 +000038525 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038526}
38527
38528
38529static int
38530test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038531 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038532
William M. Brack21e4ef22005-01-02 09:53:13 +000038533#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038534 int mem_base;
38535 int ret_val;
38536 int code; /* UCS code point */
38537 int n_code;
38538
38539 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38540 mem_base = xmlMemBlocks();
38541 code = gen_int(n_code, 0);
38542
38543 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38544 desret_int(ret_val);
38545 call_tests++;
38546 des_int(n_code, code, 0);
38547 xmlResetLastError();
38548 if (mem_base != xmlMemBlocks()) {
38549 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038551 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038552 printf(" %d", n_code);
38553 printf("\n");
38554 }
38555 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038556 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038557#endif
38558
Daniel Veillard42595322004-11-08 10:52:06 +000038559 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038560}
38561
38562
38563static int
38564test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038565 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038566
William M. Brack21e4ef22005-01-02 09:53:13 +000038567#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038568 int mem_base;
38569 int ret_val;
38570 int code; /* UCS code point */
38571 int n_code;
38572
38573 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38574 mem_base = xmlMemBlocks();
38575 code = gen_int(n_code, 0);
38576
38577 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38578 desret_int(ret_val);
38579 call_tests++;
38580 des_int(n_code, code, 0);
38581 xmlResetLastError();
38582 if (mem_base != xmlMemBlocks()) {
38583 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038585 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038586 printf(" %d", n_code);
38587 printf("\n");
38588 }
38589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038590 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038591#endif
38592
Daniel Veillard42595322004-11-08 10:52:06 +000038593 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038594}
38595
38596
38597static int
38598test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038599 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038600
William M. Brack21e4ef22005-01-02 09:53:13 +000038601#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038602 int mem_base;
38603 int ret_val;
38604 int code; /* UCS code point */
38605 int n_code;
38606
38607 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38608 mem_base = xmlMemBlocks();
38609 code = gen_int(n_code, 0);
38610
38611 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38612 desret_int(ret_val);
38613 call_tests++;
38614 des_int(n_code, code, 0);
38615 xmlResetLastError();
38616 if (mem_base != xmlMemBlocks()) {
38617 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038619 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038620 printf(" %d", n_code);
38621 printf("\n");
38622 }
38623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038624 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038625#endif
38626
Daniel Veillard42595322004-11-08 10:52:06 +000038627 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038628}
38629
38630
38631static int
38632test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038633 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038634
William M. Brack21e4ef22005-01-02 09:53:13 +000038635#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038636 int mem_base;
38637 int ret_val;
38638 int code; /* UCS code point */
38639 int n_code;
38640
38641 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38642 mem_base = xmlMemBlocks();
38643 code = gen_int(n_code, 0);
38644
38645 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38646 desret_int(ret_val);
38647 call_tests++;
38648 des_int(n_code, code, 0);
38649 xmlResetLastError();
38650 if (mem_base != xmlMemBlocks()) {
38651 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038653 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038654 printf(" %d", n_code);
38655 printf("\n");
38656 }
38657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038658 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038659#endif
38660
Daniel Veillard42595322004-11-08 10:52:06 +000038661 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038662}
38663
38664
38665static int
38666test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038667 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038668
William M. Brack21e4ef22005-01-02 09:53:13 +000038669#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038670 int mem_base;
38671 int ret_val;
38672 int code; /* UCS code point */
38673 int n_code;
38674
38675 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38676 mem_base = xmlMemBlocks();
38677 code = gen_int(n_code, 0);
38678
38679 ret_val = xmlUCSIsMongolian(code);
38680 desret_int(ret_val);
38681 call_tests++;
38682 des_int(n_code, code, 0);
38683 xmlResetLastError();
38684 if (mem_base != xmlMemBlocks()) {
38685 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038687 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038688 printf(" %d", n_code);
38689 printf("\n");
38690 }
38691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038692 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038693#endif
38694
Daniel Veillard42595322004-11-08 10:52:06 +000038695 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038696}
38697
38698
38699static int
38700test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038701 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038702
William M. Brack21e4ef22005-01-02 09:53:13 +000038703#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038704 int mem_base;
38705 int ret_val;
38706 int code; /* UCS code point */
38707 int n_code;
38708
38709 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38710 mem_base = xmlMemBlocks();
38711 code = gen_int(n_code, 0);
38712
38713 ret_val = xmlUCSIsMusicalSymbols(code);
38714 desret_int(ret_val);
38715 call_tests++;
38716 des_int(n_code, code, 0);
38717 xmlResetLastError();
38718 if (mem_base != xmlMemBlocks()) {
38719 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038721 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038722 printf(" %d", n_code);
38723 printf("\n");
38724 }
38725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038726 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038727#endif
38728
Daniel Veillard42595322004-11-08 10:52:06 +000038729 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038730}
38731
38732
38733static int
38734test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038735 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038736
William M. Brack21e4ef22005-01-02 09:53:13 +000038737#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038738 int mem_base;
38739 int ret_val;
38740 int code; /* UCS code point */
38741 int n_code;
38742
38743 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38744 mem_base = xmlMemBlocks();
38745 code = gen_int(n_code, 0);
38746
38747 ret_val = xmlUCSIsMyanmar(code);
38748 desret_int(ret_val);
38749 call_tests++;
38750 des_int(n_code, code, 0);
38751 xmlResetLastError();
38752 if (mem_base != xmlMemBlocks()) {
38753 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038755 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038756 printf(" %d", n_code);
38757 printf("\n");
38758 }
38759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038760 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038761#endif
38762
Daniel Veillard42595322004-11-08 10:52:06 +000038763 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038764}
38765
38766
38767static int
38768test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038769 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038770
William M. Brack21e4ef22005-01-02 09:53:13 +000038771#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038772 int mem_base;
38773 int ret_val;
38774 int code; /* UCS code point */
38775 int n_code;
38776
38777 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38778 mem_base = xmlMemBlocks();
38779 code = gen_int(n_code, 0);
38780
38781 ret_val = xmlUCSIsNumberForms(code);
38782 desret_int(ret_val);
38783 call_tests++;
38784 des_int(n_code, code, 0);
38785 xmlResetLastError();
38786 if (mem_base != xmlMemBlocks()) {
38787 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038789 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038790 printf(" %d", n_code);
38791 printf("\n");
38792 }
38793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038794 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038795#endif
38796
Daniel Veillard42595322004-11-08 10:52:06 +000038797 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038798}
38799
38800
38801static int
38802test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038803 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038804
William M. Brack21e4ef22005-01-02 09:53:13 +000038805#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038806 int mem_base;
38807 int ret_val;
38808 int code; /* UCS code point */
38809 int n_code;
38810
38811 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38812 mem_base = xmlMemBlocks();
38813 code = gen_int(n_code, 0);
38814
38815 ret_val = xmlUCSIsOgham(code);
38816 desret_int(ret_val);
38817 call_tests++;
38818 des_int(n_code, code, 0);
38819 xmlResetLastError();
38820 if (mem_base != xmlMemBlocks()) {
38821 printf("Leak of %d blocks found in xmlUCSIsOgham",
38822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038823 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038824 printf(" %d", n_code);
38825 printf("\n");
38826 }
38827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038828 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038829#endif
38830
Daniel Veillard42595322004-11-08 10:52:06 +000038831 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038832}
38833
38834
38835static int
38836test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038837 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038838
William M. Brack21e4ef22005-01-02 09:53:13 +000038839#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038840 int mem_base;
38841 int ret_val;
38842 int code; /* UCS code point */
38843 int n_code;
38844
38845 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38846 mem_base = xmlMemBlocks();
38847 code = gen_int(n_code, 0);
38848
38849 ret_val = xmlUCSIsOldItalic(code);
38850 desret_int(ret_val);
38851 call_tests++;
38852 des_int(n_code, code, 0);
38853 xmlResetLastError();
38854 if (mem_base != xmlMemBlocks()) {
38855 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038857 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038858 printf(" %d", n_code);
38859 printf("\n");
38860 }
38861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038862 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038863#endif
38864
Daniel Veillard42595322004-11-08 10:52:06 +000038865 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038866}
38867
38868
38869static int
38870test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038871 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038872
William M. Brack21e4ef22005-01-02 09:53:13 +000038873#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038874 int mem_base;
38875 int ret_val;
38876 int code; /* UCS code point */
38877 int n_code;
38878
38879 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38880 mem_base = xmlMemBlocks();
38881 code = gen_int(n_code, 0);
38882
38883 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38884 desret_int(ret_val);
38885 call_tests++;
38886 des_int(n_code, code, 0);
38887 xmlResetLastError();
38888 if (mem_base != xmlMemBlocks()) {
38889 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038891 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038892 printf(" %d", n_code);
38893 printf("\n");
38894 }
38895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038896 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038897#endif
38898
Daniel Veillard42595322004-11-08 10:52:06 +000038899 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038900}
38901
38902
38903static int
38904test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038905 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038906
William M. Brack21e4ef22005-01-02 09:53:13 +000038907#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038908 int mem_base;
38909 int ret_val;
38910 int code; /* UCS code point */
38911 int n_code;
38912
38913 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38914 mem_base = xmlMemBlocks();
38915 code = gen_int(n_code, 0);
38916
38917 ret_val = xmlUCSIsOriya(code);
38918 desret_int(ret_val);
38919 call_tests++;
38920 des_int(n_code, code, 0);
38921 xmlResetLastError();
38922 if (mem_base != xmlMemBlocks()) {
38923 printf("Leak of %d blocks found in xmlUCSIsOriya",
38924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038925 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038926 printf(" %d", n_code);
38927 printf("\n");
38928 }
38929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038930 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038931#endif
38932
Daniel Veillard42595322004-11-08 10:52:06 +000038933 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038934}
38935
38936
38937static int
38938test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038939 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038940
William M. Brack21e4ef22005-01-02 09:53:13 +000038941#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038942 int mem_base;
38943 int ret_val;
38944 int code; /* UCS code point */
38945 int n_code;
38946
38947 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38948 mem_base = xmlMemBlocks();
38949 code = gen_int(n_code, 0);
38950
38951 ret_val = xmlUCSIsOsmanya(code);
38952 desret_int(ret_val);
38953 call_tests++;
38954 des_int(n_code, code, 0);
38955 xmlResetLastError();
38956 if (mem_base != xmlMemBlocks()) {
38957 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038959 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038960 printf(" %d", n_code);
38961 printf("\n");
38962 }
38963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038964 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038965#endif
38966
Daniel Veillard42595322004-11-08 10:52:06 +000038967 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038968}
38969
38970
38971static int
38972test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038973 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038974
William M. Brack21e4ef22005-01-02 09:53:13 +000038975#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038976 int mem_base;
38977 int ret_val;
38978 int code; /* UCS code point */
38979 int n_code;
38980
38981 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38982 mem_base = xmlMemBlocks();
38983 code = gen_int(n_code, 0);
38984
38985 ret_val = xmlUCSIsPhoneticExtensions(code);
38986 desret_int(ret_val);
38987 call_tests++;
38988 des_int(n_code, code, 0);
38989 xmlResetLastError();
38990 if (mem_base != xmlMemBlocks()) {
38991 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038993 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038994 printf(" %d", n_code);
38995 printf("\n");
38996 }
38997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038998 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038999#endif
39000
Daniel Veillard42595322004-11-08 10:52:06 +000039001 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039002}
39003
39004
39005static int
39006test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039007 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039008
William M. Brack21e4ef22005-01-02 09:53:13 +000039009#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039010 int mem_base;
39011 int ret_val;
39012 int code; /* UCS code point */
39013 int n_code;
39014
39015 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39016 mem_base = xmlMemBlocks();
39017 code = gen_int(n_code, 0);
39018
39019 ret_val = xmlUCSIsPrivateUse(code);
39020 desret_int(ret_val);
39021 call_tests++;
39022 des_int(n_code, code, 0);
39023 xmlResetLastError();
39024 if (mem_base != xmlMemBlocks()) {
39025 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
39026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039027 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039028 printf(" %d", n_code);
39029 printf("\n");
39030 }
39031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039032 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039033#endif
39034
Daniel Veillard42595322004-11-08 10:52:06 +000039035 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039036}
39037
39038
39039static int
39040test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039041 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039042
William M. Brack21e4ef22005-01-02 09:53:13 +000039043#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039044 int mem_base;
39045 int ret_val;
39046 int code; /* UCS code point */
39047 int n_code;
39048
39049 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39050 mem_base = xmlMemBlocks();
39051 code = gen_int(n_code, 0);
39052
39053 ret_val = xmlUCSIsPrivateUseArea(code);
39054 desret_int(ret_val);
39055 call_tests++;
39056 des_int(n_code, code, 0);
39057 xmlResetLastError();
39058 if (mem_base != xmlMemBlocks()) {
39059 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
39060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039061 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039062 printf(" %d", n_code);
39063 printf("\n");
39064 }
39065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039066 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039067#endif
39068
Daniel Veillard42595322004-11-08 10:52:06 +000039069 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039070}
39071
39072
39073static int
39074test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039075 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039076
William M. Brack21e4ef22005-01-02 09:53:13 +000039077#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039078 int mem_base;
39079 int ret_val;
39080 int code; /* UCS code point */
39081 int n_code;
39082
39083 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39084 mem_base = xmlMemBlocks();
39085 code = gen_int(n_code, 0);
39086
39087 ret_val = xmlUCSIsRunic(code);
39088 desret_int(ret_val);
39089 call_tests++;
39090 des_int(n_code, code, 0);
39091 xmlResetLastError();
39092 if (mem_base != xmlMemBlocks()) {
39093 printf("Leak of %d blocks found in xmlUCSIsRunic",
39094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039095 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039096 printf(" %d", n_code);
39097 printf("\n");
39098 }
39099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039100 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039101#endif
39102
Daniel Veillard42595322004-11-08 10:52:06 +000039103 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039104}
39105
39106
39107static int
39108test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039109 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039110
William M. Brack21e4ef22005-01-02 09:53:13 +000039111#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039112 int mem_base;
39113 int ret_val;
39114 int code; /* UCS code point */
39115 int n_code;
39116
39117 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39118 mem_base = xmlMemBlocks();
39119 code = gen_int(n_code, 0);
39120
39121 ret_val = xmlUCSIsShavian(code);
39122 desret_int(ret_val);
39123 call_tests++;
39124 des_int(n_code, code, 0);
39125 xmlResetLastError();
39126 if (mem_base != xmlMemBlocks()) {
39127 printf("Leak of %d blocks found in xmlUCSIsShavian",
39128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039129 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039130 printf(" %d", n_code);
39131 printf("\n");
39132 }
39133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039134 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039135#endif
39136
Daniel Veillard42595322004-11-08 10:52:06 +000039137 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039138}
39139
39140
39141static int
39142test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039143 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039144
William M. Brack21e4ef22005-01-02 09:53:13 +000039145#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039146 int mem_base;
39147 int ret_val;
39148 int code; /* UCS code point */
39149 int n_code;
39150
39151 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39152 mem_base = xmlMemBlocks();
39153 code = gen_int(n_code, 0);
39154
39155 ret_val = xmlUCSIsSinhala(code);
39156 desret_int(ret_val);
39157 call_tests++;
39158 des_int(n_code, code, 0);
39159 xmlResetLastError();
39160 if (mem_base != xmlMemBlocks()) {
39161 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039163 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039164 printf(" %d", n_code);
39165 printf("\n");
39166 }
39167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039168 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039169#endif
39170
Daniel Veillard42595322004-11-08 10:52:06 +000039171 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039172}
39173
39174
39175static int
39176test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039177 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039178
William M. Brack21e4ef22005-01-02 09:53:13 +000039179#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039180 int mem_base;
39181 int ret_val;
39182 int code; /* UCS code point */
39183 int n_code;
39184
39185 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39186 mem_base = xmlMemBlocks();
39187 code = gen_int(n_code, 0);
39188
39189 ret_val = xmlUCSIsSmallFormVariants(code);
39190 desret_int(ret_val);
39191 call_tests++;
39192 des_int(n_code, code, 0);
39193 xmlResetLastError();
39194 if (mem_base != xmlMemBlocks()) {
39195 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039197 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039198 printf(" %d", n_code);
39199 printf("\n");
39200 }
39201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039202 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039203#endif
39204
Daniel Veillard42595322004-11-08 10:52:06 +000039205 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039206}
39207
39208
39209static int
39210test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039211 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039212
William M. Brack21e4ef22005-01-02 09:53:13 +000039213#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039214 int mem_base;
39215 int ret_val;
39216 int code; /* UCS code point */
39217 int n_code;
39218
39219 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39220 mem_base = xmlMemBlocks();
39221 code = gen_int(n_code, 0);
39222
39223 ret_val = xmlUCSIsSpacingModifierLetters(code);
39224 desret_int(ret_val);
39225 call_tests++;
39226 des_int(n_code, code, 0);
39227 xmlResetLastError();
39228 if (mem_base != xmlMemBlocks()) {
39229 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039231 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039232 printf(" %d", n_code);
39233 printf("\n");
39234 }
39235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039236 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039237#endif
39238
Daniel Veillard42595322004-11-08 10:52:06 +000039239 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039240}
39241
39242
39243static int
39244test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039246
William M. Brack21e4ef22005-01-02 09:53:13 +000039247#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039248 int mem_base;
39249 int ret_val;
39250 int code; /* UCS code point */
39251 int n_code;
39252
39253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39254 mem_base = xmlMemBlocks();
39255 code = gen_int(n_code, 0);
39256
39257 ret_val = xmlUCSIsSpecials(code);
39258 desret_int(ret_val);
39259 call_tests++;
39260 des_int(n_code, code, 0);
39261 xmlResetLastError();
39262 if (mem_base != xmlMemBlocks()) {
39263 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039266 printf(" %d", n_code);
39267 printf("\n");
39268 }
39269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039271#endif
39272
Daniel Veillard42595322004-11-08 10:52:06 +000039273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039274}
39275
39276
39277static int
39278test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039280
William M. Brack21e4ef22005-01-02 09:53:13 +000039281#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039282 int mem_base;
39283 int ret_val;
39284 int code; /* UCS code point */
39285 int n_code;
39286
39287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39288 mem_base = xmlMemBlocks();
39289 code = gen_int(n_code, 0);
39290
39291 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39292 desret_int(ret_val);
39293 call_tests++;
39294 des_int(n_code, code, 0);
39295 xmlResetLastError();
39296 if (mem_base != xmlMemBlocks()) {
39297 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039300 printf(" %d", n_code);
39301 printf("\n");
39302 }
39303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039305#endif
39306
Daniel Veillard42595322004-11-08 10:52:06 +000039307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039308}
39309
39310
39311static int
39312test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039314
William M. Brack21e4ef22005-01-02 09:53:13 +000039315#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039316 int mem_base;
39317 int ret_val;
39318 int code; /* UCS code point */
39319 int n_code;
39320
39321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39322 mem_base = xmlMemBlocks();
39323 code = gen_int(n_code, 0);
39324
39325 ret_val = xmlUCSIsSupplementalArrowsA(code);
39326 desret_int(ret_val);
39327 call_tests++;
39328 des_int(n_code, code, 0);
39329 xmlResetLastError();
39330 if (mem_base != xmlMemBlocks()) {
39331 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039334 printf(" %d", n_code);
39335 printf("\n");
39336 }
39337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039339#endif
39340
Daniel Veillard42595322004-11-08 10:52:06 +000039341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039342}
39343
39344
39345static int
39346test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039348
William M. Brack21e4ef22005-01-02 09:53:13 +000039349#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039350 int mem_base;
39351 int ret_val;
39352 int code; /* UCS code point */
39353 int n_code;
39354
39355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39356 mem_base = xmlMemBlocks();
39357 code = gen_int(n_code, 0);
39358
39359 ret_val = xmlUCSIsSupplementalArrowsB(code);
39360 desret_int(ret_val);
39361 call_tests++;
39362 des_int(n_code, code, 0);
39363 xmlResetLastError();
39364 if (mem_base != xmlMemBlocks()) {
39365 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039368 printf(" %d", n_code);
39369 printf("\n");
39370 }
39371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039373#endif
39374
Daniel Veillard42595322004-11-08 10:52:06 +000039375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039376}
39377
39378
39379static int
39380test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039382
William M. Brack21e4ef22005-01-02 09:53:13 +000039383#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039384 int mem_base;
39385 int ret_val;
39386 int code; /* UCS code point */
39387 int n_code;
39388
39389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39390 mem_base = xmlMemBlocks();
39391 code = gen_int(n_code, 0);
39392
39393 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39394 desret_int(ret_val);
39395 call_tests++;
39396 des_int(n_code, code, 0);
39397 xmlResetLastError();
39398 if (mem_base != xmlMemBlocks()) {
39399 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039402 printf(" %d", n_code);
39403 printf("\n");
39404 }
39405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039407#endif
39408
Daniel Veillard42595322004-11-08 10:52:06 +000039409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039410}
39411
39412
39413static int
39414test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039416
William M. Brack21e4ef22005-01-02 09:53:13 +000039417#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039418 int mem_base;
39419 int ret_val;
39420 int code; /* UCS code point */
39421 int n_code;
39422
39423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39424 mem_base = xmlMemBlocks();
39425 code = gen_int(n_code, 0);
39426
39427 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39428 desret_int(ret_val);
39429 call_tests++;
39430 des_int(n_code, code, 0);
39431 xmlResetLastError();
39432 if (mem_base != xmlMemBlocks()) {
39433 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039436 printf(" %d", n_code);
39437 printf("\n");
39438 }
39439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039441#endif
39442
Daniel Veillard42595322004-11-08 10:52:06 +000039443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039444}
39445
39446
39447static int
39448test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039450
William M. Brack21e4ef22005-01-02 09:53:13 +000039451#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039452 int mem_base;
39453 int ret_val;
39454 int code; /* UCS code point */
39455 int n_code;
39456
39457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39458 mem_base = xmlMemBlocks();
39459 code = gen_int(n_code, 0);
39460
39461 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39462 desret_int(ret_val);
39463 call_tests++;
39464 des_int(n_code, code, 0);
39465 xmlResetLastError();
39466 if (mem_base != xmlMemBlocks()) {
39467 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039470 printf(" %d", n_code);
39471 printf("\n");
39472 }
39473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039475#endif
39476
Daniel Veillard42595322004-11-08 10:52:06 +000039477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039478}
39479
39480
39481static int
39482test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039484
William M. Brack21e4ef22005-01-02 09:53:13 +000039485#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039486 int mem_base;
39487 int ret_val;
39488 int code; /* UCS code point */
39489 int n_code;
39490
39491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39492 mem_base = xmlMemBlocks();
39493 code = gen_int(n_code, 0);
39494
39495 ret_val = xmlUCSIsSyriac(code);
39496 desret_int(ret_val);
39497 call_tests++;
39498 des_int(n_code, code, 0);
39499 xmlResetLastError();
39500 if (mem_base != xmlMemBlocks()) {
39501 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039504 printf(" %d", n_code);
39505 printf("\n");
39506 }
39507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039509#endif
39510
Daniel Veillard42595322004-11-08 10:52:06 +000039511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039512}
39513
39514
39515static int
39516test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039518
William M. Brack21e4ef22005-01-02 09:53:13 +000039519#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039520 int mem_base;
39521 int ret_val;
39522 int code; /* UCS code point */
39523 int n_code;
39524
39525 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39526 mem_base = xmlMemBlocks();
39527 code = gen_int(n_code, 0);
39528
39529 ret_val = xmlUCSIsTagalog(code);
39530 desret_int(ret_val);
39531 call_tests++;
39532 des_int(n_code, code, 0);
39533 xmlResetLastError();
39534 if (mem_base != xmlMemBlocks()) {
39535 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039537 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039538 printf(" %d", n_code);
39539 printf("\n");
39540 }
39541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039542 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039543#endif
39544
Daniel Veillard42595322004-11-08 10:52:06 +000039545 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039546}
39547
39548
39549static int
39550test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039551 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039552
William M. Brack21e4ef22005-01-02 09:53:13 +000039553#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039554 int mem_base;
39555 int ret_val;
39556 int code; /* UCS code point */
39557 int n_code;
39558
39559 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39560 mem_base = xmlMemBlocks();
39561 code = gen_int(n_code, 0);
39562
39563 ret_val = xmlUCSIsTagbanwa(code);
39564 desret_int(ret_val);
39565 call_tests++;
39566 des_int(n_code, code, 0);
39567 xmlResetLastError();
39568 if (mem_base != xmlMemBlocks()) {
39569 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039571 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039572 printf(" %d", n_code);
39573 printf("\n");
39574 }
39575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039576 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039577#endif
39578
Daniel Veillard42595322004-11-08 10:52:06 +000039579 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039580}
39581
39582
39583static int
39584test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039585 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039586
William M. Brack21e4ef22005-01-02 09:53:13 +000039587#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039588 int mem_base;
39589 int ret_val;
39590 int code; /* UCS code point */
39591 int n_code;
39592
39593 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39594 mem_base = xmlMemBlocks();
39595 code = gen_int(n_code, 0);
39596
39597 ret_val = xmlUCSIsTags(code);
39598 desret_int(ret_val);
39599 call_tests++;
39600 des_int(n_code, code, 0);
39601 xmlResetLastError();
39602 if (mem_base != xmlMemBlocks()) {
39603 printf("Leak of %d blocks found in xmlUCSIsTags",
39604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039605 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039606 printf(" %d", n_code);
39607 printf("\n");
39608 }
39609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039610 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039611#endif
39612
Daniel Veillard42595322004-11-08 10:52:06 +000039613 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039614}
39615
39616
39617static int
39618test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039619 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039620
William M. Brack21e4ef22005-01-02 09:53:13 +000039621#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039622 int mem_base;
39623 int ret_val;
39624 int code; /* UCS code point */
39625 int n_code;
39626
39627 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39628 mem_base = xmlMemBlocks();
39629 code = gen_int(n_code, 0);
39630
39631 ret_val = xmlUCSIsTaiLe(code);
39632 desret_int(ret_val);
39633 call_tests++;
39634 des_int(n_code, code, 0);
39635 xmlResetLastError();
39636 if (mem_base != xmlMemBlocks()) {
39637 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039639 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039640 printf(" %d", n_code);
39641 printf("\n");
39642 }
39643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039644 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039645#endif
39646
Daniel Veillard42595322004-11-08 10:52:06 +000039647 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039648}
39649
39650
39651static int
39652test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039653 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039654
William M. Brack21e4ef22005-01-02 09:53:13 +000039655#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039656 int mem_base;
39657 int ret_val;
39658 int code; /* UCS code point */
39659 int n_code;
39660
39661 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39662 mem_base = xmlMemBlocks();
39663 code = gen_int(n_code, 0);
39664
39665 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39666 desret_int(ret_val);
39667 call_tests++;
39668 des_int(n_code, code, 0);
39669 xmlResetLastError();
39670 if (mem_base != xmlMemBlocks()) {
39671 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039673 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039674 printf(" %d", n_code);
39675 printf("\n");
39676 }
39677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039678 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039679#endif
39680
Daniel Veillard42595322004-11-08 10:52:06 +000039681 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039682}
39683
39684
39685static int
39686test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039687 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039688
William M. Brack21e4ef22005-01-02 09:53:13 +000039689#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039690 int mem_base;
39691 int ret_val;
39692 int code; /* UCS code point */
39693 int n_code;
39694
39695 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39696 mem_base = xmlMemBlocks();
39697 code = gen_int(n_code, 0);
39698
39699 ret_val = xmlUCSIsTamil(code);
39700 desret_int(ret_val);
39701 call_tests++;
39702 des_int(n_code, code, 0);
39703 xmlResetLastError();
39704 if (mem_base != xmlMemBlocks()) {
39705 printf("Leak of %d blocks found in xmlUCSIsTamil",
39706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039707 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039708 printf(" %d", n_code);
39709 printf("\n");
39710 }
39711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039712 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039713#endif
39714
Daniel Veillard42595322004-11-08 10:52:06 +000039715 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039716}
39717
39718
39719static int
39720test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039721 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039722
William M. Brack21e4ef22005-01-02 09:53:13 +000039723#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039724 int mem_base;
39725 int ret_val;
39726 int code; /* UCS code point */
39727 int n_code;
39728
39729 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39730 mem_base = xmlMemBlocks();
39731 code = gen_int(n_code, 0);
39732
39733 ret_val = xmlUCSIsTelugu(code);
39734 desret_int(ret_val);
39735 call_tests++;
39736 des_int(n_code, code, 0);
39737 xmlResetLastError();
39738 if (mem_base != xmlMemBlocks()) {
39739 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039741 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039742 printf(" %d", n_code);
39743 printf("\n");
39744 }
39745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039746 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039747#endif
39748
Daniel Veillard42595322004-11-08 10:52:06 +000039749 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039750}
39751
39752
39753static int
39754test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039755 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039756
William M. Brack21e4ef22005-01-02 09:53:13 +000039757#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039758 int mem_base;
39759 int ret_val;
39760 int code; /* UCS code point */
39761 int n_code;
39762
39763 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39764 mem_base = xmlMemBlocks();
39765 code = gen_int(n_code, 0);
39766
39767 ret_val = xmlUCSIsThaana(code);
39768 desret_int(ret_val);
39769 call_tests++;
39770 des_int(n_code, code, 0);
39771 xmlResetLastError();
39772 if (mem_base != xmlMemBlocks()) {
39773 printf("Leak of %d blocks found in xmlUCSIsThaana",
39774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039775 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039776 printf(" %d", n_code);
39777 printf("\n");
39778 }
39779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039780 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039781#endif
39782
Daniel Veillard42595322004-11-08 10:52:06 +000039783 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039784}
39785
39786
39787static int
39788test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039789 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039790
William M. Brack21e4ef22005-01-02 09:53:13 +000039791#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039792 int mem_base;
39793 int ret_val;
39794 int code; /* UCS code point */
39795 int n_code;
39796
39797 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39798 mem_base = xmlMemBlocks();
39799 code = gen_int(n_code, 0);
39800
39801 ret_val = xmlUCSIsThai(code);
39802 desret_int(ret_val);
39803 call_tests++;
39804 des_int(n_code, code, 0);
39805 xmlResetLastError();
39806 if (mem_base != xmlMemBlocks()) {
39807 printf("Leak of %d blocks found in xmlUCSIsThai",
39808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039809 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039810 printf(" %d", n_code);
39811 printf("\n");
39812 }
39813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039814 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039815#endif
39816
Daniel Veillard42595322004-11-08 10:52:06 +000039817 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039818}
39819
39820
39821static int
39822test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039823 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039824
William M. Brack21e4ef22005-01-02 09:53:13 +000039825#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039826 int mem_base;
39827 int ret_val;
39828 int code; /* UCS code point */
39829 int n_code;
39830
39831 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39832 mem_base = xmlMemBlocks();
39833 code = gen_int(n_code, 0);
39834
39835 ret_val = xmlUCSIsTibetan(code);
39836 desret_int(ret_val);
39837 call_tests++;
39838 des_int(n_code, code, 0);
39839 xmlResetLastError();
39840 if (mem_base != xmlMemBlocks()) {
39841 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039843 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039844 printf(" %d", n_code);
39845 printf("\n");
39846 }
39847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039848 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039849#endif
39850
Daniel Veillard42595322004-11-08 10:52:06 +000039851 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039852}
39853
39854
39855static int
39856test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039857 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039858
William M. Brack21e4ef22005-01-02 09:53:13 +000039859#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039860 int mem_base;
39861 int ret_val;
39862 int code; /* UCS code point */
39863 int n_code;
39864
39865 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39866 mem_base = xmlMemBlocks();
39867 code = gen_int(n_code, 0);
39868
39869 ret_val = xmlUCSIsUgaritic(code);
39870 desret_int(ret_val);
39871 call_tests++;
39872 des_int(n_code, code, 0);
39873 xmlResetLastError();
39874 if (mem_base != xmlMemBlocks()) {
39875 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039877 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039878 printf(" %d", n_code);
39879 printf("\n");
39880 }
39881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039882 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039883#endif
39884
Daniel Veillard42595322004-11-08 10:52:06 +000039885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039886}
39887
39888
39889static int
39890test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039892
William M. Brack21e4ef22005-01-02 09:53:13 +000039893#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039894 int mem_base;
39895 int ret_val;
39896 int code; /* UCS code point */
39897 int n_code;
39898
39899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39900 mem_base = xmlMemBlocks();
39901 code = gen_int(n_code, 0);
39902
39903 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39904 desret_int(ret_val);
39905 call_tests++;
39906 des_int(n_code, code, 0);
39907 xmlResetLastError();
39908 if (mem_base != xmlMemBlocks()) {
39909 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039912 printf(" %d", n_code);
39913 printf("\n");
39914 }
39915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039917#endif
39918
Daniel Veillard42595322004-11-08 10:52:06 +000039919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039920}
39921
39922
39923static int
39924test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039926
William M. Brack21e4ef22005-01-02 09:53:13 +000039927#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039928 int mem_base;
39929 int ret_val;
39930 int code; /* UCS code point */
39931 int n_code;
39932
39933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39934 mem_base = xmlMemBlocks();
39935 code = gen_int(n_code, 0);
39936
39937 ret_val = xmlUCSIsVariationSelectors(code);
39938 desret_int(ret_val);
39939 call_tests++;
39940 des_int(n_code, code, 0);
39941 xmlResetLastError();
39942 if (mem_base != xmlMemBlocks()) {
39943 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039946 printf(" %d", n_code);
39947 printf("\n");
39948 }
39949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039951#endif
39952
Daniel Veillard42595322004-11-08 10:52:06 +000039953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039954}
39955
39956
39957static int
39958test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039960
William M. Brack21e4ef22005-01-02 09:53:13 +000039961#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039962 int mem_base;
39963 int ret_val;
39964 int code; /* UCS code point */
39965 int n_code;
39966
39967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39968 mem_base = xmlMemBlocks();
39969 code = gen_int(n_code, 0);
39970
39971 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39972 desret_int(ret_val);
39973 call_tests++;
39974 des_int(n_code, code, 0);
39975 xmlResetLastError();
39976 if (mem_base != xmlMemBlocks()) {
39977 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039980 printf(" %d", n_code);
39981 printf("\n");
39982 }
39983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039985#endif
39986
Daniel Veillard42595322004-11-08 10:52:06 +000039987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039988}
39989
39990
39991static int
39992test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039993 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039994
William M. Brack21e4ef22005-01-02 09:53:13 +000039995#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039996 int mem_base;
39997 int ret_val;
39998 int code; /* UCS code point */
39999 int n_code;
40000
40001 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40002 mem_base = xmlMemBlocks();
40003 code = gen_int(n_code, 0);
40004
40005 ret_val = xmlUCSIsYiRadicals(code);
40006 desret_int(ret_val);
40007 call_tests++;
40008 des_int(n_code, code, 0);
40009 xmlResetLastError();
40010 if (mem_base != xmlMemBlocks()) {
40011 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
40012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040013 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040014 printf(" %d", n_code);
40015 printf("\n");
40016 }
40017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040018 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040019#endif
40020
Daniel Veillard42595322004-11-08 10:52:06 +000040021 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040022}
40023
40024
40025static int
40026test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040027 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040028
William M. Brack21e4ef22005-01-02 09:53:13 +000040029#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040030 int mem_base;
40031 int ret_val;
40032 int code; /* UCS code point */
40033 int n_code;
40034
40035 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40036 mem_base = xmlMemBlocks();
40037 code = gen_int(n_code, 0);
40038
40039 ret_val = xmlUCSIsYiSyllables(code);
40040 desret_int(ret_val);
40041 call_tests++;
40042 des_int(n_code, code, 0);
40043 xmlResetLastError();
40044 if (mem_base != xmlMemBlocks()) {
40045 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
40046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040047 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040048 printf(" %d", n_code);
40049 printf("\n");
40050 }
40051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040052 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040053#endif
40054
Daniel Veillard42595322004-11-08 10:52:06 +000040055 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040056}
40057
40058
40059static int
40060test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040061 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040062
William M. Brack21e4ef22005-01-02 09:53:13 +000040063#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040064 int mem_base;
40065 int ret_val;
40066 int code; /* UCS code point */
40067 int n_code;
40068
40069 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40070 mem_base = xmlMemBlocks();
40071 code = gen_int(n_code, 0);
40072
40073 ret_val = xmlUCSIsYijingHexagramSymbols(code);
40074 desret_int(ret_val);
40075 call_tests++;
40076 des_int(n_code, code, 0);
40077 xmlResetLastError();
40078 if (mem_base != xmlMemBlocks()) {
40079 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
40080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040081 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040082 printf(" %d", n_code);
40083 printf("\n");
40084 }
40085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040086 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040087#endif
40088
Daniel Veillard42595322004-11-08 10:52:06 +000040089 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040090}
40091
40092static int
40093test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040094 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040095
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040096 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000040097 test_ret += test_xmlUCSIsAegeanNumbers();
40098 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
40099 test_ret += test_xmlUCSIsArabic();
40100 test_ret += test_xmlUCSIsArabicPresentationFormsA();
40101 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40102 test_ret += test_xmlUCSIsArmenian();
40103 test_ret += test_xmlUCSIsArrows();
40104 test_ret += test_xmlUCSIsBasicLatin();
40105 test_ret += test_xmlUCSIsBengali();
40106 test_ret += test_xmlUCSIsBlock();
40107 test_ret += test_xmlUCSIsBlockElements();
40108 test_ret += test_xmlUCSIsBopomofo();
40109 test_ret += test_xmlUCSIsBopomofoExtended();
40110 test_ret += test_xmlUCSIsBoxDrawing();
40111 test_ret += test_xmlUCSIsBraillePatterns();
40112 test_ret += test_xmlUCSIsBuhid();
40113 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40114 test_ret += test_xmlUCSIsCJKCompatibility();
40115 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40116 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40117 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40118 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40119 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40120 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40121 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40122 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40123 test_ret += test_xmlUCSIsCat();
40124 test_ret += test_xmlUCSIsCatC();
40125 test_ret += test_xmlUCSIsCatCc();
40126 test_ret += test_xmlUCSIsCatCf();
40127 test_ret += test_xmlUCSIsCatCo();
40128 test_ret += test_xmlUCSIsCatCs();
40129 test_ret += test_xmlUCSIsCatL();
40130 test_ret += test_xmlUCSIsCatLl();
40131 test_ret += test_xmlUCSIsCatLm();
40132 test_ret += test_xmlUCSIsCatLo();
40133 test_ret += test_xmlUCSIsCatLt();
40134 test_ret += test_xmlUCSIsCatLu();
40135 test_ret += test_xmlUCSIsCatM();
40136 test_ret += test_xmlUCSIsCatMc();
40137 test_ret += test_xmlUCSIsCatMe();
40138 test_ret += test_xmlUCSIsCatMn();
40139 test_ret += test_xmlUCSIsCatN();
40140 test_ret += test_xmlUCSIsCatNd();
40141 test_ret += test_xmlUCSIsCatNl();
40142 test_ret += test_xmlUCSIsCatNo();
40143 test_ret += test_xmlUCSIsCatP();
40144 test_ret += test_xmlUCSIsCatPc();
40145 test_ret += test_xmlUCSIsCatPd();
40146 test_ret += test_xmlUCSIsCatPe();
40147 test_ret += test_xmlUCSIsCatPf();
40148 test_ret += test_xmlUCSIsCatPi();
40149 test_ret += test_xmlUCSIsCatPo();
40150 test_ret += test_xmlUCSIsCatPs();
40151 test_ret += test_xmlUCSIsCatS();
40152 test_ret += test_xmlUCSIsCatSc();
40153 test_ret += test_xmlUCSIsCatSk();
40154 test_ret += test_xmlUCSIsCatSm();
40155 test_ret += test_xmlUCSIsCatSo();
40156 test_ret += test_xmlUCSIsCatZ();
40157 test_ret += test_xmlUCSIsCatZl();
40158 test_ret += test_xmlUCSIsCatZp();
40159 test_ret += test_xmlUCSIsCatZs();
40160 test_ret += test_xmlUCSIsCherokee();
40161 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40162 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40163 test_ret += test_xmlUCSIsCombiningHalfMarks();
40164 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40165 test_ret += test_xmlUCSIsControlPictures();
40166 test_ret += test_xmlUCSIsCurrencySymbols();
40167 test_ret += test_xmlUCSIsCypriotSyllabary();
40168 test_ret += test_xmlUCSIsCyrillic();
40169 test_ret += test_xmlUCSIsCyrillicSupplement();
40170 test_ret += test_xmlUCSIsDeseret();
40171 test_ret += test_xmlUCSIsDevanagari();
40172 test_ret += test_xmlUCSIsDingbats();
40173 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40174 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40175 test_ret += test_xmlUCSIsEthiopic();
40176 test_ret += test_xmlUCSIsGeneralPunctuation();
40177 test_ret += test_xmlUCSIsGeometricShapes();
40178 test_ret += test_xmlUCSIsGeorgian();
40179 test_ret += test_xmlUCSIsGothic();
40180 test_ret += test_xmlUCSIsGreek();
40181 test_ret += test_xmlUCSIsGreekExtended();
40182 test_ret += test_xmlUCSIsGreekandCoptic();
40183 test_ret += test_xmlUCSIsGujarati();
40184 test_ret += test_xmlUCSIsGurmukhi();
40185 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40186 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40187 test_ret += test_xmlUCSIsHangulJamo();
40188 test_ret += test_xmlUCSIsHangulSyllables();
40189 test_ret += test_xmlUCSIsHanunoo();
40190 test_ret += test_xmlUCSIsHebrew();
40191 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40192 test_ret += test_xmlUCSIsHighSurrogates();
40193 test_ret += test_xmlUCSIsHiragana();
40194 test_ret += test_xmlUCSIsIPAExtensions();
40195 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40196 test_ret += test_xmlUCSIsKanbun();
40197 test_ret += test_xmlUCSIsKangxiRadicals();
40198 test_ret += test_xmlUCSIsKannada();
40199 test_ret += test_xmlUCSIsKatakana();
40200 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40201 test_ret += test_xmlUCSIsKhmer();
40202 test_ret += test_xmlUCSIsKhmerSymbols();
40203 test_ret += test_xmlUCSIsLao();
40204 test_ret += test_xmlUCSIsLatin1Supplement();
40205 test_ret += test_xmlUCSIsLatinExtendedA();
40206 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40207 test_ret += test_xmlUCSIsLatinExtendedB();
40208 test_ret += test_xmlUCSIsLetterlikeSymbols();
40209 test_ret += test_xmlUCSIsLimbu();
40210 test_ret += test_xmlUCSIsLinearBIdeograms();
40211 test_ret += test_xmlUCSIsLinearBSyllabary();
40212 test_ret += test_xmlUCSIsLowSurrogates();
40213 test_ret += test_xmlUCSIsMalayalam();
40214 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40215 test_ret += test_xmlUCSIsMathematicalOperators();
40216 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40217 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40218 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40219 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40220 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40221 test_ret += test_xmlUCSIsMongolian();
40222 test_ret += test_xmlUCSIsMusicalSymbols();
40223 test_ret += test_xmlUCSIsMyanmar();
40224 test_ret += test_xmlUCSIsNumberForms();
40225 test_ret += test_xmlUCSIsOgham();
40226 test_ret += test_xmlUCSIsOldItalic();
40227 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40228 test_ret += test_xmlUCSIsOriya();
40229 test_ret += test_xmlUCSIsOsmanya();
40230 test_ret += test_xmlUCSIsPhoneticExtensions();
40231 test_ret += test_xmlUCSIsPrivateUse();
40232 test_ret += test_xmlUCSIsPrivateUseArea();
40233 test_ret += test_xmlUCSIsRunic();
40234 test_ret += test_xmlUCSIsShavian();
40235 test_ret += test_xmlUCSIsSinhala();
40236 test_ret += test_xmlUCSIsSmallFormVariants();
40237 test_ret += test_xmlUCSIsSpacingModifierLetters();
40238 test_ret += test_xmlUCSIsSpecials();
40239 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40240 test_ret += test_xmlUCSIsSupplementalArrowsA();
40241 test_ret += test_xmlUCSIsSupplementalArrowsB();
40242 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40243 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40244 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40245 test_ret += test_xmlUCSIsSyriac();
40246 test_ret += test_xmlUCSIsTagalog();
40247 test_ret += test_xmlUCSIsTagbanwa();
40248 test_ret += test_xmlUCSIsTags();
40249 test_ret += test_xmlUCSIsTaiLe();
40250 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40251 test_ret += test_xmlUCSIsTamil();
40252 test_ret += test_xmlUCSIsTelugu();
40253 test_ret += test_xmlUCSIsThaana();
40254 test_ret += test_xmlUCSIsThai();
40255 test_ret += test_xmlUCSIsTibetan();
40256 test_ret += test_xmlUCSIsUgaritic();
40257 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40258 test_ret += test_xmlUCSIsVariationSelectors();
40259 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40260 test_ret += test_xmlUCSIsYiRadicals();
40261 test_ret += test_xmlUCSIsYiSyllables();
40262 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040263
Daniel Veillard42595322004-11-08 10:52:06 +000040264 if (test_ret != 0)
40265 printf("Module xmlunicode: %d errors\n", test_ret);
40266 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040267}
40268
40269static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040270test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040272
William M. Brack21e4ef22005-01-02 09:53:13 +000040273#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040274 int mem_base;
40275 xmlTextWriterPtr ret_val;
40276 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40277 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040278
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040279 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40280 mem_base = xmlMemBlocks();
40281 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040282
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040283 ret_val = xmlNewTextWriter(out);
40284 if (ret_val != NULL) out = NULL;
40285 desret_xmlTextWriterPtr(ret_val);
40286 call_tests++;
40287 des_xmlOutputBufferPtr(n_out, out, 0);
40288 xmlResetLastError();
40289 if (mem_base != xmlMemBlocks()) {
40290 printf("Leak of %d blocks found in xmlNewTextWriter",
40291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040292 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040293 printf(" %d", n_out);
40294 printf("\n");
40295 }
40296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040297 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040298#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040299
Daniel Veillard42595322004-11-08 10:52:06 +000040300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040301}
40302
40303
40304static int
40305test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040307
William M. Brack21e4ef22005-01-02 09:53:13 +000040308#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040309 int mem_base;
40310 xmlTextWriterPtr ret_val;
40311 const char * uri; /* the URI of the resource for the output */
40312 int n_uri;
40313 int compression; /* compress the output? */
40314 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040315
Daniel Veillard42595322004-11-08 10:52:06 +000040316 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040317 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40318 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040319 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040320 compression = gen_int(n_compression, 1);
40321
40322 ret_val = xmlNewTextWriterFilename(uri, compression);
40323 desret_xmlTextWriterPtr(ret_val);
40324 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040325 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040326 des_int(n_compression, compression, 1);
40327 xmlResetLastError();
40328 if (mem_base != xmlMemBlocks()) {
40329 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040331 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040332 printf(" %d", n_uri);
40333 printf(" %d", n_compression);
40334 printf("\n");
40335 }
40336 }
40337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040338 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040339#endif
40340
Daniel Veillard42595322004-11-08 10:52:06 +000040341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040342}
40343
40344
40345static int
40346test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040348
William M. Brack21e4ef22005-01-02 09:53:13 +000040349#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040350 int mem_base;
40351 xmlTextWriterPtr ret_val;
40352 xmlBufferPtr buf; /* xmlBufferPtr */
40353 int n_buf;
40354 int compression; /* compress the output? */
40355 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040356
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040357 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40358 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40359 mem_base = xmlMemBlocks();
40360 buf = gen_xmlBufferPtr(n_buf, 0);
40361 compression = gen_int(n_compression, 1);
40362
40363 ret_val = xmlNewTextWriterMemory(buf, compression);
40364 desret_xmlTextWriterPtr(ret_val);
40365 call_tests++;
40366 des_xmlBufferPtr(n_buf, buf, 0);
40367 des_int(n_compression, compression, 1);
40368 xmlResetLastError();
40369 if (mem_base != xmlMemBlocks()) {
40370 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040372 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040373 printf(" %d", n_buf);
40374 printf(" %d", n_compression);
40375 printf("\n");
40376 }
40377 }
40378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040379 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040380#endif
40381
Daniel Veillard42595322004-11-08 10:52:06 +000040382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040383}
40384
40385
40386static int
40387test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040389
William M. Brack21e4ef22005-01-02 09:53:13 +000040390#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040391 int mem_base;
40392 xmlTextWriterPtr ret_val;
40393 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40394 int n_ctxt;
40395 int compression; /* compress the output? */
40396 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040397
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040398 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40399 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40400 mem_base = xmlMemBlocks();
40401 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40402 compression = gen_int(n_compression, 1);
40403
40404 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040405 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040406 desret_xmlTextWriterPtr(ret_val);
40407 call_tests++;
40408 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40409 des_int(n_compression, compression, 1);
40410 xmlResetLastError();
40411 if (mem_base != xmlMemBlocks()) {
40412 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040414 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040415 printf(" %d", n_ctxt);
40416 printf(" %d", n_compression);
40417 printf("\n");
40418 }
40419 }
40420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040421 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040422#endif
40423
Daniel Veillard42595322004-11-08 10:52:06 +000040424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040425}
40426
40427
40428static int
40429test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040431
William M. Brack21e4ef22005-01-02 09:53:13 +000040432#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040433 int mem_base;
40434 xmlTextWriterPtr ret_val;
40435 xmlDocPtr doc; /* xmlDocPtr */
40436 int n_doc;
40437 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40438 int n_node;
40439 int compression; /* compress the output? */
40440 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040441
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040442 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40443 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40444 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40445 mem_base = xmlMemBlocks();
40446 doc = gen_xmlDocPtr(n_doc, 0);
40447 node = gen_xmlNodePtr(n_node, 1);
40448 compression = gen_int(n_compression, 2);
40449
40450 ret_val = xmlNewTextWriterTree(doc, node, compression);
40451 desret_xmlTextWriterPtr(ret_val);
40452 call_tests++;
40453 des_xmlDocPtr(n_doc, doc, 0);
40454 des_xmlNodePtr(n_node, node, 1);
40455 des_int(n_compression, compression, 2);
40456 xmlResetLastError();
40457 if (mem_base != xmlMemBlocks()) {
40458 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040460 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040461 printf(" %d", n_doc);
40462 printf(" %d", n_node);
40463 printf(" %d", n_compression);
40464 printf("\n");
40465 }
40466 }
40467 }
40468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040469 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040470#endif
40471
Daniel Veillard42595322004-11-08 10:52:06 +000040472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040473}
40474
40475
40476static int
40477test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040479
William M. Brack21e4ef22005-01-02 09:53:13 +000040480#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040481 int mem_base;
40482 int ret_val;
40483 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40484 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040485
Daniel Veillarde43cc572004-11-03 11:50:29 +000040486 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040488 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040489
40490 ret_val = xmlTextWriterEndAttribute(writer);
40491 desret_int(ret_val);
40492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040493 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494 xmlResetLastError();
40495 if (mem_base != xmlMemBlocks()) {
40496 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040498 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040499 printf(" %d", n_writer);
40500 printf("\n");
40501 }
40502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040503 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040504#endif
40505
Daniel Veillard42595322004-11-08 10:52:06 +000040506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040507}
40508
40509
40510static int
40511test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040513
William M. Brack21e4ef22005-01-02 09:53:13 +000040514#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040515 int mem_base;
40516 int ret_val;
40517 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40518 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040519
Daniel Veillarde43cc572004-11-03 11:50:29 +000040520 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040522 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040523
40524 ret_val = xmlTextWriterEndCDATA(writer);
40525 desret_int(ret_val);
40526 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040527 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040528 xmlResetLastError();
40529 if (mem_base != xmlMemBlocks()) {
40530 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040532 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040533 printf(" %d", n_writer);
40534 printf("\n");
40535 }
40536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040537 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040538#endif
40539
Daniel Veillard42595322004-11-08 10:52:06 +000040540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040541}
40542
40543
40544static int
40545test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040547
William M. Brack21e4ef22005-01-02 09:53:13 +000040548#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040549 int mem_base;
40550 int ret_val;
40551 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40552 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040553
Daniel Veillarde43cc572004-11-03 11:50:29 +000040554 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040556 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040557
40558 ret_val = xmlTextWriterEndComment(writer);
40559 desret_int(ret_val);
40560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040561 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040562 xmlResetLastError();
40563 if (mem_base != xmlMemBlocks()) {
40564 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040566 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040567 printf(" %d", n_writer);
40568 printf("\n");
40569 }
40570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040571 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040572#endif
40573
Daniel Veillard42595322004-11-08 10:52:06 +000040574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040575}
40576
40577
40578static int
40579test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040581
William M. Brack21e4ef22005-01-02 09:53:13 +000040582#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040583 int mem_base;
40584 int ret_val;
40585 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40586 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040587
Daniel Veillarde43cc572004-11-03 11:50:29 +000040588 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040590 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040591
40592 ret_val = xmlTextWriterEndDTD(writer);
40593 desret_int(ret_val);
40594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040595 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040596 xmlResetLastError();
40597 if (mem_base != xmlMemBlocks()) {
40598 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040600 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040601 printf(" %d", n_writer);
40602 printf("\n");
40603 }
40604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040605 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040606#endif
40607
Daniel Veillard42595322004-11-08 10:52:06 +000040608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040609}
40610
40611
40612static int
40613test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040615
William M. Brack21e4ef22005-01-02 09:53:13 +000040616#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040617 int mem_base;
40618 int ret_val;
40619 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40620 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040621
Daniel Veillarde43cc572004-11-03 11:50:29 +000040622 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040624 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040625
40626 ret_val = xmlTextWriterEndDTDAttlist(writer);
40627 desret_int(ret_val);
40628 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040629 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040630 xmlResetLastError();
40631 if (mem_base != xmlMemBlocks()) {
40632 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040634 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040635 printf(" %d", n_writer);
40636 printf("\n");
40637 }
40638 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040639 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040640#endif
40641
Daniel Veillard42595322004-11-08 10:52:06 +000040642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040643}
40644
40645
40646static int
40647test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040649
William M. Brack21e4ef22005-01-02 09:53:13 +000040650#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040651 int mem_base;
40652 int ret_val;
40653 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40654 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040655
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040658 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040659
40660 ret_val = xmlTextWriterEndDTDElement(writer);
40661 desret_int(ret_val);
40662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040663 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040664 xmlResetLastError();
40665 if (mem_base != xmlMemBlocks()) {
40666 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040668 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040669 printf(" %d", n_writer);
40670 printf("\n");
40671 }
40672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040673 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040674#endif
40675
Daniel Veillard42595322004-11-08 10:52:06 +000040676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040677}
40678
40679
40680static int
40681test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040683
William M. Brack21e4ef22005-01-02 09:53:13 +000040684#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040685 int mem_base;
40686 int ret_val;
40687 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40688 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040689
Daniel Veillarde43cc572004-11-03 11:50:29 +000040690 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040692 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040693
40694 ret_val = xmlTextWriterEndDTDEntity(writer);
40695 desret_int(ret_val);
40696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040697 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040698 xmlResetLastError();
40699 if (mem_base != xmlMemBlocks()) {
40700 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040702 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040703 printf(" %d", n_writer);
40704 printf("\n");
40705 }
40706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040707 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040708#endif
40709
Daniel Veillard42595322004-11-08 10:52:06 +000040710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040711}
40712
40713
40714static int
40715test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040717
William M. Brack21e4ef22005-01-02 09:53:13 +000040718#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040719 int mem_base;
40720 int ret_val;
40721 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40722 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040723
Daniel Veillarde43cc572004-11-03 11:50:29 +000040724 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40725 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040726 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040727
40728 ret_val = xmlTextWriterEndDocument(writer);
40729 desret_int(ret_val);
40730 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040731 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732 xmlResetLastError();
40733 if (mem_base != xmlMemBlocks()) {
40734 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040736 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040737 printf(" %d", n_writer);
40738 printf("\n");
40739 }
40740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040741 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040742#endif
40743
Daniel Veillard42595322004-11-08 10:52:06 +000040744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040745}
40746
40747
40748static int
40749test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040751
William M. Brack21e4ef22005-01-02 09:53:13 +000040752#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040753 int mem_base;
40754 int ret_val;
40755 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40756 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040757
Daniel Veillarde43cc572004-11-03 11:50:29 +000040758 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040760 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761
40762 ret_val = xmlTextWriterEndElement(writer);
40763 desret_int(ret_val);
40764 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040765 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040766 xmlResetLastError();
40767 if (mem_base != xmlMemBlocks()) {
40768 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040770 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040771 printf(" %d", n_writer);
40772 printf("\n");
40773 }
40774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040775 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040776#endif
40777
Daniel Veillard42595322004-11-08 10:52:06 +000040778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040779}
40780
40781
40782static int
40783test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040785
William M. Brack21e4ef22005-01-02 09:53:13 +000040786#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040787 int mem_base;
40788 int ret_val;
40789 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40790 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040791
Daniel Veillarde43cc572004-11-03 11:50:29 +000040792 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040794 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040795
40796 ret_val = xmlTextWriterEndPI(writer);
40797 desret_int(ret_val);
40798 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040799 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040800 xmlResetLastError();
40801 if (mem_base != xmlMemBlocks()) {
40802 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040804 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040805 printf(" %d", n_writer);
40806 printf("\n");
40807 }
40808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040809 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040810#endif
40811
Daniel Veillard42595322004-11-08 10:52:06 +000040812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040813}
40814
40815
40816static int
40817test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040819
William M. Brack21e4ef22005-01-02 09:53:13 +000040820#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040821 int mem_base;
40822 int ret_val;
40823 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40824 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040825
Daniel Veillarde43cc572004-11-03 11:50:29 +000040826 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040828 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829
40830 ret_val = xmlTextWriterFlush(writer);
40831 desret_int(ret_val);
40832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040833 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834 xmlResetLastError();
40835 if (mem_base != xmlMemBlocks()) {
40836 printf("Leak of %d blocks found in xmlTextWriterFlush",
40837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040838 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040839 printf(" %d", n_writer);
40840 printf("\n");
40841 }
40842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040843 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040844#endif
40845
Daniel Veillard42595322004-11-08 10:52:06 +000040846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040847}
40848
40849
40850static int
40851test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040853
William M. Brack21e4ef22005-01-02 09:53:13 +000040854#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040855 int mem_base;
40856 int ret_val;
40857 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40858 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040859
Daniel Veillarde43cc572004-11-03 11:50:29 +000040860 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040862 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040863
40864 ret_val = xmlTextWriterFullEndElement(writer);
40865 desret_int(ret_val);
40866 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040867 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040868 xmlResetLastError();
40869 if (mem_base != xmlMemBlocks()) {
40870 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040872 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040873 printf(" %d", n_writer);
40874 printf("\n");
40875 }
40876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040877 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040878#endif
40879
Daniel Veillard42595322004-11-08 10:52:06 +000040880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040881}
40882
40883
40884static int
40885test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040887
William M. Brack21e4ef22005-01-02 09:53:13 +000040888#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040889 int mem_base;
40890 int ret_val;
40891 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40892 int n_writer;
40893 int indent; /* do indentation? */
40894 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040895
Daniel Veillarde43cc572004-11-03 11:50:29 +000040896 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40897 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040899 writer = gen_xmlTextWriterPtr(n_writer, 0);
40900 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040901
40902 ret_val = xmlTextWriterSetIndent(writer, indent);
40903 desret_int(ret_val);
40904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040905 des_xmlTextWriterPtr(n_writer, writer, 0);
40906 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040907 xmlResetLastError();
40908 if (mem_base != xmlMemBlocks()) {
40909 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040911 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040912 printf(" %d", n_writer);
40913 printf(" %d", n_indent);
40914 printf("\n");
40915 }
40916 }
40917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040918 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040919#endif
40920
Daniel Veillard42595322004-11-08 10:52:06 +000040921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040922}
40923
40924
40925static int
40926test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040928
William M. Brack21e4ef22005-01-02 09:53:13 +000040929#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930 int mem_base;
40931 int ret_val;
40932 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40933 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040934 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040935 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040936
Daniel Veillarde43cc572004-11-03 11:50:29 +000040937 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40938 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040940 writer = gen_xmlTextWriterPtr(n_writer, 0);
40941 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040942
William M. Brackf13f77f2004-11-12 16:03:48 +000040943 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040944 desret_int(ret_val);
40945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040946 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040947 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040948 xmlResetLastError();
40949 if (mem_base != xmlMemBlocks()) {
40950 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040952 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040953 printf(" %d", n_writer);
40954 printf(" %d", n_str);
40955 printf("\n");
40956 }
40957 }
40958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040959 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040960#endif
40961
Daniel Veillard42595322004-11-08 10:52:06 +000040962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040963}
40964
40965
40966static int
40967test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040969
William M. Brack21e4ef22005-01-02 09:53:13 +000040970#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040971 int mem_base;
40972 int ret_val;
40973 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40974 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040975 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040976 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040977
Daniel Veillarde43cc572004-11-03 11:50:29 +000040978 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40979 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040981 writer = gen_xmlTextWriterPtr(n_writer, 0);
40982 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040983
William M. Brackf13f77f2004-11-12 16:03:48 +000040984 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040985 desret_int(ret_val);
40986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040987 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040988 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040989 xmlResetLastError();
40990 if (mem_base != xmlMemBlocks()) {
40991 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
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(" %d", n_name);
40996 printf("\n");
40997 }
40998 }
40999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041000 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041001#endif
41002
Daniel Veillard42595322004-11-08 10:52:06 +000041003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041004}
41005
41006
41007static int
41008test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041010
William M. Brack21e4ef22005-01-02 09:53:13 +000041011#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041012 int mem_base;
41013 int ret_val;
41014 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41015 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041016 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041017 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041018 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041019 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041020 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041021 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041022
Daniel Veillarde43cc572004-11-03 11:50:29 +000041023 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41024 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41025 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41026 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041028 writer = gen_xmlTextWriterPtr(n_writer, 0);
41029 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41030 name = gen_const_xmlChar_ptr(n_name, 2);
41031 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041032
William M. Brackf13f77f2004-11-12 16:03:48 +000041033 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041034 desret_int(ret_val);
41035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041036 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041037 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41038 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41039 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041040 xmlResetLastError();
41041 if (mem_base != xmlMemBlocks()) {
41042 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
41043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041044 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041045 printf(" %d", n_writer);
41046 printf(" %d", n_prefix);
41047 printf(" %d", n_name);
41048 printf(" %d", n_namespaceURI);
41049 printf("\n");
41050 }
41051 }
41052 }
41053 }
41054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041055 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041056#endif
41057
Daniel Veillard42595322004-11-08 10:52:06 +000041058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041059}
41060
41061
41062static int
41063test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041065
William M. Brack21e4ef22005-01-02 09:53:13 +000041066#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041067 int mem_base;
41068 int ret_val;
41069 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41070 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041071
Daniel Veillarde43cc572004-11-03 11:50:29 +000041072 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041074 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041075
41076 ret_val = xmlTextWriterStartCDATA(writer);
41077 desret_int(ret_val);
41078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041079 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041080 xmlResetLastError();
41081 if (mem_base != xmlMemBlocks()) {
41082 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
41083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041084 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041085 printf(" %d", n_writer);
41086 printf("\n");
41087 }
41088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041089 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041090#endif
41091
Daniel Veillard42595322004-11-08 10:52:06 +000041092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041093}
41094
41095
41096static int
41097test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041099
William M. Brack21e4ef22005-01-02 09:53:13 +000041100#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041101 int mem_base;
41102 int ret_val;
41103 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41104 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041105
Daniel Veillarde43cc572004-11-03 11:50:29 +000041106 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041108 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041109
41110 ret_val = xmlTextWriterStartComment(writer);
41111 desret_int(ret_val);
41112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041113 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041114 xmlResetLastError();
41115 if (mem_base != xmlMemBlocks()) {
41116 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041118 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041119 printf(" %d", n_writer);
41120 printf("\n");
41121 }
41122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041123 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041124#endif
41125
Daniel Veillard42595322004-11-08 10:52:06 +000041126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041127}
41128
41129
41130static int
41131test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041133
William M. Brack21e4ef22005-01-02 09:53:13 +000041134#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041135 int mem_base;
41136 int ret_val;
41137 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41138 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041139 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041140 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041141 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041142 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041143 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041144 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041145
Daniel Veillarde43cc572004-11-03 11:50:29 +000041146 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41147 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41148 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41149 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41150 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041151 writer = gen_xmlTextWriterPtr(n_writer, 0);
41152 name = gen_const_xmlChar_ptr(n_name, 1);
41153 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41154 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041155
William M. Brackf13f77f2004-11-12 16:03:48 +000041156 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041157 desret_int(ret_val);
41158 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041159 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041160 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41161 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41162 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041163 xmlResetLastError();
41164 if (mem_base != xmlMemBlocks()) {
41165 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041167 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041168 printf(" %d", n_writer);
41169 printf(" %d", n_name);
41170 printf(" %d", n_pubid);
41171 printf(" %d", n_sysid);
41172 printf("\n");
41173 }
41174 }
41175 }
41176 }
41177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041178 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179#endif
41180
Daniel Veillard42595322004-11-08 10:52:06 +000041181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041182}
41183
41184
41185static int
41186test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041188
William M. Brack21e4ef22005-01-02 09:53:13 +000041189#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041190 int mem_base;
41191 int ret_val;
41192 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41193 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041194 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041195 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041196
Daniel Veillarde43cc572004-11-03 11:50:29 +000041197 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41198 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041200 writer = gen_xmlTextWriterPtr(n_writer, 0);
41201 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041202
William M. Brackf13f77f2004-11-12 16:03:48 +000041203 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041204 desret_int(ret_val);
41205 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041206 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041207 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041208 xmlResetLastError();
41209 if (mem_base != xmlMemBlocks()) {
41210 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041212 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041213 printf(" %d", n_writer);
41214 printf(" %d", n_name);
41215 printf("\n");
41216 }
41217 }
41218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041219 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041220#endif
41221
Daniel Veillard42595322004-11-08 10:52:06 +000041222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041223}
41224
41225
41226static int
41227test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041229
William M. Brack21e4ef22005-01-02 09:53:13 +000041230#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041231 int mem_base;
41232 int ret_val;
41233 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41234 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041235 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041236 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041237
Daniel Veillarde43cc572004-11-03 11:50:29 +000041238 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41239 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41240 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041241 writer = gen_xmlTextWriterPtr(n_writer, 0);
41242 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041243
William M. Brackf13f77f2004-11-12 16:03:48 +000041244 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041245 desret_int(ret_val);
41246 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041247 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041248 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041249 xmlResetLastError();
41250 if (mem_base != xmlMemBlocks()) {
41251 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041253 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041254 printf(" %d", n_writer);
41255 printf(" %d", n_name);
41256 printf("\n");
41257 }
41258 }
41259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041260 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041261#endif
41262
Daniel Veillard42595322004-11-08 10:52:06 +000041263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041264}
41265
41266
41267static int
41268test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041270
William M. Brack21e4ef22005-01-02 09:53:13 +000041271#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041272 int mem_base;
41273 int ret_val;
41274 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41275 int n_writer;
41276 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41277 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041278 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041280
Daniel Veillarde43cc572004-11-03 11:50:29 +000041281 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41282 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41283 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41284 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041285 writer = gen_xmlTextWriterPtr(n_writer, 0);
41286 pe = gen_int(n_pe, 1);
41287 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041288
William M. Brackf13f77f2004-11-12 16:03:48 +000041289 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041290 desret_int(ret_val);
41291 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041292 des_xmlTextWriterPtr(n_writer, writer, 0);
41293 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041294 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041295 xmlResetLastError();
41296 if (mem_base != xmlMemBlocks()) {
41297 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041299 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041300 printf(" %d", n_writer);
41301 printf(" %d", n_pe);
41302 printf(" %d", n_name);
41303 printf("\n");
41304 }
41305 }
41306 }
41307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041308 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041309#endif
41310
Daniel Veillard42595322004-11-08 10:52:06 +000041311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041312}
41313
41314
41315static int
41316test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041318
William M. Brack21e4ef22005-01-02 09:53:13 +000041319#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041320 int mem_base;
41321 int ret_val;
41322 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41323 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041324 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041325 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041326 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041327 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041328 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041329 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041330
Daniel Veillarde43cc572004-11-03 11:50:29 +000041331 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41332 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41333 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41334 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041336 writer = gen_xmlTextWriterPtr(n_writer, 0);
41337 version = gen_const_char_ptr(n_version, 1);
41338 encoding = gen_const_char_ptr(n_encoding, 2);
41339 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041340
William M. Brackf13f77f2004-11-12 16:03:48 +000041341 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041342 desret_int(ret_val);
41343 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041344 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041345 des_const_char_ptr(n_version, (const char *)version, 1);
41346 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41347 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041348 xmlResetLastError();
41349 if (mem_base != xmlMemBlocks()) {
41350 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041352 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041353 printf(" %d", n_writer);
41354 printf(" %d", n_version);
41355 printf(" %d", n_encoding);
41356 printf(" %d", n_standalone);
41357 printf("\n");
41358 }
41359 }
41360 }
41361 }
41362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041363 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041364#endif
41365
Daniel Veillard42595322004-11-08 10:52:06 +000041366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041367}
41368
41369
41370static int
41371test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041373
William M. Brack21e4ef22005-01-02 09:53:13 +000041374#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041375 int mem_base;
41376 int ret_val;
41377 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41378 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041379 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041380 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041381
Daniel Veillarde43cc572004-11-03 11:50:29 +000041382 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41383 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41384 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041385 writer = gen_xmlTextWriterPtr(n_writer, 0);
41386 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041387
William M. Brackf13f77f2004-11-12 16:03:48 +000041388 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041389 desret_int(ret_val);
41390 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041391 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041392 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041393 xmlResetLastError();
41394 if (mem_base != xmlMemBlocks()) {
41395 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041397 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041398 printf(" %d", n_writer);
41399 printf(" %d", n_name);
41400 printf("\n");
41401 }
41402 }
41403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041404 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041405#endif
41406
Daniel Veillard42595322004-11-08 10:52:06 +000041407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041408}
41409
41410
41411static int
41412test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041414
William M. Brack21e4ef22005-01-02 09:53:13 +000041415#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041416 int mem_base;
41417 int ret_val;
41418 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41419 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041420 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041421 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041422 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041424 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041425 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041426
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41428 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41429 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41430 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41431 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041432 writer = gen_xmlTextWriterPtr(n_writer, 0);
41433 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41434 name = gen_const_xmlChar_ptr(n_name, 2);
41435 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041436
William M. Brackf13f77f2004-11-12 16:03:48 +000041437 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438 desret_int(ret_val);
41439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041440 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041441 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41442 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41443 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041444 xmlResetLastError();
41445 if (mem_base != xmlMemBlocks()) {
41446 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041448 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041449 printf(" %d", n_writer);
41450 printf(" %d", n_prefix);
41451 printf(" %d", n_name);
41452 printf(" %d", n_namespaceURI);
41453 printf("\n");
41454 }
41455 }
41456 }
41457 }
41458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041459 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041460#endif
41461
Daniel Veillard42595322004-11-08 10:52:06 +000041462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041463}
41464
41465
41466static int
41467test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041469
William M. Brack21e4ef22005-01-02 09:53:13 +000041470#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041471 int mem_base;
41472 int ret_val;
41473 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41474 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041475 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041476 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041477
Daniel Veillarde43cc572004-11-03 11:50:29 +000041478 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41479 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041481 writer = gen_xmlTextWriterPtr(n_writer, 0);
41482 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041483
William M. Brackf13f77f2004-11-12 16:03:48 +000041484 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041485 desret_int(ret_val);
41486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041487 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041488 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041489 xmlResetLastError();
41490 if (mem_base != xmlMemBlocks()) {
41491 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041493 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041494 printf(" %d", n_writer);
41495 printf(" %d", n_target);
41496 printf("\n");
41497 }
41498 }
41499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041500 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041501#endif
41502
Daniel Veillard42595322004-11-08 10:52:06 +000041503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041504}
41505
41506
41507static int
41508test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041510
William M. Brack21e4ef22005-01-02 09:53:13 +000041511#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041512 int mem_base;
41513 int ret_val;
41514 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41515 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041516 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041517 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041518 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041519 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041520
Daniel Veillarde43cc572004-11-03 11:50:29 +000041521 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41522 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41523 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041525 writer = gen_xmlTextWriterPtr(n_writer, 0);
41526 name = gen_const_xmlChar_ptr(n_name, 1);
41527 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041528
William M. Brackf13f77f2004-11-12 16:03:48 +000041529 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041530 desret_int(ret_val);
41531 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041532 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041533 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41534 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041535 xmlResetLastError();
41536 if (mem_base != xmlMemBlocks()) {
41537 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041539 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041540 printf(" %d", n_writer);
41541 printf(" %d", n_name);
41542 printf(" %d", n_content);
41543 printf("\n");
41544 }
41545 }
41546 }
41547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041548 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041549#endif
41550
Daniel Veillard42595322004-11-08 10:52:06 +000041551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041552}
41553
41554
41555static int
41556test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041558
William M. Brack21e4ef22005-01-02 09:53:13 +000041559#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041560 int mem_base;
41561 int ret_val;
41562 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41563 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041564 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041565 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041566 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041567 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041568 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041569 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041570 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041572
Daniel Veillarde43cc572004-11-03 11:50:29 +000041573 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41574 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41575 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41576 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41577 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041579 writer = gen_xmlTextWriterPtr(n_writer, 0);
41580 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41581 name = gen_const_xmlChar_ptr(n_name, 2);
41582 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41583 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041584
William M. Brackf13f77f2004-11-12 16:03:48 +000041585 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041586 desret_int(ret_val);
41587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041588 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041589 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41590 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41591 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41592 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041593 xmlResetLastError();
41594 if (mem_base != xmlMemBlocks()) {
41595 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041597 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041598 printf(" %d", n_writer);
41599 printf(" %d", n_prefix);
41600 printf(" %d", n_name);
41601 printf(" %d", n_namespaceURI);
41602 printf(" %d", n_content);
41603 printf("\n");
41604 }
41605 }
41606 }
41607 }
41608 }
41609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041610 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041611#endif
41612
Daniel Veillard42595322004-11-08 10:52:06 +000041613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041614}
41615
41616
41617static int
41618test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041620
William M. Brack21e4ef22005-01-02 09:53:13 +000041621#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041622 int mem_base;
41623 int ret_val;
41624 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41625 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041626 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041627 int n_data;
41628 int start; /* the position within the data of the first byte to encode */
41629 int n_start;
41630 int len; /* the number of bytes to encode */
41631 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041632
Daniel Veillarde43cc572004-11-03 11:50:29 +000041633 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41634 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41635 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41636 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41637 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041638 writer = gen_xmlTextWriterPtr(n_writer, 0);
41639 data = gen_const_char_ptr(n_data, 1);
41640 start = gen_int(n_start, 2);
41641 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041642
William M. Brackf13f77f2004-11-12 16:03:48 +000041643 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041644 desret_int(ret_val);
41645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041646 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041647 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041648 des_int(n_start, start, 2);
41649 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041650 xmlResetLastError();
41651 if (mem_base != xmlMemBlocks()) {
41652 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041654 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041655 printf(" %d", n_writer);
41656 printf(" %d", n_data);
41657 printf(" %d", n_start);
41658 printf(" %d", n_len);
41659 printf("\n");
41660 }
41661 }
41662 }
41663 }
41664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041665 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041666#endif
41667
Daniel Veillard42595322004-11-08 10:52:06 +000041668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041669}
41670
41671
41672static int
41673test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041675
William M. Brack21e4ef22005-01-02 09:53:13 +000041676#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041677 int mem_base;
41678 int ret_val;
41679 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41680 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041681 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041682 int n_data;
41683 int start; /* the position within the data of the first byte to encode */
41684 int n_start;
41685 int len; /* the number of bytes to encode */
41686 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041687
Daniel Veillarde43cc572004-11-03 11:50:29 +000041688 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41689 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41690 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41691 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41692 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041693 writer = gen_xmlTextWriterPtr(n_writer, 0);
41694 data = gen_const_char_ptr(n_data, 1);
41695 start = gen_int(n_start, 2);
41696 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041697
William M. Brackf13f77f2004-11-12 16:03:48 +000041698 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041699 desret_int(ret_val);
41700 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041701 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041702 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041703 des_int(n_start, start, 2);
41704 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041705 xmlResetLastError();
41706 if (mem_base != xmlMemBlocks()) {
41707 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041709 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041710 printf(" %d", n_writer);
41711 printf(" %d", n_data);
41712 printf(" %d", n_start);
41713 printf(" %d", n_len);
41714 printf("\n");
41715 }
41716 }
41717 }
41718 }
41719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041720 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041721#endif
41722
Daniel Veillard42595322004-11-08 10:52:06 +000041723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041724}
41725
41726
41727static int
41728test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041730
William M. Brack21e4ef22005-01-02 09:53:13 +000041731#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041732 int mem_base;
41733 int ret_val;
41734 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41735 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041736 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041737 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041738
Daniel Veillarde43cc572004-11-03 11:50:29 +000041739 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41740 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041742 writer = gen_xmlTextWriterPtr(n_writer, 0);
41743 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041744
William M. Brackf13f77f2004-11-12 16:03:48 +000041745 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041746 desret_int(ret_val);
41747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041748 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041749 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041750 xmlResetLastError();
41751 if (mem_base != xmlMemBlocks()) {
41752 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041754 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041755 printf(" %d", n_writer);
41756 printf(" %d", n_content);
41757 printf("\n");
41758 }
41759 }
41760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041761 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041762#endif
41763
Daniel Veillard42595322004-11-08 10:52:06 +000041764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041765}
41766
41767
41768static int
41769test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041771
William M. Brack21e4ef22005-01-02 09:53:13 +000041772#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041773 int mem_base;
41774 int ret_val;
41775 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41776 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041777 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041778 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041779
Daniel Veillarde43cc572004-11-03 11:50:29 +000041780 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41781 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041783 writer = gen_xmlTextWriterPtr(n_writer, 0);
41784 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041785
William M. Brackf13f77f2004-11-12 16:03:48 +000041786 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041787 desret_int(ret_val);
41788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041789 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041790 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041791 xmlResetLastError();
41792 if (mem_base != xmlMemBlocks()) {
41793 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041795 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041796 printf(" %d", n_writer);
41797 printf(" %d", n_content);
41798 printf("\n");
41799 }
41800 }
41801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041802 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041803#endif
41804
Daniel Veillard42595322004-11-08 10:52:06 +000041805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041806}
41807
41808
41809static int
41810test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041812
William M. Brack21e4ef22005-01-02 09:53:13 +000041813#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814 int mem_base;
41815 int ret_val;
41816 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41817 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041818 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041819 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041820 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041821 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041822 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041823 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041824 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041825 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041826
Daniel Veillarde43cc572004-11-03 11:50:29 +000041827 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41828 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41829 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41830 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41831 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41832 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041833 writer = gen_xmlTextWriterPtr(n_writer, 0);
41834 name = gen_const_xmlChar_ptr(n_name, 1);
41835 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41836 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41837 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041838
William M. Brackf13f77f2004-11-12 16:03:48 +000041839 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041840 desret_int(ret_val);
41841 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041842 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041843 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41844 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41845 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41846 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041847 xmlResetLastError();
41848 if (mem_base != xmlMemBlocks()) {
41849 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041851 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041852 printf(" %d", n_writer);
41853 printf(" %d", n_name);
41854 printf(" %d", n_pubid);
41855 printf(" %d", n_sysid);
41856 printf(" %d", n_subset);
41857 printf("\n");
41858 }
41859 }
41860 }
41861 }
41862 }
41863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041864 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041865#endif
41866
Daniel Veillard42595322004-11-08 10:52:06 +000041867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041868}
41869
41870
41871static int
41872test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041874
William M. Brack21e4ef22005-01-02 09:53:13 +000041875#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041876 int mem_base;
41877 int ret_val;
41878 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41879 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041880 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041881 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041882 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041883 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041884
Daniel Veillarde43cc572004-11-03 11:50:29 +000041885 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41886 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41887 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041889 writer = gen_xmlTextWriterPtr(n_writer, 0);
41890 name = gen_const_xmlChar_ptr(n_name, 1);
41891 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041892
William M. Brackf13f77f2004-11-12 16:03:48 +000041893 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041894 desret_int(ret_val);
41895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041896 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041897 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41898 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041899 xmlResetLastError();
41900 if (mem_base != xmlMemBlocks()) {
41901 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041903 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041904 printf(" %d", n_writer);
41905 printf(" %d", n_name);
41906 printf(" %d", n_content);
41907 printf("\n");
41908 }
41909 }
41910 }
41911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041912 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041913#endif
41914
Daniel Veillard42595322004-11-08 10:52:06 +000041915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916}
41917
41918
41919static int
41920test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041922
William M. Brack21e4ef22005-01-02 09:53:13 +000041923#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041924 int mem_base;
41925 int ret_val;
41926 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41927 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041928 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041929 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041930 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041931 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041932
Daniel Veillarde43cc572004-11-03 11:50:29 +000041933 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41934 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41935 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041937 writer = gen_xmlTextWriterPtr(n_writer, 0);
41938 name = gen_const_xmlChar_ptr(n_name, 1);
41939 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041940
William M. Brackf13f77f2004-11-12 16:03:48 +000041941 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041942 desret_int(ret_val);
41943 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041944 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41946 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041947 xmlResetLastError();
41948 if (mem_base != xmlMemBlocks()) {
41949 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041951 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041952 printf(" %d", n_writer);
41953 printf(" %d", n_name);
41954 printf(" %d", n_content);
41955 printf("\n");
41956 }
41957 }
41958 }
41959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041960 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041961#endif
41962
Daniel Veillard42595322004-11-08 10:52:06 +000041963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041964}
41965
41966
41967static int
41968test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041970
William M. Brack21e4ef22005-01-02 09:53:13 +000041971#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041972 int mem_base;
41973 int ret_val;
41974 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41975 int n_writer;
41976 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41977 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041978 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041979 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041980 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041981 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041982 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041983 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041984 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041985 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041986 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041987 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041988
Daniel Veillarde43cc572004-11-03 11:50:29 +000041989 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41990 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41991 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41992 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41993 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41994 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41995 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041997 writer = gen_xmlTextWriterPtr(n_writer, 0);
41998 pe = gen_int(n_pe, 1);
41999 name = gen_const_xmlChar_ptr(n_name, 2);
42000 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42001 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42002 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
42003 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042004
William M. Brackf13f77f2004-11-12 16:03:48 +000042005 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 +000042006 desret_int(ret_val);
42007 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042008 des_xmlTextWriterPtr(n_writer, writer, 0);
42009 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042010 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42011 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42012 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42013 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
42014 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042015 xmlResetLastError();
42016 if (mem_base != xmlMemBlocks()) {
42017 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
42018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042019 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042020 printf(" %d", n_writer);
42021 printf(" %d", n_pe);
42022 printf(" %d", n_name);
42023 printf(" %d", n_pubid);
42024 printf(" %d", n_sysid);
42025 printf(" %d", n_ndataid);
42026 printf(" %d", n_content);
42027 printf("\n");
42028 }
42029 }
42030 }
42031 }
42032 }
42033 }
42034 }
42035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042036 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042037#endif
42038
Daniel Veillard42595322004-11-08 10:52:06 +000042039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042040}
42041
42042
42043static int
42044test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046
William M. Brack21e4ef22005-01-02 09:53:13 +000042047#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042048 int mem_base;
42049 int ret_val;
42050 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42051 int n_writer;
42052 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42053 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042054 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042055 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042056 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042057 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042058 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042059 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042060 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042061 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062
Daniel Veillarde43cc572004-11-03 11:50:29 +000042063 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42064 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42065 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42066 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42067 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42068 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42069 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042070 writer = gen_xmlTextWriterPtr(n_writer, 0);
42071 pe = gen_int(n_pe, 1);
42072 name = gen_const_xmlChar_ptr(n_name, 2);
42073 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42074 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42075 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042076
William M. Brackf13f77f2004-11-12 16:03:48 +000042077 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042078 desret_int(ret_val);
42079 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042080 des_xmlTextWriterPtr(n_writer, writer, 0);
42081 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042082 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42083 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42084 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42085 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042086 xmlResetLastError();
42087 if (mem_base != xmlMemBlocks()) {
42088 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
42089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042090 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042091 printf(" %d", n_writer);
42092 printf(" %d", n_pe);
42093 printf(" %d", n_name);
42094 printf(" %d", n_pubid);
42095 printf(" %d", n_sysid);
42096 printf(" %d", n_ndataid);
42097 printf("\n");
42098 }
42099 }
42100 }
42101 }
42102 }
42103 }
42104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042105 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042106#endif
42107
Daniel Veillard42595322004-11-08 10:52:06 +000042108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042109}
42110
42111
42112static int
42113test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042115
William M. Brack21e4ef22005-01-02 09:53:13 +000042116#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042117 int mem_base;
42118 int ret_val;
42119 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42120 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042121 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042122 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042123 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042124 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042125 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042126 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042127
Daniel Veillarde43cc572004-11-03 11:50:29 +000042128 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42129 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42130 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42131 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42132 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042133 writer = gen_xmlTextWriterPtr(n_writer, 0);
42134 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42135 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42136 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042137
William M. Brackf13f77f2004-11-12 16:03:48 +000042138 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042139 desret_int(ret_val);
42140 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042141 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042142 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42143 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42144 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042145 xmlResetLastError();
42146 if (mem_base != xmlMemBlocks()) {
42147 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042149 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042150 printf(" %d", n_writer);
42151 printf(" %d", n_pubid);
42152 printf(" %d", n_sysid);
42153 printf(" %d", n_ndataid);
42154 printf("\n");
42155 }
42156 }
42157 }
42158 }
42159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042160 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042161#endif
42162
Daniel Veillard42595322004-11-08 10:52:06 +000042163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042164}
42165
42166
42167static int
42168test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042170
William M. Brack21e4ef22005-01-02 09:53:13 +000042171#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042172 int mem_base;
42173 int ret_val;
42174 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42175 int n_writer;
42176 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42177 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042178 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042179 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042180 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042181 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042182
Daniel Veillarde43cc572004-11-03 11:50:29 +000042183 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42184 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42185 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42186 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042188 writer = gen_xmlTextWriterPtr(n_writer, 0);
42189 pe = gen_int(n_pe, 1);
42190 name = gen_const_xmlChar_ptr(n_name, 2);
42191 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042192
William M. Brackf13f77f2004-11-12 16:03:48 +000042193 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042194 desret_int(ret_val);
42195 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042196 des_xmlTextWriterPtr(n_writer, writer, 0);
42197 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42199 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042200 xmlResetLastError();
42201 if (mem_base != xmlMemBlocks()) {
42202 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042204 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042205 printf(" %d", n_writer);
42206 printf(" %d", n_pe);
42207 printf(" %d", n_name);
42208 printf(" %d", n_content);
42209 printf("\n");
42210 }
42211 }
42212 }
42213 }
42214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042215 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042216#endif
42217
Daniel Veillard42595322004-11-08 10:52:06 +000042218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042219}
42220
42221
42222static int
42223test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042225
William M. Brack21e4ef22005-01-02 09:53:13 +000042226#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042227 int mem_base;
42228 int ret_val;
42229 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42230 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042231 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042232 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042233 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042234 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042235 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042236 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042237
Daniel Veillarde43cc572004-11-03 11:50:29 +000042238 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42239 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42240 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42241 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042243 writer = gen_xmlTextWriterPtr(n_writer, 0);
42244 name = gen_const_xmlChar_ptr(n_name, 1);
42245 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42246 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042247
William M. Brackf13f77f2004-11-12 16:03:48 +000042248 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042249 desret_int(ret_val);
42250 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042251 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042252 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42253 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42254 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042255 xmlResetLastError();
42256 if (mem_base != xmlMemBlocks()) {
42257 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042259 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042260 printf(" %d", n_writer);
42261 printf(" %d", n_name);
42262 printf(" %d", n_pubid);
42263 printf(" %d", n_sysid);
42264 printf("\n");
42265 }
42266 }
42267 }
42268 }
42269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042270 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042271#endif
42272
Daniel Veillard42595322004-11-08 10:52:06 +000042273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042274}
42275
42276
42277static int
42278test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042280
William M. Brack21e4ef22005-01-02 09:53:13 +000042281#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042282 int mem_base;
42283 int ret_val;
42284 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42285 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042286 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042287 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042288 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042289 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042290
Daniel Veillarde43cc572004-11-03 11:50:29 +000042291 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42292 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42293 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042295 writer = gen_xmlTextWriterPtr(n_writer, 0);
42296 name = gen_const_xmlChar_ptr(n_name, 1);
42297 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042298
William M. Brackf13f77f2004-11-12 16:03:48 +000042299 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042300 desret_int(ret_val);
42301 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042302 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042303 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42304 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042305 xmlResetLastError();
42306 if (mem_base != xmlMemBlocks()) {
42307 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042309 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042310 printf(" %d", n_writer);
42311 printf(" %d", n_name);
42312 printf(" %d", n_content);
42313 printf("\n");
42314 }
42315 }
42316 }
42317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042318 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042319#endif
42320
Daniel Veillard42595322004-11-08 10:52:06 +000042321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042322}
42323
42324
42325static int
42326test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042328
William M. Brack21e4ef22005-01-02 09:53:13 +000042329#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042330 int mem_base;
42331 int ret_val;
42332 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42333 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042334 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042335 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042336 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042337 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042338 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042339 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042340 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042341 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042342
Daniel Veillarde43cc572004-11-03 11:50:29 +000042343 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42344 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42345 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42346 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42347 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042349 writer = gen_xmlTextWriterPtr(n_writer, 0);
42350 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42351 name = gen_const_xmlChar_ptr(n_name, 2);
42352 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42353 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042354
William M. Brackf13f77f2004-11-12 16:03:48 +000042355 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042356 desret_int(ret_val);
42357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042358 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042359 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42360 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42361 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42362 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042363 xmlResetLastError();
42364 if (mem_base != xmlMemBlocks()) {
42365 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042367 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042368 printf(" %d", n_writer);
42369 printf(" %d", n_prefix);
42370 printf(" %d", n_name);
42371 printf(" %d", n_namespaceURI);
42372 printf(" %d", n_content);
42373 printf("\n");
42374 }
42375 }
42376 }
42377 }
42378 }
42379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042380 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042381#endif
42382
Daniel Veillard42595322004-11-08 10:52:06 +000042383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384}
42385
42386
42387static int
42388test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390
42391
42392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042394}
42395
42396
42397static int
42398test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042400
42401
42402 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042404}
42405
42406
42407static int
42408test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042410
42411
42412 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042414}
42415
42416
42417static int
42418test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042420
42421
42422 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042424}
42425
42426
42427static int
42428test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042430
42431
42432 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042434}
42435
42436
42437static int
42438test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042440
42441
42442 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042444}
42445
42446
42447static int
42448test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042450
42451
42452 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042454}
42455
42456
42457static int
42458test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042460
42461
42462 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042464}
42465
42466
42467static int
42468test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042470
42471
42472 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042474}
42475
42476
42477static int
42478test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042480
42481
42482 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042484}
42485
42486
42487static int
42488test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042490
42491
42492 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042494}
42495
42496
42497static int
42498test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042500
42501
42502 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042504}
42505
42506
42507static int
42508test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042510
42511
42512 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042514}
42515
42516
42517static int
42518test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042520
William M. Brack21e4ef22005-01-02 09:53:13 +000042521#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042522 int mem_base;
42523 int ret_val;
42524 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42525 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042526 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042527 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042528 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042529 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042530
Daniel Veillarde43cc572004-11-03 11:50:29 +000042531 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42532 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42533 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042535 writer = gen_xmlTextWriterPtr(n_writer, 0);
42536 target = gen_const_xmlChar_ptr(n_target, 1);
42537 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042538
William M. Brackf13f77f2004-11-12 16:03:48 +000042539 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042540 desret_int(ret_val);
42541 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042542 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042543 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42544 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042545 xmlResetLastError();
42546 if (mem_base != xmlMemBlocks()) {
42547 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042549 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042550 printf(" %d", n_writer);
42551 printf(" %d", n_target);
42552 printf(" %d", n_content);
42553 printf("\n");
42554 }
42555 }
42556 }
42557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042558 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042559#endif
42560
Daniel Veillard42595322004-11-08 10:52:06 +000042561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042562}
42563
42564
42565static int
42566test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042568
William M. Brack21e4ef22005-01-02 09:53:13 +000042569#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042570 int mem_base;
42571 int ret_val;
42572 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42573 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042574 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042575 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042576
Daniel Veillarde43cc572004-11-03 11:50:29 +000042577 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42578 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042580 writer = gen_xmlTextWriterPtr(n_writer, 0);
42581 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042582
William M. Brackf13f77f2004-11-12 16:03:48 +000042583 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042584 desret_int(ret_val);
42585 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042586 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042587 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042588 xmlResetLastError();
42589 if (mem_base != xmlMemBlocks()) {
42590 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042592 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042593 printf(" %d", n_writer);
42594 printf(" %d", n_content);
42595 printf("\n");
42596 }
42597 }
42598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042599 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042600#endif
42601
Daniel Veillard42595322004-11-08 10:52:06 +000042602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042603}
42604
42605
42606static int
42607test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042609
William M. Brack21e4ef22005-01-02 09:53:13 +000042610#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042611 int mem_base;
42612 int ret_val;
42613 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42614 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042615 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042616 int n_content;
42617 int len; /* length of the text string */
42618 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042619
Daniel Veillarde43cc572004-11-03 11:50:29 +000042620 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42621 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42622 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042624 writer = gen_xmlTextWriterPtr(n_writer, 0);
42625 content = gen_const_xmlChar_ptr(n_content, 1);
42626 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042627
William M. Brackf13f77f2004-11-12 16:03:48 +000042628 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042629 desret_int(ret_val);
42630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042631 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042632 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042633 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042634 xmlResetLastError();
42635 if (mem_base != xmlMemBlocks()) {
42636 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042638 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042639 printf(" %d", n_writer);
42640 printf(" %d", n_content);
42641 printf(" %d", n_len);
42642 printf("\n");
42643 }
42644 }
42645 }
42646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042647 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042648#endif
42649
Daniel Veillard42595322004-11-08 10:52:06 +000042650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042651}
42652
42653
42654static int
42655test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042657
William M. Brack21e4ef22005-01-02 09:53:13 +000042658#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042659 int mem_base;
42660 int ret_val;
42661 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42662 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042663 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042664 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042665
Daniel Veillarde43cc572004-11-03 11:50:29 +000042666 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42667 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042669 writer = gen_xmlTextWriterPtr(n_writer, 0);
42670 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042671
William M. Brackf13f77f2004-11-12 16:03:48 +000042672 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042673 desret_int(ret_val);
42674 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042675 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042676 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042677 xmlResetLastError();
42678 if (mem_base != xmlMemBlocks()) {
42679 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042681 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042682 printf(" %d", n_writer);
42683 printf(" %d", n_content);
42684 printf("\n");
42685 }
42686 }
42687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042688 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042689#endif
42690
Daniel Veillard42595322004-11-08 10:52:06 +000042691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042692}
42693
42694
42695static int
42696test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042698
42699
42700 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042702}
42703
42704
42705static int
42706test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042708
42709
42710 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042712}
42713
42714
42715static int
42716test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042718
42719
42720 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042722}
42723
42724
42725static int
42726test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042728
42729
42730 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042732}
42733
42734
42735static int
42736test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042738
42739
42740 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042742}
42743
42744
42745static int
42746test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042748
42749
42750 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042752}
42753
42754
42755static int
42756test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042758
42759
42760 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042762}
42763
42764
42765static int
42766test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042768
42769
42770 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042772}
42773
42774
42775static int
42776test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042778
42779
42780 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042782}
42783
42784
42785static int
42786test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042788
42789
42790 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042792}
42793
42794
42795static int
42796test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042798
42799
42800 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042802}
42803
42804
42805static int
42806test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042808
42809
42810 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042812}
42813
42814
42815static int
42816test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042818
42819
42820 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042822}
42823
42824static int
42825test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042827
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042828 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042829 test_ret += test_xmlNewTextWriter();
42830 test_ret += test_xmlNewTextWriterFilename();
42831 test_ret += test_xmlNewTextWriterMemory();
42832 test_ret += test_xmlNewTextWriterPushParser();
42833 test_ret += test_xmlNewTextWriterTree();
42834 test_ret += test_xmlTextWriterEndAttribute();
42835 test_ret += test_xmlTextWriterEndCDATA();
42836 test_ret += test_xmlTextWriterEndComment();
42837 test_ret += test_xmlTextWriterEndDTD();
42838 test_ret += test_xmlTextWriterEndDTDAttlist();
42839 test_ret += test_xmlTextWriterEndDTDElement();
42840 test_ret += test_xmlTextWriterEndDTDEntity();
42841 test_ret += test_xmlTextWriterEndDocument();
42842 test_ret += test_xmlTextWriterEndElement();
42843 test_ret += test_xmlTextWriterEndPI();
42844 test_ret += test_xmlTextWriterFlush();
42845 test_ret += test_xmlTextWriterFullEndElement();
42846 test_ret += test_xmlTextWriterSetIndent();
42847 test_ret += test_xmlTextWriterSetIndentString();
42848 test_ret += test_xmlTextWriterStartAttribute();
42849 test_ret += test_xmlTextWriterStartAttributeNS();
42850 test_ret += test_xmlTextWriterStartCDATA();
42851 test_ret += test_xmlTextWriterStartComment();
42852 test_ret += test_xmlTextWriterStartDTD();
42853 test_ret += test_xmlTextWriterStartDTDAttlist();
42854 test_ret += test_xmlTextWriterStartDTDElement();
42855 test_ret += test_xmlTextWriterStartDTDEntity();
42856 test_ret += test_xmlTextWriterStartDocument();
42857 test_ret += test_xmlTextWriterStartElement();
42858 test_ret += test_xmlTextWriterStartElementNS();
42859 test_ret += test_xmlTextWriterStartPI();
42860 test_ret += test_xmlTextWriterWriteAttribute();
42861 test_ret += test_xmlTextWriterWriteAttributeNS();
42862 test_ret += test_xmlTextWriterWriteBase64();
42863 test_ret += test_xmlTextWriterWriteBinHex();
42864 test_ret += test_xmlTextWriterWriteCDATA();
42865 test_ret += test_xmlTextWriterWriteComment();
42866 test_ret += test_xmlTextWriterWriteDTD();
42867 test_ret += test_xmlTextWriterWriteDTDAttlist();
42868 test_ret += test_xmlTextWriterWriteDTDElement();
42869 test_ret += test_xmlTextWriterWriteDTDEntity();
42870 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42871 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42872 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42873 test_ret += test_xmlTextWriterWriteDTDNotation();
42874 test_ret += test_xmlTextWriterWriteElement();
42875 test_ret += test_xmlTextWriterWriteElementNS();
42876 test_ret += test_xmlTextWriterWriteFormatAttribute();
42877 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42878 test_ret += test_xmlTextWriterWriteFormatCDATA();
42879 test_ret += test_xmlTextWriterWriteFormatComment();
42880 test_ret += test_xmlTextWriterWriteFormatDTD();
42881 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42882 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42883 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42884 test_ret += test_xmlTextWriterWriteFormatElement();
42885 test_ret += test_xmlTextWriterWriteFormatElementNS();
42886 test_ret += test_xmlTextWriterWriteFormatPI();
42887 test_ret += test_xmlTextWriterWriteFormatRaw();
42888 test_ret += test_xmlTextWriterWriteFormatString();
42889 test_ret += test_xmlTextWriterWritePI();
42890 test_ret += test_xmlTextWriterWriteRaw();
42891 test_ret += test_xmlTextWriterWriteRawLen();
42892 test_ret += test_xmlTextWriterWriteString();
42893 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42894 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42895 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42896 test_ret += test_xmlTextWriterWriteVFormatComment();
42897 test_ret += test_xmlTextWriterWriteVFormatDTD();
42898 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42899 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42900 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42901 test_ret += test_xmlTextWriterWriteVFormatElement();
42902 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42903 test_ret += test_xmlTextWriterWriteVFormatPI();
42904 test_ret += test_xmlTextWriterWriteVFormatRaw();
42905 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042906
Daniel Veillard42595322004-11-08 10:52:06 +000042907 if (test_ret != 0)
42908 printf("Module xmlwriter: %d errors\n", test_ret);
42909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042910}
42911
42912static int
42913test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042915
William M. Brack21e4ef22005-01-02 09:53:13 +000042916#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042917 int mem_base;
42918 double ret_val;
42919 int val; /* a boolean */
42920 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042921
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042922 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42923 mem_base = xmlMemBlocks();
42924 val = gen_int(n_val, 0);
42925
42926 ret_val = xmlXPathCastBooleanToNumber(val);
42927 desret_double(ret_val);
42928 call_tests++;
42929 des_int(n_val, val, 0);
42930 xmlResetLastError();
42931 if (mem_base != xmlMemBlocks()) {
42932 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042934 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042935 printf(" %d", n_val);
42936 printf("\n");
42937 }
42938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042939 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042940#endif
42941
Daniel Veillard42595322004-11-08 10:52:06 +000042942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042943}
42944
42945
42946static int
42947test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042949
William M. Brack21e4ef22005-01-02 09:53:13 +000042950#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042951 int mem_base;
42952 xmlChar * ret_val;
42953 int val; /* a boolean */
42954 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042955
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042956 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042958 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042959
42960 ret_val = xmlXPathCastBooleanToString(val);
42961 desret_xmlChar_ptr(ret_val);
42962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042963 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042964 xmlResetLastError();
42965 if (mem_base != xmlMemBlocks()) {
42966 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042968 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042969 printf(" %d", n_val);
42970 printf("\n");
42971 }
42972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042973 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042974#endif
42975
Daniel Veillard42595322004-11-08 10:52:06 +000042976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042977}
42978
42979
42980static int
42981test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042983
William M. Brack21e4ef22005-01-02 09:53:13 +000042984#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042985 int mem_base;
42986 int ret_val;
42987 xmlNodeSetPtr ns; /* a node-set */
42988 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042989
Daniel Veillardce682bc2004-11-05 17:22:25 +000042990 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42991 mem_base = xmlMemBlocks();
42992 ns = gen_xmlNodeSetPtr(n_ns, 0);
42993
42994 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42995 desret_int(ret_val);
42996 call_tests++;
42997 des_xmlNodeSetPtr(n_ns, ns, 0);
42998 xmlResetLastError();
42999 if (mem_base != xmlMemBlocks()) {
43000 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
43001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043002 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043003 printf(" %d", n_ns);
43004 printf("\n");
43005 }
43006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043007 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043008#endif
43009
Daniel Veillard42595322004-11-08 10:52:06 +000043010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043011}
43012
43013
43014static int
43015test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043017
William M. Brack21e4ef22005-01-02 09:53:13 +000043018#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043019 int mem_base;
43020 double ret_val;
43021 xmlNodeSetPtr ns; /* a node-set */
43022 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043023
Daniel Veillardce682bc2004-11-05 17:22:25 +000043024 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43025 mem_base = xmlMemBlocks();
43026 ns = gen_xmlNodeSetPtr(n_ns, 0);
43027
43028 ret_val = xmlXPathCastNodeSetToNumber(ns);
43029 desret_double(ret_val);
43030 call_tests++;
43031 des_xmlNodeSetPtr(n_ns, ns, 0);
43032 xmlResetLastError();
43033 if (mem_base != xmlMemBlocks()) {
43034 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
43035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043036 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043037 printf(" %d", n_ns);
43038 printf("\n");
43039 }
43040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043041 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043042#endif
43043
Daniel Veillard42595322004-11-08 10:52:06 +000043044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043045}
43046
43047
43048static int
43049test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043051
William M. Brack21e4ef22005-01-02 09:53:13 +000043052#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043053 int mem_base;
43054 xmlChar * ret_val;
43055 xmlNodeSetPtr ns; /* a node-set */
43056 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043057
Daniel Veillardce682bc2004-11-05 17:22:25 +000043058 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43059 mem_base = xmlMemBlocks();
43060 ns = gen_xmlNodeSetPtr(n_ns, 0);
43061
43062 ret_val = xmlXPathCastNodeSetToString(ns);
43063 desret_xmlChar_ptr(ret_val);
43064 call_tests++;
43065 des_xmlNodeSetPtr(n_ns, ns, 0);
43066 xmlResetLastError();
43067 if (mem_base != xmlMemBlocks()) {
43068 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
43069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043070 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043071 printf(" %d", n_ns);
43072 printf("\n");
43073 }
43074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043075 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043076#endif
43077
Daniel Veillard42595322004-11-08 10:52:06 +000043078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043079}
43080
43081
43082static int
43083test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043085
William M. Brack21e4ef22005-01-02 09:53:13 +000043086#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043087 int mem_base;
43088 double ret_val;
43089 xmlNodePtr node; /* a node */
43090 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043091
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043092 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43093 mem_base = xmlMemBlocks();
43094 node = gen_xmlNodePtr(n_node, 0);
43095
43096 ret_val = xmlXPathCastNodeToNumber(node);
43097 desret_double(ret_val);
43098 call_tests++;
43099 des_xmlNodePtr(n_node, node, 0);
43100 xmlResetLastError();
43101 if (mem_base != xmlMemBlocks()) {
43102 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043104 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043105 printf(" %d", n_node);
43106 printf("\n");
43107 }
43108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043109 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043110#endif
43111
Daniel Veillard42595322004-11-08 10:52:06 +000043112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043113}
43114
43115
43116static int
43117test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043119
William M. Brack21e4ef22005-01-02 09:53:13 +000043120#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043121 int mem_base;
43122 xmlChar * ret_val;
43123 xmlNodePtr node; /* a node */
43124 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043125
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043126 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043128 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043129
43130 ret_val = xmlXPathCastNodeToString(node);
43131 desret_xmlChar_ptr(ret_val);
43132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043133 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043134 xmlResetLastError();
43135 if (mem_base != xmlMemBlocks()) {
43136 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043138 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043139 printf(" %d", n_node);
43140 printf("\n");
43141 }
43142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043143 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043144#endif
43145
Daniel Veillard42595322004-11-08 10:52:06 +000043146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043147}
43148
43149
43150static int
43151test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043153
William M. Brack21e4ef22005-01-02 09:53:13 +000043154#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043155 int mem_base;
43156 int ret_val;
43157 double val; /* a number */
43158 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043159
Daniel Veillard3d95c732004-11-06 22:25:14 +000043160 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43161 mem_base = xmlMemBlocks();
43162 val = gen_double(n_val, 0);
43163
43164 ret_val = xmlXPathCastNumberToBoolean(val);
43165 desret_int(ret_val);
43166 call_tests++;
43167 des_double(n_val, val, 0);
43168 xmlResetLastError();
43169 if (mem_base != xmlMemBlocks()) {
43170 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043172 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043173 printf(" %d", n_val);
43174 printf("\n");
43175 }
43176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043177 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043178#endif
43179
Daniel Veillard42595322004-11-08 10:52:06 +000043180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043181}
43182
43183
43184static int
43185test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043187
William M. Brack21e4ef22005-01-02 09:53:13 +000043188#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043189 int mem_base;
43190 xmlChar * ret_val;
43191 double val; /* a number */
43192 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043193
Daniel Veillard3d95c732004-11-06 22:25:14 +000043194 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43195 mem_base = xmlMemBlocks();
43196 val = gen_double(n_val, 0);
43197
43198 ret_val = xmlXPathCastNumberToString(val);
43199 desret_xmlChar_ptr(ret_val);
43200 call_tests++;
43201 des_double(n_val, val, 0);
43202 xmlResetLastError();
43203 if (mem_base != xmlMemBlocks()) {
43204 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043206 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043207 printf(" %d", n_val);
43208 printf("\n");
43209 }
43210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043211 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043212#endif
43213
Daniel Veillard42595322004-11-08 10:52:06 +000043214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043215}
43216
43217
43218static int
43219test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043221
William M. Brack21e4ef22005-01-02 09:53:13 +000043222#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043223 int mem_base;
43224 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043225 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043226 int n_val;
43227
43228 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043230 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043231
William M. Brackf13f77f2004-11-12 16:03:48 +000043232 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043233 desret_int(ret_val);
43234 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043235 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043236 xmlResetLastError();
43237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043238 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043241 printf(" %d", n_val);
43242 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043243 }
43244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043245 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043246#endif
43247
Daniel Veillard42595322004-11-08 10:52:06 +000043248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043249}
43250
43251
43252static int
43253test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043255
William M. Brack21e4ef22005-01-02 09:53:13 +000043256#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043257 int mem_base;
43258 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043259 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043260 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043261
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043262 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43263 mem_base = xmlMemBlocks();
43264 val = gen_const_xmlChar_ptr(n_val, 0);
43265
William M. Brackf13f77f2004-11-12 16:03:48 +000043266 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043267 desret_double(ret_val);
43268 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043269 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043270 xmlResetLastError();
43271 if (mem_base != xmlMemBlocks()) {
43272 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043274 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043275 printf(" %d", n_val);
43276 printf("\n");
43277 }
43278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043279 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043280#endif
43281
Daniel Veillard42595322004-11-08 10:52:06 +000043282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043283}
43284
43285
43286static int
43287test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043289
William M. Brack21e4ef22005-01-02 09:53:13 +000043290#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043291 int mem_base;
43292 int ret_val;
43293 xmlXPathObjectPtr val; /* an XPath object */
43294 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043295
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043296 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043298 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043299
43300 ret_val = xmlXPathCastToBoolean(val);
43301 desret_int(ret_val);
43302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043303 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043304 xmlResetLastError();
43305 if (mem_base != xmlMemBlocks()) {
43306 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043308 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043309 printf(" %d", n_val);
43310 printf("\n");
43311 }
43312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043313 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043314#endif
43315
Daniel Veillard42595322004-11-08 10:52:06 +000043316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043317}
43318
43319
43320static int
43321test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043323
William M. Brack21e4ef22005-01-02 09:53:13 +000043324#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043325 int mem_base;
43326 double ret_val;
43327 xmlXPathObjectPtr val; /* an XPath object */
43328 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043329
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043330 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43331 mem_base = xmlMemBlocks();
43332 val = gen_xmlXPathObjectPtr(n_val, 0);
43333
43334 ret_val = xmlXPathCastToNumber(val);
43335 desret_double(ret_val);
43336 call_tests++;
43337 des_xmlXPathObjectPtr(n_val, val, 0);
43338 xmlResetLastError();
43339 if (mem_base != xmlMemBlocks()) {
43340 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043342 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043343 printf(" %d", n_val);
43344 printf("\n");
43345 }
43346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043347 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043348#endif
43349
Daniel Veillard42595322004-11-08 10:52:06 +000043350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043351}
43352
43353
43354static int
43355test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043357
William M. Brack21e4ef22005-01-02 09:53:13 +000043358#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043359 int mem_base;
43360 xmlChar * ret_val;
43361 xmlXPathObjectPtr val; /* an XPath object */
43362 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043363
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043364 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043366 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043367
43368 ret_val = xmlXPathCastToString(val);
43369 desret_xmlChar_ptr(ret_val);
43370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043371 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043372 xmlResetLastError();
43373 if (mem_base != xmlMemBlocks()) {
43374 printf("Leak of %d blocks found in xmlXPathCastToString",
43375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043376 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043377 printf(" %d", n_val);
43378 printf("\n");
43379 }
43380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043381 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043382#endif
43383
Daniel Veillard42595322004-11-08 10:52:06 +000043384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043385}
43386
43387
43388static int
43389test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043391
William M. Brack21e4ef22005-01-02 09:53:13 +000043392#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043393 int mem_base;
43394 int ret_val;
43395 xmlNodePtr node1; /* the first node */
43396 int n_node1;
43397 xmlNodePtr node2; /* the second node */
43398 int n_node2;
43399
43400 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43401 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043403 node1 = gen_xmlNodePtr(n_node1, 0);
43404 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043405
43406 ret_val = xmlXPathCmpNodes(node1, node2);
43407 desret_int(ret_val);
43408 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043409 des_xmlNodePtr(n_node1, node1, 0);
43410 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043411 xmlResetLastError();
43412 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043413 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043415 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043416 printf(" %d", n_node1);
43417 printf(" %d", n_node2);
43418 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043419 }
43420 }
43421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043422 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043423#endif
43424
Daniel Veillard42595322004-11-08 10:52:06 +000043425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043426}
43427
43428
43429static int
43430test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043432
43433
43434 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043436}
43437
Daniel Veillarda521d282004-11-09 14:59:59 +000043438#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043439
Daniel Veillardce682bc2004-11-05 17:22:25 +000043440#define gen_nb_xmlXPathCompExprPtr 1
43441static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43442 return(NULL);
43443}
43444static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43445}
Daniel Veillarda521d282004-11-09 14:59:59 +000043446#endif
43447
43448#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043449
43450#define gen_nb_xmlXPathContextPtr 1
43451static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43452 return(NULL);
43453}
43454static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43455}
Daniel Veillarda521d282004-11-09 14:59:59 +000043456#endif
43457
Daniel Veillardce682bc2004-11-05 17:22:25 +000043458
Daniel Veillardd93f6252004-11-02 15:53:51 +000043459static int
43460test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043462
William M. Brack21e4ef22005-01-02 09:53:13 +000043463#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043464 int mem_base;
43465 xmlXPathObjectPtr ret_val;
43466 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43467 int n_comp;
43468 xmlXPathContextPtr ctx; /* the XPath context */
43469 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043470
Daniel Veillardce682bc2004-11-05 17:22:25 +000043471 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43472 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43473 mem_base = xmlMemBlocks();
43474 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43475 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43476
43477 ret_val = xmlXPathCompiledEval(comp, ctx);
43478 desret_xmlXPathObjectPtr(ret_val);
43479 call_tests++;
43480 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43481 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43482 xmlResetLastError();
43483 if (mem_base != xmlMemBlocks()) {
43484 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043486 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043487 printf(" %d", n_comp);
43488 printf(" %d", n_ctx);
43489 printf("\n");
43490 }
43491 }
43492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043493 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043494#endif
43495
Daniel Veillard42595322004-11-08 10:52:06 +000043496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043497}
43498
43499
43500static int
43501test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043503
William M. Brack21e4ef22005-01-02 09:53:13 +000043504#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043505 int mem_base;
43506 xmlXPathObjectPtr ret_val;
43507 xmlXPathObjectPtr val; /* an XPath object */
43508 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043509
Daniel Veillard3d97e662004-11-04 10:49:00 +000043510 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43511 mem_base = xmlMemBlocks();
43512 val = gen_xmlXPathObjectPtr(n_val, 0);
43513
43514 ret_val = xmlXPathConvertBoolean(val);
43515 val = NULL;
43516 desret_xmlXPathObjectPtr(ret_val);
43517 call_tests++;
43518 des_xmlXPathObjectPtr(n_val, val, 0);
43519 xmlResetLastError();
43520 if (mem_base != xmlMemBlocks()) {
43521 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043523 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043524 printf(" %d", n_val);
43525 printf("\n");
43526 }
43527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043528 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043529#endif
43530
Daniel Veillard42595322004-11-08 10:52:06 +000043531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043532}
43533
43534
43535static int
43536test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043538
William M. Brack21e4ef22005-01-02 09:53:13 +000043539#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043540 int mem_base;
43541 xmlXPathObjectPtr ret_val;
43542 xmlXPathObjectPtr val; /* an XPath object */
43543 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043544
Daniel Veillard3d97e662004-11-04 10:49:00 +000043545 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43546 mem_base = xmlMemBlocks();
43547 val = gen_xmlXPathObjectPtr(n_val, 0);
43548
43549 ret_val = xmlXPathConvertNumber(val);
43550 val = NULL;
43551 desret_xmlXPathObjectPtr(ret_val);
43552 call_tests++;
43553 des_xmlXPathObjectPtr(n_val, val, 0);
43554 xmlResetLastError();
43555 if (mem_base != xmlMemBlocks()) {
43556 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043558 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043559 printf(" %d", n_val);
43560 printf("\n");
43561 }
43562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043563 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043564#endif
43565
Daniel Veillard42595322004-11-08 10:52:06 +000043566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043567}
43568
43569
43570static int
43571test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043573
William M. Brack21e4ef22005-01-02 09:53:13 +000043574#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043575 int mem_base;
43576 xmlXPathObjectPtr ret_val;
43577 xmlXPathObjectPtr val; /* an XPath object */
43578 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043579
Daniel Veillard3d97e662004-11-04 10:49:00 +000043580 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43581 mem_base = xmlMemBlocks();
43582 val = gen_xmlXPathObjectPtr(n_val, 0);
43583
43584 ret_val = xmlXPathConvertString(val);
43585 val = NULL;
43586 desret_xmlXPathObjectPtr(ret_val);
43587 call_tests++;
43588 des_xmlXPathObjectPtr(n_val, val, 0);
43589 xmlResetLastError();
43590 if (mem_base != xmlMemBlocks()) {
43591 printf("Leak of %d blocks found in xmlXPathConvertString",
43592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043593 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043594 printf(" %d", n_val);
43595 printf("\n");
43596 }
43597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043598 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043599#endif
43600
Daniel Veillard42595322004-11-08 10:52:06 +000043601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043602}
43603
43604
43605static int
43606test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043608
43609
43610 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043612}
43613
43614
43615static int
43616test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043618
William M. Brack21e4ef22005-01-02 09:53:13 +000043619#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043620 int mem_base;
43621 xmlXPathObjectPtr ret_val;
43622 xmlChar * str; /* the XPath expression */
43623 int n_str;
43624 xmlXPathContextPtr ctx; /* the XPath context */
43625 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043626
Daniel Veillardce682bc2004-11-05 17:22:25 +000043627 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43628 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43629 mem_base = xmlMemBlocks();
43630 str = gen_const_xmlChar_ptr(n_str, 0);
43631 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43632
William M. Brackf13f77f2004-11-12 16:03:48 +000043633 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043634 desret_xmlXPathObjectPtr(ret_val);
43635 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043636 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043637 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43638 xmlResetLastError();
43639 if (mem_base != xmlMemBlocks()) {
43640 printf("Leak of %d blocks found in xmlXPathEval",
43641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043642 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043643 printf(" %d", n_str);
43644 printf(" %d", n_ctx);
43645 printf("\n");
43646 }
43647 }
43648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043649 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043650#endif
43651
Daniel Veillard42595322004-11-08 10:52:06 +000043652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043653}
43654
43655
43656static int
43657test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043659
William M. Brack21e4ef22005-01-02 09:53:13 +000043660#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043661 int mem_base;
43662 xmlXPathObjectPtr ret_val;
43663 xmlChar * str; /* the XPath expression */
43664 int n_str;
43665 xmlXPathContextPtr ctxt; /* the XPath context */
43666 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043667
Daniel Veillardce682bc2004-11-05 17:22:25 +000043668 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43669 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43670 mem_base = xmlMemBlocks();
43671 str = gen_const_xmlChar_ptr(n_str, 0);
43672 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43673
William M. Brackf13f77f2004-11-12 16:03:48 +000043674 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043675 desret_xmlXPathObjectPtr(ret_val);
43676 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043677 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043678 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43679 xmlResetLastError();
43680 if (mem_base != xmlMemBlocks()) {
43681 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043683 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043684 printf(" %d", n_str);
43685 printf(" %d", n_ctxt);
43686 printf("\n");
43687 }
43688 }
43689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043690 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043691#endif
43692
Daniel Veillard42595322004-11-08 10:52:06 +000043693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043694}
43695
43696
43697static int
43698test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043700
William M. Brack21e4ef22005-01-02 09:53:13 +000043701#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043702 int mem_base;
43703 int ret_val;
43704 xmlXPathContextPtr ctxt; /* the XPath context */
43705 int n_ctxt;
43706 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43707 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043708
Daniel Veillardce682bc2004-11-05 17:22:25 +000043709 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43710 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43711 mem_base = xmlMemBlocks();
43712 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43713 res = gen_xmlXPathObjectPtr(n_res, 1);
43714
43715 ret_val = xmlXPathEvalPredicate(ctxt, res);
43716 desret_int(ret_val);
43717 call_tests++;
43718 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43719 des_xmlXPathObjectPtr(n_res, res, 1);
43720 xmlResetLastError();
43721 if (mem_base != xmlMemBlocks()) {
43722 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043724 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043725 printf(" %d", n_ctxt);
43726 printf(" %d", n_res);
43727 printf("\n");
43728 }
43729 }
43730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043731 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043732#endif
43733
Daniel Veillard42595322004-11-08 10:52:06 +000043734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043735}
43736
43737
43738static int
43739test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043741
William M. Brack21e4ef22005-01-02 09:53:13 +000043742#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043743 int mem_base;
43744
43745 mem_base = xmlMemBlocks();
43746
43747 xmlXPathInit();
43748 call_tests++;
43749 xmlResetLastError();
43750 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043751 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043753 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043754 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043756 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043757#endif
43758
Daniel Veillard42595322004-11-08 10:52:06 +000043759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043760}
43761
43762
43763static int
43764test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043766
William M. Brack21e4ef22005-01-02 09:53:13 +000043767#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043768 int mem_base;
43769 int ret_val;
43770 double val; /* a double value */
43771 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043772
Daniel Veillard3d95c732004-11-06 22:25:14 +000043773 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43774 mem_base = xmlMemBlocks();
43775 val = gen_double(n_val, 0);
43776
43777 ret_val = xmlXPathIsInf(val);
43778 desret_int(ret_val);
43779 call_tests++;
43780 des_double(n_val, val, 0);
43781 xmlResetLastError();
43782 if (mem_base != xmlMemBlocks()) {
43783 printf("Leak of %d blocks found in xmlXPathIsInf",
43784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043785 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043786 printf(" %d", n_val);
43787 printf("\n");
43788 }
43789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043790 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043791#endif
43792
Daniel Veillard42595322004-11-08 10:52:06 +000043793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043794}
43795
43796
43797static int
43798test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043800
William M. Brack21e4ef22005-01-02 09:53:13 +000043801#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043802 int mem_base;
43803 int ret_val;
43804 double val; /* a double value */
43805 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043806
Daniel Veillard3d95c732004-11-06 22:25:14 +000043807 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43808 mem_base = xmlMemBlocks();
43809 val = gen_double(n_val, 0);
43810
43811 ret_val = xmlXPathIsNaN(val);
43812 desret_int(ret_val);
43813 call_tests++;
43814 des_double(n_val, val, 0);
43815 xmlResetLastError();
43816 if (mem_base != xmlMemBlocks()) {
43817 printf("Leak of %d blocks found in xmlXPathIsNaN",
43818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043819 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043820 printf(" %d", n_val);
43821 printf("\n");
43822 }
43823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043824 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043825#endif
43826
Daniel Veillard42595322004-11-08 10:52:06 +000043827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043828}
43829
43830
43831static int
43832test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043834
43835
43836 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043838}
43839
43840
43841static int
43842test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043844
William M. Brack21e4ef22005-01-02 09:53:13 +000043845#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043846 int mem_base;
43847 xmlNodeSetPtr ret_val;
43848 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43849 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043850
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043851 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43852 mem_base = xmlMemBlocks();
43853 val = gen_xmlNodePtr(n_val, 0);
43854
43855 ret_val = xmlXPathNodeSetCreate(val);
43856 desret_xmlNodeSetPtr(ret_val);
43857 call_tests++;
43858 des_xmlNodePtr(n_val, val, 0);
43859 xmlResetLastError();
43860 if (mem_base != xmlMemBlocks()) {
43861 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43862 xmlMemBlocks() - mem_base);
43863 test_ret++;
43864 printf(" %d", n_val);
43865 printf("\n");
43866 }
43867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043868 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043869#endif
43870
Daniel Veillard42595322004-11-08 10:52:06 +000043871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043872}
43873
43874
43875static int
43876test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043878
William M. Brack21e4ef22005-01-02 09:53:13 +000043879#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043880 int mem_base;
43881 xmlXPathObjectPtr ret_val;
43882 xmlXPathObjectPtr val; /* the original object */
43883 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043884
Daniel Veillard3d97e662004-11-04 10:49:00 +000043885 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43886 mem_base = xmlMemBlocks();
43887 val = gen_xmlXPathObjectPtr(n_val, 0);
43888
43889 ret_val = xmlXPathObjectCopy(val);
43890 desret_xmlXPathObjectPtr(ret_val);
43891 call_tests++;
43892 des_xmlXPathObjectPtr(n_val, val, 0);
43893 xmlResetLastError();
43894 if (mem_base != xmlMemBlocks()) {
43895 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043897 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043898 printf(" %d", n_val);
43899 printf("\n");
43900 }
43901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043902 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043903#endif
43904
Daniel Veillard42595322004-11-08 10:52:06 +000043905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043906}
43907
43908
43909static int
43910test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043912
William M. Brack21e4ef22005-01-02 09:53:13 +000043913#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043914 int mem_base;
43915 long ret_val;
43916 xmlDocPtr doc; /* an input document */
43917 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043918
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043919 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43920 mem_base = xmlMemBlocks();
43921 doc = gen_xmlDocPtr(n_doc, 0);
43922
43923 ret_val = xmlXPathOrderDocElems(doc);
43924 desret_long(ret_val);
43925 call_tests++;
43926 des_xmlDocPtr(n_doc, doc, 0);
43927 xmlResetLastError();
43928 if (mem_base != xmlMemBlocks()) {
43929 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043931 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043932 printf(" %d", n_doc);
43933 printf("\n");
43934 }
43935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043936 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043937#endif
43938
Daniel Veillard42595322004-11-08 10:52:06 +000043939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043940}
43941
43942static int
43943test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043945
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043946 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043947 test_ret += test_xmlXPathCastBooleanToNumber();
43948 test_ret += test_xmlXPathCastBooleanToString();
43949 test_ret += test_xmlXPathCastNodeSetToBoolean();
43950 test_ret += test_xmlXPathCastNodeSetToNumber();
43951 test_ret += test_xmlXPathCastNodeSetToString();
43952 test_ret += test_xmlXPathCastNodeToNumber();
43953 test_ret += test_xmlXPathCastNodeToString();
43954 test_ret += test_xmlXPathCastNumberToBoolean();
43955 test_ret += test_xmlXPathCastNumberToString();
43956 test_ret += test_xmlXPathCastStringToBoolean();
43957 test_ret += test_xmlXPathCastStringToNumber();
43958 test_ret += test_xmlXPathCastToBoolean();
43959 test_ret += test_xmlXPathCastToNumber();
43960 test_ret += test_xmlXPathCastToString();
43961 test_ret += test_xmlXPathCmpNodes();
43962 test_ret += test_xmlXPathCompile();
43963 test_ret += test_xmlXPathCompiledEval();
43964 test_ret += test_xmlXPathConvertBoolean();
43965 test_ret += test_xmlXPathConvertNumber();
43966 test_ret += test_xmlXPathConvertString();
43967 test_ret += test_xmlXPathCtxtCompile();
43968 test_ret += test_xmlXPathEval();
43969 test_ret += test_xmlXPathEvalExpression();
43970 test_ret += test_xmlXPathEvalPredicate();
43971 test_ret += test_xmlXPathInit();
43972 test_ret += test_xmlXPathIsInf();
43973 test_ret += test_xmlXPathIsNaN();
43974 test_ret += test_xmlXPathNewContext();
43975 test_ret += test_xmlXPathNodeSetCreate();
43976 test_ret += test_xmlXPathObjectCopy();
43977 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043978
Daniel Veillard42595322004-11-08 10:52:06 +000043979 if (test_ret != 0)
43980 printf("Module xpath: %d errors\n", test_ret);
43981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043982}
Daniel Veillarda521d282004-11-09 14:59:59 +000043983#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043984
Daniel Veillarda82b1822004-11-08 16:24:57 +000043985#define gen_nb_xmlXPathParserContextPtr 1
43986static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43987 return(NULL);
43988}
43989static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43990}
Daniel Veillarda521d282004-11-09 14:59:59 +000043991#endif
43992
Daniel Veillarda82b1822004-11-08 16:24:57 +000043993
43994static int
43995test_valuePop(void) {
43996 int test_ret = 0;
43997
William M. Brack21e4ef22005-01-02 09:53:13 +000043998#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043999 int mem_base;
44000 xmlXPathObjectPtr ret_val;
44001 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44002 int n_ctxt;
44003
44004 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44005 mem_base = xmlMemBlocks();
44006 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44007
44008 ret_val = valuePop(ctxt);
44009 desret_xmlXPathObjectPtr(ret_val);
44010 call_tests++;
44011 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44012 xmlResetLastError();
44013 if (mem_base != xmlMemBlocks()) {
44014 printf("Leak of %d blocks found in valuePop",
44015 xmlMemBlocks() - mem_base);
44016 test_ret++;
44017 printf(" %d", n_ctxt);
44018 printf("\n");
44019 }
44020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044021 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044022#endif
44023
Daniel Veillarda82b1822004-11-08 16:24:57 +000044024 return(test_ret);
44025}
44026
44027
44028static int
44029test_valuePush(void) {
44030 int test_ret = 0;
44031
William M. Brack21e4ef22005-01-02 09:53:13 +000044032#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044033 int mem_base;
44034 int ret_val;
44035 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44036 int n_ctxt;
44037 xmlXPathObjectPtr value; /* the XPath object */
44038 int n_value;
44039
44040 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44041 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44042 mem_base = xmlMemBlocks();
44043 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44044 value = gen_xmlXPathObjectPtr(n_value, 1);
44045
44046 ret_val = valuePush(ctxt, value);
44047 desret_int(ret_val);
44048 call_tests++;
44049 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44050 des_xmlXPathObjectPtr(n_value, value, 1);
44051 xmlResetLastError();
44052 if (mem_base != xmlMemBlocks()) {
44053 printf("Leak of %d blocks found in valuePush",
44054 xmlMemBlocks() - mem_base);
44055 test_ret++;
44056 printf(" %d", n_ctxt);
44057 printf(" %d", n_value);
44058 printf("\n");
44059 }
44060 }
44061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044062 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044063#endif
44064
Daniel Veillarda82b1822004-11-08 16:24:57 +000044065 return(test_ret);
44066}
44067
44068
44069static int
44070test_xmlXPathAddValues(void) {
44071 int test_ret = 0;
44072
William M. Brack21e4ef22005-01-02 09:53:13 +000044073#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044074 int mem_base;
44075 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44076 int n_ctxt;
44077
44078 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44079 mem_base = xmlMemBlocks();
44080 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44081
44082 xmlXPathAddValues(ctxt);
44083 call_tests++;
44084 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44085 xmlResetLastError();
44086 if (mem_base != xmlMemBlocks()) {
44087 printf("Leak of %d blocks found in xmlXPathAddValues",
44088 xmlMemBlocks() - mem_base);
44089 test_ret++;
44090 printf(" %d", n_ctxt);
44091 printf("\n");
44092 }
44093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044095#endif
44096
Daniel Veillarda82b1822004-11-08 16:24:57 +000044097 return(test_ret);
44098}
44099
44100
44101static int
44102test_xmlXPathBooleanFunction(void) {
44103 int test_ret = 0;
44104
William M. Brack21e4ef22005-01-02 09:53:13 +000044105#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044106 int mem_base;
44107 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44108 int n_ctxt;
44109 int nargs; /* the number of arguments */
44110 int n_nargs;
44111
44112 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44113 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44114 mem_base = xmlMemBlocks();
44115 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44116 nargs = gen_int(n_nargs, 1);
44117
44118 xmlXPathBooleanFunction(ctxt, nargs);
44119 call_tests++;
44120 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44121 des_int(n_nargs, nargs, 1);
44122 xmlResetLastError();
44123 if (mem_base != xmlMemBlocks()) {
44124 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44125 xmlMemBlocks() - mem_base);
44126 test_ret++;
44127 printf(" %d", n_ctxt);
44128 printf(" %d", n_nargs);
44129 printf("\n");
44130 }
44131 }
44132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044133 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044134#endif
44135
Daniel Veillarda82b1822004-11-08 16:24:57 +000044136 return(test_ret);
44137}
44138
44139
44140static int
44141test_xmlXPathCeilingFunction(void) {
44142 int test_ret = 0;
44143
William M. Brack21e4ef22005-01-02 09:53:13 +000044144#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044145 int mem_base;
44146 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44147 int n_ctxt;
44148 int nargs; /* the number of arguments */
44149 int n_nargs;
44150
44151 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44152 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44153 mem_base = xmlMemBlocks();
44154 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44155 nargs = gen_int(n_nargs, 1);
44156
44157 xmlXPathCeilingFunction(ctxt, nargs);
44158 call_tests++;
44159 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44160 des_int(n_nargs, nargs, 1);
44161 xmlResetLastError();
44162 if (mem_base != xmlMemBlocks()) {
44163 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44164 xmlMemBlocks() - mem_base);
44165 test_ret++;
44166 printf(" %d", n_ctxt);
44167 printf(" %d", n_nargs);
44168 printf("\n");
44169 }
44170 }
44171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044172 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044173#endif
44174
Daniel Veillarda82b1822004-11-08 16:24:57 +000044175 return(test_ret);
44176}
44177
44178
44179static int
44180test_xmlXPathCompareValues(void) {
44181 int test_ret = 0;
44182
William M. Brack21e4ef22005-01-02 09:53:13 +000044183#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044184 int mem_base;
44185 int ret_val;
44186 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44187 int n_ctxt;
44188 int inf; /* less than (1) or greater than (0) */
44189 int n_inf;
44190 int strict; /* is the comparison strict */
44191 int n_strict;
44192
44193 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44194 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44195 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44196 mem_base = xmlMemBlocks();
44197 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44198 inf = gen_int(n_inf, 1);
44199 strict = gen_int(n_strict, 2);
44200
44201 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44202 desret_int(ret_val);
44203 call_tests++;
44204 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44205 des_int(n_inf, inf, 1);
44206 des_int(n_strict, strict, 2);
44207 xmlResetLastError();
44208 if (mem_base != xmlMemBlocks()) {
44209 printf("Leak of %d blocks found in xmlXPathCompareValues",
44210 xmlMemBlocks() - mem_base);
44211 test_ret++;
44212 printf(" %d", n_ctxt);
44213 printf(" %d", n_inf);
44214 printf(" %d", n_strict);
44215 printf("\n");
44216 }
44217 }
44218 }
44219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044220 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044221#endif
44222
Daniel Veillarda82b1822004-11-08 16:24:57 +000044223 return(test_ret);
44224}
44225
44226
44227static int
44228test_xmlXPathConcatFunction(void) {
44229 int test_ret = 0;
44230
William M. Brack21e4ef22005-01-02 09:53:13 +000044231#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044232 int mem_base;
44233 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44234 int n_ctxt;
44235 int nargs; /* the number of arguments */
44236 int n_nargs;
44237
44238 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44239 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44240 mem_base = xmlMemBlocks();
44241 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44242 nargs = gen_int(n_nargs, 1);
44243
44244 xmlXPathConcatFunction(ctxt, nargs);
44245 call_tests++;
44246 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44247 des_int(n_nargs, nargs, 1);
44248 xmlResetLastError();
44249 if (mem_base != xmlMemBlocks()) {
44250 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44251 xmlMemBlocks() - mem_base);
44252 test_ret++;
44253 printf(" %d", n_ctxt);
44254 printf(" %d", n_nargs);
44255 printf("\n");
44256 }
44257 }
44258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044259 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044260#endif
44261
Daniel Veillarda82b1822004-11-08 16:24:57 +000044262 return(test_ret);
44263}
44264
44265
44266static int
44267test_xmlXPathContainsFunction(void) {
44268 int test_ret = 0;
44269
William M. Brack21e4ef22005-01-02 09:53:13 +000044270#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044271 int mem_base;
44272 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44273 int n_ctxt;
44274 int nargs; /* the number of arguments */
44275 int n_nargs;
44276
44277 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44278 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44279 mem_base = xmlMemBlocks();
44280 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44281 nargs = gen_int(n_nargs, 1);
44282
44283 xmlXPathContainsFunction(ctxt, nargs);
44284 call_tests++;
44285 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44286 des_int(n_nargs, nargs, 1);
44287 xmlResetLastError();
44288 if (mem_base != xmlMemBlocks()) {
44289 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44290 xmlMemBlocks() - mem_base);
44291 test_ret++;
44292 printf(" %d", n_ctxt);
44293 printf(" %d", n_nargs);
44294 printf("\n");
44295 }
44296 }
44297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044298 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044299#endif
44300
Daniel Veillarda82b1822004-11-08 16:24:57 +000044301 return(test_ret);
44302}
44303
44304
44305static int
44306test_xmlXPathCountFunction(void) {
44307 int test_ret = 0;
44308
William M. Brack21e4ef22005-01-02 09:53:13 +000044309#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044310 int mem_base;
44311 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44312 int n_ctxt;
44313 int nargs; /* the number of arguments */
44314 int n_nargs;
44315
44316 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44317 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44318 mem_base = xmlMemBlocks();
44319 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44320 nargs = gen_int(n_nargs, 1);
44321
44322 xmlXPathCountFunction(ctxt, nargs);
44323 call_tests++;
44324 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44325 des_int(n_nargs, nargs, 1);
44326 xmlResetLastError();
44327 if (mem_base != xmlMemBlocks()) {
44328 printf("Leak of %d blocks found in xmlXPathCountFunction",
44329 xmlMemBlocks() - mem_base);
44330 test_ret++;
44331 printf(" %d", n_ctxt);
44332 printf(" %d", n_nargs);
44333 printf("\n");
44334 }
44335 }
44336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044337 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044338#endif
44339
Daniel Veillarda82b1822004-11-08 16:24:57 +000044340 return(test_ret);
44341}
44342
44343
44344static int
44345test_xmlXPathDebugDumpCompExpr(void) {
44346 int test_ret = 0;
44347
William M. Brack21e4ef22005-01-02 09:53:13 +000044348#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044349 int mem_base;
44350 FILE * output; /* the FILE * for the output */
44351 int n_output;
44352 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44353 int n_comp;
44354 int depth; /* the indentation level. */
44355 int n_depth;
44356
44357 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44358 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44359 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44360 mem_base = xmlMemBlocks();
44361 output = gen_FILE_ptr(n_output, 0);
44362 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44363 depth = gen_int(n_depth, 2);
44364
44365 xmlXPathDebugDumpCompExpr(output, comp, depth);
44366 call_tests++;
44367 des_FILE_ptr(n_output, output, 0);
44368 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44369 des_int(n_depth, depth, 2);
44370 xmlResetLastError();
44371 if (mem_base != xmlMemBlocks()) {
44372 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44373 xmlMemBlocks() - mem_base);
44374 test_ret++;
44375 printf(" %d", n_output);
44376 printf(" %d", n_comp);
44377 printf(" %d", n_depth);
44378 printf("\n");
44379 }
44380 }
44381 }
44382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044383 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044384#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044385
Daniel Veillarda82b1822004-11-08 16:24:57 +000044386 return(test_ret);
44387}
44388
44389
44390static int
44391test_xmlXPathDebugDumpObject(void) {
44392 int test_ret = 0;
44393
William M. Brack21e4ef22005-01-02 09:53:13 +000044394#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044395 int mem_base;
44396 FILE * output; /* the FILE * to dump the output */
44397 int n_output;
44398 xmlXPathObjectPtr cur; /* the object to inspect */
44399 int n_cur;
44400 int depth; /* indentation level */
44401 int n_depth;
44402
44403 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44404 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44405 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44406 mem_base = xmlMemBlocks();
44407 output = gen_FILE_ptr(n_output, 0);
44408 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44409 depth = gen_int(n_depth, 2);
44410
44411 xmlXPathDebugDumpObject(output, cur, depth);
44412 call_tests++;
44413 des_FILE_ptr(n_output, output, 0);
44414 des_xmlXPathObjectPtr(n_cur, cur, 1);
44415 des_int(n_depth, depth, 2);
44416 xmlResetLastError();
44417 if (mem_base != xmlMemBlocks()) {
44418 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44419 xmlMemBlocks() - mem_base);
44420 test_ret++;
44421 printf(" %d", n_output);
44422 printf(" %d", n_cur);
44423 printf(" %d", n_depth);
44424 printf("\n");
44425 }
44426 }
44427 }
44428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044429 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044430#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044431
Daniel Veillarda82b1822004-11-08 16:24:57 +000044432 return(test_ret);
44433}
44434
44435
44436static int
44437test_xmlXPathDifference(void) {
44438 int test_ret = 0;
44439
William M. Brack21e4ef22005-01-02 09:53:13 +000044440#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044441 int mem_base;
44442 xmlNodeSetPtr ret_val;
44443 xmlNodeSetPtr nodes1; /* a node-set */
44444 int n_nodes1;
44445 xmlNodeSetPtr nodes2; /* a node-set */
44446 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044447
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044448 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44449 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44450 mem_base = xmlMemBlocks();
44451 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44452 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44453
44454 ret_val = xmlXPathDifference(nodes1, nodes2);
44455 desret_xmlNodeSetPtr(ret_val);
44456 call_tests++;
44457 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44458 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44459 xmlResetLastError();
44460 if (mem_base != xmlMemBlocks()) {
44461 printf("Leak of %d blocks found in xmlXPathDifference",
44462 xmlMemBlocks() - mem_base);
44463 test_ret++;
44464 printf(" %d", n_nodes1);
44465 printf(" %d", n_nodes2);
44466 printf("\n");
44467 }
44468 }
44469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044470 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044471#endif
44472
Daniel Veillarda82b1822004-11-08 16:24:57 +000044473 return(test_ret);
44474}
44475
44476
44477static int
44478test_xmlXPathDistinct(void) {
44479 int test_ret = 0;
44480
William M. Brack21e4ef22005-01-02 09:53:13 +000044481#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044482 int mem_base;
44483 xmlNodeSetPtr ret_val;
44484 xmlNodeSetPtr nodes; /* a node-set */
44485 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044486
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044487 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44488 mem_base = xmlMemBlocks();
44489 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44490
44491 ret_val = xmlXPathDistinct(nodes);
44492 desret_xmlNodeSetPtr(ret_val);
44493 call_tests++;
44494 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44495 xmlResetLastError();
44496 if (mem_base != xmlMemBlocks()) {
44497 printf("Leak of %d blocks found in xmlXPathDistinct",
44498 xmlMemBlocks() - mem_base);
44499 test_ret++;
44500 printf(" %d", n_nodes);
44501 printf("\n");
44502 }
44503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044504 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044505#endif
44506
Daniel Veillarda82b1822004-11-08 16:24:57 +000044507 return(test_ret);
44508}
44509
44510
44511static int
44512test_xmlXPathDistinctSorted(void) {
44513 int test_ret = 0;
44514
William M. Brack21e4ef22005-01-02 09:53:13 +000044515#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044516 int mem_base;
44517 xmlNodeSetPtr ret_val;
44518 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44519 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044520
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044521 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44522 mem_base = xmlMemBlocks();
44523 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44524
44525 ret_val = xmlXPathDistinctSorted(nodes);
44526 desret_xmlNodeSetPtr(ret_val);
44527 call_tests++;
44528 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44529 xmlResetLastError();
44530 if (mem_base != xmlMemBlocks()) {
44531 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44532 xmlMemBlocks() - mem_base);
44533 test_ret++;
44534 printf(" %d", n_nodes);
44535 printf("\n");
44536 }
44537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044538 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044539#endif
44540
Daniel Veillarda82b1822004-11-08 16:24:57 +000044541 return(test_ret);
44542}
44543
44544
44545static int
44546test_xmlXPathDivValues(void) {
44547 int test_ret = 0;
44548
William M. Brack21e4ef22005-01-02 09:53:13 +000044549#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044550 int mem_base;
44551 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44552 int n_ctxt;
44553
44554 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44555 mem_base = xmlMemBlocks();
44556 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44557
44558 xmlXPathDivValues(ctxt);
44559 call_tests++;
44560 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44561 xmlResetLastError();
44562 if (mem_base != xmlMemBlocks()) {
44563 printf("Leak of %d blocks found in xmlXPathDivValues",
44564 xmlMemBlocks() - mem_base);
44565 test_ret++;
44566 printf(" %d", n_ctxt);
44567 printf("\n");
44568 }
44569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044570 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044571#endif
44572
Daniel Veillarda82b1822004-11-08 16:24:57 +000044573 return(test_ret);
44574}
44575
44576
44577static int
44578test_xmlXPathEqualValues(void) {
44579 int test_ret = 0;
44580
William M. Brack21e4ef22005-01-02 09:53:13 +000044581#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044582 int mem_base;
44583 int ret_val;
44584 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44585 int n_ctxt;
44586
44587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44588 mem_base = xmlMemBlocks();
44589 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44590
44591 ret_val = xmlXPathEqualValues(ctxt);
44592 desret_int(ret_val);
44593 call_tests++;
44594 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44595 xmlResetLastError();
44596 if (mem_base != xmlMemBlocks()) {
44597 printf("Leak of %d blocks found in xmlXPathEqualValues",
44598 xmlMemBlocks() - mem_base);
44599 test_ret++;
44600 printf(" %d", n_ctxt);
44601 printf("\n");
44602 }
44603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044604 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044605#endif
44606
Daniel Veillarda82b1822004-11-08 16:24:57 +000044607 return(test_ret);
44608}
44609
44610
44611static int
44612test_xmlXPathErr(void) {
44613 int test_ret = 0;
44614
William M. Brack21e4ef22005-01-02 09:53:13 +000044615#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044616 int mem_base;
44617 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44618 int n_ctxt;
44619 int error; /* the error code */
44620 int n_error;
44621
44622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44623 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44624 mem_base = xmlMemBlocks();
44625 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44626 error = gen_int(n_error, 1);
44627
44628 xmlXPathErr(ctxt, error);
44629 call_tests++;
44630 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44631 des_int(n_error, error, 1);
44632 xmlResetLastError();
44633 if (mem_base != xmlMemBlocks()) {
44634 printf("Leak of %d blocks found in xmlXPathErr",
44635 xmlMemBlocks() - mem_base);
44636 test_ret++;
44637 printf(" %d", n_ctxt);
44638 printf(" %d", n_error);
44639 printf("\n");
44640 }
44641 }
44642 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044643 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044644#endif
44645
Daniel Veillarda82b1822004-11-08 16:24:57 +000044646 return(test_ret);
44647}
44648
44649
44650static int
44651test_xmlXPathEvalExpr(void) {
44652 int test_ret = 0;
44653
William M. Brack21e4ef22005-01-02 09:53:13 +000044654#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044655 int mem_base;
44656 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44657 int n_ctxt;
44658
44659 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44660 mem_base = xmlMemBlocks();
44661 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44662
44663 xmlXPathEvalExpr(ctxt);
44664 call_tests++;
44665 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44666 xmlResetLastError();
44667 if (mem_base != xmlMemBlocks()) {
44668 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44669 xmlMemBlocks() - mem_base);
44670 test_ret++;
44671 printf(" %d", n_ctxt);
44672 printf("\n");
44673 }
44674 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044675 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044676#endif
44677
Daniel Veillarda82b1822004-11-08 16:24:57 +000044678 return(test_ret);
44679}
44680
44681
44682static int
44683test_xmlXPathEvaluatePredicateResult(void) {
44684 int test_ret = 0;
44685
William M. Brack21e4ef22005-01-02 09:53:13 +000044686#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044687 int mem_base;
44688 int ret_val;
44689 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44690 int n_ctxt;
44691 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44692 int n_res;
44693
44694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44695 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44696 mem_base = xmlMemBlocks();
44697 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44698 res = gen_xmlXPathObjectPtr(n_res, 1);
44699
44700 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44701 desret_int(ret_val);
44702 call_tests++;
44703 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44704 des_xmlXPathObjectPtr(n_res, res, 1);
44705 xmlResetLastError();
44706 if (mem_base != xmlMemBlocks()) {
44707 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44708 xmlMemBlocks() - mem_base);
44709 test_ret++;
44710 printf(" %d", n_ctxt);
44711 printf(" %d", n_res);
44712 printf("\n");
44713 }
44714 }
44715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044716 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044717#endif
44718
Daniel Veillarda82b1822004-11-08 16:24:57 +000044719 return(test_ret);
44720}
44721
44722
44723static int
44724test_xmlXPathFalseFunction(void) {
44725 int test_ret = 0;
44726
William M. Brack21e4ef22005-01-02 09:53:13 +000044727#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044728 int mem_base;
44729 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44730 int n_ctxt;
44731 int nargs; /* the number of arguments */
44732 int n_nargs;
44733
44734 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44735 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44736 mem_base = xmlMemBlocks();
44737 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44738 nargs = gen_int(n_nargs, 1);
44739
44740 xmlXPathFalseFunction(ctxt, nargs);
44741 call_tests++;
44742 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44743 des_int(n_nargs, nargs, 1);
44744 xmlResetLastError();
44745 if (mem_base != xmlMemBlocks()) {
44746 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44747 xmlMemBlocks() - mem_base);
44748 test_ret++;
44749 printf(" %d", n_ctxt);
44750 printf(" %d", n_nargs);
44751 printf("\n");
44752 }
44753 }
44754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044755 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044756#endif
44757
Daniel Veillarda82b1822004-11-08 16:24:57 +000044758 return(test_ret);
44759}
44760
44761
44762static int
44763test_xmlXPathFloorFunction(void) {
44764 int test_ret = 0;
44765
William M. Brack21e4ef22005-01-02 09:53:13 +000044766#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044767 int mem_base;
44768 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44769 int n_ctxt;
44770 int nargs; /* the number of arguments */
44771 int n_nargs;
44772
44773 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44774 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44775 mem_base = xmlMemBlocks();
44776 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44777 nargs = gen_int(n_nargs, 1);
44778
44779 xmlXPathFloorFunction(ctxt, nargs);
44780 call_tests++;
44781 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44782 des_int(n_nargs, nargs, 1);
44783 xmlResetLastError();
44784 if (mem_base != xmlMemBlocks()) {
44785 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44786 xmlMemBlocks() - mem_base);
44787 test_ret++;
44788 printf(" %d", n_ctxt);
44789 printf(" %d", n_nargs);
44790 printf("\n");
44791 }
44792 }
44793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044794 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044795#endif
44796
Daniel Veillarda82b1822004-11-08 16:24:57 +000044797 return(test_ret);
44798}
44799
44800
44801static int
44802test_xmlXPathFunctionLookup(void) {
44803 int test_ret = 0;
44804
44805
44806 /* missing type support */
44807 return(test_ret);
44808}
44809
44810
44811static int
44812test_xmlXPathFunctionLookupNS(void) {
44813 int test_ret = 0;
44814
44815
44816 /* missing type support */
44817 return(test_ret);
44818}
44819
44820
44821static int
44822test_xmlXPathHasSameNodes(void) {
44823 int test_ret = 0;
44824
William M. Brack21e4ef22005-01-02 09:53:13 +000044825#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044826 int mem_base;
44827 int ret_val;
44828 xmlNodeSetPtr nodes1; /* a node-set */
44829 int n_nodes1;
44830 xmlNodeSetPtr nodes2; /* a node-set */
44831 int n_nodes2;
44832
44833 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44834 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44835 mem_base = xmlMemBlocks();
44836 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44837 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44838
44839 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44840 desret_int(ret_val);
44841 call_tests++;
44842 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44843 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44844 xmlResetLastError();
44845 if (mem_base != xmlMemBlocks()) {
44846 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44847 xmlMemBlocks() - mem_base);
44848 test_ret++;
44849 printf(" %d", n_nodes1);
44850 printf(" %d", n_nodes2);
44851 printf("\n");
44852 }
44853 }
44854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044855 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044856#endif
44857
Daniel Veillarda82b1822004-11-08 16:24:57 +000044858 return(test_ret);
44859}
44860
44861
44862static int
44863test_xmlXPathIdFunction(void) {
44864 int test_ret = 0;
44865
William M. Brack21e4ef22005-01-02 09:53:13 +000044866#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044867 int mem_base;
44868 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44869 int n_ctxt;
44870 int nargs; /* the number of arguments */
44871 int n_nargs;
44872
44873 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44874 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44875 mem_base = xmlMemBlocks();
44876 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44877 nargs = gen_int(n_nargs, 1);
44878
44879 xmlXPathIdFunction(ctxt, nargs);
44880 call_tests++;
44881 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44882 des_int(n_nargs, nargs, 1);
44883 xmlResetLastError();
44884 if (mem_base != xmlMemBlocks()) {
44885 printf("Leak of %d blocks found in xmlXPathIdFunction",
44886 xmlMemBlocks() - mem_base);
44887 test_ret++;
44888 printf(" %d", n_ctxt);
44889 printf(" %d", n_nargs);
44890 printf("\n");
44891 }
44892 }
44893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044894 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044895#endif
44896
Daniel Veillarda82b1822004-11-08 16:24:57 +000044897 return(test_ret);
44898}
44899
44900
44901static int
44902test_xmlXPathIntersection(void) {
44903 int test_ret = 0;
44904
William M. Brack21e4ef22005-01-02 09:53:13 +000044905#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044906 int mem_base;
44907 xmlNodeSetPtr ret_val;
44908 xmlNodeSetPtr nodes1; /* a node-set */
44909 int n_nodes1;
44910 xmlNodeSetPtr nodes2; /* a node-set */
44911 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044912
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044913 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44914 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44915 mem_base = xmlMemBlocks();
44916 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44917 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44918
44919 ret_val = xmlXPathIntersection(nodes1, nodes2);
44920 desret_xmlNodeSetPtr(ret_val);
44921 call_tests++;
44922 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44923 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44924 xmlResetLastError();
44925 if (mem_base != xmlMemBlocks()) {
44926 printf("Leak of %d blocks found in xmlXPathIntersection",
44927 xmlMemBlocks() - mem_base);
44928 test_ret++;
44929 printf(" %d", n_nodes1);
44930 printf(" %d", n_nodes2);
44931 printf("\n");
44932 }
44933 }
44934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044935 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044936#endif
44937
Daniel Veillarda82b1822004-11-08 16:24:57 +000044938 return(test_ret);
44939}
44940
44941
44942static int
44943test_xmlXPathIsNodeType(void) {
44944 int test_ret = 0;
44945
William M. Brack21e4ef22005-01-02 09:53:13 +000044946#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044947 int mem_base;
44948 int ret_val;
44949 xmlChar * name; /* a name string */
44950 int n_name;
44951
44952 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44953 mem_base = xmlMemBlocks();
44954 name = gen_const_xmlChar_ptr(n_name, 0);
44955
William M. Brackf13f77f2004-11-12 16:03:48 +000044956 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044957 desret_int(ret_val);
44958 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044959 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044960 xmlResetLastError();
44961 if (mem_base != xmlMemBlocks()) {
44962 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44963 xmlMemBlocks() - mem_base);
44964 test_ret++;
44965 printf(" %d", n_name);
44966 printf("\n");
44967 }
44968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044969 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044970#endif
44971
Daniel Veillarda82b1822004-11-08 16:24:57 +000044972 return(test_ret);
44973}
44974
44975
44976static int
44977test_xmlXPathLangFunction(void) {
44978 int test_ret = 0;
44979
William M. Brack21e4ef22005-01-02 09:53:13 +000044980#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044981 int mem_base;
44982 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44983 int n_ctxt;
44984 int nargs; /* the number of arguments */
44985 int n_nargs;
44986
44987 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44988 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44989 mem_base = xmlMemBlocks();
44990 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44991 nargs = gen_int(n_nargs, 1);
44992
44993 xmlXPathLangFunction(ctxt, nargs);
44994 call_tests++;
44995 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44996 des_int(n_nargs, nargs, 1);
44997 xmlResetLastError();
44998 if (mem_base != xmlMemBlocks()) {
44999 printf("Leak of %d blocks found in xmlXPathLangFunction",
45000 xmlMemBlocks() - mem_base);
45001 test_ret++;
45002 printf(" %d", n_ctxt);
45003 printf(" %d", n_nargs);
45004 printf("\n");
45005 }
45006 }
45007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045008 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045009#endif
45010
Daniel Veillarda82b1822004-11-08 16:24:57 +000045011 return(test_ret);
45012}
45013
45014
45015static int
45016test_xmlXPathLastFunction(void) {
45017 int test_ret = 0;
45018
William M. Brack21e4ef22005-01-02 09:53:13 +000045019#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045020 int mem_base;
45021 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45022 int n_ctxt;
45023 int nargs; /* the number of arguments */
45024 int n_nargs;
45025
45026 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45027 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45028 mem_base = xmlMemBlocks();
45029 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45030 nargs = gen_int(n_nargs, 1);
45031
45032 xmlXPathLastFunction(ctxt, nargs);
45033 call_tests++;
45034 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45035 des_int(n_nargs, nargs, 1);
45036 xmlResetLastError();
45037 if (mem_base != xmlMemBlocks()) {
45038 printf("Leak of %d blocks found in xmlXPathLastFunction",
45039 xmlMemBlocks() - mem_base);
45040 test_ret++;
45041 printf(" %d", n_ctxt);
45042 printf(" %d", n_nargs);
45043 printf("\n");
45044 }
45045 }
45046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045047 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045048#endif
45049
Daniel Veillarda82b1822004-11-08 16:24:57 +000045050 return(test_ret);
45051}
45052
45053
45054static int
45055test_xmlXPathLeading(void) {
45056 int test_ret = 0;
45057
William M. Brack21e4ef22005-01-02 09:53:13 +000045058#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045059 int mem_base;
45060 xmlNodeSetPtr ret_val;
45061 xmlNodeSetPtr nodes1; /* a node-set */
45062 int n_nodes1;
45063 xmlNodeSetPtr nodes2; /* a node-set */
45064 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045065
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045066 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45067 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45068 mem_base = xmlMemBlocks();
45069 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45070 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45071
45072 ret_val = xmlXPathLeading(nodes1, nodes2);
45073 desret_xmlNodeSetPtr(ret_val);
45074 call_tests++;
45075 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45076 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45077 xmlResetLastError();
45078 if (mem_base != xmlMemBlocks()) {
45079 printf("Leak of %d blocks found in xmlXPathLeading",
45080 xmlMemBlocks() - mem_base);
45081 test_ret++;
45082 printf(" %d", n_nodes1);
45083 printf(" %d", n_nodes2);
45084 printf("\n");
45085 }
45086 }
45087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045088 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045089#endif
45090
Daniel Veillarda82b1822004-11-08 16:24:57 +000045091 return(test_ret);
45092}
45093
45094
45095static int
45096test_xmlXPathLeadingSorted(void) {
45097 int test_ret = 0;
45098
William M. Brack21e4ef22005-01-02 09:53:13 +000045099#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045100 int mem_base;
45101 xmlNodeSetPtr ret_val;
45102 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45103 int n_nodes1;
45104 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45105 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045106
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045107 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45108 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45109 mem_base = xmlMemBlocks();
45110 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45111 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45112
45113 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45114 desret_xmlNodeSetPtr(ret_val);
45115 call_tests++;
45116 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45117 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45118 xmlResetLastError();
45119 if (mem_base != xmlMemBlocks()) {
45120 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45121 xmlMemBlocks() - mem_base);
45122 test_ret++;
45123 printf(" %d", n_nodes1);
45124 printf(" %d", n_nodes2);
45125 printf("\n");
45126 }
45127 }
45128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045129 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045130#endif
45131
Daniel Veillarda82b1822004-11-08 16:24:57 +000045132 return(test_ret);
45133}
45134
45135
45136static int
45137test_xmlXPathLocalNameFunction(void) {
45138 int test_ret = 0;
45139
William M. Brack21e4ef22005-01-02 09:53:13 +000045140#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045141 int mem_base;
45142 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45143 int n_ctxt;
45144 int nargs; /* the number of arguments */
45145 int n_nargs;
45146
45147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45148 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45149 mem_base = xmlMemBlocks();
45150 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45151 nargs = gen_int(n_nargs, 1);
45152
45153 xmlXPathLocalNameFunction(ctxt, nargs);
45154 call_tests++;
45155 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45156 des_int(n_nargs, nargs, 1);
45157 xmlResetLastError();
45158 if (mem_base != xmlMemBlocks()) {
45159 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45160 xmlMemBlocks() - mem_base);
45161 test_ret++;
45162 printf(" %d", n_ctxt);
45163 printf(" %d", n_nargs);
45164 printf("\n");
45165 }
45166 }
45167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045168 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045169#endif
45170
Daniel Veillarda82b1822004-11-08 16:24:57 +000045171 return(test_ret);
45172}
45173
45174
45175static int
45176test_xmlXPathModValues(void) {
45177 int test_ret = 0;
45178
William M. Brack21e4ef22005-01-02 09:53:13 +000045179#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045180 int mem_base;
45181 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45182 int n_ctxt;
45183
45184 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45185 mem_base = xmlMemBlocks();
45186 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45187
45188 xmlXPathModValues(ctxt);
45189 call_tests++;
45190 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45191 xmlResetLastError();
45192 if (mem_base != xmlMemBlocks()) {
45193 printf("Leak of %d blocks found in xmlXPathModValues",
45194 xmlMemBlocks() - mem_base);
45195 test_ret++;
45196 printf(" %d", n_ctxt);
45197 printf("\n");
45198 }
45199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045200 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045201#endif
45202
Daniel Veillarda82b1822004-11-08 16:24:57 +000045203 return(test_ret);
45204}
45205
45206
45207static int
45208test_xmlXPathMultValues(void) {
45209 int test_ret = 0;
45210
William M. Brack21e4ef22005-01-02 09:53:13 +000045211#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045212 int mem_base;
45213 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45214 int n_ctxt;
45215
45216 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45217 mem_base = xmlMemBlocks();
45218 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45219
45220 xmlXPathMultValues(ctxt);
45221 call_tests++;
45222 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45223 xmlResetLastError();
45224 if (mem_base != xmlMemBlocks()) {
45225 printf("Leak of %d blocks found in xmlXPathMultValues",
45226 xmlMemBlocks() - mem_base);
45227 test_ret++;
45228 printf(" %d", n_ctxt);
45229 printf("\n");
45230 }
45231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045232 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045233#endif
45234
Daniel Veillarda82b1822004-11-08 16:24:57 +000045235 return(test_ret);
45236}
45237
45238
45239static int
45240test_xmlXPathNamespaceURIFunction(void) {
45241 int test_ret = 0;
45242
William M. Brack21e4ef22005-01-02 09:53:13 +000045243#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045244 int mem_base;
45245 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45246 int n_ctxt;
45247 int nargs; /* the number of arguments */
45248 int n_nargs;
45249
45250 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45251 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45252 mem_base = xmlMemBlocks();
45253 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45254 nargs = gen_int(n_nargs, 1);
45255
45256 xmlXPathNamespaceURIFunction(ctxt, nargs);
45257 call_tests++;
45258 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45259 des_int(n_nargs, nargs, 1);
45260 xmlResetLastError();
45261 if (mem_base != xmlMemBlocks()) {
45262 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45263 xmlMemBlocks() - mem_base);
45264 test_ret++;
45265 printf(" %d", n_ctxt);
45266 printf(" %d", n_nargs);
45267 printf("\n");
45268 }
45269 }
45270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045271 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045272#endif
45273
Daniel Veillarda82b1822004-11-08 16:24:57 +000045274 return(test_ret);
45275}
45276
45277
45278static int
45279test_xmlXPathNewBoolean(void) {
45280 int test_ret = 0;
45281
William M. Brack21e4ef22005-01-02 09:53:13 +000045282#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045283 int mem_base;
45284 xmlXPathObjectPtr ret_val;
45285 int val; /* the boolean value */
45286 int n_val;
45287
45288 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45289 mem_base = xmlMemBlocks();
45290 val = gen_int(n_val, 0);
45291
45292 ret_val = xmlXPathNewBoolean(val);
45293 desret_xmlXPathObjectPtr(ret_val);
45294 call_tests++;
45295 des_int(n_val, val, 0);
45296 xmlResetLastError();
45297 if (mem_base != xmlMemBlocks()) {
45298 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45299 xmlMemBlocks() - mem_base);
45300 test_ret++;
45301 printf(" %d", n_val);
45302 printf("\n");
45303 }
45304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045305 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045306#endif
45307
Daniel Veillarda82b1822004-11-08 16:24:57 +000045308 return(test_ret);
45309}
45310
45311
45312static int
45313test_xmlXPathNewCString(void) {
45314 int test_ret = 0;
45315
William M. Brack21e4ef22005-01-02 09:53:13 +000045316#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045317 int mem_base;
45318 xmlXPathObjectPtr ret_val;
45319 char * val; /* the char * value */
45320 int n_val;
45321
45322 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45323 mem_base = xmlMemBlocks();
45324 val = gen_const_char_ptr(n_val, 0);
45325
William M. Brackf13f77f2004-11-12 16:03:48 +000045326 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045327 desret_xmlXPathObjectPtr(ret_val);
45328 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045329 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045330 xmlResetLastError();
45331 if (mem_base != xmlMemBlocks()) {
45332 printf("Leak of %d blocks found in xmlXPathNewCString",
45333 xmlMemBlocks() - mem_base);
45334 test_ret++;
45335 printf(" %d", n_val);
45336 printf("\n");
45337 }
45338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045339 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045340#endif
45341
Daniel Veillarda82b1822004-11-08 16:24:57 +000045342 return(test_ret);
45343}
45344
45345
45346static int
45347test_xmlXPathNewFloat(void) {
45348 int test_ret = 0;
45349
William M. Brack21e4ef22005-01-02 09:53:13 +000045350#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045351 int mem_base;
45352 xmlXPathObjectPtr ret_val;
45353 double val; /* the double value */
45354 int n_val;
45355
45356 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45357 mem_base = xmlMemBlocks();
45358 val = gen_double(n_val, 0);
45359
45360 ret_val = xmlXPathNewFloat(val);
45361 desret_xmlXPathObjectPtr(ret_val);
45362 call_tests++;
45363 des_double(n_val, val, 0);
45364 xmlResetLastError();
45365 if (mem_base != xmlMemBlocks()) {
45366 printf("Leak of %d blocks found in xmlXPathNewFloat",
45367 xmlMemBlocks() - mem_base);
45368 test_ret++;
45369 printf(" %d", n_val);
45370 printf("\n");
45371 }
45372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045373 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045374#endif
45375
Daniel Veillarda82b1822004-11-08 16:24:57 +000045376 return(test_ret);
45377}
45378
45379
45380static int
45381test_xmlXPathNewNodeSet(void) {
45382 int test_ret = 0;
45383
William M. Brack21e4ef22005-01-02 09:53:13 +000045384#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045385 int mem_base;
45386 xmlXPathObjectPtr ret_val;
45387 xmlNodePtr val; /* the NodePtr value */
45388 int n_val;
45389
45390 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45391 mem_base = xmlMemBlocks();
45392 val = gen_xmlNodePtr(n_val, 0);
45393
45394 ret_val = xmlXPathNewNodeSet(val);
45395 desret_xmlXPathObjectPtr(ret_val);
45396 call_tests++;
45397 des_xmlNodePtr(n_val, val, 0);
45398 xmlResetLastError();
45399 if (mem_base != xmlMemBlocks()) {
45400 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45401 xmlMemBlocks() - mem_base);
45402 test_ret++;
45403 printf(" %d", n_val);
45404 printf("\n");
45405 }
45406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045407 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045408#endif
45409
Daniel Veillarda82b1822004-11-08 16:24:57 +000045410 return(test_ret);
45411}
45412
45413
45414static int
45415test_xmlXPathNewNodeSetList(void) {
45416 int test_ret = 0;
45417
William M. Brack21e4ef22005-01-02 09:53:13 +000045418#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045419 int mem_base;
45420 xmlXPathObjectPtr ret_val;
45421 xmlNodeSetPtr val; /* an existing NodeSet */
45422 int n_val;
45423
45424 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45425 mem_base = xmlMemBlocks();
45426 val = gen_xmlNodeSetPtr(n_val, 0);
45427
45428 ret_val = xmlXPathNewNodeSetList(val);
45429 desret_xmlXPathObjectPtr(ret_val);
45430 call_tests++;
45431 des_xmlNodeSetPtr(n_val, val, 0);
45432 xmlResetLastError();
45433 if (mem_base != xmlMemBlocks()) {
45434 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45435 xmlMemBlocks() - mem_base);
45436 test_ret++;
45437 printf(" %d", n_val);
45438 printf("\n");
45439 }
45440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045441 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045442#endif
45443
Daniel Veillarda82b1822004-11-08 16:24:57 +000045444 return(test_ret);
45445}
45446
45447
45448static int
45449test_xmlXPathNewParserContext(void) {
45450 int test_ret = 0;
45451
45452
45453 /* missing type support */
45454 return(test_ret);
45455}
45456
45457
45458static int
45459test_xmlXPathNewString(void) {
45460 int test_ret = 0;
45461
William M. Brack21e4ef22005-01-02 09:53:13 +000045462#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045463 int mem_base;
45464 xmlXPathObjectPtr ret_val;
45465 xmlChar * val; /* the xmlChar * value */
45466 int n_val;
45467
45468 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45469 mem_base = xmlMemBlocks();
45470 val = gen_const_xmlChar_ptr(n_val, 0);
45471
William M. Brackf13f77f2004-11-12 16:03:48 +000045472 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045473 desret_xmlXPathObjectPtr(ret_val);
45474 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045475 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045476 xmlResetLastError();
45477 if (mem_base != xmlMemBlocks()) {
45478 printf("Leak of %d blocks found in xmlXPathNewString",
45479 xmlMemBlocks() - mem_base);
45480 test_ret++;
45481 printf(" %d", n_val);
45482 printf("\n");
45483 }
45484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045485 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045486#endif
45487
Daniel Veillarda82b1822004-11-08 16:24:57 +000045488 return(test_ret);
45489}
45490
45491
45492static int
45493test_xmlXPathNextAncestor(void) {
45494 int test_ret = 0;
45495
William M. Brack21e4ef22005-01-02 09:53:13 +000045496#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045497 int mem_base;
45498 xmlNodePtr ret_val;
45499 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45500 int n_ctxt;
45501 xmlNodePtr cur; /* the current node in the traversal */
45502 int n_cur;
45503
45504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45505 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45506 mem_base = xmlMemBlocks();
45507 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45508 cur = gen_xmlNodePtr(n_cur, 1);
45509
45510 ret_val = xmlXPathNextAncestor(ctxt, cur);
45511 desret_xmlNodePtr(ret_val);
45512 call_tests++;
45513 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45514 des_xmlNodePtr(n_cur, cur, 1);
45515 xmlResetLastError();
45516 if (mem_base != xmlMemBlocks()) {
45517 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45518 xmlMemBlocks() - mem_base);
45519 test_ret++;
45520 printf(" %d", n_ctxt);
45521 printf(" %d", n_cur);
45522 printf("\n");
45523 }
45524 }
45525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045526 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045527#endif
45528
Daniel Veillarda82b1822004-11-08 16:24:57 +000045529 return(test_ret);
45530}
45531
45532
45533static int
45534test_xmlXPathNextAncestorOrSelf(void) {
45535 int test_ret = 0;
45536
William M. Brack21e4ef22005-01-02 09:53:13 +000045537#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045538 int mem_base;
45539 xmlNodePtr ret_val;
45540 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45541 int n_ctxt;
45542 xmlNodePtr cur; /* the current node in the traversal */
45543 int n_cur;
45544
45545 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45546 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45547 mem_base = xmlMemBlocks();
45548 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45549 cur = gen_xmlNodePtr(n_cur, 1);
45550
45551 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45552 desret_xmlNodePtr(ret_val);
45553 call_tests++;
45554 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45555 des_xmlNodePtr(n_cur, cur, 1);
45556 xmlResetLastError();
45557 if (mem_base != xmlMemBlocks()) {
45558 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45559 xmlMemBlocks() - mem_base);
45560 test_ret++;
45561 printf(" %d", n_ctxt);
45562 printf(" %d", n_cur);
45563 printf("\n");
45564 }
45565 }
45566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045567 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045568#endif
45569
Daniel Veillarda82b1822004-11-08 16:24:57 +000045570 return(test_ret);
45571}
45572
45573
45574static int
45575test_xmlXPathNextAttribute(void) {
45576 int test_ret = 0;
45577
William M. Brack21e4ef22005-01-02 09:53:13 +000045578#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045579 int mem_base;
45580 xmlNodePtr ret_val;
45581 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45582 int n_ctxt;
45583 xmlNodePtr cur; /* the current attribute in the traversal */
45584 int n_cur;
45585
45586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45587 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45588 mem_base = xmlMemBlocks();
45589 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45590 cur = gen_xmlNodePtr(n_cur, 1);
45591
45592 ret_val = xmlXPathNextAttribute(ctxt, cur);
45593 desret_xmlNodePtr(ret_val);
45594 call_tests++;
45595 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45596 des_xmlNodePtr(n_cur, cur, 1);
45597 xmlResetLastError();
45598 if (mem_base != xmlMemBlocks()) {
45599 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45600 xmlMemBlocks() - mem_base);
45601 test_ret++;
45602 printf(" %d", n_ctxt);
45603 printf(" %d", n_cur);
45604 printf("\n");
45605 }
45606 }
45607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045608 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045609#endif
45610
Daniel Veillarda82b1822004-11-08 16:24:57 +000045611 return(test_ret);
45612}
45613
45614
45615static int
45616test_xmlXPathNextChild(void) {
45617 int test_ret = 0;
45618
William M. Brack21e4ef22005-01-02 09:53:13 +000045619#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045620 int mem_base;
45621 xmlNodePtr ret_val;
45622 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45623 int n_ctxt;
45624 xmlNodePtr cur; /* the current node in the traversal */
45625 int n_cur;
45626
45627 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45628 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45629 mem_base = xmlMemBlocks();
45630 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45631 cur = gen_xmlNodePtr(n_cur, 1);
45632
45633 ret_val = xmlXPathNextChild(ctxt, cur);
45634 desret_xmlNodePtr(ret_val);
45635 call_tests++;
45636 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45637 des_xmlNodePtr(n_cur, cur, 1);
45638 xmlResetLastError();
45639 if (mem_base != xmlMemBlocks()) {
45640 printf("Leak of %d blocks found in xmlXPathNextChild",
45641 xmlMemBlocks() - mem_base);
45642 test_ret++;
45643 printf(" %d", n_ctxt);
45644 printf(" %d", n_cur);
45645 printf("\n");
45646 }
45647 }
45648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045649 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045650#endif
45651
Daniel Veillarda82b1822004-11-08 16:24:57 +000045652 return(test_ret);
45653}
45654
45655
45656static int
45657test_xmlXPathNextDescendant(void) {
45658 int test_ret = 0;
45659
William M. Brack21e4ef22005-01-02 09:53:13 +000045660#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045661 int mem_base;
45662 xmlNodePtr ret_val;
45663 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45664 int n_ctxt;
45665 xmlNodePtr cur; /* the current node in the traversal */
45666 int n_cur;
45667
45668 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45669 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45670 mem_base = xmlMemBlocks();
45671 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45672 cur = gen_xmlNodePtr(n_cur, 1);
45673
45674 ret_val = xmlXPathNextDescendant(ctxt, cur);
45675 desret_xmlNodePtr(ret_val);
45676 call_tests++;
45677 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45678 des_xmlNodePtr(n_cur, cur, 1);
45679 xmlResetLastError();
45680 if (mem_base != xmlMemBlocks()) {
45681 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45682 xmlMemBlocks() - mem_base);
45683 test_ret++;
45684 printf(" %d", n_ctxt);
45685 printf(" %d", n_cur);
45686 printf("\n");
45687 }
45688 }
45689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045690 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045691#endif
45692
Daniel Veillarda82b1822004-11-08 16:24:57 +000045693 return(test_ret);
45694}
45695
45696
45697static int
45698test_xmlXPathNextDescendantOrSelf(void) {
45699 int test_ret = 0;
45700
William M. Brack21e4ef22005-01-02 09:53:13 +000045701#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045702 int mem_base;
45703 xmlNodePtr ret_val;
45704 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45705 int n_ctxt;
45706 xmlNodePtr cur; /* the current node in the traversal */
45707 int n_cur;
45708
45709 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45710 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45711 mem_base = xmlMemBlocks();
45712 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45713 cur = gen_xmlNodePtr(n_cur, 1);
45714
45715 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45716 desret_xmlNodePtr(ret_val);
45717 call_tests++;
45718 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45719 des_xmlNodePtr(n_cur, cur, 1);
45720 xmlResetLastError();
45721 if (mem_base != xmlMemBlocks()) {
45722 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45723 xmlMemBlocks() - mem_base);
45724 test_ret++;
45725 printf(" %d", n_ctxt);
45726 printf(" %d", n_cur);
45727 printf("\n");
45728 }
45729 }
45730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045731 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045732#endif
45733
Daniel Veillarda82b1822004-11-08 16:24:57 +000045734 return(test_ret);
45735}
45736
45737
45738static int
45739test_xmlXPathNextFollowing(void) {
45740 int test_ret = 0;
45741
William M. Brack21e4ef22005-01-02 09:53:13 +000045742#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045743 int mem_base;
45744 xmlNodePtr ret_val;
45745 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45746 int n_ctxt;
45747 xmlNodePtr cur; /* the current node in the traversal */
45748 int n_cur;
45749
45750 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45751 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45752 mem_base = xmlMemBlocks();
45753 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45754 cur = gen_xmlNodePtr(n_cur, 1);
45755
45756 ret_val = xmlXPathNextFollowing(ctxt, cur);
45757 desret_xmlNodePtr(ret_val);
45758 call_tests++;
45759 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45760 des_xmlNodePtr(n_cur, cur, 1);
45761 xmlResetLastError();
45762 if (mem_base != xmlMemBlocks()) {
45763 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45764 xmlMemBlocks() - mem_base);
45765 test_ret++;
45766 printf(" %d", n_ctxt);
45767 printf(" %d", n_cur);
45768 printf("\n");
45769 }
45770 }
45771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045772 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045773#endif
45774
Daniel Veillarda82b1822004-11-08 16:24:57 +000045775 return(test_ret);
45776}
45777
45778
45779static int
45780test_xmlXPathNextFollowingSibling(void) {
45781 int test_ret = 0;
45782
William M. Brack21e4ef22005-01-02 09:53:13 +000045783#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045784 int mem_base;
45785 xmlNodePtr ret_val;
45786 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45787 int n_ctxt;
45788 xmlNodePtr cur; /* the current node in the traversal */
45789 int n_cur;
45790
45791 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45792 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45793 mem_base = xmlMemBlocks();
45794 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45795 cur = gen_xmlNodePtr(n_cur, 1);
45796
45797 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45798 desret_xmlNodePtr(ret_val);
45799 call_tests++;
45800 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45801 des_xmlNodePtr(n_cur, cur, 1);
45802 xmlResetLastError();
45803 if (mem_base != xmlMemBlocks()) {
45804 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45805 xmlMemBlocks() - mem_base);
45806 test_ret++;
45807 printf(" %d", n_ctxt);
45808 printf(" %d", n_cur);
45809 printf("\n");
45810 }
45811 }
45812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045813 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045814#endif
45815
Daniel Veillarda82b1822004-11-08 16:24:57 +000045816 return(test_ret);
45817}
45818
45819
45820static int
45821test_xmlXPathNextNamespace(void) {
45822 int test_ret = 0;
45823
William M. Brack21e4ef22005-01-02 09:53:13 +000045824#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045825 int mem_base;
45826 xmlNodePtr ret_val;
45827 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45828 int n_ctxt;
45829 xmlNodePtr cur; /* the current attribute in the traversal */
45830 int n_cur;
45831
45832 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45833 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45834 mem_base = xmlMemBlocks();
45835 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45836 cur = gen_xmlNodePtr(n_cur, 1);
45837
45838 ret_val = xmlXPathNextNamespace(ctxt, cur);
45839 desret_xmlNodePtr(ret_val);
45840 call_tests++;
45841 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45842 des_xmlNodePtr(n_cur, cur, 1);
45843 xmlResetLastError();
45844 if (mem_base != xmlMemBlocks()) {
45845 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45846 xmlMemBlocks() - mem_base);
45847 test_ret++;
45848 printf(" %d", n_ctxt);
45849 printf(" %d", n_cur);
45850 printf("\n");
45851 }
45852 }
45853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045854 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045855#endif
45856
Daniel Veillarda82b1822004-11-08 16:24:57 +000045857 return(test_ret);
45858}
45859
45860
45861static int
45862test_xmlXPathNextParent(void) {
45863 int test_ret = 0;
45864
William M. Brack21e4ef22005-01-02 09:53:13 +000045865#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045866 int mem_base;
45867 xmlNodePtr ret_val;
45868 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45869 int n_ctxt;
45870 xmlNodePtr cur; /* the current node in the traversal */
45871 int n_cur;
45872
45873 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45874 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45875 mem_base = xmlMemBlocks();
45876 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45877 cur = gen_xmlNodePtr(n_cur, 1);
45878
45879 ret_val = xmlXPathNextParent(ctxt, cur);
45880 desret_xmlNodePtr(ret_val);
45881 call_tests++;
45882 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45883 des_xmlNodePtr(n_cur, cur, 1);
45884 xmlResetLastError();
45885 if (mem_base != xmlMemBlocks()) {
45886 printf("Leak of %d blocks found in xmlXPathNextParent",
45887 xmlMemBlocks() - mem_base);
45888 test_ret++;
45889 printf(" %d", n_ctxt);
45890 printf(" %d", n_cur);
45891 printf("\n");
45892 }
45893 }
45894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045895 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045896#endif
45897
Daniel Veillarda82b1822004-11-08 16:24:57 +000045898 return(test_ret);
45899}
45900
45901
45902static int
45903test_xmlXPathNextPreceding(void) {
45904 int test_ret = 0;
45905
William M. Brack21e4ef22005-01-02 09:53:13 +000045906#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045907 int mem_base;
45908 xmlNodePtr ret_val;
45909 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45910 int n_ctxt;
45911 xmlNodePtr cur; /* the current node in the traversal */
45912 int n_cur;
45913
45914 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45915 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45916 mem_base = xmlMemBlocks();
45917 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45918 cur = gen_xmlNodePtr(n_cur, 1);
45919
45920 ret_val = xmlXPathNextPreceding(ctxt, cur);
45921 desret_xmlNodePtr(ret_val);
45922 call_tests++;
45923 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45924 des_xmlNodePtr(n_cur, cur, 1);
45925 xmlResetLastError();
45926 if (mem_base != xmlMemBlocks()) {
45927 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45928 xmlMemBlocks() - mem_base);
45929 test_ret++;
45930 printf(" %d", n_ctxt);
45931 printf(" %d", n_cur);
45932 printf("\n");
45933 }
45934 }
45935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045936 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045937#endif
45938
Daniel Veillarda82b1822004-11-08 16:24:57 +000045939 return(test_ret);
45940}
45941
45942
45943static int
45944test_xmlXPathNextPrecedingSibling(void) {
45945 int test_ret = 0;
45946
William M. Brack21e4ef22005-01-02 09:53:13 +000045947#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045948 int mem_base;
45949 xmlNodePtr ret_val;
45950 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45951 int n_ctxt;
45952 xmlNodePtr cur; /* the current node in the traversal */
45953 int n_cur;
45954
45955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45956 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45957 mem_base = xmlMemBlocks();
45958 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45959 cur = gen_xmlNodePtr(n_cur, 1);
45960
45961 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45962 desret_xmlNodePtr(ret_val);
45963 call_tests++;
45964 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45965 des_xmlNodePtr(n_cur, cur, 1);
45966 xmlResetLastError();
45967 if (mem_base != xmlMemBlocks()) {
45968 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45969 xmlMemBlocks() - mem_base);
45970 test_ret++;
45971 printf(" %d", n_ctxt);
45972 printf(" %d", n_cur);
45973 printf("\n");
45974 }
45975 }
45976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045977 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045978#endif
45979
Daniel Veillarda82b1822004-11-08 16:24:57 +000045980 return(test_ret);
45981}
45982
45983
45984static int
45985test_xmlXPathNextSelf(void) {
45986 int test_ret = 0;
45987
William M. Brack21e4ef22005-01-02 09:53:13 +000045988#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045989 int mem_base;
45990 xmlNodePtr ret_val;
45991 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45992 int n_ctxt;
45993 xmlNodePtr cur; /* the current node in the traversal */
45994 int n_cur;
45995
45996 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45997 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45998 mem_base = xmlMemBlocks();
45999 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46000 cur = gen_xmlNodePtr(n_cur, 1);
46001
46002 ret_val = xmlXPathNextSelf(ctxt, cur);
46003 desret_xmlNodePtr(ret_val);
46004 call_tests++;
46005 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46006 des_xmlNodePtr(n_cur, cur, 1);
46007 xmlResetLastError();
46008 if (mem_base != xmlMemBlocks()) {
46009 printf("Leak of %d blocks found in xmlXPathNextSelf",
46010 xmlMemBlocks() - mem_base);
46011 test_ret++;
46012 printf(" %d", n_ctxt);
46013 printf(" %d", n_cur);
46014 printf("\n");
46015 }
46016 }
46017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046018 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046019#endif
46020
Daniel Veillarda82b1822004-11-08 16:24:57 +000046021 return(test_ret);
46022}
46023
46024
46025static int
46026test_xmlXPathNodeLeading(void) {
46027 int test_ret = 0;
46028
William M. Brack21e4ef22005-01-02 09:53:13 +000046029#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046030 int mem_base;
46031 xmlNodeSetPtr ret_val;
46032 xmlNodeSetPtr nodes; /* a node-set */
46033 int n_nodes;
46034 xmlNodePtr node; /* a node */
46035 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046036
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046037 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46038 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46039 mem_base = xmlMemBlocks();
46040 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46041 node = gen_xmlNodePtr(n_node, 1);
46042
46043 ret_val = xmlXPathNodeLeading(nodes, node);
46044 desret_xmlNodeSetPtr(ret_val);
46045 call_tests++;
46046 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46047 des_xmlNodePtr(n_node, node, 1);
46048 xmlResetLastError();
46049 if (mem_base != xmlMemBlocks()) {
46050 printf("Leak of %d blocks found in xmlXPathNodeLeading",
46051 xmlMemBlocks() - mem_base);
46052 test_ret++;
46053 printf(" %d", n_nodes);
46054 printf(" %d", n_node);
46055 printf("\n");
46056 }
46057 }
46058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046059 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046060#endif
46061
Daniel Veillarda82b1822004-11-08 16:24:57 +000046062 return(test_ret);
46063}
46064
46065
46066static int
46067test_xmlXPathNodeLeadingSorted(void) {
46068 int test_ret = 0;
46069
William M. Brack21e4ef22005-01-02 09:53:13 +000046070#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046071 int mem_base;
46072 xmlNodeSetPtr ret_val;
46073 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46074 int n_nodes;
46075 xmlNodePtr node; /* a node */
46076 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046077
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046078 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46079 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46080 mem_base = xmlMemBlocks();
46081 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46082 node = gen_xmlNodePtr(n_node, 1);
46083
46084 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
46085 desret_xmlNodeSetPtr(ret_val);
46086 call_tests++;
46087 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46088 des_xmlNodePtr(n_node, node, 1);
46089 xmlResetLastError();
46090 if (mem_base != xmlMemBlocks()) {
46091 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
46092 xmlMemBlocks() - mem_base);
46093 test_ret++;
46094 printf(" %d", n_nodes);
46095 printf(" %d", n_node);
46096 printf("\n");
46097 }
46098 }
46099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046100 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046101#endif
46102
Daniel Veillarda82b1822004-11-08 16:24:57 +000046103 return(test_ret);
46104}
46105
46106
46107static int
46108test_xmlXPathNodeSetAdd(void) {
46109 int test_ret = 0;
46110
William M. Brack21e4ef22005-01-02 09:53:13 +000046111#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046112 int mem_base;
46113 xmlNodeSetPtr cur; /* the initial node set */
46114 int n_cur;
46115 xmlNodePtr val; /* a new xmlNodePtr */
46116 int n_val;
46117
46118 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46119 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46120 mem_base = xmlMemBlocks();
46121 cur = gen_xmlNodeSetPtr(n_cur, 0);
46122 val = gen_xmlNodePtr(n_val, 1);
46123
46124 xmlXPathNodeSetAdd(cur, val);
46125 call_tests++;
46126 des_xmlNodeSetPtr(n_cur, cur, 0);
46127 des_xmlNodePtr(n_val, val, 1);
46128 xmlResetLastError();
46129 if (mem_base != xmlMemBlocks()) {
46130 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46131 xmlMemBlocks() - mem_base);
46132 test_ret++;
46133 printf(" %d", n_cur);
46134 printf(" %d", n_val);
46135 printf("\n");
46136 }
46137 }
46138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046139 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046140#endif
46141
Daniel Veillarda82b1822004-11-08 16:24:57 +000046142 return(test_ret);
46143}
46144
46145
46146static int
46147test_xmlXPathNodeSetAddNs(void) {
46148 int test_ret = 0;
46149
William M. Brack21e4ef22005-01-02 09:53:13 +000046150#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046151 int mem_base;
46152 xmlNodeSetPtr cur; /* the initial node set */
46153 int n_cur;
46154 xmlNodePtr node; /* the hosting node */
46155 int n_node;
46156 xmlNsPtr ns; /* a the namespace node */
46157 int n_ns;
46158
46159 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46160 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46161 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46162 mem_base = xmlMemBlocks();
46163 cur = gen_xmlNodeSetPtr(n_cur, 0);
46164 node = gen_xmlNodePtr(n_node, 1);
46165 ns = gen_xmlNsPtr(n_ns, 2);
46166
46167 xmlXPathNodeSetAddNs(cur, node, ns);
46168 call_tests++;
46169 des_xmlNodeSetPtr(n_cur, cur, 0);
46170 des_xmlNodePtr(n_node, node, 1);
46171 des_xmlNsPtr(n_ns, ns, 2);
46172 xmlResetLastError();
46173 if (mem_base != xmlMemBlocks()) {
46174 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46175 xmlMemBlocks() - mem_base);
46176 test_ret++;
46177 printf(" %d", n_cur);
46178 printf(" %d", n_node);
46179 printf(" %d", n_ns);
46180 printf("\n");
46181 }
46182 }
46183 }
46184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046185 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046186#endif
46187
Daniel Veillarda82b1822004-11-08 16:24:57 +000046188 return(test_ret);
46189}
46190
46191
46192static int
46193test_xmlXPathNodeSetAddUnique(void) {
46194 int test_ret = 0;
46195
William M. Brack21e4ef22005-01-02 09:53:13 +000046196#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046197 int mem_base;
46198 xmlNodeSetPtr cur; /* the initial node set */
46199 int n_cur;
46200 xmlNodePtr val; /* a new xmlNodePtr */
46201 int n_val;
46202
46203 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46204 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46205 mem_base = xmlMemBlocks();
46206 cur = gen_xmlNodeSetPtr(n_cur, 0);
46207 val = gen_xmlNodePtr(n_val, 1);
46208
46209 xmlXPathNodeSetAddUnique(cur, val);
46210 call_tests++;
46211 des_xmlNodeSetPtr(n_cur, cur, 0);
46212 des_xmlNodePtr(n_val, val, 1);
46213 xmlResetLastError();
46214 if (mem_base != xmlMemBlocks()) {
46215 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46216 xmlMemBlocks() - mem_base);
46217 test_ret++;
46218 printf(" %d", n_cur);
46219 printf(" %d", n_val);
46220 printf("\n");
46221 }
46222 }
46223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046224 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046225#endif
46226
Daniel Veillarda82b1822004-11-08 16:24:57 +000046227 return(test_ret);
46228}
46229
46230
46231static int
46232test_xmlXPathNodeSetContains(void) {
46233 int test_ret = 0;
46234
William M. Brack21e4ef22005-01-02 09:53:13 +000046235#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046236 int mem_base;
46237 int ret_val;
46238 xmlNodeSetPtr cur; /* the node-set */
46239 int n_cur;
46240 xmlNodePtr val; /* the node */
46241 int n_val;
46242
46243 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46244 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46245 mem_base = xmlMemBlocks();
46246 cur = gen_xmlNodeSetPtr(n_cur, 0);
46247 val = gen_xmlNodePtr(n_val, 1);
46248
46249 ret_val = xmlXPathNodeSetContains(cur, val);
46250 desret_int(ret_val);
46251 call_tests++;
46252 des_xmlNodeSetPtr(n_cur, cur, 0);
46253 des_xmlNodePtr(n_val, val, 1);
46254 xmlResetLastError();
46255 if (mem_base != xmlMemBlocks()) {
46256 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46257 xmlMemBlocks() - mem_base);
46258 test_ret++;
46259 printf(" %d", n_cur);
46260 printf(" %d", n_val);
46261 printf("\n");
46262 }
46263 }
46264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046265 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046266#endif
46267
Daniel Veillarda82b1822004-11-08 16:24:57 +000046268 return(test_ret);
46269}
46270
46271
46272static int
46273test_xmlXPathNodeSetDel(void) {
46274 int test_ret = 0;
46275
William M. Brack21e4ef22005-01-02 09:53:13 +000046276#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046277 int mem_base;
46278 xmlNodeSetPtr cur; /* the initial node set */
46279 int n_cur;
46280 xmlNodePtr val; /* an xmlNodePtr */
46281 int n_val;
46282
46283 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46284 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46285 mem_base = xmlMemBlocks();
46286 cur = gen_xmlNodeSetPtr(n_cur, 0);
46287 val = gen_xmlNodePtr(n_val, 1);
46288
46289 xmlXPathNodeSetDel(cur, val);
46290 call_tests++;
46291 des_xmlNodeSetPtr(n_cur, cur, 0);
46292 des_xmlNodePtr(n_val, val, 1);
46293 xmlResetLastError();
46294 if (mem_base != xmlMemBlocks()) {
46295 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46296 xmlMemBlocks() - mem_base);
46297 test_ret++;
46298 printf(" %d", n_cur);
46299 printf(" %d", n_val);
46300 printf("\n");
46301 }
46302 }
46303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046304 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046305#endif
46306
Daniel Veillarda82b1822004-11-08 16:24:57 +000046307 return(test_ret);
46308}
46309
46310
46311static int
46312test_xmlXPathNodeSetMerge(void) {
46313 int test_ret = 0;
46314
William M. Brack21e4ef22005-01-02 09:53:13 +000046315#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046316 int mem_base;
46317 xmlNodeSetPtr ret_val;
46318 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46319 int n_val1;
46320 xmlNodeSetPtr val2; /* the second NodeSet */
46321 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046322
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046323 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46324 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46325 mem_base = xmlMemBlocks();
46326 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46327 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46328
46329 ret_val = xmlXPathNodeSetMerge(val1, val2);
46330 desret_xmlNodeSetPtr(ret_val);
46331 call_tests++;
46332 des_xmlNodeSetPtr(n_val1, val1, 0);
46333 des_xmlNodeSetPtr(n_val2, val2, 1);
46334 xmlResetLastError();
46335 if (mem_base != xmlMemBlocks()) {
46336 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46337 xmlMemBlocks() - mem_base);
46338 test_ret++;
46339 printf(" %d", n_val1);
46340 printf(" %d", n_val2);
46341 printf("\n");
46342 }
46343 }
46344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046345 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046346#endif
46347
Daniel Veillarda82b1822004-11-08 16:24:57 +000046348 return(test_ret);
46349}
46350
46351
46352static int
46353test_xmlXPathNodeSetRemove(void) {
46354 int test_ret = 0;
46355
William M. Brack21e4ef22005-01-02 09:53:13 +000046356#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046357 int mem_base;
46358 xmlNodeSetPtr cur; /* the initial node set */
46359 int n_cur;
46360 int val; /* the index to remove */
46361 int n_val;
46362
46363 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46364 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46365 mem_base = xmlMemBlocks();
46366 cur = gen_xmlNodeSetPtr(n_cur, 0);
46367 val = gen_int(n_val, 1);
46368
46369 xmlXPathNodeSetRemove(cur, val);
46370 call_tests++;
46371 des_xmlNodeSetPtr(n_cur, cur, 0);
46372 des_int(n_val, val, 1);
46373 xmlResetLastError();
46374 if (mem_base != xmlMemBlocks()) {
46375 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46376 xmlMemBlocks() - mem_base);
46377 test_ret++;
46378 printf(" %d", n_cur);
46379 printf(" %d", n_val);
46380 printf("\n");
46381 }
46382 }
46383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046384 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046385#endif
46386
Daniel Veillarda82b1822004-11-08 16:24:57 +000046387 return(test_ret);
46388}
46389
46390
46391static int
46392test_xmlXPathNodeSetSort(void) {
46393 int test_ret = 0;
46394
William M. Brack21e4ef22005-01-02 09:53:13 +000046395#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046396 int mem_base;
46397 xmlNodeSetPtr set; /* the node set */
46398 int n_set;
46399
46400 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46401 mem_base = xmlMemBlocks();
46402 set = gen_xmlNodeSetPtr(n_set, 0);
46403
46404 xmlXPathNodeSetSort(set);
46405 call_tests++;
46406 des_xmlNodeSetPtr(n_set, set, 0);
46407 xmlResetLastError();
46408 if (mem_base != xmlMemBlocks()) {
46409 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46410 xmlMemBlocks() - mem_base);
46411 test_ret++;
46412 printf(" %d", n_set);
46413 printf("\n");
46414 }
46415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046416 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046417#endif
46418
Daniel Veillarda82b1822004-11-08 16:24:57 +000046419 return(test_ret);
46420}
46421
46422
46423static int
46424test_xmlXPathNodeTrailing(void) {
46425 int test_ret = 0;
46426
William M. Brack21e4ef22005-01-02 09:53:13 +000046427#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046428 int mem_base;
46429 xmlNodeSetPtr ret_val;
46430 xmlNodeSetPtr nodes; /* a node-set */
46431 int n_nodes;
46432 xmlNodePtr node; /* a node */
46433 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046434
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046435 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46436 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46437 mem_base = xmlMemBlocks();
46438 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46439 node = gen_xmlNodePtr(n_node, 1);
46440
46441 ret_val = xmlXPathNodeTrailing(nodes, node);
46442 desret_xmlNodeSetPtr(ret_val);
46443 call_tests++;
46444 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46445 des_xmlNodePtr(n_node, node, 1);
46446 xmlResetLastError();
46447 if (mem_base != xmlMemBlocks()) {
46448 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46449 xmlMemBlocks() - mem_base);
46450 test_ret++;
46451 printf(" %d", n_nodes);
46452 printf(" %d", n_node);
46453 printf("\n");
46454 }
46455 }
46456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046457 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046458#endif
46459
Daniel Veillarda82b1822004-11-08 16:24:57 +000046460 return(test_ret);
46461}
46462
46463
46464static int
46465test_xmlXPathNodeTrailingSorted(void) {
46466 int test_ret = 0;
46467
William M. Brack21e4ef22005-01-02 09:53:13 +000046468#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046469 int mem_base;
46470 xmlNodeSetPtr ret_val;
46471 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46472 int n_nodes;
46473 xmlNodePtr node; /* a node */
46474 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046475
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046476 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46477 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46478 mem_base = xmlMemBlocks();
46479 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46480 node = gen_xmlNodePtr(n_node, 1);
46481
46482 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46483 desret_xmlNodeSetPtr(ret_val);
46484 call_tests++;
46485 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46486 des_xmlNodePtr(n_node, node, 1);
46487 xmlResetLastError();
46488 if (mem_base != xmlMemBlocks()) {
46489 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46490 xmlMemBlocks() - mem_base);
46491 test_ret++;
46492 printf(" %d", n_nodes);
46493 printf(" %d", n_node);
46494 printf("\n");
46495 }
46496 }
46497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046498 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046499#endif
46500
Daniel Veillarda82b1822004-11-08 16:24:57 +000046501 return(test_ret);
46502}
46503
46504
46505static int
46506test_xmlXPathNormalizeFunction(void) {
46507 int test_ret = 0;
46508
William M. Brack21e4ef22005-01-02 09:53:13 +000046509#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046510 int mem_base;
46511 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46512 int n_ctxt;
46513 int nargs; /* the number of arguments */
46514 int n_nargs;
46515
46516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46517 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46518 mem_base = xmlMemBlocks();
46519 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46520 nargs = gen_int(n_nargs, 1);
46521
46522 xmlXPathNormalizeFunction(ctxt, nargs);
46523 call_tests++;
46524 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46525 des_int(n_nargs, nargs, 1);
46526 xmlResetLastError();
46527 if (mem_base != xmlMemBlocks()) {
46528 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46529 xmlMemBlocks() - mem_base);
46530 test_ret++;
46531 printf(" %d", n_ctxt);
46532 printf(" %d", n_nargs);
46533 printf("\n");
46534 }
46535 }
46536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046537 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046538#endif
46539
Daniel Veillarda82b1822004-11-08 16:24:57 +000046540 return(test_ret);
46541}
46542
46543
46544static int
46545test_xmlXPathNotEqualValues(void) {
46546 int test_ret = 0;
46547
William M. Brack21e4ef22005-01-02 09:53:13 +000046548#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046549 int mem_base;
46550 int ret_val;
46551 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46552 int n_ctxt;
46553
46554 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46555 mem_base = xmlMemBlocks();
46556 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46557
46558 ret_val = xmlXPathNotEqualValues(ctxt);
46559 desret_int(ret_val);
46560 call_tests++;
46561 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46562 xmlResetLastError();
46563 if (mem_base != xmlMemBlocks()) {
46564 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46565 xmlMemBlocks() - mem_base);
46566 test_ret++;
46567 printf(" %d", n_ctxt);
46568 printf("\n");
46569 }
46570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046571 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046572#endif
46573
Daniel Veillarda82b1822004-11-08 16:24:57 +000046574 return(test_ret);
46575}
46576
46577
46578static int
46579test_xmlXPathNotFunction(void) {
46580 int test_ret = 0;
46581
William M. Brack21e4ef22005-01-02 09:53:13 +000046582#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046583 int mem_base;
46584 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46585 int n_ctxt;
46586 int nargs; /* the number of arguments */
46587 int n_nargs;
46588
46589 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46590 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46591 mem_base = xmlMemBlocks();
46592 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46593 nargs = gen_int(n_nargs, 1);
46594
46595 xmlXPathNotFunction(ctxt, nargs);
46596 call_tests++;
46597 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46598 des_int(n_nargs, nargs, 1);
46599 xmlResetLastError();
46600 if (mem_base != xmlMemBlocks()) {
46601 printf("Leak of %d blocks found in xmlXPathNotFunction",
46602 xmlMemBlocks() - mem_base);
46603 test_ret++;
46604 printf(" %d", n_ctxt);
46605 printf(" %d", n_nargs);
46606 printf("\n");
46607 }
46608 }
46609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046610 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046611#endif
46612
Daniel Veillarda82b1822004-11-08 16:24:57 +000046613 return(test_ret);
46614}
46615
46616
46617static int
46618test_xmlXPathNsLookup(void) {
46619 int test_ret = 0;
46620
William M. Brack21e4ef22005-01-02 09:53:13 +000046621#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046622 int mem_base;
46623 const xmlChar * ret_val;
46624 xmlXPathContextPtr ctxt; /* the XPath context */
46625 int n_ctxt;
46626 xmlChar * prefix; /* the namespace prefix value */
46627 int n_prefix;
46628
46629 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46630 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46631 mem_base = xmlMemBlocks();
46632 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46633 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46634
William M. Brackf13f77f2004-11-12 16:03:48 +000046635 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046636 desret_const_xmlChar_ptr(ret_val);
46637 call_tests++;
46638 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046639 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046640 xmlResetLastError();
46641 if (mem_base != xmlMemBlocks()) {
46642 printf("Leak of %d blocks found in xmlXPathNsLookup",
46643 xmlMemBlocks() - mem_base);
46644 test_ret++;
46645 printf(" %d", n_ctxt);
46646 printf(" %d", n_prefix);
46647 printf("\n");
46648 }
46649 }
46650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046651 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046652#endif
46653
Daniel Veillarda82b1822004-11-08 16:24:57 +000046654 return(test_ret);
46655}
46656
46657
46658static int
46659test_xmlXPathNumberFunction(void) {
46660 int test_ret = 0;
46661
William M. Brack21e4ef22005-01-02 09:53:13 +000046662#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046663 int mem_base;
46664 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46665 int n_ctxt;
46666 int nargs; /* the number of arguments */
46667 int n_nargs;
46668
46669 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46670 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46671 mem_base = xmlMemBlocks();
46672 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46673 nargs = gen_int(n_nargs, 1);
46674
46675 xmlXPathNumberFunction(ctxt, nargs);
46676 call_tests++;
46677 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46678 des_int(n_nargs, nargs, 1);
46679 xmlResetLastError();
46680 if (mem_base != xmlMemBlocks()) {
46681 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46682 xmlMemBlocks() - mem_base);
46683 test_ret++;
46684 printf(" %d", n_ctxt);
46685 printf(" %d", n_nargs);
46686 printf("\n");
46687 }
46688 }
46689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046690 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046691#endif
46692
Daniel Veillarda82b1822004-11-08 16:24:57 +000046693 return(test_ret);
46694}
46695
46696
46697static int
46698test_xmlXPathParseNCName(void) {
46699 int test_ret = 0;
46700
William M. Brack21e4ef22005-01-02 09:53:13 +000046701#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046702 int mem_base;
46703 xmlChar * ret_val;
46704 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46705 int n_ctxt;
46706
46707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46708 mem_base = xmlMemBlocks();
46709 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46710
46711 ret_val = xmlXPathParseNCName(ctxt);
46712 desret_xmlChar_ptr(ret_val);
46713 call_tests++;
46714 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46715 xmlResetLastError();
46716 if (mem_base != xmlMemBlocks()) {
46717 printf("Leak of %d blocks found in xmlXPathParseNCName",
46718 xmlMemBlocks() - mem_base);
46719 test_ret++;
46720 printf(" %d", n_ctxt);
46721 printf("\n");
46722 }
46723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046724 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046725#endif
46726
Daniel Veillarda82b1822004-11-08 16:24:57 +000046727 return(test_ret);
46728}
46729
46730
46731static int
46732test_xmlXPathParseName(void) {
46733 int test_ret = 0;
46734
William M. Brack21e4ef22005-01-02 09:53:13 +000046735#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046736 int mem_base;
46737 xmlChar * ret_val;
46738 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46739 int n_ctxt;
46740
46741 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46742 mem_base = xmlMemBlocks();
46743 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46744
46745 ret_val = xmlXPathParseName(ctxt);
46746 desret_xmlChar_ptr(ret_val);
46747 call_tests++;
46748 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46749 xmlResetLastError();
46750 if (mem_base != xmlMemBlocks()) {
46751 printf("Leak of %d blocks found in xmlXPathParseName",
46752 xmlMemBlocks() - mem_base);
46753 test_ret++;
46754 printf(" %d", n_ctxt);
46755 printf("\n");
46756 }
46757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046758 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046759#endif
46760
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761 return(test_ret);
46762}
46763
46764
46765static int
46766test_xmlXPathPopBoolean(void) {
46767 int test_ret = 0;
46768
William M. Brack21e4ef22005-01-02 09:53:13 +000046769#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046770 int mem_base;
46771 int ret_val;
46772 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46773 int n_ctxt;
46774
46775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46776 mem_base = xmlMemBlocks();
46777 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46778
46779 ret_val = xmlXPathPopBoolean(ctxt);
46780 desret_int(ret_val);
46781 call_tests++;
46782 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46783 xmlResetLastError();
46784 if (mem_base != xmlMemBlocks()) {
46785 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46786 xmlMemBlocks() - mem_base);
46787 test_ret++;
46788 printf(" %d", n_ctxt);
46789 printf("\n");
46790 }
46791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046792 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046793#endif
46794
Daniel Veillarda82b1822004-11-08 16:24:57 +000046795 return(test_ret);
46796}
46797
46798
46799static int
46800test_xmlXPathPopExternal(void) {
46801 int test_ret = 0;
46802
William M. Brack21e4ef22005-01-02 09:53:13 +000046803#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046804 int mem_base;
46805 void * ret_val;
46806 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46807 int n_ctxt;
46808
46809 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46810 mem_base = xmlMemBlocks();
46811 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46812
46813 ret_val = xmlXPathPopExternal(ctxt);
46814 desret_void_ptr(ret_val);
46815 call_tests++;
46816 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46817 xmlResetLastError();
46818 if (mem_base != xmlMemBlocks()) {
46819 printf("Leak of %d blocks found in xmlXPathPopExternal",
46820 xmlMemBlocks() - mem_base);
46821 test_ret++;
46822 printf(" %d", n_ctxt);
46823 printf("\n");
46824 }
46825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046826 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046827#endif
46828
Daniel Veillarda82b1822004-11-08 16:24:57 +000046829 return(test_ret);
46830}
46831
46832
46833static int
46834test_xmlXPathPopNodeSet(void) {
46835 int test_ret = 0;
46836
William M. Brack21e4ef22005-01-02 09:53:13 +000046837#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046838 int mem_base;
46839 xmlNodeSetPtr ret_val;
46840 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46841 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046842
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046843 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46844 mem_base = xmlMemBlocks();
46845 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46846
46847 ret_val = xmlXPathPopNodeSet(ctxt);
46848 desret_xmlNodeSetPtr(ret_val);
46849 call_tests++;
46850 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46851 xmlResetLastError();
46852 if (mem_base != xmlMemBlocks()) {
46853 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46854 xmlMemBlocks() - mem_base);
46855 test_ret++;
46856 printf(" %d", n_ctxt);
46857 printf("\n");
46858 }
46859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046860 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046861#endif
46862
Daniel Veillarda82b1822004-11-08 16:24:57 +000046863 return(test_ret);
46864}
46865
46866
46867static int
46868test_xmlXPathPopNumber(void) {
46869 int test_ret = 0;
46870
William M. Brack21e4ef22005-01-02 09:53:13 +000046871#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046872 int mem_base;
46873 double ret_val;
46874 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46875 int n_ctxt;
46876
46877 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46878 mem_base = xmlMemBlocks();
46879 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46880
46881 ret_val = xmlXPathPopNumber(ctxt);
46882 desret_double(ret_val);
46883 call_tests++;
46884 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46885 xmlResetLastError();
46886 if (mem_base != xmlMemBlocks()) {
46887 printf("Leak of %d blocks found in xmlXPathPopNumber",
46888 xmlMemBlocks() - mem_base);
46889 test_ret++;
46890 printf(" %d", n_ctxt);
46891 printf("\n");
46892 }
46893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046894 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046895#endif
46896
Daniel Veillarda82b1822004-11-08 16:24:57 +000046897 return(test_ret);
46898}
46899
46900
46901static int
46902test_xmlXPathPopString(void) {
46903 int test_ret = 0;
46904
William M. Brack21e4ef22005-01-02 09:53:13 +000046905#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046906 int mem_base;
46907 xmlChar * ret_val;
46908 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46909 int n_ctxt;
46910
46911 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46912 mem_base = xmlMemBlocks();
46913 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46914
46915 ret_val = xmlXPathPopString(ctxt);
46916 desret_xmlChar_ptr(ret_val);
46917 call_tests++;
46918 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46919 xmlResetLastError();
46920 if (mem_base != xmlMemBlocks()) {
46921 printf("Leak of %d blocks found in xmlXPathPopString",
46922 xmlMemBlocks() - mem_base);
46923 test_ret++;
46924 printf(" %d", n_ctxt);
46925 printf("\n");
46926 }
46927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046928 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046929#endif
46930
Daniel Veillarda82b1822004-11-08 16:24:57 +000046931 return(test_ret);
46932}
46933
46934
46935static int
46936test_xmlXPathPositionFunction(void) {
46937 int test_ret = 0;
46938
William M. Brack21e4ef22005-01-02 09:53:13 +000046939#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046940 int mem_base;
46941 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46942 int n_ctxt;
46943 int nargs; /* the number of arguments */
46944 int n_nargs;
46945
46946 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46947 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46948 mem_base = xmlMemBlocks();
46949 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46950 nargs = gen_int(n_nargs, 1);
46951
46952 xmlXPathPositionFunction(ctxt, nargs);
46953 call_tests++;
46954 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46955 des_int(n_nargs, nargs, 1);
46956 xmlResetLastError();
46957 if (mem_base != xmlMemBlocks()) {
46958 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46959 xmlMemBlocks() - mem_base);
46960 test_ret++;
46961 printf(" %d", n_ctxt);
46962 printf(" %d", n_nargs);
46963 printf("\n");
46964 }
46965 }
46966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046967 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046968#endif
46969
Daniel Veillarda82b1822004-11-08 16:24:57 +000046970 return(test_ret);
46971}
46972
46973
46974static int
46975test_xmlXPathRegisterAllFunctions(void) {
46976 int test_ret = 0;
46977
William M. Brack21e4ef22005-01-02 09:53:13 +000046978#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046979 int mem_base;
46980 xmlXPathContextPtr ctxt; /* the XPath context */
46981 int n_ctxt;
46982
46983 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46984 mem_base = xmlMemBlocks();
46985 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46986
46987 xmlXPathRegisterAllFunctions(ctxt);
46988 call_tests++;
46989 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46990 xmlResetLastError();
46991 if (mem_base != xmlMemBlocks()) {
46992 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46993 xmlMemBlocks() - mem_base);
46994 test_ret++;
46995 printf(" %d", n_ctxt);
46996 printf("\n");
46997 }
46998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046999 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047000#endif
47001
Daniel Veillarda82b1822004-11-08 16:24:57 +000047002 return(test_ret);
47003}
47004
47005
47006static int
47007test_xmlXPathRegisterFunc(void) {
47008 int test_ret = 0;
47009
47010
47011 /* missing type support */
47012 return(test_ret);
47013}
47014
47015
47016static int
47017test_xmlXPathRegisterFuncLookup(void) {
47018 int test_ret = 0;
47019
47020
47021 /* missing type support */
47022 return(test_ret);
47023}
47024
47025
47026static int
47027test_xmlXPathRegisterFuncNS(void) {
47028 int test_ret = 0;
47029
47030
47031 /* missing type support */
47032 return(test_ret);
47033}
47034
47035
47036static int
47037test_xmlXPathRegisterNs(void) {
47038 int test_ret = 0;
47039
William M. Brack21e4ef22005-01-02 09:53:13 +000047040#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047041 int mem_base;
47042 int ret_val;
47043 xmlXPathContextPtr ctxt; /* the XPath context */
47044 int n_ctxt;
47045 xmlChar * prefix; /* the namespace prefix */
47046 int n_prefix;
47047 xmlChar * ns_uri; /* the namespace name */
47048 int n_ns_uri;
47049
47050 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47051 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47052 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47053 mem_base = xmlMemBlocks();
47054 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47055 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47056 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47057
William M. Brackf13f77f2004-11-12 16:03:48 +000047058 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047059 desret_int(ret_val);
47060 call_tests++;
47061 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047062 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
47063 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047064 xmlResetLastError();
47065 if (mem_base != xmlMemBlocks()) {
47066 printf("Leak of %d blocks found in xmlXPathRegisterNs",
47067 xmlMemBlocks() - mem_base);
47068 test_ret++;
47069 printf(" %d", n_ctxt);
47070 printf(" %d", n_prefix);
47071 printf(" %d", n_ns_uri);
47072 printf("\n");
47073 }
47074 }
47075 }
47076 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047077 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047078#endif
47079
Daniel Veillarda82b1822004-11-08 16:24:57 +000047080 return(test_ret);
47081}
47082
47083
47084static int
47085test_xmlXPathRegisterVariable(void) {
47086 int test_ret = 0;
47087
William M. Brack21e4ef22005-01-02 09:53:13 +000047088#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047089 int mem_base;
47090 int ret_val;
47091 xmlXPathContextPtr ctxt; /* the XPath context */
47092 int n_ctxt;
47093 xmlChar * name; /* the variable name */
47094 int n_name;
47095 xmlXPathObjectPtr value; /* the variable value or NULL */
47096 int n_value;
47097
47098 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47099 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47100 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47101 mem_base = xmlMemBlocks();
47102 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47103 name = gen_const_xmlChar_ptr(n_name, 1);
47104 value = gen_xmlXPathObjectPtr(n_value, 2);
47105
William M. Brackf13f77f2004-11-12 16:03:48 +000047106 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047107 desret_int(ret_val);
47108 call_tests++;
47109 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047110 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047111 des_xmlXPathObjectPtr(n_value, value, 2);
47112 xmlResetLastError();
47113 if (mem_base != xmlMemBlocks()) {
47114 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47115 xmlMemBlocks() - mem_base);
47116 test_ret++;
47117 printf(" %d", n_ctxt);
47118 printf(" %d", n_name);
47119 printf(" %d", n_value);
47120 printf("\n");
47121 }
47122 }
47123 }
47124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047125 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047126#endif
47127
Daniel Veillarda82b1822004-11-08 16:24:57 +000047128 return(test_ret);
47129}
47130
47131
47132static int
47133test_xmlXPathRegisterVariableLookup(void) {
47134 int test_ret = 0;
47135
47136
47137 /* missing type support */
47138 return(test_ret);
47139}
47140
47141
47142static int
47143test_xmlXPathRegisterVariableNS(void) {
47144 int test_ret = 0;
47145
William M. Brack21e4ef22005-01-02 09:53:13 +000047146#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047147 int mem_base;
47148 int ret_val;
47149 xmlXPathContextPtr ctxt; /* the XPath context */
47150 int n_ctxt;
47151 xmlChar * name; /* the variable name */
47152 int n_name;
47153 xmlChar * ns_uri; /* the variable namespace URI */
47154 int n_ns_uri;
47155 xmlXPathObjectPtr value; /* the variable value or NULL */
47156 int n_value;
47157
47158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47159 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47160 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47161 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47162 mem_base = xmlMemBlocks();
47163 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47164 name = gen_const_xmlChar_ptr(n_name, 1);
47165 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47166 value = gen_xmlXPathObjectPtr(n_value, 3);
47167
William M. Brackf13f77f2004-11-12 16:03:48 +000047168 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047169 desret_int(ret_val);
47170 call_tests++;
47171 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047172 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47173 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047174 des_xmlXPathObjectPtr(n_value, value, 3);
47175 xmlResetLastError();
47176 if (mem_base != xmlMemBlocks()) {
47177 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47178 xmlMemBlocks() - mem_base);
47179 test_ret++;
47180 printf(" %d", n_ctxt);
47181 printf(" %d", n_name);
47182 printf(" %d", n_ns_uri);
47183 printf(" %d", n_value);
47184 printf("\n");
47185 }
47186 }
47187 }
47188 }
47189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047190 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047191#endif
47192
Daniel Veillarda82b1822004-11-08 16:24:57 +000047193 return(test_ret);
47194}
47195
47196
47197static int
47198test_xmlXPathRegisteredFuncsCleanup(void) {
47199 int test_ret = 0;
47200
William M. Brack21e4ef22005-01-02 09:53:13 +000047201#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047202 int mem_base;
47203 xmlXPathContextPtr ctxt; /* the XPath context */
47204 int n_ctxt;
47205
47206 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47207 mem_base = xmlMemBlocks();
47208 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47209
47210 xmlXPathRegisteredFuncsCleanup(ctxt);
47211 call_tests++;
47212 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47213 xmlResetLastError();
47214 if (mem_base != xmlMemBlocks()) {
47215 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
47216 xmlMemBlocks() - mem_base);
47217 test_ret++;
47218 printf(" %d", n_ctxt);
47219 printf("\n");
47220 }
47221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047222 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047223#endif
47224
Daniel Veillarda82b1822004-11-08 16:24:57 +000047225 return(test_ret);
47226}
47227
47228
47229static int
47230test_xmlXPathRegisteredNsCleanup(void) {
47231 int test_ret = 0;
47232
William M. Brack21e4ef22005-01-02 09:53:13 +000047233#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047234 int mem_base;
47235 xmlXPathContextPtr ctxt; /* the XPath context */
47236 int n_ctxt;
47237
47238 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47239 mem_base = xmlMemBlocks();
47240 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47241
47242 xmlXPathRegisteredNsCleanup(ctxt);
47243 call_tests++;
47244 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47245 xmlResetLastError();
47246 if (mem_base != xmlMemBlocks()) {
47247 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47248 xmlMemBlocks() - mem_base);
47249 test_ret++;
47250 printf(" %d", n_ctxt);
47251 printf("\n");
47252 }
47253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047254 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047255#endif
47256
Daniel Veillarda82b1822004-11-08 16:24:57 +000047257 return(test_ret);
47258}
47259
47260
47261static int
47262test_xmlXPathRegisteredVariablesCleanup(void) {
47263 int test_ret = 0;
47264
William M. Brack21e4ef22005-01-02 09:53:13 +000047265#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047266 int mem_base;
47267 xmlXPathContextPtr ctxt; /* the XPath context */
47268 int n_ctxt;
47269
47270 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47271 mem_base = xmlMemBlocks();
47272 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47273
47274 xmlXPathRegisteredVariablesCleanup(ctxt);
47275 call_tests++;
47276 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47277 xmlResetLastError();
47278 if (mem_base != xmlMemBlocks()) {
47279 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47280 xmlMemBlocks() - mem_base);
47281 test_ret++;
47282 printf(" %d", n_ctxt);
47283 printf("\n");
47284 }
47285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047286 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047287#endif
47288
Daniel Veillarda82b1822004-11-08 16:24:57 +000047289 return(test_ret);
47290}
47291
47292
47293static int
47294test_xmlXPathRoot(void) {
47295 int test_ret = 0;
47296
William M. Brack21e4ef22005-01-02 09:53:13 +000047297#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047298 int mem_base;
47299 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47300 int n_ctxt;
47301
47302 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47303 mem_base = xmlMemBlocks();
47304 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47305
47306 xmlXPathRoot(ctxt);
47307 call_tests++;
47308 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47309 xmlResetLastError();
47310 if (mem_base != xmlMemBlocks()) {
47311 printf("Leak of %d blocks found in xmlXPathRoot",
47312 xmlMemBlocks() - mem_base);
47313 test_ret++;
47314 printf(" %d", n_ctxt);
47315 printf("\n");
47316 }
47317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047318 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047319#endif
47320
Daniel Veillarda82b1822004-11-08 16:24:57 +000047321 return(test_ret);
47322}
47323
47324
47325static int
47326test_xmlXPathRoundFunction(void) {
47327 int test_ret = 0;
47328
William M. Brack21e4ef22005-01-02 09:53:13 +000047329#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047330 int mem_base;
47331 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47332 int n_ctxt;
47333 int nargs; /* the number of arguments */
47334 int n_nargs;
47335
47336 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47337 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47338 mem_base = xmlMemBlocks();
47339 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47340 nargs = gen_int(n_nargs, 1);
47341
47342 xmlXPathRoundFunction(ctxt, nargs);
47343 call_tests++;
47344 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47345 des_int(n_nargs, nargs, 1);
47346 xmlResetLastError();
47347 if (mem_base != xmlMemBlocks()) {
47348 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47349 xmlMemBlocks() - mem_base);
47350 test_ret++;
47351 printf(" %d", n_ctxt);
47352 printf(" %d", n_nargs);
47353 printf("\n");
47354 }
47355 }
47356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047357 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047358#endif
47359
Daniel Veillarda82b1822004-11-08 16:24:57 +000047360 return(test_ret);
47361}
47362
47363
47364static int
47365test_xmlXPathStartsWithFunction(void) {
47366 int test_ret = 0;
47367
William M. Brack21e4ef22005-01-02 09:53:13 +000047368#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047369 int mem_base;
47370 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47371 int n_ctxt;
47372 int nargs; /* the number of arguments */
47373 int n_nargs;
47374
47375 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47376 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47377 mem_base = xmlMemBlocks();
47378 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47379 nargs = gen_int(n_nargs, 1);
47380
47381 xmlXPathStartsWithFunction(ctxt, nargs);
47382 call_tests++;
47383 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47384 des_int(n_nargs, nargs, 1);
47385 xmlResetLastError();
47386 if (mem_base != xmlMemBlocks()) {
47387 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47388 xmlMemBlocks() - mem_base);
47389 test_ret++;
47390 printf(" %d", n_ctxt);
47391 printf(" %d", n_nargs);
47392 printf("\n");
47393 }
47394 }
47395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047396 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047397#endif
47398
Daniel Veillarda82b1822004-11-08 16:24:57 +000047399 return(test_ret);
47400}
47401
47402
47403static int
47404test_xmlXPathStringEvalNumber(void) {
47405 int test_ret = 0;
47406
William M. Brack21e4ef22005-01-02 09:53:13 +000047407#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047408 int mem_base;
47409 double ret_val;
47410 xmlChar * str; /* A string to scan */
47411 int n_str;
47412
47413 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47414 mem_base = xmlMemBlocks();
47415 str = gen_const_xmlChar_ptr(n_str, 0);
47416
William M. Brackf13f77f2004-11-12 16:03:48 +000047417 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047418 desret_double(ret_val);
47419 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047420 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047421 xmlResetLastError();
47422 if (mem_base != xmlMemBlocks()) {
47423 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47424 xmlMemBlocks() - mem_base);
47425 test_ret++;
47426 printf(" %d", n_str);
47427 printf("\n");
47428 }
47429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047430 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047431#endif
47432
Daniel Veillarda82b1822004-11-08 16:24:57 +000047433 return(test_ret);
47434}
47435
47436
47437static int
47438test_xmlXPathStringFunction(void) {
47439 int test_ret = 0;
47440
William M. Brack21e4ef22005-01-02 09:53:13 +000047441#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047442 int mem_base;
47443 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47444 int n_ctxt;
47445 int nargs; /* the number of arguments */
47446 int n_nargs;
47447
47448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47449 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47450 mem_base = xmlMemBlocks();
47451 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47452 nargs = gen_int(n_nargs, 1);
47453
47454 xmlXPathStringFunction(ctxt, nargs);
47455 call_tests++;
47456 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47457 des_int(n_nargs, nargs, 1);
47458 xmlResetLastError();
47459 if (mem_base != xmlMemBlocks()) {
47460 printf("Leak of %d blocks found in xmlXPathStringFunction",
47461 xmlMemBlocks() - mem_base);
47462 test_ret++;
47463 printf(" %d", n_ctxt);
47464 printf(" %d", n_nargs);
47465 printf("\n");
47466 }
47467 }
47468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047469 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047470#endif
47471
Daniel Veillarda82b1822004-11-08 16:24:57 +000047472 return(test_ret);
47473}
47474
47475
47476static int
47477test_xmlXPathStringLengthFunction(void) {
47478 int test_ret = 0;
47479
William M. Brack21e4ef22005-01-02 09:53:13 +000047480#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047481 int mem_base;
47482 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47483 int n_ctxt;
47484 int nargs; /* the number of arguments */
47485 int n_nargs;
47486
47487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47488 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47489 mem_base = xmlMemBlocks();
47490 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47491 nargs = gen_int(n_nargs, 1);
47492
47493 xmlXPathStringLengthFunction(ctxt, nargs);
47494 call_tests++;
47495 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47496 des_int(n_nargs, nargs, 1);
47497 xmlResetLastError();
47498 if (mem_base != xmlMemBlocks()) {
47499 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47500 xmlMemBlocks() - mem_base);
47501 test_ret++;
47502 printf(" %d", n_ctxt);
47503 printf(" %d", n_nargs);
47504 printf("\n");
47505 }
47506 }
47507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047508 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047509#endif
47510
Daniel Veillarda82b1822004-11-08 16:24:57 +000047511 return(test_ret);
47512}
47513
47514
47515static int
47516test_xmlXPathSubValues(void) {
47517 int test_ret = 0;
47518
William M. Brack21e4ef22005-01-02 09:53:13 +000047519#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047520 int mem_base;
47521 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47522 int n_ctxt;
47523
47524 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47525 mem_base = xmlMemBlocks();
47526 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47527
47528 xmlXPathSubValues(ctxt);
47529 call_tests++;
47530 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47531 xmlResetLastError();
47532 if (mem_base != xmlMemBlocks()) {
47533 printf("Leak of %d blocks found in xmlXPathSubValues",
47534 xmlMemBlocks() - mem_base);
47535 test_ret++;
47536 printf(" %d", n_ctxt);
47537 printf("\n");
47538 }
47539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047540 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047541#endif
47542
Daniel Veillarda82b1822004-11-08 16:24:57 +000047543 return(test_ret);
47544}
47545
47546
47547static int
47548test_xmlXPathSubstringAfterFunction(void) {
47549 int test_ret = 0;
47550
William M. Brack21e4ef22005-01-02 09:53:13 +000047551#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047552 int mem_base;
47553 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47554 int n_ctxt;
47555 int nargs; /* the number of arguments */
47556 int n_nargs;
47557
47558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47559 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47560 mem_base = xmlMemBlocks();
47561 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47562 nargs = gen_int(n_nargs, 1);
47563
47564 xmlXPathSubstringAfterFunction(ctxt, nargs);
47565 call_tests++;
47566 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47567 des_int(n_nargs, nargs, 1);
47568 xmlResetLastError();
47569 if (mem_base != xmlMemBlocks()) {
47570 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47571 xmlMemBlocks() - mem_base);
47572 test_ret++;
47573 printf(" %d", n_ctxt);
47574 printf(" %d", n_nargs);
47575 printf("\n");
47576 }
47577 }
47578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047579 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047580#endif
47581
Daniel Veillarda82b1822004-11-08 16:24:57 +000047582 return(test_ret);
47583}
47584
47585
47586static int
47587test_xmlXPathSubstringBeforeFunction(void) {
47588 int test_ret = 0;
47589
William M. Brack21e4ef22005-01-02 09:53:13 +000047590#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047591 int mem_base;
47592 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47593 int n_ctxt;
47594 int nargs; /* the number of arguments */
47595 int n_nargs;
47596
47597 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47598 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47599 mem_base = xmlMemBlocks();
47600 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47601 nargs = gen_int(n_nargs, 1);
47602
47603 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47604 call_tests++;
47605 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47606 des_int(n_nargs, nargs, 1);
47607 xmlResetLastError();
47608 if (mem_base != xmlMemBlocks()) {
47609 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47610 xmlMemBlocks() - mem_base);
47611 test_ret++;
47612 printf(" %d", n_ctxt);
47613 printf(" %d", n_nargs);
47614 printf("\n");
47615 }
47616 }
47617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047618 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047619#endif
47620
Daniel Veillarda82b1822004-11-08 16:24:57 +000047621 return(test_ret);
47622}
47623
47624
47625static int
47626test_xmlXPathSubstringFunction(void) {
47627 int test_ret = 0;
47628
William M. Brack21e4ef22005-01-02 09:53:13 +000047629#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047630 int mem_base;
47631 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47632 int n_ctxt;
47633 int nargs; /* the number of arguments */
47634 int n_nargs;
47635
47636 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47637 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47638 mem_base = xmlMemBlocks();
47639 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47640 nargs = gen_int(n_nargs, 1);
47641
47642 xmlXPathSubstringFunction(ctxt, nargs);
47643 call_tests++;
47644 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47645 des_int(n_nargs, nargs, 1);
47646 xmlResetLastError();
47647 if (mem_base != xmlMemBlocks()) {
47648 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47649 xmlMemBlocks() - mem_base);
47650 test_ret++;
47651 printf(" %d", n_ctxt);
47652 printf(" %d", n_nargs);
47653 printf("\n");
47654 }
47655 }
47656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047657 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047658#endif
47659
Daniel Veillarda82b1822004-11-08 16:24:57 +000047660 return(test_ret);
47661}
47662
47663
47664static int
47665test_xmlXPathSumFunction(void) {
47666 int test_ret = 0;
47667
William M. Brack21e4ef22005-01-02 09:53:13 +000047668#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047669 int mem_base;
47670 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47671 int n_ctxt;
47672 int nargs; /* the number of arguments */
47673 int n_nargs;
47674
47675 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47676 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47677 mem_base = xmlMemBlocks();
47678 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47679 nargs = gen_int(n_nargs, 1);
47680
47681 xmlXPathSumFunction(ctxt, nargs);
47682 call_tests++;
47683 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47684 des_int(n_nargs, nargs, 1);
47685 xmlResetLastError();
47686 if (mem_base != xmlMemBlocks()) {
47687 printf("Leak of %d blocks found in xmlXPathSumFunction",
47688 xmlMemBlocks() - mem_base);
47689 test_ret++;
47690 printf(" %d", n_ctxt);
47691 printf(" %d", n_nargs);
47692 printf("\n");
47693 }
47694 }
47695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047696 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047697#endif
47698
Daniel Veillarda82b1822004-11-08 16:24:57 +000047699 return(test_ret);
47700}
47701
47702
47703static int
47704test_xmlXPathTrailing(void) {
47705 int test_ret = 0;
47706
William M. Brack21e4ef22005-01-02 09:53:13 +000047707#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047708 int mem_base;
47709 xmlNodeSetPtr ret_val;
47710 xmlNodeSetPtr nodes1; /* a node-set */
47711 int n_nodes1;
47712 xmlNodeSetPtr nodes2; /* a node-set */
47713 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047714
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047715 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47716 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47717 mem_base = xmlMemBlocks();
47718 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47719 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47720
47721 ret_val = xmlXPathTrailing(nodes1, nodes2);
47722 desret_xmlNodeSetPtr(ret_val);
47723 call_tests++;
47724 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47725 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47726 xmlResetLastError();
47727 if (mem_base != xmlMemBlocks()) {
47728 printf("Leak of %d blocks found in xmlXPathTrailing",
47729 xmlMemBlocks() - mem_base);
47730 test_ret++;
47731 printf(" %d", n_nodes1);
47732 printf(" %d", n_nodes2);
47733 printf("\n");
47734 }
47735 }
47736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047737 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047738#endif
47739
Daniel Veillarda82b1822004-11-08 16:24:57 +000047740 return(test_ret);
47741}
47742
47743
47744static int
47745test_xmlXPathTrailingSorted(void) {
47746 int test_ret = 0;
47747
William M. Brack21e4ef22005-01-02 09:53:13 +000047748#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047749 int mem_base;
47750 xmlNodeSetPtr ret_val;
47751 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47752 int n_nodes1;
47753 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47754 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047755
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047756 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47757 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47758 mem_base = xmlMemBlocks();
47759 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47760 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47761
47762 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47763 desret_xmlNodeSetPtr(ret_val);
47764 call_tests++;
47765 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47766 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47767 xmlResetLastError();
47768 if (mem_base != xmlMemBlocks()) {
47769 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47770 xmlMemBlocks() - mem_base);
47771 test_ret++;
47772 printf(" %d", n_nodes1);
47773 printf(" %d", n_nodes2);
47774 printf("\n");
47775 }
47776 }
47777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047778 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047779#endif
47780
Daniel Veillarda82b1822004-11-08 16:24:57 +000047781 return(test_ret);
47782}
47783
47784
47785static int
47786test_xmlXPathTranslateFunction(void) {
47787 int test_ret = 0;
47788
William M. Brack21e4ef22005-01-02 09:53:13 +000047789#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047790 int mem_base;
47791 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47792 int n_ctxt;
47793 int nargs; /* the number of arguments */
47794 int n_nargs;
47795
47796 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47797 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47798 mem_base = xmlMemBlocks();
47799 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47800 nargs = gen_int(n_nargs, 1);
47801
47802 xmlXPathTranslateFunction(ctxt, nargs);
47803 call_tests++;
47804 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47805 des_int(n_nargs, nargs, 1);
47806 xmlResetLastError();
47807 if (mem_base != xmlMemBlocks()) {
47808 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47809 xmlMemBlocks() - mem_base);
47810 test_ret++;
47811 printf(" %d", n_ctxt);
47812 printf(" %d", n_nargs);
47813 printf("\n");
47814 }
47815 }
47816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047817 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047818#endif
47819
Daniel Veillarda82b1822004-11-08 16:24:57 +000047820 return(test_ret);
47821}
47822
47823
47824static int
47825test_xmlXPathTrueFunction(void) {
47826 int test_ret = 0;
47827
William M. Brack21e4ef22005-01-02 09:53:13 +000047828#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047829 int mem_base;
47830 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47831 int n_ctxt;
47832 int nargs; /* the number of arguments */
47833 int n_nargs;
47834
47835 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47836 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47837 mem_base = xmlMemBlocks();
47838 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47839 nargs = gen_int(n_nargs, 1);
47840
47841 xmlXPathTrueFunction(ctxt, nargs);
47842 call_tests++;
47843 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47844 des_int(n_nargs, nargs, 1);
47845 xmlResetLastError();
47846 if (mem_base != xmlMemBlocks()) {
47847 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47848 xmlMemBlocks() - mem_base);
47849 test_ret++;
47850 printf(" %d", n_ctxt);
47851 printf(" %d", n_nargs);
47852 printf("\n");
47853 }
47854 }
47855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047856 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047857#endif
47858
Daniel Veillarda82b1822004-11-08 16:24:57 +000047859 return(test_ret);
47860}
47861
47862
47863static int
47864test_xmlXPathValueFlipSign(void) {
47865 int test_ret = 0;
47866
William M. Brack21e4ef22005-01-02 09:53:13 +000047867#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047868 int mem_base;
47869 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47870 int n_ctxt;
47871
47872 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47873 mem_base = xmlMemBlocks();
47874 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47875
47876 xmlXPathValueFlipSign(ctxt);
47877 call_tests++;
47878 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47879 xmlResetLastError();
47880 if (mem_base != xmlMemBlocks()) {
47881 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47882 xmlMemBlocks() - mem_base);
47883 test_ret++;
47884 printf(" %d", n_ctxt);
47885 printf("\n");
47886 }
47887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047888 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047889#endif
47890
Daniel Veillarda82b1822004-11-08 16:24:57 +000047891 return(test_ret);
47892}
47893
47894
47895static int
47896test_xmlXPathVariableLookup(void) {
47897 int test_ret = 0;
47898
William M. Brack21e4ef22005-01-02 09:53:13 +000047899#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047900 int mem_base;
47901 xmlXPathObjectPtr ret_val;
47902 xmlXPathContextPtr ctxt; /* the XPath context */
47903 int n_ctxt;
47904 xmlChar * name; /* the variable name */
47905 int n_name;
47906
47907 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47908 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47909 mem_base = xmlMemBlocks();
47910 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47911 name = gen_const_xmlChar_ptr(n_name, 1);
47912
William M. Brackf13f77f2004-11-12 16:03:48 +000047913 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047914 desret_xmlXPathObjectPtr(ret_val);
47915 call_tests++;
47916 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047917 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047918 xmlResetLastError();
47919 if (mem_base != xmlMemBlocks()) {
47920 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47921 xmlMemBlocks() - mem_base);
47922 test_ret++;
47923 printf(" %d", n_ctxt);
47924 printf(" %d", n_name);
47925 printf("\n");
47926 }
47927 }
47928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047929 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047930#endif
47931
Daniel Veillarda82b1822004-11-08 16:24:57 +000047932 return(test_ret);
47933}
47934
47935
47936static int
47937test_xmlXPathVariableLookupNS(void) {
47938 int test_ret = 0;
47939
William M. Brack21e4ef22005-01-02 09:53:13 +000047940#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047941 int mem_base;
47942 xmlXPathObjectPtr ret_val;
47943 xmlXPathContextPtr ctxt; /* the XPath context */
47944 int n_ctxt;
47945 xmlChar * name; /* the variable name */
47946 int n_name;
47947 xmlChar * ns_uri; /* the variable namespace URI */
47948 int n_ns_uri;
47949
47950 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47951 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47952 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47953 mem_base = xmlMemBlocks();
47954 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47955 name = gen_const_xmlChar_ptr(n_name, 1);
47956 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47957
William M. Brackf13f77f2004-11-12 16:03:48 +000047958 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047959 desret_xmlXPathObjectPtr(ret_val);
47960 call_tests++;
47961 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047962 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47963 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047964 xmlResetLastError();
47965 if (mem_base != xmlMemBlocks()) {
47966 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47967 xmlMemBlocks() - mem_base);
47968 test_ret++;
47969 printf(" %d", n_ctxt);
47970 printf(" %d", n_name);
47971 printf(" %d", n_ns_uri);
47972 printf("\n");
47973 }
47974 }
47975 }
47976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047977 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047978#endif
47979
Daniel Veillarda82b1822004-11-08 16:24:57 +000047980 return(test_ret);
47981}
47982
47983
47984static int
47985test_xmlXPathWrapCString(void) {
47986 int test_ret = 0;
47987
William M. Brack21e4ef22005-01-02 09:53:13 +000047988#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047989 int mem_base;
47990 xmlXPathObjectPtr ret_val;
47991 char * val; /* the char * value */
47992 int n_val;
47993
47994 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47995 mem_base = xmlMemBlocks();
47996 val = gen_char_ptr(n_val, 0);
47997
47998 ret_val = xmlXPathWrapCString(val);
47999 desret_xmlXPathObjectPtr(ret_val);
48000 call_tests++;
48001 des_char_ptr(n_val, val, 0);
48002 xmlResetLastError();
48003 if (mem_base != xmlMemBlocks()) {
48004 printf("Leak of %d blocks found in xmlXPathWrapCString",
48005 xmlMemBlocks() - mem_base);
48006 test_ret++;
48007 printf(" %d", n_val);
48008 printf("\n");
48009 }
48010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048011 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048012#endif
48013
Daniel Veillarda82b1822004-11-08 16:24:57 +000048014 return(test_ret);
48015}
48016
48017
48018static int
48019test_xmlXPathWrapExternal(void) {
48020 int test_ret = 0;
48021
William M. Brack21e4ef22005-01-02 09:53:13 +000048022#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048023 int mem_base;
48024 xmlXPathObjectPtr ret_val;
48025 void * val; /* the user data */
48026 int n_val;
48027
48028 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
48029 mem_base = xmlMemBlocks();
48030 val = gen_void_ptr(n_val, 0);
48031
48032 ret_val = xmlXPathWrapExternal(val);
48033 desret_xmlXPathObjectPtr(ret_val);
48034 call_tests++;
48035 des_void_ptr(n_val, val, 0);
48036 xmlResetLastError();
48037 if (mem_base != xmlMemBlocks()) {
48038 printf("Leak of %d blocks found in xmlXPathWrapExternal",
48039 xmlMemBlocks() - mem_base);
48040 test_ret++;
48041 printf(" %d", n_val);
48042 printf("\n");
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_xmlXPathWrapNodeSet(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 xmlXPathObjectPtr ret_val;
48059 xmlNodeSetPtr val; /* the NodePtr value */
48060 int n_val;
48061
48062 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
48063 mem_base = xmlMemBlocks();
48064 val = gen_xmlNodeSetPtr(n_val, 0);
48065
48066 ret_val = xmlXPathWrapNodeSet(val);
48067 desret_xmlXPathObjectPtr(ret_val);
48068 call_tests++;
48069 des_xmlNodeSetPtr(n_val, val, 0);
48070 xmlResetLastError();
48071 if (mem_base != xmlMemBlocks()) {
48072 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
48073 xmlMemBlocks() - mem_base);
48074 test_ret++;
48075 printf(" %d", n_val);
48076 printf("\n");
48077 }
48078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048079 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048080#endif
48081
Daniel Veillarda82b1822004-11-08 16:24:57 +000048082 return(test_ret);
48083}
48084
48085
48086static int
48087test_xmlXPatherror(void) {
48088 int test_ret = 0;
48089
William M. Brack21e4ef22005-01-02 09:53:13 +000048090#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048091 int mem_base;
48092 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48093 int n_ctxt;
48094 const char * file; /* the file name */
48095 int n_file;
48096 int line; /* the line number */
48097 int n_line;
48098 int no; /* the error number */
48099 int n_no;
48100
48101 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48102 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48103 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48104 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48105 mem_base = xmlMemBlocks();
48106 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48107 file = gen_filepath(n_file, 1);
48108 line = gen_int(n_line, 2);
48109 no = gen_int(n_no, 3);
48110
48111 xmlXPatherror(ctxt, file, line, no);
48112 call_tests++;
48113 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48114 des_filepath(n_file, file, 1);
48115 des_int(n_line, line, 2);
48116 des_int(n_no, no, 3);
48117 xmlResetLastError();
48118 if (mem_base != xmlMemBlocks()) {
48119 printf("Leak of %d blocks found in xmlXPatherror",
48120 xmlMemBlocks() - mem_base);
48121 test_ret++;
48122 printf(" %d", n_ctxt);
48123 printf(" %d", n_file);
48124 printf(" %d", n_line);
48125 printf(" %d", n_no);
48126 printf("\n");
48127 }
48128 }
48129 }
48130 }
48131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048132 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048133#endif
48134
Daniel Veillarda82b1822004-11-08 16:24:57 +000048135 return(test_ret);
48136}
48137
48138static int
48139test_xpathInternals(void) {
48140 int test_ret = 0;
48141
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048142 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048143 test_ret += test_valuePop();
48144 test_ret += test_valuePush();
48145 test_ret += test_xmlXPathAddValues();
48146 test_ret += test_xmlXPathBooleanFunction();
48147 test_ret += test_xmlXPathCeilingFunction();
48148 test_ret += test_xmlXPathCompareValues();
48149 test_ret += test_xmlXPathConcatFunction();
48150 test_ret += test_xmlXPathContainsFunction();
48151 test_ret += test_xmlXPathCountFunction();
48152 test_ret += test_xmlXPathDebugDumpCompExpr();
48153 test_ret += test_xmlXPathDebugDumpObject();
48154 test_ret += test_xmlXPathDifference();
48155 test_ret += test_xmlXPathDistinct();
48156 test_ret += test_xmlXPathDistinctSorted();
48157 test_ret += test_xmlXPathDivValues();
48158 test_ret += test_xmlXPathEqualValues();
48159 test_ret += test_xmlXPathErr();
48160 test_ret += test_xmlXPathEvalExpr();
48161 test_ret += test_xmlXPathEvaluatePredicateResult();
48162 test_ret += test_xmlXPathFalseFunction();
48163 test_ret += test_xmlXPathFloorFunction();
48164 test_ret += test_xmlXPathFunctionLookup();
48165 test_ret += test_xmlXPathFunctionLookupNS();
48166 test_ret += test_xmlXPathHasSameNodes();
48167 test_ret += test_xmlXPathIdFunction();
48168 test_ret += test_xmlXPathIntersection();
48169 test_ret += test_xmlXPathIsNodeType();
48170 test_ret += test_xmlXPathLangFunction();
48171 test_ret += test_xmlXPathLastFunction();
48172 test_ret += test_xmlXPathLeading();
48173 test_ret += test_xmlXPathLeadingSorted();
48174 test_ret += test_xmlXPathLocalNameFunction();
48175 test_ret += test_xmlXPathModValues();
48176 test_ret += test_xmlXPathMultValues();
48177 test_ret += test_xmlXPathNamespaceURIFunction();
48178 test_ret += test_xmlXPathNewBoolean();
48179 test_ret += test_xmlXPathNewCString();
48180 test_ret += test_xmlXPathNewFloat();
48181 test_ret += test_xmlXPathNewNodeSet();
48182 test_ret += test_xmlXPathNewNodeSetList();
48183 test_ret += test_xmlXPathNewParserContext();
48184 test_ret += test_xmlXPathNewString();
48185 test_ret += test_xmlXPathNextAncestor();
48186 test_ret += test_xmlXPathNextAncestorOrSelf();
48187 test_ret += test_xmlXPathNextAttribute();
48188 test_ret += test_xmlXPathNextChild();
48189 test_ret += test_xmlXPathNextDescendant();
48190 test_ret += test_xmlXPathNextDescendantOrSelf();
48191 test_ret += test_xmlXPathNextFollowing();
48192 test_ret += test_xmlXPathNextFollowingSibling();
48193 test_ret += test_xmlXPathNextNamespace();
48194 test_ret += test_xmlXPathNextParent();
48195 test_ret += test_xmlXPathNextPreceding();
48196 test_ret += test_xmlXPathNextPrecedingSibling();
48197 test_ret += test_xmlXPathNextSelf();
48198 test_ret += test_xmlXPathNodeLeading();
48199 test_ret += test_xmlXPathNodeLeadingSorted();
48200 test_ret += test_xmlXPathNodeSetAdd();
48201 test_ret += test_xmlXPathNodeSetAddNs();
48202 test_ret += test_xmlXPathNodeSetAddUnique();
48203 test_ret += test_xmlXPathNodeSetContains();
48204 test_ret += test_xmlXPathNodeSetDel();
48205 test_ret += test_xmlXPathNodeSetMerge();
48206 test_ret += test_xmlXPathNodeSetRemove();
48207 test_ret += test_xmlXPathNodeSetSort();
48208 test_ret += test_xmlXPathNodeTrailing();
48209 test_ret += test_xmlXPathNodeTrailingSorted();
48210 test_ret += test_xmlXPathNormalizeFunction();
48211 test_ret += test_xmlXPathNotEqualValues();
48212 test_ret += test_xmlXPathNotFunction();
48213 test_ret += test_xmlXPathNsLookup();
48214 test_ret += test_xmlXPathNumberFunction();
48215 test_ret += test_xmlXPathParseNCName();
48216 test_ret += test_xmlXPathParseName();
48217 test_ret += test_xmlXPathPopBoolean();
48218 test_ret += test_xmlXPathPopExternal();
48219 test_ret += test_xmlXPathPopNodeSet();
48220 test_ret += test_xmlXPathPopNumber();
48221 test_ret += test_xmlXPathPopString();
48222 test_ret += test_xmlXPathPositionFunction();
48223 test_ret += test_xmlXPathRegisterAllFunctions();
48224 test_ret += test_xmlXPathRegisterFunc();
48225 test_ret += test_xmlXPathRegisterFuncLookup();
48226 test_ret += test_xmlXPathRegisterFuncNS();
48227 test_ret += test_xmlXPathRegisterNs();
48228 test_ret += test_xmlXPathRegisterVariable();
48229 test_ret += test_xmlXPathRegisterVariableLookup();
48230 test_ret += test_xmlXPathRegisterVariableNS();
48231 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48232 test_ret += test_xmlXPathRegisteredNsCleanup();
48233 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48234 test_ret += test_xmlXPathRoot();
48235 test_ret += test_xmlXPathRoundFunction();
48236 test_ret += test_xmlXPathStartsWithFunction();
48237 test_ret += test_xmlXPathStringEvalNumber();
48238 test_ret += test_xmlXPathStringFunction();
48239 test_ret += test_xmlXPathStringLengthFunction();
48240 test_ret += test_xmlXPathSubValues();
48241 test_ret += test_xmlXPathSubstringAfterFunction();
48242 test_ret += test_xmlXPathSubstringBeforeFunction();
48243 test_ret += test_xmlXPathSubstringFunction();
48244 test_ret += test_xmlXPathSumFunction();
48245 test_ret += test_xmlXPathTrailing();
48246 test_ret += test_xmlXPathTrailingSorted();
48247 test_ret += test_xmlXPathTranslateFunction();
48248 test_ret += test_xmlXPathTrueFunction();
48249 test_ret += test_xmlXPathValueFlipSign();
48250 test_ret += test_xmlXPathVariableLookup();
48251 test_ret += test_xmlXPathVariableLookupNS();
48252 test_ret += test_xmlXPathWrapCString();
48253 test_ret += test_xmlXPathWrapExternal();
48254 test_ret += test_xmlXPathWrapNodeSet();
48255 test_ret += test_xmlXPatherror();
48256
48257 if (test_ret != 0)
48258 printf("Module xpathInternals: %d errors\n", test_ret);
48259 return(test_ret);
48260}
48261
Daniel Veillardd93f6252004-11-02 15:53:51 +000048262static int
48263test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048265
William M. Brack21e4ef22005-01-02 09:53:13 +000048266#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048267 int mem_base;
48268 xmlNodePtr ret_val;
48269 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48270 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048271
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048272 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48273 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048274 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048275
48276 ret_val = xmlXPtrBuildNodeList(obj);
48277 desret_xmlNodePtr(ret_val);
48278 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048279 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048280 xmlResetLastError();
48281 if (mem_base != xmlMemBlocks()) {
48282 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048284 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048285 printf(" %d", n_obj);
48286 printf("\n");
48287 }
48288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048289 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048290#endif
48291
Daniel Veillard42595322004-11-08 10:52:06 +000048292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048293}
48294
48295
48296static int
48297test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048299
William M. Brack21e4ef22005-01-02 09:53:13 +000048300#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048301 int mem_base;
48302 xmlXPathObjectPtr ret_val;
48303 xmlChar * str; /* the XPointer expression */
48304 int n_str;
48305 xmlXPathContextPtr ctx; /* the XPointer context */
48306 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048307
Daniel Veillardce682bc2004-11-05 17:22:25 +000048308 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48309 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48310 mem_base = xmlMemBlocks();
48311 str = gen_const_xmlChar_ptr(n_str, 0);
48312 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48313
William M. Brackf13f77f2004-11-12 16:03:48 +000048314 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048315 desret_xmlXPathObjectPtr(ret_val);
48316 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048317 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048318 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48319 xmlResetLastError();
48320 if (mem_base != xmlMemBlocks()) {
48321 printf("Leak of %d blocks found in xmlXPtrEval",
48322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048323 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048324 printf(" %d", n_str);
48325 printf(" %d", n_ctx);
48326 printf("\n");
48327 }
48328 }
48329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048330 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048331#endif
48332
Daniel Veillard42595322004-11-08 10:52:06 +000048333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048334}
48335
48336
48337static int
48338test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048340
William M. Brack21e4ef22005-01-02 09:53:13 +000048341#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048342 int mem_base;
48343 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48344 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048345
Daniel Veillardce682bc2004-11-05 17:22:25 +000048346 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48347 mem_base = xmlMemBlocks();
48348 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48349
48350 xmlXPtrEvalRangePredicate(ctxt);
48351 call_tests++;
48352 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48353 xmlResetLastError();
48354 if (mem_base != xmlMemBlocks()) {
48355 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048357 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048358 printf(" %d", n_ctxt);
48359 printf("\n");
48360 }
48361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048362 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048363#endif
48364
Daniel Veillard42595322004-11-08 10:52:06 +000048365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048366}
48367
Daniel Veillarda521d282004-11-09 14:59:59 +000048368#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048369
Daniel Veillardce682bc2004-11-05 17:22:25 +000048370#define gen_nb_xmlLocationSetPtr 1
48371static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48372 return(NULL);
48373}
48374static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48375}
Daniel Veillarda521d282004-11-09 14:59:59 +000048376#endif
48377
Daniel Veillardce682bc2004-11-05 17:22:25 +000048378
Daniel Veillardd93f6252004-11-02 15:53:51 +000048379static int
48380test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048382
William M. Brack21e4ef22005-01-02 09:53:13 +000048383#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048384 int mem_base;
48385 xmlLocationSetPtr cur; /* the initial range set */
48386 int n_cur;
48387 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48388 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048389
Daniel Veillardce682bc2004-11-05 17:22:25 +000048390 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48391 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48392 mem_base = xmlMemBlocks();
48393 cur = gen_xmlLocationSetPtr(n_cur, 0);
48394 val = gen_xmlXPathObjectPtr(n_val, 1);
48395
48396 xmlXPtrLocationSetAdd(cur, val);
48397 call_tests++;
48398 des_xmlLocationSetPtr(n_cur, cur, 0);
48399 des_xmlXPathObjectPtr(n_val, val, 1);
48400 xmlResetLastError();
48401 if (mem_base != xmlMemBlocks()) {
48402 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048404 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048405 printf(" %d", n_cur);
48406 printf(" %d", n_val);
48407 printf("\n");
48408 }
48409 }
48410 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048411 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048412#endif
48413
Daniel Veillard42595322004-11-08 10:52:06 +000048414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048415}
48416
48417
48418static int
48419test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048421
48422
48423 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048425}
48426
48427
48428static int
48429test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048431
William M. Brack21e4ef22005-01-02 09:53:13 +000048432#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048433 int mem_base;
48434 xmlLocationSetPtr cur; /* the initial range set */
48435 int n_cur;
48436 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48437 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048438
Daniel Veillardce682bc2004-11-05 17:22:25 +000048439 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48440 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48441 mem_base = xmlMemBlocks();
48442 cur = gen_xmlLocationSetPtr(n_cur, 0);
48443 val = gen_xmlXPathObjectPtr(n_val, 1);
48444
48445 xmlXPtrLocationSetDel(cur, val);
48446 call_tests++;
48447 des_xmlLocationSetPtr(n_cur, cur, 0);
48448 des_xmlXPathObjectPtr(n_val, val, 1);
48449 xmlResetLastError();
48450 if (mem_base != xmlMemBlocks()) {
48451 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048453 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048454 printf(" %d", n_cur);
48455 printf(" %d", n_val);
48456 printf("\n");
48457 }
48458 }
48459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048460 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048461#endif
48462
Daniel Veillard42595322004-11-08 10:52:06 +000048463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048464}
48465
48466
48467static int
48468test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048470
48471
48472 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048474}
48475
48476
48477static int
48478test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048480
William M. Brack21e4ef22005-01-02 09:53:13 +000048481#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048482 int mem_base;
48483 xmlLocationSetPtr cur; /* the initial range set */
48484 int n_cur;
48485 int val; /* the index to remove */
48486 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048487
Daniel Veillardce682bc2004-11-05 17:22:25 +000048488 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48489 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48490 mem_base = xmlMemBlocks();
48491 cur = gen_xmlLocationSetPtr(n_cur, 0);
48492 val = gen_int(n_val, 1);
48493
48494 xmlXPtrLocationSetRemove(cur, val);
48495 call_tests++;
48496 des_xmlLocationSetPtr(n_cur, cur, 0);
48497 des_int(n_val, val, 1);
48498 xmlResetLastError();
48499 if (mem_base != xmlMemBlocks()) {
48500 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048502 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048503 printf(" %d", n_cur);
48504 printf(" %d", n_val);
48505 printf("\n");
48506 }
48507 }
48508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048509 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048510#endif
48511
Daniel Veillard42595322004-11-08 10:52:06 +000048512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048513}
48514
48515
48516static int
48517test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048519
William M. Brack21e4ef22005-01-02 09:53:13 +000048520#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048521 int mem_base;
48522 xmlXPathObjectPtr ret_val;
48523 xmlNodePtr start; /* the starting and ending node */
48524 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048525
Daniel Veillard3d97e662004-11-04 10:49:00 +000048526 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48527 mem_base = xmlMemBlocks();
48528 start = gen_xmlNodePtr(n_start, 0);
48529
48530 ret_val = xmlXPtrNewCollapsedRange(start);
48531 desret_xmlXPathObjectPtr(ret_val);
48532 call_tests++;
48533 des_xmlNodePtr(n_start, start, 0);
48534 xmlResetLastError();
48535 if (mem_base != xmlMemBlocks()) {
48536 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048538 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048539 printf(" %d", n_start);
48540 printf("\n");
48541 }
48542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048543 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048544#endif
48545
Daniel Veillard42595322004-11-08 10:52:06 +000048546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048547}
48548
48549
48550static int
48551test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048553
48554
48555 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048557}
48558
48559
48560static int
48561test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048563
William M. Brack21e4ef22005-01-02 09:53:13 +000048564#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048565 int mem_base;
48566 xmlXPathObjectPtr ret_val;
48567 xmlNodeSetPtr set; /* a node set */
48568 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048569
Daniel Veillardce682bc2004-11-05 17:22:25 +000048570 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48571 mem_base = xmlMemBlocks();
48572 set = gen_xmlNodeSetPtr(n_set, 0);
48573
48574 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48575 desret_xmlXPathObjectPtr(ret_val);
48576 call_tests++;
48577 des_xmlNodeSetPtr(n_set, set, 0);
48578 xmlResetLastError();
48579 if (mem_base != xmlMemBlocks()) {
48580 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048583 printf(" %d", n_set);
48584 printf("\n");
48585 }
48586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048587 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048588#endif
48589
Daniel Veillard42595322004-11-08 10:52:06 +000048590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048591}
48592
48593
48594static int
48595test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048597
William M. Brack21e4ef22005-01-02 09:53:13 +000048598#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048599 int mem_base;
48600 xmlXPathObjectPtr ret_val;
48601 xmlNodePtr start; /* the start NodePtr value */
48602 int n_start;
48603 xmlNodePtr end; /* the end NodePtr value or NULL */
48604 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048605
Daniel Veillard3d97e662004-11-04 10:49:00 +000048606 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48607 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48608 mem_base = xmlMemBlocks();
48609 start = gen_xmlNodePtr(n_start, 0);
48610 end = gen_xmlNodePtr(n_end, 1);
48611
48612 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48613 desret_xmlXPathObjectPtr(ret_val);
48614 call_tests++;
48615 des_xmlNodePtr(n_start, start, 0);
48616 des_xmlNodePtr(n_end, end, 1);
48617 xmlResetLastError();
48618 if (mem_base != xmlMemBlocks()) {
48619 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048621 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048622 printf(" %d", n_start);
48623 printf(" %d", n_end);
48624 printf("\n");
48625 }
48626 }
48627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048628 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048629#endif
48630
Daniel Veillard42595322004-11-08 10:52:06 +000048631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048632}
48633
48634
48635static int
48636test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048638
William M. Brack21e4ef22005-01-02 09:53:13 +000048639#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048640 int mem_base;
48641 xmlXPathObjectPtr ret_val;
48642 xmlNodePtr start; /* the starting node */
48643 int n_start;
48644 int startindex; /* the start index */
48645 int n_startindex;
48646 xmlNodePtr end; /* the ending point */
48647 int n_end;
48648 int endindex; /* the ending index */
48649 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048650
Daniel Veillard3d97e662004-11-04 10:49:00 +000048651 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48652 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48653 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48654 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48655 mem_base = xmlMemBlocks();
48656 start = gen_xmlNodePtr(n_start, 0);
48657 startindex = gen_int(n_startindex, 1);
48658 end = gen_xmlNodePtr(n_end, 2);
48659 endindex = gen_int(n_endindex, 3);
48660
48661 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48662 desret_xmlXPathObjectPtr(ret_val);
48663 call_tests++;
48664 des_xmlNodePtr(n_start, start, 0);
48665 des_int(n_startindex, startindex, 1);
48666 des_xmlNodePtr(n_end, end, 2);
48667 des_int(n_endindex, endindex, 3);
48668 xmlResetLastError();
48669 if (mem_base != xmlMemBlocks()) {
48670 printf("Leak of %d blocks found in xmlXPtrNewRange",
48671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048672 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048673 printf(" %d", n_start);
48674 printf(" %d", n_startindex);
48675 printf(" %d", n_end);
48676 printf(" %d", n_endindex);
48677 printf("\n");
48678 }
48679 }
48680 }
48681 }
48682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048683 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048684#endif
48685
Daniel Veillard42595322004-11-08 10:52:06 +000048686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048687}
48688
48689
48690static int
48691test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048693
William M. Brack21e4ef22005-01-02 09:53:13 +000048694#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048695 int mem_base;
48696 xmlXPathObjectPtr ret_val;
48697 xmlNodePtr start; /* the starting node */
48698 int n_start;
48699 xmlXPathObjectPtr end; /* the ending object */
48700 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048701
Daniel Veillard3d97e662004-11-04 10:49:00 +000048702 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48703 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48704 mem_base = xmlMemBlocks();
48705 start = gen_xmlNodePtr(n_start, 0);
48706 end = gen_xmlXPathObjectPtr(n_end, 1);
48707
48708 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48709 desret_xmlXPathObjectPtr(ret_val);
48710 call_tests++;
48711 des_xmlNodePtr(n_start, start, 0);
48712 des_xmlXPathObjectPtr(n_end, end, 1);
48713 xmlResetLastError();
48714 if (mem_base != xmlMemBlocks()) {
48715 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048717 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048718 printf(" %d", n_start);
48719 printf(" %d", n_end);
48720 printf("\n");
48721 }
48722 }
48723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048724 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048725#endif
48726
Daniel Veillard42595322004-11-08 10:52:06 +000048727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048728}
48729
48730
48731static int
48732test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048734
William M. Brack21e4ef22005-01-02 09:53:13 +000048735#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048736 int mem_base;
48737 xmlXPathObjectPtr ret_val;
48738 xmlNodePtr start; /* the starting node */
48739 int n_start;
48740 xmlXPathObjectPtr end; /* the ending point */
48741 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048742
Daniel Veillard3d97e662004-11-04 10:49:00 +000048743 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48744 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48745 mem_base = xmlMemBlocks();
48746 start = gen_xmlNodePtr(n_start, 0);
48747 end = gen_xmlXPathObjectPtr(n_end, 1);
48748
48749 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48750 desret_xmlXPathObjectPtr(ret_val);
48751 call_tests++;
48752 des_xmlNodePtr(n_start, start, 0);
48753 des_xmlXPathObjectPtr(n_end, end, 1);
48754 xmlResetLastError();
48755 if (mem_base != xmlMemBlocks()) {
48756 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048758 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048759 printf(" %d", n_start);
48760 printf(" %d", n_end);
48761 printf("\n");
48762 }
48763 }
48764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048765 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048766#endif
48767
Daniel Veillard42595322004-11-08 10:52:06 +000048768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048769}
48770
48771
48772static int
48773test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048775
William M. Brack21e4ef22005-01-02 09:53:13 +000048776#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048777 int mem_base;
48778 xmlXPathObjectPtr ret_val;
48779 xmlNodePtr start; /* the starting node */
48780 int n_start;
48781 xmlNodePtr end; /* the ending node */
48782 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048783
Daniel Veillard3d97e662004-11-04 10:49:00 +000048784 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48785 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48786 mem_base = xmlMemBlocks();
48787 start = gen_xmlNodePtr(n_start, 0);
48788 end = gen_xmlNodePtr(n_end, 1);
48789
48790 ret_val = xmlXPtrNewRangeNodes(start, end);
48791 desret_xmlXPathObjectPtr(ret_val);
48792 call_tests++;
48793 des_xmlNodePtr(n_start, start, 0);
48794 des_xmlNodePtr(n_end, end, 1);
48795 xmlResetLastError();
48796 if (mem_base != xmlMemBlocks()) {
48797 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048799 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048800 printf(" %d", n_start);
48801 printf(" %d", n_end);
48802 printf("\n");
48803 }
48804 }
48805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048806 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048807#endif
48808
Daniel Veillard42595322004-11-08 10:52:06 +000048809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048810}
48811
48812
48813static int
48814test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048816
William M. Brack21e4ef22005-01-02 09:53:13 +000048817#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048818 int mem_base;
48819 xmlXPathObjectPtr ret_val;
48820 xmlXPathObjectPtr start; /* the starting point */
48821 int n_start;
48822 xmlNodePtr end; /* the ending node */
48823 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048824
Daniel Veillard3d97e662004-11-04 10:49:00 +000048825 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48826 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48827 mem_base = xmlMemBlocks();
48828 start = gen_xmlXPathObjectPtr(n_start, 0);
48829 end = gen_xmlNodePtr(n_end, 1);
48830
48831 ret_val = xmlXPtrNewRangePointNode(start, end);
48832 desret_xmlXPathObjectPtr(ret_val);
48833 call_tests++;
48834 des_xmlXPathObjectPtr(n_start, start, 0);
48835 des_xmlNodePtr(n_end, end, 1);
48836 xmlResetLastError();
48837 if (mem_base != xmlMemBlocks()) {
48838 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048840 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048841 printf(" %d", n_start);
48842 printf(" %d", n_end);
48843 printf("\n");
48844 }
48845 }
48846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048847 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048848#endif
48849
Daniel Veillard42595322004-11-08 10:52:06 +000048850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048851}
48852
48853
48854static int
48855test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048857
William M. Brack21e4ef22005-01-02 09:53:13 +000048858#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048859 int mem_base;
48860 xmlXPathObjectPtr ret_val;
48861 xmlXPathObjectPtr start; /* the starting point */
48862 int n_start;
48863 xmlXPathObjectPtr end; /* the ending point */
48864 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048865
Daniel Veillard3d97e662004-11-04 10:49:00 +000048866 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48867 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48868 mem_base = xmlMemBlocks();
48869 start = gen_xmlXPathObjectPtr(n_start, 0);
48870 end = gen_xmlXPathObjectPtr(n_end, 1);
48871
48872 ret_val = xmlXPtrNewRangePoints(start, end);
48873 desret_xmlXPathObjectPtr(ret_val);
48874 call_tests++;
48875 des_xmlXPathObjectPtr(n_start, start, 0);
48876 des_xmlXPathObjectPtr(n_end, end, 1);
48877 xmlResetLastError();
48878 if (mem_base != xmlMemBlocks()) {
48879 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048881 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048882 printf(" %d", n_start);
48883 printf(" %d", n_end);
48884 printf("\n");
48885 }
48886 }
48887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048888 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048889#endif
48890
Daniel Veillard42595322004-11-08 10:52:06 +000048891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048892}
48893
48894
48895static int
48896test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048898
William M. Brack21e4ef22005-01-02 09:53:13 +000048899#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048900 int mem_base;
48901 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48902 int n_ctxt;
48903 int nargs; /* the number of args */
48904 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048905
Daniel Veillardce682bc2004-11-05 17:22:25 +000048906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48907 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48908 mem_base = xmlMemBlocks();
48909 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48910 nargs = gen_int(n_nargs, 1);
48911
48912 xmlXPtrRangeToFunction(ctxt, nargs);
48913 call_tests++;
48914 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48915 des_int(n_nargs, nargs, 1);
48916 xmlResetLastError();
48917 if (mem_base != xmlMemBlocks()) {
48918 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048920 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048921 printf(" %d", n_ctxt);
48922 printf(" %d", n_nargs);
48923 printf("\n");
48924 }
48925 }
48926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048927 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048928#endif
48929
Daniel Veillard42595322004-11-08 10:52:06 +000048930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048931}
48932
48933
48934static int
48935test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048937
William M. Brack21e4ef22005-01-02 09:53:13 +000048938#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048939 int mem_base;
48940 xmlXPathObjectPtr ret_val;
48941 xmlLocationSetPtr val; /* the LocationSet value */
48942 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048943
Daniel Veillardce682bc2004-11-05 17:22:25 +000048944 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48945 mem_base = xmlMemBlocks();
48946 val = gen_xmlLocationSetPtr(n_val, 0);
48947
48948 ret_val = xmlXPtrWrapLocationSet(val);
48949 desret_xmlXPathObjectPtr(ret_val);
48950 call_tests++;
48951 des_xmlLocationSetPtr(n_val, val, 0);
48952 xmlResetLastError();
48953 if (mem_base != xmlMemBlocks()) {
48954 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048956 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048957 printf(" %d", n_val);
48958 printf("\n");
48959 }
48960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048961 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048962#endif
48963
Daniel Veillard42595322004-11-08 10:52:06 +000048964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048965}
48966
48967static int
48968test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048970
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048971 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048972 test_ret += test_xmlXPtrBuildNodeList();
48973 test_ret += test_xmlXPtrEval();
48974 test_ret += test_xmlXPtrEvalRangePredicate();
48975 test_ret += test_xmlXPtrLocationSetAdd();
48976 test_ret += test_xmlXPtrLocationSetCreate();
48977 test_ret += test_xmlXPtrLocationSetDel();
48978 test_ret += test_xmlXPtrLocationSetMerge();
48979 test_ret += test_xmlXPtrLocationSetRemove();
48980 test_ret += test_xmlXPtrNewCollapsedRange();
48981 test_ret += test_xmlXPtrNewContext();
48982 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48983 test_ret += test_xmlXPtrNewLocationSetNodes();
48984 test_ret += test_xmlXPtrNewRange();
48985 test_ret += test_xmlXPtrNewRangeNodeObject();
48986 test_ret += test_xmlXPtrNewRangeNodePoint();
48987 test_ret += test_xmlXPtrNewRangeNodes();
48988 test_ret += test_xmlXPtrNewRangePointNode();
48989 test_ret += test_xmlXPtrNewRangePoints();
48990 test_ret += test_xmlXPtrRangeToFunction();
48991 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048992
Daniel Veillard42595322004-11-08 10:52:06 +000048993 if (test_ret != 0)
48994 printf("Module xpointer: %d errors\n", test_ret);
48995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048996}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048997static int
48998test_module(const char *module) {
48999 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
49000 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049001 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049002 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049003 if (!strcmp(module, "catalog")) return(test_catalog());
49004 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049005 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049006 if (!strcmp(module, "dict")) return(test_dict());
49007 if (!strcmp(module, "encoding")) return(test_encoding());
49008 if (!strcmp(module, "entities")) return(test_entities());
49009 if (!strcmp(module, "hash")) return(test_hash());
49010 if (!strcmp(module, "list")) return(test_list());
49011 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
49012 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
49013 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049014 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049015 if (!strcmp(module, "pattern")) return(test_pattern());
49016 if (!strcmp(module, "relaxng")) return(test_relaxng());
49017 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
49018 if (!strcmp(module, "tree")) return(test_tree());
49019 if (!strcmp(module, "uri")) return(test_uri());
49020 if (!strcmp(module, "valid")) return(test_valid());
49021 if (!strcmp(module, "xinclude")) return(test_xinclude());
49022 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049023 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049024 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049025 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049026 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049027 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049028 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
49029 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
49030 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
49031 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000049032 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049033 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
49034 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049035 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049036 if (!strcmp(module, "xpointer")) return(test_xpointer());
49037 return(0);
49038}